Afforess
The White Wizard
Recall that you just changed the name of that function.It should be "getCivicAttitudeChange(...)"
Got a new one. Looks like it's working, but it must be ignoring the XML.

Recall that you just changed the name of that function.It should be "getCivicAttitudeChange(...)"
Try reversing the two civics to see if it's being stored backwards.
A good way to test these types of things is to put in data that will be obvious. In the code that reads the modifier from the XML (readpass2() IIRC), overwrite the value with -100. This will make every civic have a -100 modifier for all other civics. It will test that the code that copies the values on down to reading them for AI_getAttitudeVal() works.
pXML->InitList(&m_piCivicAttitudeChanges, GC.getNumCivicInfos(), 0);
pXML->InitList(&m_piCivicAttitudeChanges, GC.getNumCivicInfos(), -100);
// create arrays to hold attitude changes and messages
//pXML->InitList(&m_piCivicAttitudeChanges, GC.getNumCivicInfos(), 0);
//pXML->InitList(&m_pszCivicAttitudeTextKeys, GC.getNumCivicInfos(), "");
Okay, that makes me suspect that the copying is not working. Can you please post the latest CvInfos.cpp?
I found CivicAttitudeChangesI've added some debug alert messages to the readpass2() function. Give it a shot. You should see these messages:
- Found CivicAttitudeChanges
- Found first CivicAttitudeChange
- Civic: <civic>
- Modifier: <modifier>
Perhaps it has to do with CvPlayerAI.cpp rather than CvInfos.cpp. Can we see CvPlayerAI.cpp?
int CvPlayerAI::AI_getCivicAttitudeChange(PlayerTypes ePlayer) const
{
int iAttitude = 0;
// add modifier for every combination of civics between the two players
for (int iI = 0; iI < GC.getNumCivicOptionInfos(); iI++)
{
for (int iJ = 0; iJ < GC.getNumCivicOptionInfos(); iJ++)
{
iAttitude += GC.getCivicInfo(getCivics((CivicOptionTypes)iI)).getCivicAttitudeChange(GET_PLAYER(ePlayer).getCivics((CivicOptionTypes)iJ));
}
}
return iAttitude;
}
Have you verified that those -100 modifiers are making their way into the final CvCivicInfo objects? Try out that code snippet I had you type into the in-game console to verify that you can see the modifiers. It's possible that the copyNonDefaults() is failing or not getting called.
Have you verified that those -100 modifiers are making their way into the final CvCivicInfo objects? Try out that code snippet I had you type into the in-game console to verify that you can see the modifiers. It's possible that the copyNonDefaults() is failing or not getting called.
At the end of read() there is a commented-out call to InitList() for the array. Uncomment it and see if that solves the problem. I really wish there was some documentation around these functions for WoC as I really don't want to read through a bunch of code I won't be using.</whine>
void CvCivicInfo::copyNonDefaultsReadPass2(CvCivicInfo* pClassInfo) //Afforess
{
bool bDefault = false;
int iDefault = 0;
int iTextDefault = -1; //all integers which are TEXT_KEYS in the xml are -1 by default
char szMessage[1024];
if (m_piCivicAttitudeChanges)
{
for ( int i = 0; i < GC.getNumCivicInfos(); i++ )
{
if ( m_piCivicAttitudeChanges[i] == iDefault )
{
m_piCivicAttitudeChanges[i] = pClassInfo->getCivicAttitudeChange(i);
if (m_piCivicAttitudeChanges[i] != 0)
{
sprintf(szMessage, "Civic: %d = %d", i, m_piCivicAttitudeChanges[i]);
gDLL->MessageBox(szMessage, "copyNonDefaultsReadPass2");
}
}
}
}
else
{
sprintf(szMessage, "Skipping");
gDLL->MessageBox(szMessage, "copyNonDefaultsReadPass2");
}
}