Bazaar developer reference

CvDealAI::IsMakeDemand(PlayerTypes, CvDeal *)

Defined in
CvDealAI.cpp, line 3723
Class
CvDealAI
Hook name
CivHooks::CvDealAI_IsMakeDemand

Hooks

static bool BeforeCvDealAI_IsMakeDemand(CvDealAI* self, PlayerTypes eOtherPlayer, CvDeal* pDeal, bool& result);static void AfterCvDealAI_IsMakeDemand(CvDealAI* self, PlayerTypes eOtherPlayer, CvDeal* pDeal, bool& result);static bool ReplaceCvDealAI_IsMakeDemand(bool (*original)(CvDealAI*, PlayerTypes, CvDeal*), CvDealAI* self, PlayerTypes eOtherPlayer, CvDeal* pDeal);CivRegisterBefore<CivHooks::CvDealAI_IsMakeDemand>(host, &BeforeCvDealAI_IsMakeDemand);CivRegisterAfter<CivHooks::CvDealAI_IsMakeDemand>(host, &AfterCvDealAI_IsMakeDemand);CivRegisterReplace<CivHooks::CvDealAI_IsMakeDemand>(host, &ReplaceCvDealAI_IsMakeDemand);

Code

3722/// AI making a demand of eOtherPlayer3723bool CvDealAI::IsMakeDemand(PlayerTypes eOtherPlayer, CvDeal* pDeal)3724{3725	CvAssert(eOtherPlayer >= 0);3726	CvAssert(eOtherPlayer < MAX_MAJOR_CIVS);37273728	// Set that this CvDeal is a demand3729	pDeal->SetDemandingPlayer(GetPlayer()->GetID());37303731	int iGold = pDeal->GetGoldAvailable(eOtherPlayer, TRADE_ITEM_GOLD);37323733	// Don't ask for too much3734	int iMaxGold = 200 + (GET_TEAM(GET_PLAYER(eOtherPlayer).getTeam()).GetCurrentEra() * 150);3735	iGold = min(iMaxGold, iGold);37363737	if(pDeal->IsPossibleToTradeItem(eOtherPlayer, GetPlayer()->GetID(), TRADE_ITEM_GOLD, iGold))3738	{3739		pDeal->AddGoldTrade(eOtherPlayer, iGold);37403741		return true;3742	}37433744	return false;3745}

Calls

Called by