From e2c19696c908f9e3855b8c21dd3a2e958110bbd4 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 20 Oct 2019 10:48:16 +0300 Subject: [PATCH] Grassland ad Tundra are now also constants, completing the set --- .../NewGame,SaveGame,LoadGame,Options.json | 2 +- core/src/com/unciv/Constants.kt | 2 ++ .../logic/automation/WorkerAutomation.kt | 4 ++-- .../com/unciv/logic/map/RandomMapGenerator.kt | 21 +++++++++---------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json b/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json index 2a4e60b75e..5dd093fbbd 100644 --- a/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json +++ b/android/assets/jsons/Translations/NewGame,SaveGame,LoadGame,Options.json @@ -776,7 +776,7 @@ German: "Untätige Einheiten anzeigen bei Rundenende" French:"Vérifier les unités inactives" Russian:"Найти незанятые юниты" - Korean:"턴이 끝나기 전에 미행동 유닛 보기 + Korean:"턴이 끝나기 전에 미행동 유닛 보기" } "Move units with a single tap":{ diff --git a/core/src/com/unciv/Constants.kt b/core/src/com/unciv/Constants.kt index 883c53090d..82bc1ee2d2 100644 --- a/core/src/com/unciv/Constants.kt +++ b/core/src/com/unciv/Constants.kt @@ -14,6 +14,8 @@ class Constants{ const val plains = "Plains" const val lakes = "Lakes" const val desert = "Desert" + const val grassland = "Grassland" + const val tundra = "Tundra" const val barbarianEncampment = "Barbarian encampment" diff --git a/core/src/com/unciv/logic/automation/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/WorkerAutomation.kt index d0761e7ef8..a3ed3fd258 100644 --- a/core/src/com/unciv/logic/automation/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/WorkerAutomation.kt @@ -188,8 +188,8 @@ class WorkerAutomation(val unit: MapUnit) { tile.terrainFeature == "Marsh" -> "Remove Marsh" tile.terrainFeature == Constants.forest -> "Lumber mill" tile.baseTerrain == Constants.hill -> "Mine" - tile.baseTerrain in listOf("Grassland",Constants.desert,Constants.plains) -> "Farm" - tile.baseTerrain == "Tundra" -> "Trading post" + tile.baseTerrain in listOf(Constants.grassland,Constants.desert,Constants.plains) -> "Farm" + tile.baseTerrain == Constants.tundra -> "Trading post" else -> throw Exception("No improvement found for "+tile.baseTerrain) } if (improvementString == null) return null diff --git a/core/src/com/unciv/logic/map/RandomMapGenerator.kt b/core/src/com/unciv/logic/map/RandomMapGenerator.kt index 7ad25e3dfe..a24c2399b3 100644 --- a/core/src/com/unciv/logic/map/RandomMapGenerator.kt +++ b/core/src/com/unciv/logic/map/RandomMapGenerator.kt @@ -200,15 +200,15 @@ class CelluarAutomataRandomMapGenerator(): SeedRandomMapGenerator() { //change grassland to desert or tundra based on y if (abs(getLatitude(tile.position)) < maxLatitude * 0.1) { - if (terrain == "Grassland" || terrain == "Tundra") + if (terrain == Constants.grassland || terrain == Constants.tundra) terrain = Constants.desert } else if (abs(getLatitude(tile.position)) > maxLatitude * 0.7) { - if (terrain == "Grassland" || terrain == Constants.plains || terrain == Constants.desert || terrain == Constants.ocean) { - terrain = "Tundra" + if (terrain == Constants.grassland || terrain == Constants.plains || terrain == Constants.desert || terrain == Constants.ocean) { + terrain = Constants.tundra } } else { - if (terrain == "Tundra") terrain = Constants.plains - else if (terrain == Constants.desert) terrain = "Grassland" + if (terrain == Constants.tundra) terrain = Constants.plains + else if (terrain == Constants.desert) terrain = Constants.grassland } val area = Area(terrain) @@ -282,10 +282,9 @@ class AlexanderRandomMapGenerator:RandomMapGenerator(){ map[vector] = null val sparkList = ArrayList() - val grassland = "Grassland" for(i in 0..distance*distance/6){ val location = map.filter { it.value==null }.map { it.key }.random() - map[location] = TileInfo().apply { baseTerrain= grassland} + map[location] = TileInfo().apply { baseTerrain= Constants.grassland} sparkList.add(location) } @@ -293,9 +292,9 @@ class AlexanderRandomMapGenerator:RandomMapGenerator(){ val currentSpark = sparkList.random() val emptyTilesAroundSpark = HexMath().getAdjacentVectors(currentSpark) .filter { map.containsKey(it) && map[it]==null } - if(map[currentSpark]!!.baseTerrain==grassland){ + if(map[currentSpark]!!.baseTerrain==Constants.grassland){ for(tile in emptyTilesAroundSpark){ - if(Math.random()