Bazaar developer reference

CvUnit::healTurns(const CvPlot *) const

Defined in
CvUnit.cpp, line 5891
Class
CvUnit
Hook name
CivHooks::CvUnit_healTurns

Hooks

static bool BeforeCvUnit_healTurns(const CvUnit* self, const CvPlot* pPlot, int& result);static void AfterCvUnit_healTurns(const CvUnit* self, const CvPlot* pPlot, int& result);static int ReplaceCvUnit_healTurns(int (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_healTurns>(host, &BeforeCvUnit_healTurns);CivRegisterAfter<CivHooks::CvUnit_healTurns>(host, &AfterCvUnit_healTurns);CivRegisterReplace<CivHooks::CvUnit_healTurns>(host, &ReplaceCvUnit_healTurns);

Code

5891int CvUnit::healTurns(const CvPlot* pPlot) const5892{5893	VALIDATE_OBJECT5894	int iHeal;5895	int iTurns;58965897	if(!IsHurt())5898	{5899		return 0;5900	}59015902	iHeal = healRate(pPlot);59035904	if(iHeal > 0)5905	{5906		iTurns = (getDamage() / iHeal);59075908		if((getDamage() % iHeal) != 0)5909		{5910			iTurns++;5911		}59125913		return iTurns;5914	}5915	else5916	{5917		return INT_MAX;5918	}5919}

Calls

Called by