gameSetupInfo in newGameScreen is now val

This commit is contained in:
Yair Morgenstern
2024-04-24 00:21:16 +03:00
parent 2bee2d6368
commit 80505a1a63

View File

@ -41,9 +41,9 @@ import com.unciv.ui.screens.pickerscreens.PickerScreen
import com.unciv.utils.Concurrency import com.unciv.utils.Concurrency
import com.unciv.utils.Log import com.unciv.utils.Log
import com.unciv.utils.launchOnGLThread import com.unciv.utils.launchOnGLThread
import kotlinx.coroutines.coroutineScope
import java.net.URL import java.net.URL
import java.util.UUID import java.util.UUID
import kotlinx.coroutines.coroutineScope
import kotlin.math.floor import kotlin.math.floor
import com.unciv.ui.components.widgets.AutoScrollPane as ScrollPane import com.unciv.ui.components.widgets.AutoScrollPane as ScrollPane
@ -52,7 +52,7 @@ class NewGameScreen(
isReset: Boolean = false isReset: Boolean = false
): IPreviousScreen, PickerScreen(), RecreateOnResize { ): IPreviousScreen, PickerScreen(), RecreateOnResize {
override var gameSetupInfo = defaultGameSetupInfo ?: GameSetupInfo.fromSettings() override val gameSetupInfo = defaultGameSetupInfo ?: GameSetupInfo.fromSettings()
override val ruleset = Ruleset() // updateRuleset will clear and add override val ruleset = Ruleset() // updateRuleset will clear and add
private val newGameOptionsTable: GameOptionsTable private val newGameOptionsTable: GameOptionsTable
internal val playerPickerTable: PlayerPickerTable internal val playerPickerTable: PlayerPickerTable
@ -368,8 +368,9 @@ class NewGameScreen(
var success = true var success = true
fun handleFailure(message: String): Ruleset { fun handleFailure(message: String): Ruleset {
success = false success = false
gameSetupInfo = GameSetupInfo()
ToastPopup(message, this, 5000) ToastPopup(message, this, 5000)
gameSetupInfo.gameParameters.mods.clear()
gameSetupInfo.gameParameters.baseRuleset = BaseRuleset.Civ_V_GnK.fullName
return RulesetCache[BaseRuleset.Civ_V_GnK.fullName]!! return RulesetCache[BaseRuleset.Civ_V_GnK.fullName]!!
} }