Bazaar developer reference

CvUnit::canSentry(const CvPlot *) const

Defined in
CvUnit.cpp, line 5704
Class
CvUnit
Hook name
CivHooks::CvUnit_canSentry

Hooks

static bool BeforeCvUnit_canSentry(const CvUnit* self, const CvPlot* pPlot, bool& result);static void AfterCvUnit_canSentry(const CvUnit* self, const CvPlot* pPlot, bool& result);static bool ReplaceCvUnit_canSentry(bool (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_canSentry>(host, &BeforeCvUnit_canSentry);CivRegisterAfter<CivHooks::CvUnit_canSentry>(host, &AfterCvUnit_canSentry);CivRegisterReplace<CivHooks::CvUnit_canSentry>(host, &ReplaceCvUnit_canSentry);

Code

5704bool CvUnit::canSentry(const CvPlot* pPlot) const5705{5706	VALIDATE_OBJECT5707	if(isHuman() && !getFortifyTurns())  // we aren't fortified5708	{5709#if defined(MOD_GLOBAL_STACKING_RULES)5710		if(pPlot->getNumFriendlyUnitsOfType(this) > pPlot->getUnitLimit())5711#else5712		if(pPlot->getNumFriendlyUnitsOfType(this) > GC.getPLOT_UNIT_LIMIT())5713#endif5714		{5715			return false;5716		}5717	}57185719	if(!IsCanDefend(pPlot))5720	{5721		return false;5722	}57235724	if(isWaiting())5725	{5726		return false;5727	}57285729	return true;5730}

Calls

Called by