Bazaar developer reference

CvPlot::getFeatureProduction(BuildTypes, PlayerTypes, CvCity **) const

Defined in
CvPlot.cpp, line 2890
Class
CvPlot
Hook name
CivHooks::CvPlot_getFeatureProduction

Hooks

static bool BeforeCvPlot_getFeatureProduction(const CvPlot* self, BuildTypes eBuild, PlayerTypes ePlayer, CvCity** ppCity, int& result);static void AfterCvPlot_getFeatureProduction(const CvPlot* self, BuildTypes eBuild, PlayerTypes ePlayer, CvCity** ppCity, int& result);static int ReplaceCvPlot_getFeatureProduction(int (*original)(const CvPlot*, BuildTypes, PlayerTypes, CvCity**), const CvPlot* self, BuildTypes eBuild, PlayerTypes ePlayer, CvCity** ppCity);CivRegisterBefore<CivHooks::CvPlot_getFeatureProduction>(host, &BeforeCvPlot_getFeatureProduction);CivRegisterAfter<CivHooks::CvPlot_getFeatureProduction>(host, &AfterCvPlot_getFeatureProduction);CivRegisterReplace<CivHooks::CvPlot_getFeatureProduction>(host, &ReplaceCvPlot_getFeatureProduction);

Code

2890int CvPlot::getFeatureProduction(BuildTypes eBuild, PlayerTypes ePlayer, CvCity** ppCity) const2891{2892	int iProduction;28932894	TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();28952896	if(getFeatureType() == NO_FEATURE)2897	{2898		return 0;2899	}29002901	*ppCity = getWorkingCity();29022903	if(*ppCity == NULL)2904	{2905		*ppCity = GC.getMap().findCity(getX(), getY(), NO_PLAYER, eTeam, false);2906	}29072908	if(*ppCity == NULL)2909	{2910		return 0;2911	}29122913	// Base value2914	if(GET_PLAYER(ePlayer).GetAllFeatureProduction() > 0)2915	{2916		iProduction = GET_PLAYER(ePlayer).GetAllFeatureProduction();2917	}2918	else2919	{2920		iProduction = GC.getBuildInfo(eBuild)->getFeatureProduction(getFeatureType());2921	}29222923	// Distance mod2924	iProduction -= (std::max(0, (plotDistance(getX(), getY(), (*ppCity)->getX(), (*ppCity)->getY()) - 2)) * 5);29252926	iProduction *= std::max(0, (GET_PLAYER((*ppCity)->getOwner()).getFeatureProductionModifier() + 100));2927	iProduction /= 100;29282929	iProduction *= GC.getGame().getGameSpeedInfo().getFeatureProductionPercent();2930	iProduction /= 100;29312932	if(getTeam() != eTeam)2933	{2934		iProduction *= GC.getDIFFERENT_TEAM_FEATURE_PRODUCTION_PERCENT();2935		iProduction /= 100;2936	}29372938	return std::max(0, iProduction);2939}

Calls

Called by