Bazaar developer reference

CvUnit::setMaxHitPointsBase(int)

Defined in
CvUnit.cpp, line 19075
Class
CvUnit
Hook name
CivHooks::CvUnit_setMaxHitPointsBase

Hooks

static bool BeforeCvUnit_setMaxHitPointsBase(CvUnit* self, int iMaxHitPoints);static void AfterCvUnit_setMaxHitPointsBase(CvUnit* self, int iMaxHitPoints);static void ReplaceCvUnit_setMaxHitPointsBase(void (*original)(CvUnit*, int), CvUnit* self, int iMaxHitPoints);CivRegisterBefore<CivHooks::CvUnit_setMaxHitPointsBase>(host, &BeforeCvUnit_setMaxHitPointsBase);CivRegisterAfter<CivHooks::CvUnit_setMaxHitPointsBase>(host, &AfterCvUnit_setMaxHitPointsBase);CivRegisterReplace<CivHooks::CvUnit_setMaxHitPointsBase>(host, &ReplaceCvUnit_setMaxHitPointsBase);

Code

19075void CvUnit::setMaxHitPointsBase(int iMaxHitPoints)19076{19077	// Do NOT allow max hit points to be less than 119078	m_iMaxHitPointsBase = max(1, iMaxHitPoints);1907919080	// Do NOT allow changing base max HP to kill the unit19081	setDamage(min(getDamage(), max(1, GetMaxHitPoints()-1)));1908219083	setInfoBarDirty(true);19084}

Calls

Called by