diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 8ee84b926f..8a66d7afff 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -118,9 +118,9 @@ class UncivGame(parameters: UncivGameParameters) : Game() { fun loadGame(gameInfo: GameInfo) { this.gameInfo = gameInfo ImageGetter.ruleset = gameInfo.ruleSet + ImageGetter.reload() Gdx.input.inputProcessor = null // Since we will set the world screen when we're ready, // This is to avoid ANRs when loading. - //ImageGetter.refreshAtlas() worldScreen = WorldScreen(gameInfo.getPlayerToViewAs()) setWorldScreen() } diff --git a/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt b/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt index dc1ce64f52..3ccff35a3d 100644 --- a/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt @@ -174,7 +174,7 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick ruleset.modOptions = newRuleset.modOptions ImageGetter.ruleset = ruleset - ImageGetter.setTextureRegionDrawables() + ImageGetter.reload() } fun Table.addModCheckboxes() { diff --git a/core/src/com/unciv/ui/utils/ImageGetter.kt b/core/src/com/unciv/ui/utils/ImageGetter.kt index 1ebc27307b..135b91c930 100644 --- a/core/src/com/unciv/ui/utils/ImageGetter.kt +++ b/core/src/com/unciv/ui/utils/ImageGetter.kt @@ -36,17 +36,17 @@ object ImageGetter { val textureRegionDrawables = HashMap() init{ - setTextureRegionDrawables() + reload() } fun setNewRuleset(ruleset: Ruleset) { if (this.ruleset == ruleset) return this.ruleset = ruleset - setTextureRegionDrawables() + reload() } - - fun setTextureRegionDrawables(){ + /** Required every time the ruleset changes, in order to load mod-specific images */ + fun reload(){ textureRegionDrawables.clear() // These are the drawables from the base game for(region in atlas.regions){