Hooks
static bool BeforeCvDiplomacyAI_DoWeMadePeaceWithSomeone(CvDiplomacyAI* self, TeamTypes eOtherTeam);static void AfterCvDiplomacyAI_DoWeMadePeaceWithSomeone(CvDiplomacyAI* self, TeamTypes eOtherTeam);static void ReplaceCvDiplomacyAI_DoWeMadePeaceWithSomeone(void (*original)(CvDiplomacyAI*, TeamTypes), CvDiplomacyAI* self, TeamTypes eOtherTeam);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoWeMadePeaceWithSomeone>(host, &BeforeCvDiplomacyAI_DoWeMadePeaceWithSomeone);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoWeMadePeaceWithSomeone>(host, &AfterCvDiplomacyAI_DoWeMadePeaceWithSomeone);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoWeMadePeaceWithSomeone>(host, &ReplaceCvDiplomacyAI_DoWeMadePeaceWithSomeone);
Code
9631/// ePlayer made peace with someone, so figure out what that means9632void CvDiplomacyAI::DoWeMadePeaceWithSomeone(TeamTypes eOtherTeam)9633{9634 CvAssertMsg(eOtherTeam >= 0, "DIPLOMACY_AI: Invalid Team Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");9635 CvAssertMsg(eOtherTeam < MAX_CIV_TEAMS, "DIPLOMACY_AI: Invalid Team Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");96369637 PlayerTypes eThirdPlayer;9638 int iThirdPlayerLoop;96399640 PlayerTypes ePeacePlayer;9641 for(int iPeacePlayerLoop = 0; iPeacePlayerLoop < MAX_CIV_PLAYERS; iPeacePlayerLoop++)9642 {9643 ePeacePlayer = (PlayerTypes) iPeacePlayerLoop;96449645 if(GET_PLAYER(ePeacePlayer).getTeam() == eOtherTeam)9646 {9647 // In case we had an ongoing operation, kill it9648 SetMusteringForAttack(ePeacePlayer, false);96499650 if(!GET_PLAYER(ePeacePlayer).isMinorCiv())9651 {9652 // If we made peace, reset coop war and working against status9653 for(iThirdPlayerLoop = 0; iThirdPlayerLoop < MAX_MAJOR_CIVS; iThirdPlayerLoop++)9654 {9655 eThirdPlayer = (PlayerTypes) iThirdPlayerLoop;96569657 SetCoopWarAcceptedState(eThirdPlayer, ePeacePlayer, NO_COOP_WAR_STATE);9658 //SetWorkingAgainstPlayerAccepted(eThirdPlayer, ePeacePlayer, false);9659 //SetWorkingAgainstPlayerCounter(eThirdPlayer, ePeacePlayer, -666);9660 }96619662 // If we made peace with someone, set our Approach with them to Neutral to bias against another war9663 if(GetMajorCivApproach(ePeacePlayer, /*bHideTrueFeelings*/ false) == MAJOR_CIV_APPROACH_WAR)9664 SetMajorCivApproach(ePeacePlayer, MAJOR_CIV_APPROACH_NEUTRAL);9665 }9666 else9667 {9668 // Reset flags for taunt messages we sent to other civs about attacking this minor9669 ResetSentAttackProtectedMinorTaunts(ePeacePlayer);9670 }9671 }9672 }9673}