CvDiplomacyAI::IsPlayerValid(PlayerTypes, bool)
- Defined in
- CvDiplomacyAI.cpp, line 24425
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_IsPlayerValid
Hooks
static bool BeforeCvDiplomacyAI_IsPlayerValid(CvDiplomacyAI* self, PlayerTypes eOtherPlayer, bool bMyTeamIsValid, bool& result);static void AfterCvDiplomacyAI_IsPlayerValid(CvDiplomacyAI* self, PlayerTypes eOtherPlayer, bool bMyTeamIsValid, bool& result);static bool ReplaceCvDiplomacyAI_IsPlayerValid(bool (*original)(CvDiplomacyAI*, PlayerTypes, bool), CvDiplomacyAI* self, PlayerTypes eOtherPlayer, bool bMyTeamIsValid);CivRegisterBefore<CivHooks::CvDiplomacyAI_IsPlayerValid>(host, &BeforeCvDiplomacyAI_IsPlayerValid);CivRegisterAfter<CivHooks::CvDiplomacyAI_IsPlayerValid>(host, &AfterCvDiplomacyAI_IsPlayerValid);CivRegisterReplace<CivHooks::CvDiplomacyAI_IsPlayerValid>(host, &ReplaceCvDiplomacyAI_IsPlayerValid);
Code
24424/// Helper function: is this a valid player to be looking at? (e.g. are they alive, do we know them, etc.)24425bool CvDiplomacyAI::IsPlayerValid(PlayerTypes eOtherPlayer, bool bMyTeamIsValid)24426{24427 CvAssertMsg(eOtherPlayer >= 0, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");24428 CvAssertMsg(eOtherPlayer < MAX_CIV_PLAYERS, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");2442924430 // Alive?24431 if(!GET_PLAYER(eOtherPlayer).isAlive())24432 {24433 return false;24434 }2443524436 // REALLY Alive? (For some reason a player can be "alive" but have no Cities, Units, etc... grrrr)24437 if(GET_PLAYER(eOtherPlayer).getNumCities() == 0)24438 {24439 return false;24440 }2444124442 // A player we've met?24443 if(!GET_TEAM(GetTeam()).isHasMet(GET_PLAYER(eOtherPlayer).getTeam()))24444 {24445 return false;24446 }2444724448 // Teammate?24449 if(!bMyTeamIsValid)24450 {24451 if(GetTeam() == GET_PLAYER(eOtherPlayer).getTeam())24452 {24453 return false;24454 }24455 }2445624457 return true;24458}
Calls
Called by
74 functions in 6 files
- CvCityCulture::GetTourismMultiplier(PlayerTypes, bool, bool, bool, bool, bool) const
- CvCityCulture::GetTourismTooltip()
- CvPlayerCulture::AddTourismAllKnownCivs(int)
- CvPlayerCulture::GetTourismModifierWith(PlayerTypes) const
- CvPlayerCulture::GetTourismModifierWithTooltip(PlayerTypes) const
- CvPlayerCulture::ThemeBuilding(vector<CvGreatWorkBuildingInMyEmpire>::const_iterator, vector<CvGreatWorkInMyEmpire> &, vector<CvGreatWorkInMyEmpire> &, bool)
- CvPlayerCulture::ThemeEqualArtArtifact(CvGreatWorkBuildingInMyEmpire, int, int, vector<CvGreatWorkInMyEmpire> &, vector<CvGreatWorkInMyEmpire> &, bool)
- CvDiplomacyAI::ChangeWarValueLost(PlayerTypes, int)
- CvDiplomacyAI::DoContactMajorCivs()
- CvDiplomacyAI::DoContactMinorCivs()
- CvDiplomacyAI::DoCounters()
- CvDiplomacyAI::DoEstimateOtherPlayerOpinions()
- CvDiplomacyAI::DoMakePeaceWithMinors()
- CvDiplomacyAI::DoMakePublicDeclaration(PublicDeclarationTypes, int, int, PlayerTypes, PlayerTypes)
- CvDiplomacyAI::DoMakeWarOnPlayer(PlayerTypes)
- CvDiplomacyAI::DoPlayerBulliedSomeone(PlayerTypes, PlayerTypes)
- CvDiplomacyAI::DoPlayerDeclaredWarOnSomeone(PlayerTypes, TeamTypes)
- CvDiplomacyAI::DoPlayerKilledSomeone(PlayerTypes, PlayerTypes)
- CvDiplomacyAI::DoPlayerMetSomeone(PlayerTypes, PlayerTypes)
- CvDiplomacyAI::DoSomeoneDeclaredWarOnMe(TeamTypes)
- CvDiplomacyAI::DoTestCoopWarDesire(PlayerTypes, PlayerTypes &)
- CvDiplomacyAI::DoTestPromises()
- CvDiplomacyAI::DoUpdateApproachTowardsUsGuesses()
- CvDiplomacyAI::DoUpdateDemands()
- CvDiplomacyAI::DoUpdateEstimateOtherPlayerLandDisputeLevels()
- CvDiplomacyAI::DoUpdateEstimateOtherPlayerMilitaryThreats()
- CvDiplomacyAI::DoUpdateEstimateOtherPlayerVictoryDisputeLevels()
- CvDiplomacyAI::DoUpdateLandDisputeLevels()
- CvDiplomacyAI::DoUpdateMajorCivApproaches()
- CvDiplomacyAI::DoUpdateMilitaryThreats()
- CvDiplomacyAI::DoUpdateMinorCivApproaches()
- CvDiplomacyAI::DoUpdateMinorCivDisputeLevels()
- CvDiplomacyAI::DoUpdateOnePlayerEconomicStrength(PlayerTypes)
- CvDiplomacyAI::DoUpdateOnePlayerExpansionAggressivePosture(PlayerTypes)
- CvDiplomacyAI::DoUpdateOnePlayerMilitaryAggressivePosture(PlayerTypes)
- CvDiplomacyAI::DoUpdateOnePlayerMilitaryStrength(PlayerTypes)
- CvDiplomacyAI::DoUpdateOnePlayerOpinion(PlayerTypes)
- CvDiplomacyAI::DoUpdateOnePlayerTargetValue(PlayerTypes)
- CvDiplomacyAI::DoUpdateOtherPlayerWarDamageLevel()
- CvDiplomacyAI::DoUpdatePeaceTreatyWillingness()
- CvDiplomacyAI::DoUpdatePlanningExchanges()
- CvDiplomacyAI::DoUpdatePlotBuyingAggressivePosture()
- CvDiplomacyAI::DoUpdateVictoryDisputeLevels()
- CvDiplomacyAI::DoUpdateWarDamageLevel()
- CvDiplomacyAI::DoUpdateWarGoals()
- CvDiplomacyAI::DoUpdateWarProjections()
- CvDiplomacyAI::DoUpdateWarStates()
- CvDiplomacyAI::DoUpdateWarmongerThreats()
- CvDiplomacyAI::DoUpdateWonderDisputeLevels()
- CvDiplomacyAI::DoWarDamageDecay()
- CvDiplomacyAI::GetBestApproachTowardsMajorCiv(PlayerTypes, int &, bool, bool, WarFaceTypes &)
- CvDiplomacyAI::GetBestApproachTowardsMinorCiv(PlayerTypes, int &, bool, bool)
- CvDiplomacyAI::GetCoopWarScore(PlayerTypes, PlayerTypes, bool)
- CvDiplomacyAI::GetGlobalCoopWarAcceptedState(PlayerTypes)
- CvDiplomacyAI::GetGlobalCoopWarCounter(PlayerTypes)
- CvDiplomacyAI::GetNumDoF()
- CvDiplomacyAI::GetNumOurEnemiesPlayerAtWarWith(PlayerTypes)
- CvDiplomacyAI::GetOtherPlayerProtectedMinorBullied(PlayerTypes)
- CvDiplomacyAI::GetTotalLandDisputeLevel()
- CvDiplomacyAI::LogOtherPlayerGuessStatus()
- CvDiplomacyAI::LogStatements()
- CvDiplomacyAI::LogStatus()
- CvDiplomacyAI::LogWarStatus()
- CvDiplomacyAI::MakeWar()
- CvMilitaryAI::GetHighestThreat()
- CvMilitaryAI::GetNumberCivsAtWarWith() const
- CvMilitaryAI::UpdateOperations()
- CvMilitaryAI::UpdateThreats()
- CvMilitaryAI::UpdateWars()
- MilitaryAIHelpers::IsTestStrategy_EnoughAntiAirUnits(CvPlayer *, int, int)
- MilitaryAIHelpers::IsTestStrategy_NeedAntiAirUnits(CvPlayer *, int, int)
- CvPlayer::GetGreatPeopleRateModFromFriendships() const
- CvPolicyAI::DoChooseIdeology(CvPlayer *)
- CvUnit::blastTourism()