Bazaar developer reference

CvPlayer::updateYield()

Defined in
CvPlayer.cpp, line 5182
Class
CvPlayer
Hook name
CivHooks::CvPlayer_updateYield

Hooks

static bool BeforeCvPlayer_updateYield(CvPlayer* self);static void AfterCvPlayer_updateYield(CvPlayer* self);static void ReplaceCvPlayer_updateYield(void (*original)(CvPlayer*), CvPlayer* self);CivRegisterBefore<CivHooks::CvPlayer_updateYield>(host, &BeforeCvPlayer_updateYield);CivRegisterAfter<CivHooks::CvPlayer_updateYield>(host, &AfterCvPlayer_updateYield);CivRegisterReplace<CivHooks::CvPlayer_updateYield>(host, &ReplaceCvPlayer_updateYield);

Code

5182void CvPlayer::updateYield()5183{5184	// This will go through all of the plots and update the yield if the player owns it.5185	// The plot will not contribute to the player's yield unless it is worked by a city.5186	// Previously this would just go through all the plots the city can work (3 rings around it)5187	// but all plots have their yields updated on load and not updating them here could lead to 5188	// a visual discrepancy.5189	CvMap& kMap = GC.getMap();5190	int iNumPlots = kMap.numPlots();5191	PlayerTypes ePlayer = GetID();5192	for (int iI = 0; iI < iNumPlots; iI++)5193	{5194		CvPlot* pkPlot = kMap.plotByIndexUnchecked(iI);5195		if (pkPlot->getOwner() == ePlayer)5196			pkPlot->updateYield();5197	}5198}

Calls

Called by