Bazaar developer reference

CvDealAI::DoTradeScreenClosed(bool)

Defined in
CvDealAI.cpp, line 4022
Class
CvDealAI
Hook name
CivHooks::CvDealAI_DoTradeScreenClosed

Hooks

static bool BeforeCvDealAI_DoTradeScreenClosed(CvDealAI* self, bool bAIWasMakingOffer);static void AfterCvDealAI_DoTradeScreenClosed(CvDealAI* self, bool bAIWasMakingOffer);static void ReplaceCvDealAI_DoTradeScreenClosed(void (*original)(CvDealAI*, bool), CvDealAI* self, bool bAIWasMakingOffer);CivRegisterBefore<CivHooks::CvDealAI_DoTradeScreenClosed>(host, &BeforeCvDealAI_DoTradeScreenClosed);CivRegisterAfter<CivHooks::CvDealAI_DoTradeScreenClosed>(host, &AfterCvDealAI_DoTradeScreenClosed);CivRegisterReplace<CivHooks::CvDealAI_DoTradeScreenClosed>(host, &ReplaceCvDealAI_DoTradeScreenClosed);

Code

4021/// This function called when human player enters diplomacy4022void CvDealAI::DoTradeScreenClosed(bool bAIWasMakingOffer)4023{4024	PlayerTypes eActivePlayer = GC.getGame().getActivePlayer();40254026	// Reset cached values each time screen closed4027	SetCachedValueOfPeaceWithHuman(0);40284029	GC.GetEngineUserInterface()->SetAIRequestingConcessions(false);4030	GC.GetEngineUserInterface()->SetHumanMakingDemand(false);40314032	GetPlayer()->GetDiplomacyAI()->ClearDealToRenew();40334034	if(bAIWasMakingOffer)4035	{4036		// If AI was planning on a mutual Research Agreement, cancel it because the human left :(4037		// May want to do this slightly differently, as we can't be 100% sure this is what the AI was asking about (although if we make it through both of the following if statements there's an awful lot of circumstantial evidence)4038		if(GetPlayer()->GetDiplomacyAI()->IsWantsResearchAgreementWithPlayer(eActivePlayer))4039		{4040			if(GetPlayer()->GetDiplomacyAI()->IsCanMakeResearchAgreementRightNow(eActivePlayer))4041			{4042				GetPlayer()->GetDiplomacyAI()->DoCancelWantsResearchAgreementWithPlayer(eActivePlayer);4043			}4044		}4045	}4046}

Calls

Called by