From 2f00aa2af135dcfcaa4445c7c6f0a6c98598a34c Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Sat, 11 Mar 2023 19:03:08 +0100 Subject: [PATCH] Comments only - TileInfo to Tile (#8861) (the two in UniqueParameterType are actually useful links during code review) --- .../unciv/logic/automation/unit/WorkerAutomation.kt | 2 +- .../unciv/logic/civilization/managers/UnitManager.kt | 2 +- core/src/com/unciv/logic/map/TileMap.kt | 10 +++++----- core/src/com/unciv/logic/map/tile/Tile.kt | 2 +- .../unciv/models/ruleset/unique/UniqueParameterType.kt | 4 ++-- .../screens/mapeditorscreen/tabs/MapEditorViewTab.kt | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/src/com/unciv/logic/automation/unit/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/unit/WorkerAutomation.kt index 4d2e3cceab..3a7e77ec52 100644 --- a/core/src/com/unciv/logic/automation/unit/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/unit/WorkerAutomation.kt @@ -85,7 +85,7 @@ class WorkerAutomation( if (result.isEmpty()) debug("\tempty") else result.forEach { - debug("\t$it") // ${it.getCity()?.name} included in TileInfo toString() + debug("\t$it") // ${it.getCity()?.name} included in Tile toString() } } result diff --git a/core/src/com/unciv/logic/civilization/managers/UnitManager.kt b/core/src/com/unciv/logic/civilization/managers/UnitManager.kt index b78767ad17..ee134e3888 100644 --- a/core/src/com/unciv/logic/civilization/managers/UnitManager.kt +++ b/core/src/com/unciv/logic/civilization/managers/UnitManager.kt @@ -94,7 +94,7 @@ class UnitManager(val civInfo:Civilization) { nextPotentiallyDueAt = 0 if (updateCivInfo) { - // Not relevant when updating TileInfo transients, since some info of the civ itself isn't yet available, + // Not relevant when updating Tile transients, since some info of the civ itself isn't yet available, // and in any case it'll be updated once civ info transients are civInfo.updateStatsForNextTurn() // unit upkeep if (mapUnit.baseUnit.getResourceRequirements().isNotEmpty()) diff --git a/core/src/com/unciv/logic/map/TileMap.kt b/core/src/com/unciv/logic/map/TileMap.kt index 62a7d94d6c..05bb8942ba 100644 --- a/core/src/com/unciv/logic/map/TileMap.kt +++ b/core/src/com/unciv/logic/map/TileMap.kt @@ -381,7 +381,7 @@ class TileMap : IsPartOfGameInfoSerialization { rulesetIncompatibilities.addAll(set) // All the rest is to find missing nations - try { // This can fail if the map contains a resource that isn't in the ruleset, in TileInfo.tileResource + try { // This can fail if the map contains a resource that isn't in the ruleset, in Tile.tileResource setTransients(ruleset) } catch (ex: Exception) { return rulesetIncompatibilities @@ -438,10 +438,10 @@ class TileMap : IsPartOfGameInfoSerialization { tileMatrix[tileInfo.position.x.toInt() - leftX][tileInfo.position.y.toInt() - bottomY] = tileInfo } for (tileInfo in values) { - // Do ***NOT*** call TileInfo.setTerrainTransients before the tileMatrix is complete - + // Do ***NOT*** call Tile.setTerrainTransients before the tileMatrix is complete - // setting transients might trigger the neighbors lazy (e.g. thanks to convertHillToTerrainFeature). // When that lazy runs, some directions might be omitted because getIfTileExistsOrNull - // looks at tileMatrix. Thus filling TileInfos into tileMatrix and setting their + // looks at tileMatrix. Thus filling Tiles into tileMatrix and setting their // transients in the same loop will leave incomplete cached `neighbors`. tileInfo.tileMap = this tileInfo.ruleset = this.ruleset!! @@ -450,8 +450,8 @@ class TileMap : IsPartOfGameInfoSerialization { } } - /** Initialize based on TileInfo which Civ has neutral tile roads - */ + /** Initialize Civilization.neutralRoads based on Tile.roadOwner + * - which Civ owns roads on which neutral tiles */ fun setNeutralTransients() { for (tileInfo in values) { tileInfo.setOwnerTransients() diff --git a/core/src/com/unciv/logic/map/tile/Tile.kt b/core/src/com/unciv/logic/map/tile/Tile.kt index 5aefb89d07..7a4e31892f 100644 --- a/core/src/com/unciv/logic/map/tile/Tile.kt +++ b/core/src/com/unciv/logic/map/tile/Tile.kt @@ -629,7 +629,7 @@ open class Tile : IsPartOfGameInfoSerialization { /** Shows important properties of this tile for debugging _only_, it helps to see what you're doing */ override fun toString(): String { - val lineList = arrayListOf("TileInfo @$position") + val lineList = arrayListOf("Tile @$position") if (!this::baseTerrain.isInitialized) return lineList[0] + ", uninitialized" if (isCityCenter()) lineList += getCity()!!.name lineList += baseTerrain diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt index 5bf86ca35b..08e28c436e 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt @@ -261,7 +261,7 @@ enum class UniqueParameterType( override fun getTranslationWriterStringsForOutput() = knownValues }, - /** Implemented by [TileInfo.matchesTerrainFilter][com.unciv.logic.map.TileInfo.matchesTerrainFilter] */ + /** Implemented by [Tile.matchesTerrainFilter][com.unciv.logic.map.tile.Tile.matchesTerrainFilter] */ TerrainFilter("terrainFilter", Constants.freshWaterFilter, null, "Terrain Filters") { private val knownValues = setOf("All", Constants.coastal, "River", "Open terrain", "Rough terrain", "Water resource", @@ -282,7 +282,7 @@ enum class UniqueParameterType( override fun getTranslationWriterStringsForOutput() = knownValues }, - /** Implemented by [TileInfo.matchesFilter][com.unciv.logic.map.TileInfo.matchesFilter] */ + /** Implemented by [Tile.matchesFilter][com.unciv.logic.map.tile.Tile.matchesFilter] */ TileFilter("tileFilter", "Farm", "Anything that can be used either in an improvementFilter or in a terrainFilter can be used here, plus 'unimproved'", "Tile Filters") { private val knownValues = setOf("unimproved", "All Road", "Great Improvement") override fun getErrorSeverity(parameterText: String, ruleset: Ruleset): diff --git a/core/src/com/unciv/ui/screens/mapeditorscreen/tabs/MapEditorViewTab.kt b/core/src/com/unciv/ui/screens/mapeditorscreen/tabs/MapEditorViewTab.kt index 50ab0b7041..aa0971ab75 100644 --- a/core/src/com/unciv/ui/screens/mapeditorscreen/tabs/MapEditorViewTab.kt +++ b/core/src/com/unciv/ui/screens/mapeditorscreen/tabs/MapEditorViewTab.kt @@ -48,7 +48,7 @@ class MapEditorViewTab( } private fun createMockCiv(ruleset: Ruleset) = Civilization().apply { - // This crappy construct exists only to allow us to call TileInfo.getTileStats + // This crappy construct exists only to allow us to call Tile.TileStatFunctions.getTileStats nation = Nation() nation.name = "Test" gameInfo = GameInfo()