Afforess
The White Wizard
I'm trying to add an attitude threshold for the AI, so that they won't accept vassals if they are angry with the leader. I think I added it right, and codeblocks compiles fine, but ingame, the AI still accepts vassalage, even if our relations are -100. The code I am looking at is CvPlayerAI.cpp, and is this section.
Everything in blue is what I changed. What exactly am I missing?
Code:
if (!bOffered)
{
setTradeItem(&item, TRADE_VASSAL);
if (canTradeItem((PlayerTypes)iI, item, true))
{
ourList.clear();
theirList.clear();
ourList.insertAtEnd(item);
[COLOR=Blue] if (GET_PLAYER((PlayerTypes)iI).AI_getAttitude((PlayerTypes)iI) < ATTITUDE_ANNOYED )
{[/COLOR]
if (GET_PLAYER((PlayerTypes)iI).isHuman())
{
if (!(abContacted[GET_PLAYER((PlayerTypes)iI).getTeam()]))
{
AI_changeContactTimer(((PlayerTypes)iI), CONTACT_PERMANENT_ALLIANCE, GC.getLeaderHeadInfo(getPersonalityType()).getContactDelay(CONTACT_PERMANENT_ALLIANCE));
pDiplo = new CvDiploParameters(getID());
FAssertMsg(pDiplo != NULL, "pDiplo must be valid");
pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_OFFER_VASSAL"));
pDiplo->setAIContact(true);
pDiplo->setOurOfferList(theirList);
pDiplo->setTheirOfferList(ourList);
/*************************************************************************************************/
/** REVOLUTIONDCM_MOD 02/04/08 Glider1 */
/** */
/** */
/*************************************************************************************************/
// RevolutionDCM start - new diplomacy option
AI_beginDiplomacy(pDiplo, (PlayerTypes)iI);
// gDLL->beginDiplomacy(pDiplo, (PlayerTypes)iI);
// RevolutionDCM end
/*************************************************************************************************/
/** REVOLUTIONDCM_MOD END Glider1 */
/*************************************************************************************************/ abContacted[GET_PLAYER((PlayerTypes)iI).getTeam()] = true;
}
}
else
{
bool bAccepted = true;
TeamTypes eMasterTeam = GET_PLAYER((PlayerTypes)iI).getTeam();
for (int iTeam = 0; iTeam < MAX_CIV_TEAMS; iTeam++)
{
if (GET_TEAM((TeamTypes)iTeam).isAlive())
{
if (iTeam != getTeam() && iTeam != eMasterTeam && atWar(getTeam(), (TeamTypes)iTeam) && !atWar(eMasterTeam, (TeamTypes)iTeam))
{
if (GET_TEAM(eMasterTeam).AI_declareWarTrade((TeamTypes)iTeam, getTeam(), false) != NO_DENIAL)
{
bAccepted = false;
break;
}
}
}
}
if (bAccepted)
{
GC.getGameINLINE().implementDeal(getID(), ((PlayerTypes)iI), &ourList, &theirList);
}
}
[COLOR=Blue]}
else
break;[/COLOR]
}
}
Everything in blue is what I changed. What exactly am I missing?