Bazaar developer reference

CvDiplomacyAI::DoAddWantsResearchAgreementWithPlayer(PlayerTypes)

Defined in
CvDiplomacyAI.cpp, line 7496
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer

Hooks

static bool BeforeCvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer(CvDiplomacyAI* self, PlayerTypes ePlayer);static void AfterCvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer(CvDiplomacyAI* self, PlayerTypes ePlayer);static void ReplaceCvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer(void (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer>(host, &BeforeCvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer>(host, &AfterCvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer>(host, &ReplaceCvDiplomacyAI_DoAddWantsResearchAgreementWithPlayer);

Code

7495/// AI wants a Research Agreement with ePlayer, so handle everything that means7496void CvDiplomacyAI::DoAddWantsResearchAgreementWithPlayer(PlayerTypes ePlayer)7497{7498	CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");7499	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.");75007501	CvAssertMsg(!IsWantsResearchAgreementWithPlayer(ePlayer), "DIPLOMACY_AI: AI trying to save for multiple Research Agreements with a player.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")75027503	SetWantsResearchAgreementWithPlayer(ePlayer, true);75047505	// Start saving the Gold7506	int iGoldAmount = GC.getGame().GetGameDeals()->GetTradeItemGoldCost(TRADE_ITEM_RESEARCH_AGREEMENT, GetPlayer()->GetID(), ePlayer);7507	GetPlayer()->GetEconomicAI()->StartSaveForPurchase(PURCHASE_TYPE_MAJOR_CIV_TRADE, iGoldAmount, /*Priority*/ 1);75087509	LogWantRA(ePlayer);7510}

Calls

Called by