Bazaar developer reference

CvDiplomacyAI::ChangeWarValueLost(PlayerTypes, int)

Defined in
CvDiplomacyAI.cpp, line 9166
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_ChangeWarValueLost

Hooks

static bool BeforeCvDiplomacyAI_ChangeWarValueLost(CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);static void AfterCvDiplomacyAI_ChangeWarValueLost(CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);static void ReplaceCvDiplomacyAI_ChangeWarValueLost(void (*original)(CvDiplomacyAI*, PlayerTypes, int), CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);CivRegisterBefore<CivHooks::CvDiplomacyAI_ChangeWarValueLost>(host, &BeforeCvDiplomacyAI_ChangeWarValueLost);CivRegisterAfter<CivHooks::CvDiplomacyAI_ChangeWarValueLost>(host, &AfterCvDiplomacyAI_ChangeWarValueLost);CivRegisterReplace<CivHooks::CvDiplomacyAI_ChangeWarValueLost>(host, &ReplaceCvDiplomacyAI_ChangeWarValueLost);

Code

9165// Changes the value of stuff (Units & Cities) lost in a war against a particular Player9166void CvDiplomacyAI::ChangeWarValueLost(PlayerTypes ePlayer, int iChange)9167{9168	SetWarValueLost(ePlayer, GetWarValueLost(ePlayer) + iChange);91699170	if(iChange > 0)9171	{9172		// Loop through all the other major civs and see if any of them are fighting us.  If so they are happy this player damaged us.9173		PlayerTypes eLoopPlayer;9174		for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)9175		{9176			eLoopPlayer = (PlayerTypes) iPlayerLoop;91779178			if(eLoopPlayer != ePlayer && eLoopPlayer != m_pPlayer->GetID() && IsPlayerValid(eLoopPlayer))9179			{9180				// Are they at war with me too?9181				CvPlayer& kOtherPlayer = GET_PLAYER(eLoopPlayer);9182				if(IsAtWar(eLoopPlayer))9183				{9184					kOtherPlayer.GetDiplomacyAI()->ChangeCommonFoeValue(ePlayer, iChange);9185				}9186			}9187		}9188	}9189}

Calls

Called by