Bazaar developer reference

CvDeal::ChangeThirdPartyEmbargoDuration(PlayerTypes, PlayerTypes, int)

Defined in
CvDealClasses.cpp, line 1844
Class
CvDeal
Hook name
CivHooks::CvDeal_ChangeThirdPartyEmbargoDuration

Hooks

static bool BeforeCvDeal_ChangeThirdPartyEmbargoDuration(CvDeal* self, PlayerTypes eFrom, PlayerTypes eThirdParty, int iNewDuration);static void AfterCvDeal_ChangeThirdPartyEmbargoDuration(CvDeal* self, PlayerTypes eFrom, PlayerTypes eThirdParty, int iNewDuration);static void ReplaceCvDeal_ChangeThirdPartyEmbargoDuration(void (*original)(CvDeal*, PlayerTypes, PlayerTypes, int), CvDeal* self, PlayerTypes eFrom, PlayerTypes eThirdParty, int iNewDuration);CivRegisterBefore<CivHooks::CvDeal_ChangeThirdPartyEmbargoDuration>(host, &BeforeCvDeal_ChangeThirdPartyEmbargoDuration);CivRegisterAfter<CivHooks::CvDeal_ChangeThirdPartyEmbargoDuration>(host, &AfterCvDeal_ChangeThirdPartyEmbargoDuration);CivRegisterReplace<CivHooks::CvDeal_ChangeThirdPartyEmbargoDuration>(host, &ReplaceCvDeal_ChangeThirdPartyEmbargoDuration);

Code

1844void CvDeal::ChangeThirdPartyEmbargoDuration(PlayerTypes eFrom, PlayerTypes eThirdParty, int iNewDuration)1845{1846	CvAssertMsg(iNewDuration >= 0, "DEAL: Trying to add a negative duration to a TradeItem.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");1847	CvAssertMsg(iNewDuration < GC.getGame().getEstimateEndTurn() * 2, "DEAL: Trade item has a crazy long duration (probably invalid).  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");18481849	TradedItemList::iterator it;1850	for(it = m_TradedItems.begin(); it != m_TradedItems.end(); ++it)1851	{1852		if(it->m_eItemType == TRADE_ITEM_THIRD_PARTY_EMBARGO &&1853		        (PlayerTypes)it->m_iData1 == eThirdParty &&1854		        (PlayerTypes)it->m_eFromPlayer == eFrom)1855		{1856			it->m_iDuration = iNewDuration;1857			break;1858		}1859	}1860}

Calls

Called by