Bazaar developer reference

CvDiplomacyAI::DoHostileStatement(PlayerTypes, DiploStatementTypes &)

Defined in
CvDiplomacyAI.cpp, line 15083
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoHostileStatement

Hooks

static bool BeforeCvDiplomacyAI_DoHostileStatement(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);static void AfterCvDiplomacyAI_DoHostileStatement(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);static void ReplaceCvDiplomacyAI_DoHostileStatement(void (*original)(CvDiplomacyAI*, PlayerTypes, DiploStatementTypes&), CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoHostileStatement>(host, &BeforeCvDiplomacyAI_DoHostileStatement);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoHostileStatement>(host, &AfterCvDiplomacyAI_DoHostileStatement);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoHostileStatement>(host, &ReplaceCvDiplomacyAI_DoHostileStatement);

Code

15082/// Possible Contact Statement15083void CvDiplomacyAI::DoHostileStatement(PlayerTypes ePlayer, DiploStatementTypes& eStatement)15084{15085	CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");15086	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.");1508715088	MajorCivApproachTypes eApproach = GetMajorCivApproach(ePlayer, /*bHideTrueFeelings*/ true);1508915090	if(eStatement == NO_DIPLO_STATEMENT_TYPE)15091	{15092		if(eApproach == MAJOR_CIV_APPROACH_HOSTILE)15093		{15094			TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();1509515096			// If we've made peace recently, don't go mouthing off right away15097			int iPeaceTreatyTurn = GET_TEAM(GetTeam()).GetTurnMadePeaceTreatyWithTeam(eTeam);15098			if(iPeaceTreatyTurn != -1)15099			{15100				int iTurnsSincePeace = GC.getGame().getElapsedGameTurns() - iPeaceTreatyTurn;15101				if(iTurnsSincePeace < /*25*/ GC.getTURNS_SINCE_PEACE_WEIGHT_DAMPENER())15102					return;15103			}1510415105			DiploStatementTypes eTempStatement = DIPLO_STATEMENT_INSULT;15106			int iTurnsBetweenStatements = 35;1510715108			if(GetNumTurnsSinceStatementSent(ePlayer, eTempStatement) >= iTurnsBetweenStatements)15109				eStatement = eTempStatement;15110		}15111	}15112}

Calls

Called by