Skip to content

Commit

Permalink
GOTTA, SWEEP SWEEP SWEEP!
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursiveVision committed Aug 1, 2024
1 parent 1f31cc0 commit cbf9154
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 49 deletions.
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvBarbarians.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ void CvBarbarians::DoCamps()
if (pPlot->isRevealed(eTeam))
{
pPlot->setRevealedImprovementType(eTeam, eCamp);
if (GC.getGame().getActivePlayer() == GET_PLAYER(*it).GetID())
if (GC.getGame().getActivePlayer() == *it)
bUpdateMapFog = true;
}
}
Expand Down
8 changes: 4 additions & 4 deletions CvGameCoreDLL_Expansion2/CvCultureClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@ bool CvPlayerCulture::ThemeBuilding(vector<CvGreatWorkBuildingInMyEmpire>::const

// Loop through the rest looking for works that will match up
it2 = it;
for (it2++; it2 != worksToConsider.end() && aWorksChosen.size() < (unsigned int)iCountSlots; it2++)
for (++it2; it2 != worksToConsider.end() && aWorksChosen.size() < (unsigned int)iCountSlots; ++it2)
{
if (CultureHelpers::IsValidForThemingBonus(pkBonusInfo, it2->m_eEra, aErasSeen, it2->m_ePlayer, aPlayersSeen, m_pPlayer->GetID()))
{
Expand Down Expand Up @@ -2089,7 +2089,7 @@ bool CvPlayerCulture::ThemeEqualArtArtifact(CvGreatWorkBuildingInMyEmpire kBldg,

// Loop through the rest looking for works that will match up
vector<CvGreatWorkInMyEmpire>::const_iterator it2 = it;
for (it2++; it2 != works2.end() && aArtifactsChosen.size() < (unsigned int)iWorksInHalf; it2++)
for (++it2; it2 != works2.end() && aArtifactsChosen.size() < (unsigned int)iWorksInHalf; ++it2)
{
if (CultureHelpers::IsValidForThemingBonus(pkBonusInfo, it2->m_eEra, aArtifactsErasSeen, it2->m_ePlayer, aArtifactsPlayersSeen, m_pPlayer->GetID()))
{
Expand Down Expand Up @@ -2688,7 +2688,7 @@ bool CvPlayerCulture::FillBuilding(vector<CvGreatWorkBuildingInMyEmpire>::const_
vector<CvGreatWorkInMyEmpire> tempWorks;

tempWorks.clear();
for (it2 = works1.begin(); it2 != works1.end(); it2++)
for (it2 = works1.begin(); it2 != works1.end(); ++it2)
{
// Copy it over if not chosen, updating its location
if (find(aWorksChosen.begin(), aWorksChosen.end(), it2->m_iGreatWorkIndex) == aWorksChosen.end())
Expand All @@ -2700,7 +2700,7 @@ bool CvPlayerCulture::FillBuilding(vector<CvGreatWorkBuildingInMyEmpire>::const_
works1 = tempWorks;

tempWorks.clear();
for (it2 = works2.begin(); it2 != works2.end(); it2++)
for (it2 = works2.begin(); it2 != works2.end(); ++it2)
{
// Copy it over if not chosen, updating its location
if (find(aWorksChosen.begin(), aWorksChosen.end(), it2->m_iGreatWorkIndex) == aWorksChosen.end())
Expand Down
10 changes: 5 additions & 5 deletions CvGameCoreDLL_Expansion2/CvDealClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4915,7 +4915,7 @@ void CvGameDeals::ActivateDeal(PlayerTypes eFromPlayer, PlayerTypes eToPlayer, C
}

// If AI, adjust opinion of the broker and the warrior, if appropriate.
for (std::vector<PlayerTypes>::iterator iter = vPlayersWithSurveillance.begin(); iter != vPlayersWithSurveillance.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vPlayersWithSurveillance.begin(); iter != vPlayersWithSurveillance.end(); ++iter)
{
TeamTypes eTeam = GET_PLAYER(*iter).getTeam();
if (!GET_PLAYER(*iter).isHuman())
Expand Down Expand Up @@ -4989,7 +4989,7 @@ void CvGameDeals::ActivateDeal(PlayerTypes eFromPlayer, PlayerTypes eToPlayer, C
}
}
// Notify any humans who have debug mode enabled
for (std::vector<PlayerTypes>::iterator iter = vDebugModePlayers.begin(); iter != vDebugModePlayers.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vDebugModePlayers.begin(); iter != vDebugModePlayers.end(); ++iter)
{
if (std::find(vNotifiedPlayers.begin(), vNotifiedPlayers.end(), *iter) != vNotifiedPlayers.end())
continue;
Expand All @@ -5009,7 +5009,7 @@ void CvGameDeals::ActivateDeal(PlayerTypes eFromPlayer, PlayerTypes eToPlayer, C
}

// Negate warmongering penalties for the team that made the purchase
for (std::vector<PlayerTypes>::iterator iter = vReceivingTeam.begin(); iter != vReceivingTeam.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vReceivingTeam.begin(); iter != vReceivingTeam.end(); ++iter)
{
if (!GET_PLAYER(*iter).isAlive() || !GET_PLAYER(*iter).isMajorCiv())
continue;
Expand Down Expand Up @@ -5041,7 +5041,7 @@ void CvGameDeals::ActivateDeal(PlayerTypes eFromPlayer, PlayerTypes eToPlayer, C
}

// Notified players reevaluate the broker!
for (std::vector<PlayerTypes>::iterator iter = vNotifiedPlayers.begin(); iter != vNotifiedPlayers.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vNotifiedPlayers.begin(); iter != vNotifiedPlayers.end(); ++iter)
{
if (!GET_PLAYER(*iter).isHuman())
{
Expand All @@ -5051,7 +5051,7 @@ void CvGameDeals::ActivateDeal(PlayerTypes eFromPlayer, PlayerTypes eToPlayer, C
}

// Cancel the previous negation
for (std::vector<PlayerTypes>::iterator iter = vReceivingTeam.begin(); iter != vReceivingTeam.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vReceivingTeam.begin(); iter != vReceivingTeam.end(); ++iter)
{
if (!GET_PLAYER(*iter).isAlive() || !GET_PLAYER(*iter).isMajorCiv())
continue;
Expand Down
64 changes: 32 additions & 32 deletions CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,9 +1539,9 @@ vector<PlayerTypes> CvDiplomacyAI::GetWarAllies(PlayerTypes eOtherPlayer, bool b
break;
}

for (std::vector<PlayerTypes>::iterator iter = vValidPlayers.begin(); iter != vValidPlayers.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vValidPlayers.begin(); iter != vValidPlayers.end(); ++iter)
{
PlayerTypes eLoopPlayer = GET_PLAYER(*iter).GetID();
PlayerTypes eLoopPlayer = *iter;

if (GET_PLAYER(eLoopPlayer).getTeam() == GET_PLAYER(eMasterPlayer).getTeam())
continue;
Expand Down Expand Up @@ -1572,9 +1572,9 @@ vector<PlayerTypes> CvDiplomacyAI::GetWarAllies(PlayerTypes eOtherPlayer, bool b
// For all relevant allies, check if they have vassals and include them too!
for (std::vector<PlayerTypes>::iterator it = vCheckVassals.begin(); it != vCheckVassals.end(); ++it)
{
for (std::vector<PlayerTypes>::iterator iter = vValidPlayers.begin(); iter != vValidPlayers.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vValidPlayers.begin(); iter != vValidPlayers.end(); ++iter)
{
PlayerTypes eLoopPlayer = GET_PLAYER(*iter).GetID();
PlayerTypes eLoopPlayer = *iter;

if (GET_PLAYER(eLoopPlayer).getTeam() == GET_PLAYER(*it).getTeam())
continue;
Expand Down Expand Up @@ -1779,9 +1779,9 @@ vector<PlayerTypes> CvDiplomacyAI::GetWarAllies(PlayerTypes eOtherPlayer, bool b
break;
}

for (std::vector<PlayerTypes>::iterator iter = vValidPlayers.begin(); iter != vValidPlayers.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vValidPlayers.begin(); iter != vValidPlayers.end(); ++iter)
{
PlayerTypes eLoopPlayer = GET_PLAYER(*iter).GetID();
PlayerTypes eLoopPlayer = *iter;

if (GET_PLAYER(eLoopPlayer).getTeam() == GET_PLAYER(eMasterPlayer).getTeam())
continue;
Expand Down Expand Up @@ -1812,9 +1812,9 @@ vector<PlayerTypes> CvDiplomacyAI::GetWarAllies(PlayerTypes eOtherPlayer, bool b
// For all relevant allies, check if they have vassals and include them too!
for (std::vector<PlayerTypes>::iterator it = vCheckVassals.begin(); it != vCheckVassals.end(); ++it)
{
for (std::vector<PlayerTypes>::iterator iter = vValidPlayers.begin(); iter != vValidPlayers.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vValidPlayers.begin(); iter != vValidPlayers.end(); ++iter)
{
PlayerTypes eLoopPlayer = GET_PLAYER(*iter).GetID();
PlayerTypes eLoopPlayer = *iter;

if (GET_PLAYER(eLoopPlayer).getTeam() == GET_PLAYER(*it).getTeam())
continue;
Expand Down Expand Up @@ -11382,7 +11382,7 @@ void CvDiplomacyAI::DoUpdatePlayerStrengthEstimates()
// Go through the lists of allies and see which of them are relevant for ATTACK and DEFENSE evaluations
for (std::vector<PlayerTypes>::iterator it = vValidPlayers.begin(); it != vValidPlayers.end(); ++it)
{
PlayerTypes eLoopPlayer = GET_PLAYER(*it).GetID();
PlayerTypes eLoopPlayer = *it;
if (eLoopPlayer == ePlayer)
continue;

Expand Down Expand Up @@ -11421,7 +11421,7 @@ void CvDiplomacyAI::DoUpdatePlayerStrengthEstimates()
// Our allies
for (std::vector<PlayerTypes>::iterator it = vOurAllies.begin(); it != vOurAllies.end(); ++it)
{
PlayerTypes eAllyPlayer = GET_PLAYER(*it).GetID();
PlayerTypes eAllyPlayer = *it;
int iAllyMight = max(iBase + GET_PLAYER(eAllyPlayer).GetMilitaryMight() - GET_PLAYER(eAllyPlayer).GetNuclearMight(), 1);
int iTheirMight = max(iBase + GET_PLAYER(ePlayer).GetMilitaryMight() - GET_PLAYER(ePlayer).GetNuclearMight(), 1);

Expand Down Expand Up @@ -11664,7 +11664,7 @@ void CvDiplomacyAI::DoUpdatePlayerStrengthEstimates()
// Their allies
for (std::vector<PlayerTypes>::iterator it = vTheirAllies.begin(); it != vTheirAllies.end(); ++it)
{
PlayerTypes eEnemyPlayer = GET_PLAYER(*it).GetID();
PlayerTypes eEnemyPlayer = *it;
int iOurMight = iMilitaryStrength;
int iEnemyMight = max(iBase + GET_PLAYER(eEnemyPlayer).GetMilitaryMight() - GET_PLAYER(eEnemyPlayer).GetNuclearMight(), 1);

Expand Down Expand Up @@ -14797,7 +14797,7 @@ void CvDiplomacyAI::DoReevaluatePlayers(vector<PlayerTypes>& vTargetPlayers, boo
vector<PlayerTypes> vPlayersToReevaluate;
for (std::vector<PlayerTypes>::iterator it = vTargetPlayers.begin(); it != vTargetPlayers.end(); ++it)
{
PlayerTypes ePlayer = GET_PLAYER(*it).GetID();
PlayerTypes ePlayer = *it;
if (ePlayer != NO_PLAYER && GET_PLAYER(ePlayer).isAlive() && IsHasMet(ePlayer) && GET_PLAYER(ePlayer).isMajorCiv() && std::find(vPlayersToReevaluate.begin(), vPlayersToReevaluate.end(), ePlayer) == vPlayersToReevaluate.end())
{
vPlayersToReevaluate.push_back(ePlayer);
Expand Down Expand Up @@ -20932,7 +20932,7 @@ void CvDiplomacyAI::SelectBestApproachTowardsMajorCiv(PlayerTypes ePlayer, bool

for (std::vector<PlayerTypes>::iterator it = vValidPlayers.begin(); it != vValidPlayers.end(); ++it)
{
if (GET_PLAYER(*it).GetID() == GET_PLAYER(ePlayer).GetID())
if (ePlayer == *it)
continue;

if (GetCachedOpinionWeight(*it) > /*30*/ GD_INT_GET(OPINION_THRESHOLD_COMPETITOR))
Expand Down Expand Up @@ -20990,7 +20990,7 @@ void CvDiplomacyAI::SelectBestApproachTowardsMajorCiv(PlayerTypes ePlayer, bool

for (std::vector<PlayerTypes>::iterator it = vValidPlayers.begin(); it != vValidPlayers.end(); ++it)
{
if (GET_PLAYER(*it).GetID() == GET_PLAYER(ePlayer).GetID())
if (ePlayer == *it)
continue;

if (GetCachedOpinionWeight(*it) < /*-30*/ GD_INT_GET(OPINION_THRESHOLD_FAVORABLE))
Expand Down Expand Up @@ -22042,7 +22042,7 @@ void CvDiplomacyAI::DoRelationshipPairing()
// First let's examine any conditions which make some players the greatest competitors.
for (std::vector<PlayerTypes>::iterator it = vPotentialCompetitors.begin(); it != vPotentialCompetitors.end(); ++it)
{
PlayerTypes eLoopPlayer = GET_PLAYER(*it).GetID();
PlayerTypes eLoopPlayer = *it;
int iPriority = 0;
bool bIgnoreCityConquests = false;

Expand Down Expand Up @@ -22326,7 +22326,7 @@ void CvDiplomacyAI::DoRelationshipPairing()

for (std::vector<PlayerTypes>::iterator it = vValidPlayers.begin(); it != vValidPlayers.end(); ++it)
{
PlayerTypes eLoopPlayer = GET_PLAYER(*it).GetID();
PlayerTypes eLoopPlayer = *it;

if (IsAtWar(eLoopPlayer) || GetCivApproach(eLoopPlayer) == CIV_APPROACH_WAR)
{
Expand Down Expand Up @@ -22575,7 +22575,7 @@ void CvDiplomacyAI::DoUpdatePlanningExchanges()
continue;

// We're unlikely to befriend our biggest competitors
if (GetBiggestCompetitor() == GET_PLAYER(*it).GetID() || GetPrimeLeagueCompetitor() == GET_PLAYER(*it).GetID())
if (GetBiggestCompetitor() == *it || GetPrimeLeagueCompetitor() == *it)
{
CivOpinionTypes eOpinion = GetCivOpinion(*it);
CivApproachTypes eApproach = GetCivApproach(*it);
Expand All @@ -22589,7 +22589,7 @@ void CvDiplomacyAI::DoUpdatePlanningExchanges()
continue;
}
// Don't befriend our prime league competitor unless we really like them.
if (GetPrimeLeagueCompetitor() == GET_PLAYER(*it).GetID() && !bLiberator)
if (GetPrimeLeagueCompetitor() == *it && !bLiberator)
{
if (IsCompetingForVictory() && IsGoingForDiploVictory() && eOpinion < CIV_OPINION_ALLY)
{
Expand Down Expand Up @@ -22892,7 +22892,7 @@ void CvDiplomacyAI::DoUpdatePlanningExchanges()
if (iScore > iHighestScore)
{
iHighestScore = iScore;
eMostValuableAlly = GET_PLAYER(*it).GetID();
eMostValuableAlly = *it;
}
}

Expand Down Expand Up @@ -23498,7 +23498,7 @@ PlayerTypes CvDiplomacyAI::GetHighestScoringDefensivePact(vector<PlayerTypes>& v
if (std::find(vPlayersToExclude.begin(), vPlayersToExclude.end(), *it) != vPlayersToExclude.end())
continue;

PlayerTypes eChoice = GET_PLAYER(*it).GetID();
PlayerTypes eChoice = *it;
int iDPValue = ScoreDefensivePactChoice(*it, bCoastal);

if (iDPValue > iBestDPValue)
Expand Down Expand Up @@ -23787,7 +23787,7 @@ void CvDiplomacyAI::DoUpdateWarTargets()
vDirectTargets.push_back(*it);
vector<PlayerTypes> vDefensiveWarAllies = GetDefensiveWarAllies(*it, /*bIncludeMinors*/ false, /*bReverseMode*/ true, /*bNewWarsOnly*/ true);

for (std::vector<PlayerTypes>::iterator it2 = vDefensiveWarAllies.begin(); it2 != vDefensiveWarAllies.end(); it2++)
for (std::vector<PlayerTypes>::iterator it2 = vDefensiveWarAllies.begin(); it2 != vDefensiveWarAllies.end(); ++it2)
{
if (std::find(vAtWarPlayers.begin(), vAtWarPlayers.end(), *it2) == vAtWarPlayers.end())
{
Expand Down Expand Up @@ -24004,7 +24004,7 @@ void CvDiplomacyAI::DoUpdateWarTargets()

for (std::vector<PlayerTypes>::iterator it = vNotAtWarPlayers.begin(); it != vNotAtWarPlayers.end(); ++it)
{
if (std::find(vPlanningWarPlayers.begin(), vPlanningWarPlayers.end(), *it) != vPlanningWarPlayers.end() && GetDemandTargetPlayer() != GET_PLAYER(*it).GetID())
if (std::find(vPlanningWarPlayers.begin(), vPlanningWarPlayers.end(), *it) != vPlanningWarPlayers.end() && GetDemandTargetPlayer() != *it)
{
// How much do we value this existing sneak attack?
if (GetPlayer()->getFirstOffensiveAIOperation(*it) != NULL || IsArmyInPlaceForAttack(*it))
Expand Down Expand Up @@ -24178,7 +24178,7 @@ void CvDiplomacyAI::DoUpdateWarTargets()
{
for (std::vector<PlayerTypes>::iterator it = vValidPlayers.begin(); it != vValidPlayers.end(); ++it)
{
PlayerTypes ePlayer = GET_PLAYER(*it).GetID();
PlayerTypes ePlayer = *it;

// Already at war?
if (IsAtWar(ePlayer))
Expand Down Expand Up @@ -25672,7 +25672,7 @@ void CvDiplomacyAI::DoUpdatePeaceTreatyWillingness(bool bMyTurn)
{
for (std::vector<PlayerTypes>::iterator it = vPeacePossibleMinors.begin(); it != vPeacePossibleMinors.end(); ++it)
{
PlayerTypes eMinor = GET_PLAYER(*it).GetID();
PlayerTypes eMinor = *it;

// Only consider peace with City-States if they aren't our war target or we're doing poorly (since there's no War Weariness)
if (!bMakePeaceWithAllMinors && GetCSWarTargetPlayer() == eMinor)
Expand Down Expand Up @@ -26412,9 +26412,9 @@ void CvDiplomacyAI::DoUpdatePeaceTreatyWillingness(bool bMyTurn)
int iAlliesMod = 0;
if (!bInTerribleShape)
{
for (std::vector<PlayerTypes>::iterator iter = vOurWarAllies.begin(); iter != vOurWarAllies.end(); iter++)
for (std::vector<PlayerTypes>::iterator iter = vOurWarAllies.begin(); iter != vOurWarAllies.end(); ++iter)
{
if (GET_PLAYER(*iter).GetID() == GetID())
if (*iter == GetID())
continue;
if (!GET_PLAYER(*iter).isMajorCiv())
continue;
Expand Down Expand Up @@ -30655,7 +30655,7 @@ void CvDiplomacyAI::DoSendStatementToPlayer(PlayerTypes ePlayer, DiploStatementT
break;
}
// If we're already planning a war/demand against them, then we don't care.
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != GET_PLAYER(*it).GetID())
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != *it)
{
if (GetMilitaryStrengthComparedToUs(*it) > STRENGTH_AVERAGE)
{
Expand Down Expand Up @@ -38641,7 +38641,7 @@ void CvDiplomacyAI::DoFromUIDiploEvent(PlayerTypes eFromPlayer, FromUIDiploEvent
break;
}
// If we're already planning a war/demand against them, then we don't care.
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != GET_PLAYER(*it).GetID())
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != *it)
{
if (GetMilitaryStrengthComparedToUs(*it) > STRENGTH_AVERAGE)
{
Expand Down Expand Up @@ -38902,7 +38902,7 @@ void CvDiplomacyAI::DoFromUIDiploEvent(PlayerTypes eFromPlayer, FromUIDiploEvent
break;
}
// If we're already planning a war/demand against them, then we don't care.
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != GET_PLAYER(*it).GetID())
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != *it)
{
if (GetMilitaryStrengthComparedToUs(*it) > STRENGTH_AVERAGE)
{
Expand Down Expand Up @@ -39074,7 +39074,7 @@ void CvDiplomacyAI::DoFromUIDiploEvent(PlayerTypes eFromPlayer, FromUIDiploEvent
break;
}
// If we're already planning a war/demand against them, then we don't care.
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != GET_PLAYER(*it).GetID())
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != *it)
{
if (GetMilitaryStrengthComparedToUs(*it) > STRENGTH_AVERAGE)
{
Expand Down Expand Up @@ -39512,7 +39512,7 @@ void CvDiplomacyAI::DoFromUIDiploEvent(PlayerTypes eFromPlayer, FromUIDiploEvent
break;
}
// If we're already planning a war/demand against them, then we don't care.
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != GET_PLAYER(*it).GetID())
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != *it)
{
if (GetMilitaryStrengthComparedToUs(*it) > STRENGTH_AVERAGE)
{
Expand Down Expand Up @@ -56536,7 +56536,7 @@ bool CvDiplomacyAI::IsVoluntaryVassalageRequestAcceptable(PlayerTypes ePlayer)
{
if (GetCivApproach(*it) == CIV_APPROACH_AFRAID)
return false;
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != GET_PLAYER(*it).GetID())
else if (GetCivApproach(*it) != CIV_APPROACH_WAR && GetDemandTargetPlayer() != *it)
{
if (bWeLikeOneOfThem && GetMilitaryStrengthComparedToUs(*it) > STRENGTH_STRONG)
return false;
Expand Down
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvMinorCivAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6057,7 +6057,7 @@ void CvMinorCivAI::DoTurnQuests()

for (std::vector<PlayerTypes>::iterator it = ValidMajors.begin(); it != ValidMajors.end(); it++)
{
PlayerTypes ePlayer = GET_PLAYER(*it).GetID();
PlayerTypes ePlayer = *it;

// Unlock turn - seed the counter
if (GC.getGame().getElapsedGameTurns() == iFirstTurnForPersonalQuests)
Expand Down
9 changes: 6 additions & 3 deletions CvGameCoreDLL_Expansion2/CvPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19676,9 +19676,9 @@ void CvPlayer::DistributeHappinessToCities()
CitiesSortedByPopulation.StableSortItems();

// Distribute happiness to cities in descending order of Need until all cities are full
bool bAllCitiesFull = false;
bool bAllCitiesFull = CitiesSortedByNeed.empty();

while (iHappiness > 0 && !bAllCitiesFull && CitiesSortedByNeed.size() > 0)
while (!bAllCitiesFull)
{
for (int i = 0; i < CitiesSortedByNeed.size(); i++)
{
Expand All @@ -19703,12 +19703,15 @@ void CvPlayer::DistributeHappinessToCities()
for (int i = 0; i < CitiesSortedByNeed.size(); i++)
{
if (CitiesSortedByNeed.GetWeight(i) > 0)
{
bAllCitiesFull = false;
break;
}
}
}

// If there's any happiness left over, distribute it in descending order of population until there's none left
while (iHappiness > 0 && CitiesSortedByPopulation.size() > 0)
while (true)
{
for (int i = 0; i < CitiesSortedByPopulation.size(); i++)
{
Expand Down
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvTeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9977,7 +9977,7 @@ void CvTeam::DoBecomeVassal(TeamTypes eTeam, bool bVoluntary, PlayerTypes eOrigi
// create spies as diplomats for the masters in the vassals' capitals
if (!GC.getGame().isOption(GAMEOPTION_NO_ESPIONAGE))
{
for (std::vector<PlayerTypes>::iterator it2 = aMasterTeam.begin(); it2 != aMasterTeam.end(); it2++)
for (std::vector<PlayerTypes>::iterator it2 = aMasterTeam.begin(); it2 != aMasterTeam.end(); ++it2)
{
CvPlayerEspionage* pMasterEspionage = GET_PLAYER(*it2).GetEspionage();
pMasterEspionage->CreateSpy(*it);
Expand Down
Loading

0 comments on commit cbf9154

Please sign in to comment.