Bazaar developer reference

CvTreasury::SetGoldTimes100(int)

Defined in
CvTreasury.cpp, line 145
Class
CvTreasury
Hook name
CivHooks::CvTreasury_SetGoldTimes100

Hooks

static bool BeforeCvTreasury_SetGoldTimes100(CvTreasury* self, int iNewValue);static void AfterCvTreasury_SetGoldTimes100(CvTreasury* self, int iNewValue);static void ReplaceCvTreasury_SetGoldTimes100(void (*original)(CvTreasury*, int), CvTreasury* self, int iNewValue);CivRegisterBefore<CivHooks::CvTreasury_SetGoldTimes100>(host, &BeforeCvTreasury_SetGoldTimes100);CivRegisterAfter<CivHooks::CvTreasury_SetGoldTimes100>(host, &AfterCvTreasury_SetGoldTimes100);CivRegisterReplace<CivHooks::CvTreasury_SetGoldTimes100>(host, &ReplaceCvTreasury_SetGoldTimes100);

Code

144/// Sets current balance in treasury (in hundredths)145void CvTreasury::SetGoldTimes100(int iNewValue)146{147	// Minors don't get Gold!148	if(GetGoldTimes100() != iNewValue)149	{150		if(iNewValue < 0)151		{152			CvAssertMsg(false, "GAMEPLAY: Player is being set to a negative Gold value. Please send Jon this with your last 5 autosaves.");153		}154155		m_iGold = iNewValue;156157		if(m_pPlayer->GetID() == GC.getGame().getActivePlayer())158		{159			// Are we now able to buy a Plot when we weren't before?160			//if (GetGold() >= m_pPlayer->GetBuyPlotCost() && iOldGold < m_pPlayer->GetBuyPlotCost() && m_pPlayer->getNumCities() > 0)161			//{162			//	CvString strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_ENOUGH_GOLD_TO_BUY_PLOT");163			//	CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_ENOUGH_GOLD_TO_BUY_PLOT");164			//	CvNotifications* pNotifications = m_pPlayer->GetNotifications();165			//	if (pNotifications)166			//	{167			//		pNotifications->Add(NOTIFICATION_BUY_TILE, strBuffer, strSummary, -1, -1, -1);168			//	}169			//}170171			GC.GetEngineUserInterface()->setDirty(MiscButtons_DIRTY_BIT, true);172			GC.GetEngineUserInterface()->setDirty(SelectionButtons_DIRTY_BIT, true);173			GC.GetEngineUserInterface()->setDirty(GameData_DIRTY_BIT, true);174		}175	}176}

Calls

Called by