CvMilitaryAI::GetHighestThreat()
- Defined in
- CvMilitaryAI.cpp, line 1554
- Class
- CvMilitaryAI
- Hook name
CivHooks::CvMilitaryAI_GetHighestThreat
Hooks
static bool BeforeCvMilitaryAI_GetHighestThreat(CvMilitaryAI* self, ThreatTypes& result);static void AfterCvMilitaryAI_GetHighestThreat(CvMilitaryAI* self, ThreatTypes& result);static ThreatTypes ReplaceCvMilitaryAI_GetHighestThreat(ThreatTypes (*original)(CvMilitaryAI*), CvMilitaryAI* self);CivRegisterBefore<CivHooks::CvMilitaryAI_GetHighestThreat>(host, &BeforeCvMilitaryAI_GetHighestThreat);CivRegisterAfter<CivHooks::CvMilitaryAI_GetHighestThreat>(host, &AfterCvMilitaryAI_GetHighestThreat);CivRegisterReplace<CivHooks::CvMilitaryAI_GetHighestThreat>(host, &ReplaceCvMilitaryAI_GetHighestThreat);
Code
1553/// See if the threats we are facing have changed1554ThreatTypes CvMilitaryAI::GetHighestThreat()1555{1556 ThreatTypes eHighestThreat = THREAT_NONE;1557 ThreatTypes eMilitaryThreatType;15581559 PlayerTypes eLoopPlayer;1560 for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)1561 {1562 eLoopPlayer = (PlayerTypes) iPlayerLoop;15631564 // Is this a player we have relations with?1565 if(eLoopPlayer != m_pPlayer->GetID() && m_pDiplomacyAI->IsPlayerValid(eLoopPlayer))1566 {1567 eMilitaryThreatType = m_pDiplomacyAI->GetMilitaryThreat(eLoopPlayer);1568 if((int)eMilitaryThreatType > (int)eHighestThreat)1569 {1570 eHighestThreat = eMilitaryThreatType;1571 }1572 }1573 }1574 return eHighestThreat;1575}