Bazaar developer reference

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

Defined in
CvDiplomacyAI.cpp, line 14744
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoResearchAgreementOffer

Hooks

static bool BeforeCvDiplomacyAI_DoResearchAgreementOffer(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, CvDeal* pDeal);static void AfterCvDiplomacyAI_DoResearchAgreementOffer(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, CvDeal* pDeal);static void ReplaceCvDiplomacyAI_DoResearchAgreementOffer(void (*original)(CvDiplomacyAI*, PlayerTypes, DiploStatementTypes&, CvDeal*), CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement, CvDeal* pDeal);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoResearchAgreementOffer>(host, &BeforeCvDiplomacyAI_DoResearchAgreementOffer);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoResearchAgreementOffer>(host, &AfterCvDiplomacyAI_DoResearchAgreementOffer);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoResearchAgreementOffer>(host, &ReplaceCvDiplomacyAI_DoResearchAgreementOffer);

Code

14743/// Possible Contact Statement - Research Agreement Offer14744void CvDiplomacyAI::DoResearchAgreementOffer(PlayerTypes ePlayer, DiploStatementTypes& eStatement, CvDeal* pDeal)14745{14746	CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");14747	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.");1474814749	if(eStatement == NO_DIPLO_STATEMENT_TYPE)14750	{14751		if(IsCanMakeResearchAgreementRightNow(ePlayer))14752		{14753			if(GetPlayer()->GetDealAI()->IsMakeOfferForResearchAgreement(ePlayer, /*pDeal can be modified in this function*/ pDeal))14754			{14755				DiploStatementTypes eTempStatement = DIPLO_STATEMENT_RESEARCH_AGREEMENT_OFFER;14756				int iTurnsBetweenStatements = 20;1475714758				if(GetNumTurnsSinceStatementSent(ePlayer, eTempStatement) >= iTurnsBetweenStatements)14759					eStatement = eTempStatement;14760			}14761			else14762			{14763				// 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 at14764				pDeal->ClearItems();14765			}14766		}14767	}14768}

Calls

Called by