Bazaar developer reference

CvDiplomacyAI::IsPlayerMadeBorderPromise(PlayerTypes, int)

Defined in
CvDiplomacyAI.cpp, line 22526
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_IsPlayerMadeBorderPromise

Hooks

static bool BeforeCvDiplomacyAI_IsPlayerMadeBorderPromise(CvDiplomacyAI* self, PlayerTypes ePlayer, int iTestGameTurn, bool& result);static void AfterCvDiplomacyAI_IsPlayerMadeBorderPromise(CvDiplomacyAI* self, PlayerTypes ePlayer, int iTestGameTurn, bool& result);static bool ReplaceCvDiplomacyAI_IsPlayerMadeBorderPromise(bool (*original)(CvDiplomacyAI*, PlayerTypes, int), CvDiplomacyAI* self, PlayerTypes ePlayer, int iTestGameTurn);CivRegisterBefore<CivHooks::CvDiplomacyAI_IsPlayerMadeBorderPromise>(host, &BeforeCvDiplomacyAI_IsPlayerMadeBorderPromise);CivRegisterAfter<CivHooks::CvDiplomacyAI_IsPlayerMadeBorderPromise>(host, &AfterCvDiplomacyAI_IsPlayerMadeBorderPromise);CivRegisterReplace<CivHooks::CvDiplomacyAI_IsPlayerMadeBorderPromise>(host, &ReplaceCvDiplomacyAI_IsPlayerMadeBorderPromise);

Code

22526bool CvDiplomacyAI::IsPlayerMadeBorderPromise(PlayerTypes ePlayer, int iTestGameTurn)22527{22528	CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");22529	CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");22530	if (m_paiPlayerMadeBorderPromiseTurn[ePlayer] < 0)22531	{22532		return false;22533	}2253422535	int iGameTurn;22536	if (iTestGameTurn != -1)22537	{22538		iGameTurn = iTestGameTurn;22539	}22540	else22541	{22542		iGameTurn = GC.getGame().getGameTurn();22543	}2254422545	int iTurnDifference = iGameTurn - m_paiPlayerMadeBorderPromiseTurn[ePlayer];22546	int iTimeOutTurns = (GC.getBORDER_PROMISE_TURNS_EFFECTIVE() * GC.getGame().getGameSpeedInfo().getOpinionDurationPercent()) / 100;22547	if (iTurnDifference < iTimeOutTurns)22548	{22549		return true;22550	}22551	else22552	{22553		return false;22554	}22555}

Calls

Called by