Bazaar developer reference

CvUnit::canHold(const CvPlot *) const

Defined in
CvUnit.cpp, line 4582
Class
CvUnit
Hook name
CivHooks::CvUnit_canHold

Hooks

static bool BeforeCvUnit_canHold(const CvUnit* self, const CvPlot* pPlot, bool& result);static void AfterCvUnit_canHold(const CvUnit* self, const CvPlot* pPlot, bool& result);static bool ReplaceCvUnit_canHold(bool (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_canHold>(host, &BeforeCvUnit_canHold);CivRegisterAfter<CivHooks::CvUnit_canHold>(host, &AfterCvUnit_canHold);CivRegisterReplace<CivHooks::CvUnit_canHold>(host, &ReplaceCvUnit_canHold);

Code

4582bool CvUnit::canHold(const CvPlot* pPlot) const // skip turn4583{4584	VALIDATE_OBJECT4585	if(isHuman() && !getFortifyTurns())  // we aren't fortified4586	{4587#if defined(MOD_GLOBAL_STACKING_RULES)4588		if(pPlot->getNumFriendlyUnitsOfType(this) > pPlot->getUnitLimit())4589#else4590		if(pPlot->getNumFriendlyUnitsOfType(this) > GC.getPLOT_UNIT_LIMIT())4591#endif4592		{4593			return false;4594		}4595	}45964597	return true;4598}

Calls

Called by