Bazaar developer reference

CvCity::HasTerrain(TerrainTypes) const

Defined in
CvCity.cpp, line 17510
Class
CvCity
Hook name
CivHooks::CvCity_HasTerrain

Hooks

static bool BeforeCvCity_HasTerrain(const CvCity* self, TerrainTypes iTerrainType, bool& result);static void AfterCvCity_HasTerrain(const CvCity* self, TerrainTypes iTerrainType, bool& result);static bool ReplaceCvCity_HasTerrain(bool (*original)(const CvCity*, TerrainTypes), const CvCity* self, TerrainTypes iTerrainType);CivRegisterBefore<CivHooks::CvCity_HasTerrain>(host, &BeforeCvCity_HasTerrain);CivRegisterAfter<CivHooks::CvCity_HasTerrain>(host, &AfterCvCity_HasTerrain);CivRegisterReplace<CivHooks::CvCity_HasTerrain>(host, &ReplaceCvCity_HasTerrain);

Code

17510bool CvCity::HasTerrain(TerrainTypes iTerrainType) const17511{17512	int iX = getX(); int iY = getY(); int iOwner = getOwner();1751317514#if defined(MOD_GLOBAL_CITY_WORKING)17515	for (int iCityPlotLoop = 0; iCityPlotLoop < GetNumWorkablePlots(); iCityPlotLoop++)17516#else17517	for (int iCityPlotLoop = 0; iCityPlotLoop < NUM_CITY_PLOTS; iCityPlotLoop++)17518#endif17519	{17520		CvPlot* pLoopPlot = plotCity(iX, iY, iCityPlotLoop);1752117522		// Invalid plot or not owned by this player17523		if (pLoopPlot == NULL || pLoopPlot->getOwner() != iOwner) {17524			continue;17525		}1752617527		if (pLoopPlot->HasTerrain(iTerrainType)) {17528			return true;17529		}17530	}1753117532	return false;17533}

Calls

Called by