From 56dbd5459eb0a5bea94905d54c263928a2e72c4e Mon Sep 17 00:00:00 2001 From: givehub99 <71454921+givehub99@users.noreply.github.com> Date: Mon, 28 Sep 2020 13:34:36 -0700 Subject: [PATCH] "No Maintenance costs for improvements in []" generic unique. Compatibility for Incan unique without having to edit the nations.json file. (#3194) --- core/src/com/unciv/logic/civilization/CivInfoStats.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/civilization/CivInfoStats.kt b/core/src/com/unciv/logic/civilization/CivInfoStats.kt index ccb2b0746a..da9d728caf 100644 --- a/core/src/com/unciv/logic/civilization/CivInfoStats.kt +++ b/core/src/com/unciv/logic/civilization/CivInfoStats.kt @@ -45,11 +45,20 @@ class CivInfoStats(val civInfo: CivilizationInfo){ var transportationUpkeep = 0 // we no longer use .flatMap, because there are a lot of tiles and keeping them all in a list // just to go over them once is a waste of memory - there are low-end phones who don't have much ram - val ignoreHillTiles = civInfo.hasUnique("No Maintenance costs for improvements in Hills") + + val ignoredTileTypes = civInfo.getMatchingUniques("No Maintenance costs for improvements in []").map { it.params[0] } + // accounting for both the old way and the new way of doing no maintenance in hills + val ignoreHillTiles = civInfo.hasUnique("No Maintenance costs for improvements in Hills")|| "Hills" in ignoredTileTypes + for (city in civInfo.cities) { for (tile in city.getTiles()) { if (tile.isCityCenter()) continue if (ignoreHillTiles && tile.isHill()) continue + + if (tile.terrainFeature in ignoredTileTypes || tile.baseTerrain in ignoredTileTypes) { + continue + } + val tileUpkeep = when (tile.roadStatus) { RoadStatus.Road -> 1