Resolved #694, and another crashing bug

This commit is contained in:
Yair Morgenstern 2019-05-02 23:06:34 +03:00
parent 628463cc54
commit 827d24c778
5 changed files with 18 additions and 6 deletions

View File

@ -21,7 +21,7 @@ android {
applicationId "com.unciv.app" applicationId "com.unciv.app"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 28 targetSdkVersion 28
versionCode 234 versionCode 236
versionName "2.16.0" versionName "2.16.0"
} }

View File

@ -57,7 +57,7 @@ class NextTurnAutomation{
} }
val otherCivList = civInfo.getKnownCivs() val otherCivList = civInfo.getKnownCivs()
.filter { it.playerType == PlayerType.AI && !it.isBarbarianCivilization() } .filter { it.playerType == PlayerType.AI && it.isMajorCiv() }
.sortedBy { it.tech.techsResearched.size } .sortedBy { it.tech.techsResearched.size }
for (otherCiv in otherCivList) { for (otherCiv in otherCivList) {

View File

@ -19,6 +19,7 @@ class CityInfo {
@Transient var isConnectedToCapital = false @Transient var isConnectedToCapital = false
@Transient lateinit var ccenterTile:TileInfo // cached for better performance @Transient lateinit var ccenterTile:TileInfo // cached for better performance
@Transient val range = 2 @Transient val range = 2
@Transient lateinit var tileMap: TileMap
var location: Vector2 = Vector2.Zero var location: Vector2 = Vector2.Zero
var name: String = "" var name: String = ""
@ -96,8 +97,7 @@ class CityInfo {
return toReturn return toReturn
} }
internal val tileMap: TileMap
get() = civInfo.gameInfo.tileMap
fun getCenterTile(): TileInfo = ccenterTile fun getCenterTile(): TileInfo = ccenterTile
fun getTiles(): List<TileInfo> = tiles.map { tileMap[it] } fun getTiles(): List<TileInfo> = tiles.map { tileMap[it] }
@ -183,6 +183,7 @@ class CityInfo {
//region state-changing functions //region state-changing functions
fun setTransients() { fun setTransients() {
tileMap = civInfo.gameInfo.tileMap
ccenterTile = tileMap[location] ccenterTile = tileMap[location]
population.cityInfo = this population.cityInfo = this
expansion.cityInfo = this expansion.cityInfo = this

View File

@ -98,7 +98,8 @@ class CivilizationInfo {
toReturn.goldenAges = goldenAges.clone() toReturn.goldenAges = goldenAges.clone()
toReturn.greatPeople = greatPeople.clone() toReturn.greatPeople = greatPeople.clone()
toReturn.victoryManager = victoryManager.clone() toReturn.victoryManager = victoryManager.clone()
toReturn.diplomacy.putAll(diplomacy) for(diplomacyManager in diplomacy.values.map { it.clone() })
toReturn.diplomacy.put(diplomacyManager.otherCivName, diplomacyManager)
toReturn.cities = cities.map { it.clone() } toReturn.cities = cities.map { it.clone() }
toReturn.exploredTiles.addAll(exploredTiles) toReturn.exploredTiles.addAll(exploredTiles)
toReturn.notifications.addAll(notifications) toReturn.notifications.addAll(notifications)

View File

@ -7,4 +7,14 @@ enum class AlertType{
CityConquered CityConquered
} }
class PopupAlert (val type:AlertType, val value:String) class PopupAlert {
lateinit var type: AlertType
lateinit var value: String
constructor(type: AlertType, value: String) {
this.type = type
this.value = value
}
constructor() // for json serialization
}