Skip to content

Commit

Permalink
Small improvement planning fix (#11327)
Browse files Browse the repository at this point in the history
Fix improvement planner not properly accounting for pillaged improvements when planning improvements with adjacency bonuses.
  • Loading branch information
KungCheops authored Oct 16, 2024
1 parent 07f2998 commit 505fc7b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CvGameCoreDLL_Expansion2/CvBuilderTaskingAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2874,11 +2874,14 @@ pair<int,int> 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))
Expand Down

0 comments on commit 505fc7b

Please sign in to comment.