Bazaar developer reference

CvUnit::canAdvance(const CvPlot &, int) const

Defined in
CvUnit.cpp, line 24148
Class
CvUnit
Hook name
CivHooks::CvUnit_canAdvance

Hooks

static bool BeforeCvUnit_canAdvance(const CvUnit* self, const CvPlot& plot, int iThreshold, bool& result);static void AfterCvUnit_canAdvance(const CvUnit* self, const CvPlot& plot, int iThreshold, bool& result);static bool ReplaceCvUnit_canAdvance(bool (*original)(const CvUnit*, const CvPlot&, int), const CvUnit* self, const CvPlot& plot, int iThreshold);CivRegisterBefore<CivHooks::CvUnit_canAdvance>(host, &BeforeCvUnit_canAdvance);CivRegisterAfter<CivHooks::CvUnit_canAdvance>(host, &AfterCvUnit_canAdvance);CivRegisterReplace<CivHooks::CvUnit_canAdvance>(host, &ReplaceCvUnit_canAdvance);

Code

24148bool CvUnit::canAdvance(const CvPlot& plot, int iThreshold) const24149{24150	VALIDATE_OBJECT24151	CvAssert(IsCombatUnit());24152	CvAssert(getDomainType() != DOMAIN_AIR);24153	CvAssert(getDomainType() != DOMAIN_IMMOBILE);2415424155	if(plot.getNumVisibleEnemyDefenders(this) > iThreshold)24156	{24157		return false;24158	}2415924160	if(isNoCapture())24161	{24162		if(plot.isEnemyCity(*this))24163		{24164			return false;24165		}24166	}2416724168	return true;24169}

Calls

Called by