CvTeam::getHandicapType() const
- Defined in
- CvTeam.cpp, line 2675
- Class
- CvTeam
- Hook name
CivHooks::CvTeam_getHandicapType
Hooks
static bool BeforeCvTeam_getHandicapType(const CvTeam* self, HandicapTypes& result);static void AfterCvTeam_getHandicapType(const CvTeam* self, HandicapTypes& result);static HandicapTypes ReplaceCvTeam_getHandicapType(HandicapTypes (*original)(const CvTeam*), const CvTeam* self);CivRegisterBefore<CivHooks::CvTeam_getHandicapType>(host, &BeforeCvTeam_getHandicapType);CivRegisterAfter<CivHooks::CvTeam_getHandicapType>(host, &AfterCvTeam_getHandicapType);CivRegisterReplace<CivHooks::CvTeam_getHandicapType>(host, &ReplaceCvTeam_getHandicapType);
Code
2675HandicapTypes CvTeam::getHandicapType() const2676{2677 int iGameHandicap;2678 int iCount;2679 int iI;26802681 iGameHandicap = 0;2682 iCount = 0;26832684 for(iI = 0; iI < MAX_PLAYERS; iI++)2685 {2686 CvPlayerAI& thisPlayer = GET_PLAYER((PlayerTypes)iI);2687 if(thisPlayer.isAlive())2688 {2689 if(thisPlayer.getTeam() == m_eID)2690 {2691 iGameHandicap += GET_PLAYER((PlayerTypes)iI).getHandicapType();2692 iCount++;2693 }2694 }2695 }26962697 if(iCount > 0)2698 {2699 CvAssertMsg((iGameHandicap / iCount) >= 0, "(iGameHandicap / iCount) is expected to be non-negative (invalid Index)");2700 return ((HandicapTypes)(iGameHandicap / iCount));2701 }2702 else2703 {2704 return ((HandicapTypes)(GC.getSTANDARD_HANDICAP()));2705 }2706}