From 117e7535d28a83d6474cff2b6f0b301fae0881cb Mon Sep 17 00:00:00 2001 From: Sesu8642 <45859254+Sesu8642@users.noreply.github.com> Date: Mon, 7 Oct 2024 23:41:43 +0200 Subject: [PATCH] fix difficulty setting not always being updated --- .../sesu8642/feudaltactics/ingame/ui/IngameScreen.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/de/sesu8642/feudaltactics/ingame/ui/IngameScreen.java b/core/src/main/java/de/sesu8642/feudaltactics/ingame/ui/IngameScreen.java index 3948356..c611e79 100644 --- a/core/src/main/java/de/sesu8642/feudaltactics/ingame/ui/IngameScreen.java +++ b/core/src/main/java/de/sesu8642/feudaltactics/ingame/ui/IngameScreen.java @@ -509,19 +509,23 @@ private void addParameterInputListeners() { Stream.of(parameterInputStage.seedTextField, parameterInputStage.randomButton, parameterInputStage.sizeSelect, parameterInputStage.densitySelect, parameterInputStage.startingPositionSelect, - parameterInputStage.pasteButton) + parameterInputStage.pasteButton, parameterInputStage.difficultySelect) .forEach(actor -> actor.addListener(new ExceptionLoggingChangeListener(() -> { eventBus.post(new RegenerateMapEvent(parameterInputStage.getBotIntelligence(), new MapParameters(parameterInputStage.getStartingPosition(), parameterInputStage.getSeedParam(), parameterInputStage.getMapSizeParam().getAmountOfTiles(), parameterInputStage.getMapDensityParam().getDensityFloat()))); - centerMap(); newGamePrefDao.saveNewGamePreferences(new NewGamePreferences( parameterInputStage.getBotIntelligence(), parameterInputStage.getMapSizeParam(), parameterInputStage.getMapDensityParam(), parameterInputStage.getStartingPosition())); }))); - + // only the settings that visually change the map need to cause centering + Stream.of(parameterInputStage.seedTextField, parameterInputStage.randomButton, parameterInputStage.sizeSelect, + parameterInputStage.densitySelect, parameterInputStage.pasteButton) + .forEach(actor -> actor.addListener(new ExceptionLoggingChangeListener(() -> { + centerMap(); + }))); parameterInputStage.playButton .addListener(new ExceptionLoggingChangeListener(() -> eventBus.post(new GameStartEvent()))); }