Resolves #9703 - AI only buys tiles contiguous to the current city tiles (was: contiguous to civ tiles)

This commit is contained in:
Yair Morgenstern
2023-06-30 15:13:14 +03:00
parent 1694a59fd2
commit 947a1001c4
3 changed files with 4 additions and 4 deletions

View File

@ -235,7 +235,7 @@
"uniques": ["Nullifies all other stats this tile provides", "Doesn't generate naturally"], "uniques": ["Nullifies all other stats this tile provides", "Doesn't generate naturally"],
// For map editor only - the generator won't place it without code or enabling uniques // For map editor only - the generator won't place it without code or enabling uniques
// If the map generator is ever updated to always take these into account, it should also take the "Doesn't generate naturally" unique into account // If the map generator is ever updated to always take these into account, it should also take the "Doesn't generate naturally" unique into account
"occursOn": ["Grassland","Plains","Desert","Tundra","Snow","Forest","Jungle","Hill","Flood plains","Marsh","Oasis"] "occursOn": ["Grassland","Plains","Desert","Tundra","Snow","Forest","Jungle","Hill","Flood plains","Marsh","Oasis"],
"defenceBonus": -0.15 "defenceBonus": -0.15
}, },
{ {

View File

@ -236,7 +236,7 @@
"uniques": ["Nullifies all other stats this tile provides", "Doesn't generate naturally"], "uniques": ["Nullifies all other stats this tile provides", "Doesn't generate naturally"],
// For map editor only - the generator won't place it without code or enabling uniques // For map editor only - the generator won't place it without code or enabling uniques
// If the map generator is ever updated to always take these into account, it should also take the "Doesn't generate naturally" unique into account // If the map generator is ever updated to always take these into account, it should also take the "Doesn't generate naturally" unique into account
"occursOn": ["Grassland","Plains","Desert","Tundra","Snow","Forest","Jungle","Hill","Flood plains","Marsh","Oasis"] "occursOn": ["Grassland","Plains","Desert","Tundra","Snow","Forest","Jungle","Hill","Flood plains","Marsh","Oasis"],
"defenceBonus": -0.15 "defenceBonus": -0.15
}, },
{ {

View File

@ -386,11 +386,11 @@ object NextTurnAutomation {
} }
val bfs = BFS(cityWithLeastCostToBuy.getCenterTile()) val bfs = BFS(cityWithLeastCostToBuy.getCenterTile())
{ {
it.getOwner() == null || it.getOwner() == civInfo it.getOwner() == null || it.owningCity == cityWithLeastCostToBuy
} }
bfs.stepUntilDestination(highlyDesirableTile.key) bfs.stepUntilDestination(highlyDesirableTile.key)
val tilesThatNeedBuying = val tilesThatNeedBuying =
bfs.getPathTo(highlyDesirableTile.key).filter { it.getOwner() != civInfo } bfs.getPathTo(highlyDesirableTile.key).filter { it.getOwner() == null }
.toList().reversed() // getPathTo is from destination to source .toList().reversed() // getPathTo is from destination to source
// We're trying to acquire everything and revert if it fails, because of the difficult // We're trying to acquire everything and revert if it fails, because of the difficult