diff --git a/core/src/com/unciv/ui/components/tilegroups/TileSetStrings.kt b/core/src/com/unciv/ui/components/tilegroups/TileSetStrings.kt index 006302bbbd..7710830a21 100644 --- a/core/src/com/unciv/ui/components/tilegroups/TileSetStrings.kt +++ b/core/src/com/unciv/ui/components/tilegroups/TileSetStrings.kt @@ -17,6 +17,8 @@ class TileSetStrings(tileSet: String = UncivGame.Current.settings.tileSet, unitS // this is so that when we have 100s of TileGroups, they won't all individually come up with all these strings themselves, // it gets pretty memory-intensive (10s of MBs which is a lot for lower-end phones) + val tileSetName = tileSet + val unitSetName = unitSet val tileSetLocation = "TileSets/$tileSet/" val unitSetLocation = "TileSets/$unitSet/" val tileSetConfig = TileSetCache[tileSet]?.config ?: TileSetConfig() diff --git a/core/src/com/unciv/ui/screens/mainmenuscreen/MainMenuScreen.kt b/core/src/com/unciv/ui/screens/mainmenuscreen/MainMenuScreen.kt index 1ba8340189..3e112e21b2 100644 --- a/core/src/com/unciv/ui/screens/mainmenuscreen/MainMenuScreen.kt +++ b/core/src/com/unciv/ui/screens/mainmenuscreen/MainMenuScreen.kt @@ -47,6 +47,7 @@ import com.unciv.ui.screens.newgamescreen.NewGameScreen import com.unciv.ui.screens.pickerscreens.ModManagementScreen import com.unciv.ui.screens.worldscreen.mainmenu.WorldScreenMenuPopup import com.unciv.ui.screens.mainmenuscreen.EasterEggRulesets.modifyForEasterEgg +import com.unciv.ui.screens.worldscreen.WorldScreen import com.unciv.utils.concurrency.Concurrency import com.unciv.utils.concurrency.launchOnGLThread import kotlin.math.min @@ -221,9 +222,18 @@ class MainMenuScreen: BaseScreen(), RecreateOnResize { private fun resumeGame() { if (GUI.isWorldLoaded()) { - GUI.resetToWorldScreen() - GUI.getWorldScreen().popups.filterIsInstance(WorldScreenMenuPopup::class.java).forEach(Popup::close) - ImageGetter.ruleset = game.gameInfo!!.ruleset + val currentTileSet = GUI.getMap().currentTileSetStrings + val currentGameSetting = GUI.getSettings() + if (currentTileSet.tileSetName != currentGameSetting.tileSet || + currentTileSet.unitSetName != currentGameSetting.unitSet) { + for (screen in game.screenStack.filterIsInstance()) screen.dispose() + game.screenStack.removeAll { it is WorldScreen } + QuickSave.autoLoadGame(this) + } else { + GUI.resetToWorldScreen() + GUI.getWorldScreen().popups.filterIsInstance(WorldScreenMenuPopup::class.java).forEach(Popup::close) + ImageGetter.ruleset = game.gameInfo!!.ruleset + } } else { QuickSave.autoLoadGame(this) } diff --git a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt index b11e9e0a38..b36037570e 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt @@ -69,6 +69,8 @@ class WorldMapHolder( private lateinit var tileGroupMap: TileGroupMap + lateinit var currentTileSetStrings: TileSetStrings + init { if (Gdx.app.type == Application.ApplicationType.Desktop) this.setFlingTime(0f) continuousScrollingX = tileMap.mapParameters.worldWrap @@ -109,6 +111,7 @@ class WorldMapHolder( internal fun addTiles() { val tileSetStrings = TileSetStrings() + currentTileSetStrings = tileSetStrings val tileGroupsNew = tileMap.values.map { WorldTileGroup(it, tileSetStrings) } tileGroupMap = TileGroupMap(this, tileGroupsNew, continuousScrollingX)