Skip to content

Commit

Permalink
Fix assertion hits for coop wars
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursiveVision committed Dec 9, 2024
1 parent 2f92084 commit 448f5fd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41946,6 +41946,8 @@ void CvDiplomacyAI::CancelCoopWarsAgainstPlayer(PlayerTypes ePlayer, bool bNotif
for (int iThirdPartyLoop = 0; iThirdPartyLoop < MAX_MAJOR_CIVS; iThirdPartyLoop++)
{
PlayerTypes eThirdParty = (PlayerTypes) iThirdPartyLoop;
if (eThirdParty == GetID() || GET_PLAYER(eThirdParty).getTeam() == GET_PLAYER(ePlayer).getTeam())
continue;

if (!GET_PLAYER(ePlayer).isAlive() || GetCoopWarState(eThirdParty, ePlayer) >= COOP_WAR_STATE_PREPARING)
{
Expand Down Expand Up @@ -41984,6 +41986,8 @@ void CvDiplomacyAI::CancelCoopWarsWithPlayer(PlayerTypes ePlayer, bool bPenalty)
for (int iThirdPartyLoop = 0; iThirdPartyLoop < MAX_MAJOR_CIVS; iThirdPartyLoop++)
{
PlayerTypes eThirdParty = (PlayerTypes) iThirdPartyLoop;
if (GET_PLAYER(eThirdParty).getTeam() == GetTeam())
continue;

if (IsPlayerValid(eThirdParty) && GetCoopWarState(ePlayer, eThirdParty) >= COOP_WAR_STATE_PREPARING)
{
Expand Down Expand Up @@ -42028,7 +42032,7 @@ void CvDiplomacyAI::CancelAllCoopWars()
for (int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)
{
PlayerTypes eLoopPlayer = (PlayerTypes) iPlayerLoop;
if (!GET_PLAYER(eLoopPlayer).isAlive())
if (!GET_PLAYER(eLoopPlayer).isAlive() || eLoopPlayer == GetID())
continue;

CvNotifications* pNotify = GET_PLAYER(eLoopPlayer).GetNotifications();
Expand All @@ -42037,6 +42041,8 @@ void CvDiplomacyAI::CancelAllCoopWars()
for (int iThirdPartyLoop = 0; iThirdPartyLoop < MAX_MAJOR_CIVS; iThirdPartyLoop++)
{
PlayerTypes eThirdParty = (PlayerTypes) iThirdPartyLoop;
if (GET_PLAYER(eThirdParty).getTeam() == GetTeam())
continue;

if (pNotify && !bNotified && GetCoopWarState(eLoopPlayer, eThirdParty) == COOP_WAR_STATE_PREPARING)
{
Expand Down

0 comments on commit 448f5fd

Please sign in to comment.