From aee34de2f47ceb08ef4f8cae20be518342828524 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Mon, 8 Jul 2024 17:00:30 +0300 Subject: [PATCH] Resolved #10375 - ALWAYS reload images when loading There were cases where the images would be changed out (in new game screen / mod screen) which led to reloading the same game causing missing images --- core/src/com/unciv/UncivGame.kt | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 5018842c1a..1a415a0c18 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -193,7 +193,7 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci throw UncivShowableException("You are not allowed to spectate!") } - initializeResources(prevGameInfo, newGameInfo) + initializeResources(newGameInfo) val isLoadingSameGame = worldScreen != null && prevGameInfo != null && prevGameInfo.gameId == newGameInfo.gameId val worldScreenRestoreState = if (!callFromLoadScreen && isLoadingSameGame) worldScreen!!.getRestoreState() else null @@ -232,16 +232,12 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci } /** The new game info may have different mods or rulesets, which may use different resources that need to be loaded. */ - private suspend fun initializeResources(prevGameInfo: GameInfo?, newGameInfo: GameInfo) { - if (prevGameInfo == null - || prevGameInfo.gameParameters.baseRuleset != newGameInfo.gameParameters.baseRuleset - || prevGameInfo.gameParameters.mods != newGameInfo.gameParameters.mods) { - withGLContext { - ImageGetter.setNewRuleset(newGameInfo.ruleset) - } - val fullModList = newGameInfo.gameParameters.getModsAndBaseRuleset() - musicController.setModList(fullModList) + private suspend fun initializeResources(newGameInfo: GameInfo) { + withGLContext { + ImageGetter.setNewRuleset(newGameInfo.ruleset) } + val fullModList = newGameInfo.gameParameters.getModsAndBaseRuleset() + musicController.setModList(fullModList) } /** Re-creates the current [worldScreen], if there is any. */