mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Comments only - TileInfo to Tile (#8861)
(the two in UniqueParameterType are actually useful links during code review)
This commit is contained in:
parent
3826a4b7c3
commit
2f00aa2af1
@ -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
|
||||
|
@ -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())
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user