From efe200442a86f372bd9ffce0c55318d8d9980840 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 14 Feb 2020 13:15:30 +0200 Subject: [PATCH] Resolved #1927- changing new game parameters and exiting the new game screen doesn't change the current game's parameters --- .../com/unciv/models/metadata/GameParameters.kt | 15 +++++++++++++++ .../com/unciv/ui/newgamescreen/NewGameScreen.kt | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/models/metadata/GameParameters.kt b/core/src/com/unciv/models/metadata/GameParameters.kt index 69e1217e3b..f41f3268cf 100644 --- a/core/src/com/unciv/models/metadata/GameParameters.kt +++ b/core/src/com/unciv/models/metadata/GameParameters.kt @@ -21,4 +21,19 @@ class GameParameters { // Default values are the default new game var isOnlineMultiplayer = false var mods = HashSet() + + fun clone(): GameParameters { + val parameters=GameParameters() + parameters.difficulty=difficulty + parameters.gameSpeed=gameSpeed + parameters.players= ArrayList(players) + parameters.numberOfCityStates=numberOfCityStates + parameters.noBarbarians=noBarbarians + parameters.oneCityChallenge=oneCityChallenge + parameters.victoryTypes= ArrayList(victoryTypes) + parameters.startingEra=startingEra + parameters.isOnlineMultiplayer=isOnlineMultiplayer + parameters.mods= HashSet(mods) + return parameters + } } \ No newline at end of file diff --git a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt index 21d91ef336..a463367774 100644 --- a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt +++ b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt @@ -13,17 +13,17 @@ import com.unciv.logic.civilization.PlayerType import com.unciv.models.ruleset.RulesetCache import com.unciv.models.translations.tr import com.unciv.ui.pickerscreens.PickerScreen +import com.unciv.ui.utils.Popup import com.unciv.ui.utils.disable import com.unciv.ui.utils.enable import com.unciv.ui.utils.onClick import com.unciv.ui.worldscreen.mainmenu.OnlineMultiplayer -import com.unciv.ui.utils.Popup import java.util.* import kotlin.concurrent.thread class NewGameScreen: PickerScreen(){ - val newGameParameters= UncivGame.Current.gameInfo.gameParameters + val newGameParameters= UncivGame.Current.gameInfo.gameParameters.clone() val mapParameters = UncivGame.Current.gameInfo.tileMap.mapParameters val ruleset = RulesetCache.getComplexRuleset(newGameParameters.mods)