CvMilitaryAI::GetNumberCivsAtWarWith() const
- Defined in
- CvMilitaryAI.cpp, line 1618
- Class
- CvMilitaryAI
- Hook name
CivHooks::CvMilitaryAI_GetNumberCivsAtWarWith
Hooks
static bool BeforeCvMilitaryAI_GetNumberCivsAtWarWith(const CvMilitaryAI* self, int& result);static void AfterCvMilitaryAI_GetNumberCivsAtWarWith(const CvMilitaryAI* self, int& result);static int ReplaceCvMilitaryAI_GetNumberCivsAtWarWith(int (*original)(const CvMilitaryAI*), const CvMilitaryAI* self);CivRegisterBefore<CivHooks::CvMilitaryAI_GetNumberCivsAtWarWith>(host, &BeforeCvMilitaryAI_GetNumberCivsAtWarWith);CivRegisterAfter<CivHooks::CvMilitaryAI_GetNumberCivsAtWarWith>(host, &AfterCvMilitaryAI_GetNumberCivsAtWarWith);CivRegisterReplace<CivHooks::CvMilitaryAI_GetNumberCivsAtWarWith>(host, &ReplaceCvMilitaryAI_GetNumberCivsAtWarWith);
Code
1617/// How many civs are we fighting?1618int CvMilitaryAI::GetNumberCivsAtWarWith() const1619{1620 PlayerTypes eLoopPlayer;1621 WarStateTypes eWarState;1622 int iRtnValue = 0;16231624 // Let's figure out if we're at war1625 for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)1626 {1627 eLoopPlayer = (PlayerTypes) iPlayerLoop;16281629 // Is this a player we have relations with?1630 if(eLoopPlayer != m_pPlayer->GetID() && m_pPlayer->GetDiplomacyAI()->IsPlayerValid(eLoopPlayer))1631 {1632 eWarState = m_pPlayer->GetDiplomacyAI()->GetWarState(eLoopPlayer);1633 if(eWarState != NO_WAR_STATE_TYPE)1634 {1635 iRtnValue++;1636 }1637 }1638 }16391640 return iRtnValue;1641}