Skip to content

Commit

Permalink
fix difficulty setting not always being updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Sesu8642 committed Oct 7, 2024
1 parent c2cc054 commit 117e753
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())));
}
Expand Down

0 comments on commit 117e753

Please sign in to comment.