From 9afa2e942810fd290c1db30f624f261016f9585e Mon Sep 17 00:00:00 2001 From: Samuel Holgersson Date: Sat, 14 Dec 2024 10:32:19 +0100 Subject: [PATCH] Fix city state diplomacy crash Fix crash where city state considers diplomatic ramifications from constructing a dig site. --- CvGameCoreDLL_Expansion2/CvHomelandAI.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/CvGameCoreDLL_Expansion2/CvHomelandAI.cpp b/CvGameCoreDLL_Expansion2/CvHomelandAI.cpp index 6aaefba687..79e2fadf72 100644 --- a/CvGameCoreDLL_Expansion2/CvHomelandAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvHomelandAI.cpp @@ -358,16 +358,19 @@ void CvHomelandAI::FindHomelandTargets() m_TargetedCities.push_back(newTarget); } // ... antiquity site? - bool bArtifact = pLoopPlot->getResourceType(eTeam) == eArtifactResourceType; - bool bHiddenArtifact = pLoopPlot->getResourceType(eTeam) == eHiddenArtifactResourceType; - if ((bArtifact || bHiddenArtifact) && - (pLoopPlot->getOwner() != m_pPlayer->GetID() || ((!bArtifact || !pCivImproveArtifact) && (!bHiddenArtifact || !pCivImproveHiddenArtifact))) && - !m_pPlayer->GetDiplomacyAI()->IsBadTheftTarget(pLoopPlot->getOwner(), THEFT_TYPE_ARTIFACT, pLoopPlot)) + if (m_pPlayer->isMajorCiv()) { - newTarget.SetTargetType(AI_HOMELAND_TARGET_ANTIQUITY_SITE); - newTarget.SetTargetX(pLoopPlot->getX()); - newTarget.SetTargetY(pLoopPlot->getY()); - m_TargetedAntiquitySites.push_back(newTarget); + bool bArtifact = pLoopPlot->getResourceType(eTeam) == eArtifactResourceType; + bool bHiddenArtifact = pLoopPlot->getResourceType(eTeam) == eHiddenArtifactResourceType; + if ((bArtifact || bHiddenArtifact) && + (pLoopPlot->getOwner() != m_pPlayer->GetID() || ((!bArtifact || !pCivImproveArtifact) && (!bHiddenArtifact || !pCivImproveHiddenArtifact))) && + !m_pPlayer->GetDiplomacyAI()->IsBadTheftTarget(pLoopPlot->getOwner(), THEFT_TYPE_ARTIFACT, pLoopPlot)) + { + newTarget.SetTargetType(AI_HOMELAND_TARGET_ANTIQUITY_SITE); + newTarget.SetTargetX(pLoopPlot->getX()); + newTarget.SetTargetY(pLoopPlot->getY()); + m_TargetedAntiquitySites.push_back(newTarget); + } } // ... border fortification? if (!pLoopPlot->isWater() &&