Bazaar developer reference

CvPlot::GetAdjacentFriendlyCity(TeamTypes, bool) const

Defined in
CvPlot.cpp, line 3266
Class
CvPlot
Hook name
CivHooks::CvPlot_GetAdjacentFriendlyCity

Hooks

static bool BeforeCvPlot_GetAdjacentFriendlyCity(const CvPlot* self, TeamTypes eTeam, bool bLandOnly, CvCity*& result);static void AfterCvPlot_GetAdjacentFriendlyCity(const CvPlot* self, TeamTypes eTeam, bool bLandOnly, CvCity*& result);static CvCity* ReplaceCvPlot_GetAdjacentFriendlyCity(CvCity* (*original)(const CvPlot*, TeamTypes, bool), const CvPlot* self, TeamTypes eTeam, bool bLandOnly);CivRegisterBefore<CivHooks::CvPlot_GetAdjacentFriendlyCity>(host, &BeforeCvPlot_GetAdjacentFriendlyCity);CivRegisterAfter<CivHooks::CvPlot_GetAdjacentFriendlyCity>(host, &AfterCvPlot_GetAdjacentFriendlyCity);CivRegisterReplace<CivHooks::CvPlot_GetAdjacentFriendlyCity>(host, &ReplaceCvPlot_GetAdjacentFriendlyCity);

Code

3266CvCity* CvPlot::GetAdjacentFriendlyCity(TeamTypes eTeam, bool bLandOnly) const3267{3268	CvPlot* pAdjacentPlot;3269	int iI;32703271	for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)3272	{3273		pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));32743275		if(pAdjacentPlot != NULL)3276		{3277			if(pAdjacentPlot->getTeam() == eTeam && pAdjacentPlot->isCity())3278			{3279				if(!bLandOnly || !(pAdjacentPlot->isWater()))3280				{3281					CvCity* pCity = pAdjacentPlot->getPlotCity();3282					if(pCity)3283					{3284						if(pCity->getTeam() == eTeam)3285						{3286							return pCity;3287						}3288					}3289				}3290			}3291		}3292	}32933294	return NULL;3295}

Calls

Called by