Bazaar developer reference

CvPlot::GetAdjacentCity(bool) const

Defined in
CvPlot.cpp, line 3298
Class
CvPlot
Hook name
CivHooks::CvPlot_GetAdjacentCity

Hooks

static bool BeforeCvPlot_GetAdjacentCity(const CvPlot* self, bool bLandOnly, CvCity*& result);static void AfterCvPlot_GetAdjacentCity(const CvPlot* self, bool bLandOnly, CvCity*& result);static CvCity* ReplaceCvPlot_GetAdjacentCity(CvCity* (*original)(const CvPlot*, bool), const CvPlot* self, bool bLandOnly);CivRegisterBefore<CivHooks::CvPlot_GetAdjacentCity>(host, &BeforeCvPlot_GetAdjacentCity);CivRegisterAfter<CivHooks::CvPlot_GetAdjacentCity>(host, &AfterCvPlot_GetAdjacentCity);CivRegisterReplace<CivHooks::CvPlot_GetAdjacentCity>(host, &ReplaceCvPlot_GetAdjacentCity);

Code

3298CvCity* CvPlot::GetAdjacentCity(bool bLandOnly) const3299{3300	CvPlot* pAdjacentPlot;3301	int iI;33023303	for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)3304	{3305		pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));33063307		if(pAdjacentPlot != NULL)3308		{3309			if(pAdjacentPlot->isCity())3310			{3311				if(!bLandOnly || !(pAdjacentPlot->isWater()))3312				{3313					CvCity* pCity = pAdjacentPlot->getPlotCity();3314					if(pCity)3315					{3316						return pCity;3317					}3318				}3319			}3320		}3321	}33223323	return NULL;3324}

Calls

Called by