Natural wonders spawned before rivers, so we don't retroactively get rivers on coast tiles

Other small improvements for catching and avoiding crashes
This commit is contained in:
Yair Morgenstern 2020-06-03 18:44:03 +03:00
parent bb9404152f
commit 3e31be1801
7 changed files with 9 additions and 5 deletions

View file

@ -10,7 +10,7 @@
// Civilopedia only, because players said this was too wall-of-text
New_Game: [
"Your first mission is to found your capital city.\nThis is actually an important task because your capital city will probably be your most prosperous.\nMany game bonuses apply only to your capital city and it will probably be the center of your empire.",
"How do you know a spot is appropriate?\nThats not an easy question to answer, but looking for and building next to luxury resources is a good rule of thumb.\nLuxury resources are tiles that have things like gems, cotton, or silk (indicated by a smiley next to the resource icon)\nThese resources make your civilization happy. You should also keep an eye out for resources needed to build units, such as iron." ,
"How do you know a spot is appropriate?\nThats not an easy question to answer, but looking for and building next to luxury resources is a good rule of thumb.\nLuxury resources are tiles that have things like gems, cotton, or silk (indicated by a smiley next to the resource icon)\nThese resources make your civilization happy. You should also keep an eye out for resources needed to build units, such as iron. Cities cannot be built within 3 tiles of existing cities, which is another thing to watch out for!",
"However, cities dont have a set area that they can work - more on that later!\nThis means you dont have to settle cities right next to resources.\nLets say, for example, that you want access to some iron but the resource is right next to a desert.\nYou dont have to settle your city next to the desert. You can settle a few tiles away in more prosperous lands.\nYour city will grow and eventually gain access to the resource.\nYou only need to settle right next to resources if you need them immediately \n which might be the case now and then, but youll usually have the luxury of time." ,
"The first thing coming out of your city should be either a Scout or Warrior.\nI generally prefer the Warrior because it can be used for defense and because it can be upgraded\n to the Swordsman unit later in the game for a relatively modest sum of gold.\nScouts can be effective, however, if you seem to be located in an area of dense forest and hills.\nScouts dont suffer a movement penalty in this terrain.\nIf youre a veteran of the 4x strategy genre your first Warrior or Scout will be followed by a Settler.\nFast expanding is absolutely critical in most games of this type."
],

View file

@ -18,7 +18,8 @@ class AndroidLauncher : AndroidApplication() {
// Only allow mods on KK+, to avoid READ_EXTERNAL_STORAGE permission earlier versions need
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
copyMods()
GameSaver.externalFilesDirForAndroid = getExternalFilesDir(null)!!.path
val externalfilesDir = getExternalFilesDir(null)
if(externalfilesDir!=null) GameSaver.externalFilesDirForAndroid = externalfilesDir.path
}
val config = AndroidApplicationConfiguration().apply { useImmersiveMode = true }

View file

@ -343,6 +343,7 @@ open class TileInfo {
/** The two tiles have a river between them */
fun isConnectedByRiver(otherTile:TileInfo): Boolean {
if(otherTile==this) throw Exception("Should not be called to compare to self!")
val xDifference = this.position.x - otherTile.position.x
val yDifference = this.position.y - otherTile.position.y

View file

@ -44,10 +44,10 @@ class MapGenerator(val ruleset: Ruleset) {
spawnVegetation(map)
spawnRareFeatures(map)
spawnIce(map)
NaturalWonderGenerator(ruleset).spawnNaturalWonders(map, randomness)
RiverGenerator(randomness).spawnRivers(map)
spreadResources(map)
spreadAncientRuins(map)
NaturalWonderGenerator(ruleset).spawnNaturalWonders(map, randomness)
return map
}

View file

@ -50,7 +50,7 @@ class RiverGenerator(val randomness: MapGenerationRandomness){
RiverCoordinate.BottomRightOrLeft.values().random(randomness.RNG))
while(getAdjacentTiles(riverCoordinate,map).none { it.isWater }){
while(getAdjacentTiles(riverCoordinate, map).none { it.isWater }){
val possibleCoordinates = riverCoordinate.getAdjacentPositions()
.filter { map.contains(it.position) }
if(possibleCoordinates.none()) return // end of the line

View file

@ -32,6 +32,8 @@ enum class Tutorial(val value: String, val isCivilopedia: Boolean = !value.start
CityStates("City-States"),
NaturalWonders("Natural_Wonders"),
CityExpansion("City_Expansion"),
GreatPeople("Great_People"),
RemovingTerrainFeatures("Removing_Terrain_Features")
;
companion object {

View file

@ -32,7 +32,7 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table() {
unitAction.startsWith("Create ") -> {
// Regexplaination: start with a [, take as many non-] chars as you can, until you reach a ].
// What you find between the first [ and the first ] that comes after it, will be group no. 1
val improvementName = Regex("""Create \[([^]]*)]""").find(unitAction)!!.groups[1]!!.value
val improvementName = Regex("""Create \[([^]]*)\]""").find(unitAction)!!.groups[1]!!.value
return UnitIconAndKey(ImageGetter.getImprovementIcon(improvementName), 'i')
}
unitAction.startsWith("Sleep") -> return UnitIconAndKey(ImageGetter.getImage("OtherIcons/Sleep"), 'f')