Bazaar developer reference

CvDiplomacyAI::DoMakeDemand(PlayerTypes, DiploStatementTypes &, CvDeal *)

Defined in
CvDiplomacyAI.cpp, line 13757
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoMakeDemand

Hooks

static bool BeforeCvDiplomacyAI_DoMakeDemand(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, CvDeal* pDeal);static void AfterCvDiplomacyAI_DoMakeDemand(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, CvDeal* pDeal);static void ReplaceCvDiplomacyAI_DoMakeDemand(void (*original)(CvDiplomacyAI*, PlayerTypes, DiploStatementTypes&, CvDeal*), CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, CvDeal* pDeal);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoMakeDemand>(host, &BeforeCvDiplomacyAI_DoMakeDemand);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoMakeDemand>(host, &AfterCvDiplomacyAI_DoMakeDemand);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoMakeDemand>(host, &ReplaceCvDiplomacyAI_DoMakeDemand);

Code

13756/// Possible Contact Statement - Demand13757void CvDiplomacyAI::DoMakeDemand(PlayerTypes ePlayer, DiploStatementTypes& eStatement, CvDeal* pDeal)13758{13759	CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");13760	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.");1376113762	if(eStatement == NO_DIPLO_STATEMENT_TYPE)13763	{13764		if(GetDemandTargetPlayer() == ePlayer)13765		{13766			if(IsDemandReady())13767			{13768				if(GetPlayer()->GetDealAI()->IsMakeDemand(ePlayer, /*pDeal can be modified in this function*/ pDeal))13769				{13770					DiploStatementTypes eTempStatement = DIPLO_STATEMENT_DEMAND;13771					int iTurnsBetweenStatements = 40;1377213773					if(GetNumTurnsSinceStatementSent(ePlayer, eTempStatement) >= iTurnsBetweenStatements)13774						eStatement = eTempStatement;13775				}13776				else13777				{13778					// Clear out the deal if we don't want to offer it so that it's not tainted for the next trade possibility we look at13779					pDeal->ClearItems();13780				}13781			}13782		}13783	}13784}

Calls

Called by