Bazaar developer reference

CvMinorCivAI::DoNowAtWarWithTeam(TeamTypes)

Defined in
CvMinorCivAI.cpp, line 10208
Class
CvMinorCivAI
Hook name
CivHooks::CvMinorCivAI_DoNowAtWarWithTeam

Hooks

static bool BeforeCvMinorCivAI_DoNowAtWarWithTeam(CvMinorCivAI* self, TeamTypes eTeam);static void AfterCvMinorCivAI_DoNowAtWarWithTeam(CvMinorCivAI* self, TeamTypes eTeam);static void ReplaceCvMinorCivAI_DoNowAtWarWithTeam(void (*original)(CvMinorCivAI*, TeamTypes), CvMinorCivAI* self, TeamTypes eTeam);CivRegisterBefore<CivHooks::CvMinorCivAI_DoNowAtWarWithTeam>(host, &BeforeCvMinorCivAI_DoNowAtWarWithTeam);CivRegisterAfter<CivHooks::CvMinorCivAI_DoNowAtWarWithTeam>(host, &AfterCvMinorCivAI_DoNowAtWarWithTeam);CivRegisterReplace<CivHooks::CvMinorCivAI_DoNowAtWarWithTeam>(host, &ReplaceCvMinorCivAI_DoNowAtWarWithTeam);

Code

10207/// Now at war with eTeam10208void CvMinorCivAI::DoNowAtWarWithTeam(TeamTypes eTeam)10209{10210	int iOldFriendship;10211	int iWarFriendship = /*-60*/ GC.getMINOR_FRIENDSHIP_AT_WAR();1021210213	PlayerTypes ePlayer;10214	for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)10215	{10216		ePlayer = (PlayerTypes) iPlayerLoop;1021710218		if(GET_PLAYER(ePlayer).getTeam() == eTeam)10219		{10220			// Friendship change10221			iOldFriendship = GetBaseFriendshipWithMajor(ePlayer);10222			DoFriendshipChangeEffects(ePlayer, iOldFriendship, iWarFriendship);1022310224			// Revoke PtP is there was one10225			if(IsProtectedByMajor(ePlayer))10226			{10227				DoChangeProtectionFromMajor(ePlayer, false);10228			}1022910230			// Revoke quests if there were any10231			if(GetNumActiveQuestsForPlayer(ePlayer) > 0)10232			{10233				EndAllActiveQuestsForPlayer(ePlayer);10234			}1023510236			// Nullify Quests - Deprecated?10237			//GET_PLAYER((PlayerTypes) iMinorCivLoop).GetMinorCivAI()->SetPeaceQuestCompletedByMajor((PlayerTypes) iMajorCivLoop, true);10238			//GET_PLAYER((PlayerTypes) iMinorCivLoop).GetMinorCivAI()->SetWarQuestCompletedByMajor((PlayerTypes) iMajorCivLoop, true);1023910240			//// Is this player declaring war also already a Bully?  If so, he's gonna regret it10241			//GET_PLAYER((PlayerTypes) iMinorCivLoop).GetMinorCivAI()->DoBullyDeclareWar((PlayerTypes) iMajorCivLoop);10242		}10243		else if (!IsAtWarWithPlayersTeam(ePlayer) && GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isAtWar(eTeam))10244		{10245			// If ePlayer is also at war with eTeam, we might shorten the unit spawn timer10246			if (IsFriends(ePlayer) && GetTrait() == MINOR_CIV_TRAIT_MILITARISTIC)10247			{10248				int iBaseSpawnTurns = GetSpawnBaseTurns(ePlayer); // May be significantly less now with common enemy due to social policy10249				iBaseSpawnTurns = MAX(iBaseSpawnTurns, 1);10250				if (iBaseSpawnTurns < GetUnitSpawnCounter(ePlayer))10251				{10252					SetUnitSpawnCounter(ePlayer, iBaseSpawnTurns);10253				}10254			}10255		}10256	}1025710258	GC.GetEngineUserInterface()->setDirty(GameData_DIRTY_BIT, true);10259}

Calls

Called by