4.8.9-patch2

This commit is contained in:
Yair Morgenstern 2023-10-01 16:04:04 +03:00
parent 43ff2ac1f5
commit 9386e4a7ce
6 changed files with 18 additions and 24 deletions

View File

@ -4,8 +4,8 @@ package com.unciv.build
object BuildConfig { object BuildConfig {
const val kotlinVersion = "1.8.21" const val kotlinVersion = "1.8.21"
const val appName = "Unciv" const val appName = "Unciv"
const val appCodeNumber = 918 const val appCodeNumber = 919
const val appVersion = "4.8.9-patch1" const val appVersion = "4.8.9-patch2"
const val gdxVersion = "1.11.0" const val gdxVersion = "1.11.0"
const val ktorVersion = "2.2.3" const val ktorVersion = "2.2.3"

View File

@ -536,7 +536,7 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci
companion object { companion object {
//region AUTOMATICALLY GENERATED VERSION DATA - DO NOT CHANGE THIS REGION, INCLUDING THIS COMMENT //region AUTOMATICALLY GENERATED VERSION DATA - DO NOT CHANGE THIS REGION, INCLUDING THIS COMMENT
val VERSION = Version("4.8.9-patch1", 918) val VERSION = Version("4.8.9-patch2", 919)
//endregion //endregion
lateinit var Current: UncivGame lateinit var Current: UncivGame

View File

@ -269,7 +269,7 @@ object UnitAutomation {
if (unit.hasUnique(UniqueType.MayFoundReligion) if (unit.hasUnique(UniqueType.MayFoundReligion)
&& unit.civ.religionManager.religionState < ReligionState.Religion && unit.civ.religionManager.religionState < ReligionState.Religion
&& unit.civ.religionManager.mayFoundReligionAtAll(unit) && unit.civ.religionManager.mayFoundReligionAtAll()
) )
return SpecificUnitAutomation.foundReligion(unit) return SpecificUnitAutomation.foundReligion(unit)

View File

@ -256,7 +256,7 @@ class ReligionManager : IsPartOfGameInfoSerialization {
} }
fun mayFoundReligionAtAll(prophet: MapUnit): Boolean { fun mayFoundReligionAtAll(): Boolean {
if (!civInfo.gameInfo.isReligionEnabled()) return false // No religion if (!civInfo.gameInfo.isReligionEnabled()) return false // No religion
if (religionState >= ReligionState.Religion) return false // Already created a major religion if (religionState >= ReligionState.Religion) return false // Already created a major religion
@ -269,7 +269,7 @@ class ReligionManager : IsPartOfGameInfoSerialization {
} }
fun mayFoundReligionNow(prophet: MapUnit): Boolean { fun mayFoundReligionNow(prophet: MapUnit): Boolean {
if (!mayFoundReligionAtAll(prophet)) return false if (!mayFoundReligionAtAll()) return false
if (!prophet.getTile().isCityCenter()) return false if (!prophet.getTile().isCityCenter()) return false
if (prophet.getTile().getCity()!!.isHolyCity()) return false if (prophet.getTile().getCity()!!.isHolyCity()) return false
// No double holy cities. Not sure if these were allowed in the base game // No double holy cities. Not sure if these were allowed in the base game
@ -445,7 +445,7 @@ class ReligionManager : IsPartOfGameInfoSerialization {
val religion = missionary.civ.gameInfo.religions[missionary.religion] ?: return false val religion = missionary.civ.gameInfo.religions[missionary.religion] ?: return false
if (religion.isPantheon()) return false if (religion.isPantheon()) return false
if (!missionary.canDoLimitedAction(Constants.spreadReligion) if (!missionary.canDoLimitedAction(Constants.spreadReligion)
&& UnitActionModifiers.getUsableUnitActionUniques(missionary, UniqueType.CanSpreadReligion).any()) return false && UnitActionModifiers.getUsableUnitActionUniques(missionary, UniqueType.CanSpreadReligion).none()) return false
return true return true
} }

View File

@ -16,7 +16,6 @@ import com.unciv.ui.components.input.onChange
import com.unciv.ui.screens.basescreen.BaseScreen import com.unciv.ui.screens.basescreen.BaseScreen
import com.unciv.ui.screens.victoryscreen.LoadMapPreview import com.unciv.ui.screens.victoryscreen.LoadMapPreview
import com.unciv.utils.Concurrency import com.unciv.utils.Concurrency
import io.ktor.util.collections.*
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import com.badlogic.gdx.utils.Array as GdxArray import com.badlogic.gdx.utils.Array as GdxArray
@ -35,7 +34,7 @@ class MapFileSelectTable(
private class MapWrapper(val fileHandle: FileHandle, val mapParameters: MapParameters) { private class MapWrapper(val fileHandle: FileHandle, val mapParameters: MapParameters) {
override fun toString(): String = mapParameters.baseRuleset + " | " + fileHandle.name() override fun toString(): String = mapParameters.baseRuleset + " | " + fileHandle.name()
} }
private val mapWrappers = ConcurrentSet<MapWrapper>() private val mapWrappers = ArrayList<MapWrapper>()
private val columnWidth = newGameScreen.getColumnWidth() private val columnWidth = newGameScreen.getColumnWidth()
@ -69,20 +68,15 @@ class MapFileSelectTable(
private fun addMapWrappersAsync(){ private fun addMapWrappersAsync(){
val mapFilesSequence = getMapFilesSequence() val mapFilesSequence = getMapFilesSequence()
// We only really need ONE map to be loaded to tell us "isNotEmpty" and "recentlySavedMapExists"
// The rest we can defer, so that users don't get ANRs when opening the new game screen
// because the game wants to load ALL the maps before first render
fun tryAddMapFile(mapFile: FileHandle){
val mapParameters = try {
MapSaver.loadMapParameters(mapFile)
} catch (_: Exception) {
return
}
mapWrappers.add(MapWrapper(mapFile, mapParameters))
}
Concurrency.run { Concurrency.run {
for (mapFile in mapFilesSequence) tryAddMapFile(mapFile) for (mapFile in mapFilesSequence) {
val mapParameters = try {
MapSaver.loadMapParameters(mapFile)
} catch (_: Exception) {
continue
}
mapWrappers.add(MapWrapper(mapFile, mapParameters))
}
Concurrency.runOnGLThread { fillMapFileSelectBox() } Concurrency.runOnGLThread { fillMapFileSelectBox() }
} }
} }
@ -102,7 +96,7 @@ class MapFileSelectTable(
fun isNotEmpty() = firstMap != null fun isNotEmpty() = firstMap != null
fun recentlySavedMapExists() = firstMap!=null && firstMap!!.lastModified() > System.currentTimeMillis() - 900000 fun recentlySavedMapExists() = firstMap!=null && firstMap!!.lastModified() > System.currentTimeMillis() - 900000
fun fillMapFileSelectBox() { private fun fillMapFileSelectBox() {
if (!mapFileSelectBox.items.isEmpty) return if (!mapFileSelectBox.items.isEmpty) return
val mapFiles = GdxArray<MapWrapper>() val mapFiles = GdxArray<MapWrapper>()

View File

@ -14,7 +14,7 @@ object UnitActionsReligion {
internal fun addFoundReligionAction(unit: MapUnit, actionList: ArrayList<UnitAction>) { internal fun addFoundReligionAction(unit: MapUnit, actionList: ArrayList<UnitAction>) {
if (!unit.civ.religionManager.mayFoundReligionAtAll(unit)) return if (!unit.civ.religionManager.mayFoundReligionAtAll()) return
val unique = UnitActionModifiers.getUsableUnitActionUniques(unit, UniqueType.MayFoundReligion) val unique = UnitActionModifiers.getUsableUnitActionUniques(unit, UniqueType.MayFoundReligion)
.firstOrNull() ?: return .firstOrNull() ?: return