Code
2379/// See if the threats we are facing have changed2380void CvMilitaryAI::UpdateThreats()2381{2382 AI_PERF_FORMAT("Military-AI-perf.csv", ("UpdateThreats, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), m_pPlayer->getCivilizationShortDescription()) );23832384 ThreatTypes eMilitaryThreatType;23852386 PlayerTypes eLoopPlayer;2387 for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)2388 {2389 eLoopPlayer = (PlayerTypes) iPlayerLoop;23902391 // Is this a player we have relations with?2392 if(eLoopPlayer != m_pPlayer->GetID() && m_pDiplomacyAI->IsPlayerValid(eLoopPlayer))2393 {2394 eMilitaryThreatType = m_pDiplomacyAI->GetMilitaryThreat(eLoopPlayer);2395 if(eMilitaryThreatType != m_paeLastTurnMilitaryThreat[eLoopPlayer])2396 {2397 // Change in threat level2398 if(eMilitaryThreatType > m_paeLastTurnMilitaryThreat[eLoopPlayer])2399 {2400 ThreatIncrease(eMilitaryThreatType, (ThreatTypes)m_paeLastTurnMilitaryThreat[eLoopPlayer]);2401 }2402 else2403 {2404 ThreatDecrease(eMilitaryThreatType, (ThreatTypes)m_paeLastTurnMilitaryThreat[eLoopPlayer]);2405 }24062407 // Save off new value2408 m_paeLastTurnMilitaryThreat[eLoopPlayer] = eMilitaryThreatType;2409 }2410 }2411 }2412}