CvGame::isUnitClassMaxedOut(UnitClassTypes, int)
- Defined in
- CvGame.cpp, line 7335
- Class
- CvGame
- Hook name
CivHooks::CvGame_isUnitClassMaxedOut
Hooks
static bool BeforeCvGame_isUnitClassMaxedOut(CvGame* self, UnitClassTypes eIndex, int iExtra, bool& result);static void AfterCvGame_isUnitClassMaxedOut(CvGame* self, UnitClassTypes eIndex, int iExtra, bool& result);static bool ReplaceCvGame_isUnitClassMaxedOut(bool (*original)(CvGame*, UnitClassTypes, int), CvGame* self, UnitClassTypes eIndex, int iExtra);CivRegisterBefore<CivHooks::CvGame_isUnitClassMaxedOut>(host, &BeforeCvGame_isUnitClassMaxedOut);CivRegisterAfter<CivHooks::CvGame_isUnitClassMaxedOut>(host, &AfterCvGame_isUnitClassMaxedOut);CivRegisterReplace<CivHooks::CvGame_isUnitClassMaxedOut>(host, &ReplaceCvGame_isUnitClassMaxedOut);
Code
7335bool CvGame::isUnitClassMaxedOut(UnitClassTypes eIndex, int iExtra)7336{7337 CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");7338 CvAssertMsg(eIndex < GC.getNumUnitClassInfos(), "eIndex is expected to be within maximum bounds (invalid Index)");73397340 CvUnitClassInfo* pkUnitClassInfo = GC.getUnitClassInfo(eIndex);7341 if(pkUnitClassInfo == NULL)7342 {7343 return false;7344 }73457346 if(!isWorldUnitClass(eIndex))7347 {7348 return false;7349 }73507351 CvAssertMsg(getUnitClassCreatedCount(eIndex) <= pkUnitClassInfo->getMaxGlobalInstances(), "Index is expected to be within maximum bounds (invalid Index)");73527353 return ((getUnitClassCreatedCount(eIndex) + iExtra) >= pkUnitClassInfo->getMaxGlobalInstances());7354}