From 505fc7b3cb2322b6df5123386660298fc545e059 Mon Sep 17 00:00:00 2001 From: KungCheops Date: Wed, 16 Oct 2024 13:31:20 +0200 Subject: [PATCH] Small improvement planning fix (#11327) Fix improvement planner not properly accounting for pillaged improvements when planning improvements with adjacency bonuses. --- CvGameCoreDLL_Expansion2/CvBuilderTaskingAI.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CvGameCoreDLL_Expansion2/CvBuilderTaskingAI.cpp b/CvGameCoreDLL_Expansion2/CvBuilderTaskingAI.cpp index acedee9405..ed1545f40b 100644 --- a/CvGameCoreDLL_Expansion2/CvBuilderTaskingAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvBuilderTaskingAI.cpp @@ -2874,11 +2874,14 @@ pair CvBuilderTaskingAI::ScorePlotBuild(CvPlot* pPlot, ImprovementTypes ImprovementTypes eOtherImprovement = (ImprovementTypes)pkOtherBuildInfo->getImprovement(); + if (eOtherImprovement == NO_IMPROVEMENT && pkOtherBuildInfo->isRepair() && pAdjacentPlot->getImprovementType() != NO_IMPROVEMENT && pAdjacentPlot->IsImprovementPillaged()) + eOtherImprovement = pAdjacentPlot->getImprovementType(); + CvImprovementEntry* pkOtherImprovementInfo = GC.getImprovementInfo(eOtherImprovement); if (!pkOtherImprovementInfo) continue; - if (pkOtherImprovementInfo->IsCreatedByGreatPerson()) + if (pkOtherImprovementInfo->IsCreatedByGreatPerson() && !pkOtherBuildInfo->isRepair()) continue; if (!m_pPlayer->canBuild(pAdjacentPlot, eOtherBuild, true))