Bazaar developer reference

CvPlayer::changeUnitClassCount(UnitClassTypes, int)

Defined in
CvPlayer.cpp, line 20475
Class
CvPlayer
Hook name
CivHooks::CvPlayer_changeUnitClassCount

Hooks

static bool BeforeCvPlayer_changeUnitClassCount(CvPlayer* self, UnitClassTypes eIndex, int iChange);static void AfterCvPlayer_changeUnitClassCount(CvPlayer* self, UnitClassTypes eIndex, int iChange);static void ReplaceCvPlayer_changeUnitClassCount(void (*original)(CvPlayer*, UnitClassTypes, int), CvPlayer* self, UnitClassTypes eIndex, int iChange);CivRegisterBefore<CivHooks::CvPlayer_changeUnitClassCount>(host, &BeforeCvPlayer_changeUnitClassCount);CivRegisterAfter<CivHooks::CvPlayer_changeUnitClassCount>(host, &AfterCvPlayer_changeUnitClassCount);CivRegisterReplace<CivHooks::CvPlayer_changeUnitClassCount>(host, &ReplaceCvPlayer_changeUnitClassCount);

Code

20475void CvPlayer::changeUnitClassCount(UnitClassTypes eIndex, int iChange)20476{20477	CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");20478	CvAssertMsg(eIndex < GC.getNumUnitClassInfos(), "eIndex is expected to be within maximum bounds (invalid Index)");20479	m_paiUnitClassCount.setAt(eIndex, m_paiUnitClassCount[eIndex] + iChange);20480	CvAssert(getUnitClassCount(eIndex) >= 0);20481}

Calls

Called by