Bazaar developer reference

CvDiplomacyAI::DoMakePeaceWithMinors()

Defined in
CvDiplomacyAI.cpp, line 5149
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoMakePeaceWithMinors

Hooks

static bool BeforeCvDiplomacyAI_DoMakePeaceWithMinors(CvDiplomacyAI* self);static void AfterCvDiplomacyAI_DoMakePeaceWithMinors(CvDiplomacyAI* self);static void ReplaceCvDiplomacyAI_DoMakePeaceWithMinors(void (*original)(CvDiplomacyAI*), CvDiplomacyAI* self);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoMakePeaceWithMinors>(host, &BeforeCvDiplomacyAI_DoMakePeaceWithMinors);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoMakePeaceWithMinors>(host, &AfterCvDiplomacyAI_DoMakePeaceWithMinors);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoMakePeaceWithMinors>(host, &ReplaceCvDiplomacyAI_DoMakePeaceWithMinors);

Code

5148/// Do we want to make peace with anyone Minors we're at war with?5149void CvDiplomacyAI::DoMakePeaceWithMinors()5150{5151	if((int)m_eTargetPlayer >= (int)DIPLO_FIRST_PLAYER)5152		return;51535154	PlayerTypes eLoopPlayer;51555156	for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)5157	{5158		eLoopPlayer = (PlayerTypes) iPlayerLoop;51595160		if(IsPlayerValid(eLoopPlayer))5161		{5162			if(GET_PLAYER(eLoopPlayer).isMinorCiv())5163			{5164				if(IsAtWar(eLoopPlayer))5165				{5166					if(IsWantsPeaceWithPlayer(eLoopPlayer) && GET_TEAM(GetPlayer()->getTeam()).GetNumTurnsLockedIntoWar(GET_PLAYER(eLoopPlayer).getTeam()) == 0)	// Locked into war for a period of time? (coop war, war deal, etc.)5167					{5168						if(!GET_PLAYER(eLoopPlayer).GetMinorCivAI()->IsPeaceBlocked(GetPlayer()->getTeam()))5169						{5170#if defined(MOD_EVENTS_WAR_AND_PEACE)5171							GET_TEAM(GetTeam()).makePeace(GET_PLAYER(eLoopPlayer).getTeam(), true, false, GetPlayer()->GetID());5172#else5173							GET_TEAM(GetTeam()).makePeace(GET_PLAYER(eLoopPlayer).getTeam());5174#endif51755176							LogPeaceMade(eLoopPlayer);5177						}5178					}5179				}5180			}5181		}5182	}5183}

Calls

Called by