Bazaar developer reference

CvUnit::canFortify(const CvPlot *) const

Defined in
CvUnit.cpp, line 4638
Class
CvUnit
Hook name
CivHooks::CvUnit_canFortify

Hooks

static bool BeforeCvUnit_canFortify(const CvUnit* self, const CvPlot* pPlot, bool& result);static void AfterCvUnit_canFortify(const CvUnit* self, const CvPlot* pPlot, bool& result);static bool ReplaceCvUnit_canFortify(bool (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_canFortify>(host, &BeforeCvUnit_canFortify);CivRegisterAfter<CivHooks::CvUnit_canFortify>(host, &AfterCvUnit_canFortify);CivRegisterReplace<CivHooks::CvUnit_canFortify>(host, &ReplaceCvUnit_canFortify);

Code

4638bool CvUnit::canFortify(const CvPlot* pPlot) const4639{4640	VALIDATE_OBJECT4641	if(isHuman() && !getFortifyTurns())  // we aren't fortified4642	{4643#if defined(MOD_GLOBAL_STACKING_RULES)4644		if(pPlot->getNumFriendlyUnitsOfType(this) > pPlot->getUnitLimit())4645#else4646		if(pPlot->getNumFriendlyUnitsOfType(this) > GC.getPLOT_UNIT_LIMIT())4647#endif4648		{4649			return false;4650		}4651	}46524653	if(!isFortifyable(true))4654	{4655		return false;4656	}46574658	if(isWaiting())4659	{4660		return false;4661	}46624663	return true;4664}

Calls

Called by