diff --git a/buildSrc/src/main/kotlin/BuildConfig.kt b/buildSrc/src/main/kotlin/BuildConfig.kt index f97359e139..f07796c6e8 100644 --- a/buildSrc/src/main/kotlin/BuildConfig.kt +++ b/buildSrc/src/main/kotlin/BuildConfig.kt @@ -4,8 +4,8 @@ package com.unciv.build object BuildConfig { const val kotlinVersion = "1.8.21" const val appName = "Unciv" - const val appCodeNumber = 918 - const val appVersion = "4.8.9-patch1" + const val appCodeNumber = 919 + const val appVersion = "4.8.9-patch2" const val gdxVersion = "1.11.0" const val ktorVersion = "2.2.3" diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index e88415fb2d..d4dc76f795 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -536,7 +536,7 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci companion object { //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 lateinit var Current: UncivGame diff --git a/core/src/com/unciv/logic/automation/unit/UnitAutomation.kt b/core/src/com/unciv/logic/automation/unit/UnitAutomation.kt index f863bb2bb2..977d1fff38 100644 --- a/core/src/com/unciv/logic/automation/unit/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/unit/UnitAutomation.kt @@ -269,7 +269,7 @@ object UnitAutomation { if (unit.hasUnique(UniqueType.MayFoundReligion) && unit.civ.religionManager.religionState < ReligionState.Religion - && unit.civ.religionManager.mayFoundReligionAtAll(unit) + && unit.civ.religionManager.mayFoundReligionAtAll() ) return SpecificUnitAutomation.foundReligion(unit) diff --git a/core/src/com/unciv/logic/civilization/managers/ReligionManager.kt b/core/src/com/unciv/logic/civilization/managers/ReligionManager.kt index 9bad600483..929c591216 100644 --- a/core/src/com/unciv/logic/civilization/managers/ReligionManager.kt +++ b/core/src/com/unciv/logic/civilization/managers/ReligionManager.kt @@ -256,7 +256,7 @@ class ReligionManager : IsPartOfGameInfoSerialization { } - fun mayFoundReligionAtAll(prophet: MapUnit): Boolean { + fun mayFoundReligionAtAll(): Boolean { if (!civInfo.gameInfo.isReligionEnabled()) return false // No religion if (religionState >= ReligionState.Religion) return false // Already created a major religion @@ -269,7 +269,7 @@ class ReligionManager : IsPartOfGameInfoSerialization { } fun mayFoundReligionNow(prophet: MapUnit): Boolean { - if (!mayFoundReligionAtAll(prophet)) return false + if (!mayFoundReligionAtAll()) return false if (!prophet.getTile().isCityCenter()) return false if (prophet.getTile().getCity()!!.isHolyCity()) return false // 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 if (religion.isPantheon()) return false if (!missionary.canDoLimitedAction(Constants.spreadReligion) - && UnitActionModifiers.getUsableUnitActionUniques(missionary, UniqueType.CanSpreadReligion).any()) return false + && UnitActionModifiers.getUsableUnitActionUniques(missionary, UniqueType.CanSpreadReligion).none()) return false return true } diff --git a/core/src/com/unciv/ui/screens/newgamescreen/MapFileSelectTable.kt b/core/src/com/unciv/ui/screens/newgamescreen/MapFileSelectTable.kt index 6ce6b34ee1..93ded075f9 100644 --- a/core/src/com/unciv/ui/screens/newgamescreen/MapFileSelectTable.kt +++ b/core/src/com/unciv/ui/screens/newgamescreen/MapFileSelectTable.kt @@ -16,7 +16,6 @@ import com.unciv.ui.components.input.onChange import com.unciv.ui.screens.basescreen.BaseScreen import com.unciv.ui.screens.victoryscreen.LoadMapPreview import com.unciv.utils.Concurrency -import io.ktor.util.collections.* import kotlinx.coroutines.Job import kotlinx.coroutines.isActive import com.badlogic.gdx.utils.Array as GdxArray @@ -35,7 +34,7 @@ class MapFileSelectTable( private class MapWrapper(val fileHandle: FileHandle, val mapParameters: MapParameters) { override fun toString(): String = mapParameters.baseRuleset + " | " + fileHandle.name() } - private val mapWrappers = ConcurrentSet() + private val mapWrappers = ArrayList() private val columnWidth = newGameScreen.getColumnWidth() @@ -69,20 +68,15 @@ class MapFileSelectTable( private fun addMapWrappersAsync(){ 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 { - 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() } } } @@ -102,7 +96,7 @@ class MapFileSelectTable( fun isNotEmpty() = firstMap != null fun recentlySavedMapExists() = firstMap!=null && firstMap!!.lastModified() > System.currentTimeMillis() - 900000 - fun fillMapFileSelectBox() { + private fun fillMapFileSelectBox() { if (!mapFileSelectBox.items.isEmpty) return val mapFiles = GdxArray() diff --git a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsReligion.kt b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsReligion.kt index 3e5c793e3c..3796ffd1f1 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsReligion.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsReligion.kt @@ -14,7 +14,7 @@ object UnitActionsReligion { internal fun addFoundReligionAction(unit: MapUnit, actionList: ArrayList) { - if (!unit.civ.religionManager.mayFoundReligionAtAll(unit)) return + if (!unit.civ.religionManager.mayFoundReligionAtAll()) return val unique = UnitActionModifiers.getUsableUnitActionUniques(unit, UniqueType.MayFoundReligion) .firstOrNull() ?: return