Bazaar developer reference

CvUnit::getTradeGold(const CvPlot *) const

Defined in
CvUnit.cpp, line 9336
Class
CvUnit
Hook name
CivHooks::CvUnit_getTradeGold

Hooks

static bool BeforeCvUnit_getTradeGold(const CvUnit* self, const CvPlot* arg0, int& result);static void AfterCvUnit_getTradeGold(const CvUnit* self, const CvPlot* arg0, int& result);static int ReplaceCvUnit_getTradeGold(int (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* arg0);CivRegisterBefore<CivHooks::CvUnit_getTradeGold>(host, &BeforeCvUnit_getTradeGold);CivRegisterAfter<CivHooks::CvUnit_getTradeGold>(host, &AfterCvUnit_getTradeGold);CivRegisterReplace<CivHooks::CvUnit_getTradeGold>(host, &ReplaceCvUnit_getTradeGold);

Code

9336int CvUnit::getTradeGold(const CvPlot* /*pPlot*/) const9337{9338	VALIDATE_OBJECT9339	int iGold;93409341	// Seed the gold Value with some cash9342	iGold = m_pUnitInfo->GetBaseGold();93439344	// Amount of Gold also increases with how far into the game we are9345	iGold += (m_pUnitInfo->GetNumGoldPerEra() * GET_TEAM(getTeam()).GetCurrentEra());93469347	iGold *= GC.getGame().getGameSpeedInfo().getUnitTradePercent();9348	iGold /= 100;93499350	iGold *= (100 + GET_PLAYER(getOwner()).GetPlayerPolicies()->GetNumericModifier(POLICYMOD_TRADE_MISSION_GOLD_MODIFIER));9351	iGold /= 100;93529353	iGold *= (100 + GetTradeMissionGoldModifier());9354	iGold /= 100;93559356	return std::max(0, iGold);9357}

Calls

Called by