Bazaar developer reference

CvGame::DoMinorPledgeProtection(PlayerTypes, PlayerTypes, bool, bool)

Defined in
CvGame.cpp, line 10509
Class
CvGame
Hook name
CivHooks::CvGame_DoMinorPledgeProtection

Hooks

static bool BeforeCvGame_DoMinorPledgeProtection(CvGame* self, PlayerTypes eMajor, PlayerTypes eMinor, bool bProtect, bool bPledgeNowBroken);static void AfterCvGame_DoMinorPledgeProtection(CvGame* self, PlayerTypes eMajor, PlayerTypes eMinor, bool bProtect, bool bPledgeNowBroken);static void ReplaceCvGame_DoMinorPledgeProtection(void (*original)(CvGame*, PlayerTypes, PlayerTypes, bool, bool), CvGame* self, PlayerTypes eMajor, PlayerTypes eMinor, bool bProtect, bool bPledgeNowBroken);CivRegisterBefore<CivHooks::CvGame_DoMinorPledgeProtection>(host, &BeforeCvGame_DoMinorPledgeProtection);CivRegisterAfter<CivHooks::CvGame_DoMinorPledgeProtection>(host, &AfterCvGame_DoMinorPledgeProtection);CivRegisterReplace<CivHooks::CvGame_DoMinorPledgeProtection>(host, &ReplaceCvGame_DoMinorPledgeProtection);

Code

10508/// Called when a major changes its protection status towards a minor10509void CvGame::DoMinorPledgeProtection(PlayerTypes eMajor, PlayerTypes eMinor, bool bProtect, bool bPledgeNowBroken)10510{10511	CvAssertMsg(eMajor >= 0, "eMajor is expected to be non-negative (invalid Index)");10512	CvAssertMsg(eMajor < MAX_MAJOR_CIVS, "eMajor is expected to be within maximum bounds (invalid Index)");10513	CvAssertMsg(eMinor >= MAX_MAJOR_CIVS, "eMinor is not in expected range (invalid Index)");10514	CvAssertMsg(eMinor < MAX_CIV_PLAYERS, "eMinor is not in expected range (invalid Index)");1051510516	if(bProtect)10517	{10518		CvAssertMsg(GET_PLAYER(eMinor).GetMinorCivAI()->CanMajorProtect(eMajor), "eMajor is not allowed to protect this minor! Please send Anton your save file and version.");10519	}1052010521	gDLL->sendMinorPledgeProtection(eMajor, eMinor, bProtect, bPledgeNowBroken);10522}

Calls

Called by