Bazaar developer reference

CvTeam::setAtWar(TeamTypes, bool, bool)

Defined in
CvTeam.cpp, line 3881
Class
CvTeam
Hook name
CivHooks::CvTeam_setAtWar

Hooks

static bool BeforeCvTeam_setAtWar(CvTeam* self, TeamTypes eIndex, bool bNewValue, bool bAggressorPacifier);static void AfterCvTeam_setAtWar(CvTeam* self, TeamTypes eIndex, bool bNewValue, bool bAggressorPacifier);static void ReplaceCvTeam_setAtWar(void (*original)(CvTeam*, TeamTypes, bool, bool), CvTeam* self, TeamTypes eIndex, bool bNewValue, bool bAggressorPacifier);CivRegisterBefore<CivHooks::CvTeam_setAtWar>(host, &BeforeCvTeam_setAtWar);CivRegisterAfter<CivHooks::CvTeam_setAtWar>(host, &AfterCvTeam_setAtWar);CivRegisterReplace<CivHooks::CvTeam_setAtWar>(host, &ReplaceCvTeam_setAtWar);

Code

3880#if defined(MOD_EVENTS_WAR_AND_PEACE)3881void CvTeam::setAtWar(TeamTypes eIndex, bool bNewValue, bool bAggressorPacifier)3882#else3883void CvTeam::setAtWar(TeamTypes eIndex, bool bNewValue)3884#endif3885{3886	CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");3887	CvAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be within maximum bounds (invalid Index)");3888	CvAssertMsg(eIndex != GetID() || bNewValue == false, "Team is setting war with itself!");3889	if(eIndex != GetID() || bNewValue == false)3890#if defined(MOD_EVENTS_WAR_AND_PEACE)3891	{3892		m_abAggressorPacifier[eIndex] = bAggressorPacifier;3893#endif3894		m_abAtWar[eIndex] = bNewValue;3895#if defined(MOD_EVENTS_WAR_AND_PEACE)3896	}3897#endif38983899	gDLL->GameplayWarStateChanged(GetID(), eIndex, bNewValue);39003901#ifndef FINAL_RELEASE3902	for(int iMinorLoop = MAX_MAJOR_CIVS; iMinorLoop < MAX_CIV_PLAYERS; iMinorLoop++)3903	{3904		CvPlayerAI& kPlayer = GET_PLAYER((PlayerTypes) iMinorLoop);3905		if(kPlayer.getTeam() == eIndex && kPlayer.isAlive())3906			CvAssertMsg(GET_PLAYER((PlayerTypes) iMinorLoop).GetMinorCivAI()->GetAlly() != getLeaderID(), "Major civ is now at war with a minor it is allied with! This is dumb and bad. If you didn't do this on purpose, please send Jon this along with your last 5 autosaves and a changelist #.");3907	}3908#endif3909}

Calls

Called by