CvMinorCivAI::IsPeaceBlocked(TeamTypes) const
- Defined in
- CvMinorCivAI.cpp, line 10284
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_IsPeaceBlocked
Hooks
static bool BeforeCvMinorCivAI_IsPeaceBlocked(const CvMinorCivAI* self, TeamTypes eTeam, bool& result);static void AfterCvMinorCivAI_IsPeaceBlocked(const CvMinorCivAI* self, TeamTypes eTeam, bool& result);static bool ReplaceCvMinorCivAI_IsPeaceBlocked(bool (*original)(const CvMinorCivAI*, TeamTypes), const CvMinorCivAI* self, TeamTypes eTeam);CivRegisterBefore<CivHooks::CvMinorCivAI_IsPeaceBlocked>(host, &BeforeCvMinorCivAI_IsPeaceBlocked);CivRegisterAfter<CivHooks::CvMinorCivAI_IsPeaceBlocked>(host, &AfterCvMinorCivAI_IsPeaceBlocked);CivRegisterReplace<CivHooks::CvMinorCivAI_IsPeaceBlocked>(host, &ReplaceCvMinorCivAI_IsPeaceBlocked);
Code
10283/// Will this AI allow peace with ePlayer?10284bool CvMinorCivAI::IsPeaceBlocked(TeamTypes eTeam) const10285{10286 // Permanent war?10287 if(IsPermanentWar(eTeam))10288 return true;1028910290 // Allies with someone at war with this guy?10291 PlayerTypes eMajor;10292 for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)10293 {10294 eMajor = (PlayerTypes) iMajorLoop;1029510296 // Major must be alive10297 if(!GET_PLAYER(eMajor).isAlive())10298 continue;1029910300 // Must be allies10301 if(!IsAllies(eMajor))10302 continue;1030310304 // Ally must be at war with this team10305 if(!GET_TEAM(GET_PLAYER(eMajor).getTeam()).isAtWar(eTeam))10306 continue;1030710308 return true;10309 }10310 10311#if defined(MOD_CONFIG_GAME_IN_XML)10312 int iLimit = GD_INT_GET(WAR_MINOR_MINIMUM_TURNS);1031310314 if (iLimit > 0) {10315 int iTurns = m_pPlayer->GetDiplomacyAI()->GetTeamNumTurnsAtWar(eTeam);1031610317 if ((iTurns == 0 && GET_TEAM(m_pPlayer->getTeam()).isAtWar(eTeam)) || (iTurns != 0 && iTurns <= iLimit))10318 {10319 return true;10320 }10321 }10322#endif1032310324 return false;10325}
Calls
- CvDiplomacyAI::GetTeamNumTurnsAtWar(TeamTypes) const
- CvGlobals::getWAR_MINOR_MINIMUM_TURNS()
- CvMinorCivAI::IsAllies(PlayerTypes) const
- CvMinorCivAI::IsPermanentWar(TeamTypes) const
- CvPlayer::GetDiplomacyAI() const
- CvPlayer::getTeam() const
- CvPlayer::isAlive() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvTeam::getTeam(TeamTypes)
- CvTeam::isAtWar(TeamTypes) const
Called by
- CvDeal::IsPossibleToTradeItem(PlayerTypes, PlayerTypes, TradeableItems, int, int, int, bool, bool, bool)
- CvDiplomacyAI::DoMakePeaceWithMinors()
- CvMinorCivAI::DoFirstContactWithMajor(TeamTypes, bool)
- CvMinorCivAI::IsProxyWarActiveForMajor(PlayerTypes, PlayerTypes)
- CvLuaPlayer::lIsPeaceBlocked(lua_State *)