Skip to content

Commit

Permalink
Fixed difficulty selection popping up multiple times when loading a g…
Browse files Browse the repository at this point in the history
…ame (fixes #5392)

The first issue was difficulty_dialog::show being called twice. The second issue was that show_difficulty_dialog
was called from both load_game_ingame and load_game. The latter is called after the former (this should probably
be refactored), so if you selected Change Difficulty when loading from within a game, the dialog prompt would be
shown when both functions were called. Fixed this by toggling off the show_difficulty flag once a difficulty had
been selected.
  • Loading branch information
Vultraz committed Jan 16, 2021
1 parent f69aa28 commit bf153a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -22,6 +22,7 @@
* New `[set_variable]` options: reverse=yes, min=list, max=list
### Miscellaneous and Bug Fixes
* Fixed `[terrain_defaults]` and `[resistance_defaults]` (issue #5308).
* Fixed being prompted multiple times to select campaign difficulty when loading a game (issue #5392)

## Version 1.15.8
### Add-ons client
Expand Down
2 changes: 1 addition & 1 deletion src/savegame.cpp
Expand Up @@ -101,14 +101,14 @@ bool loadgame::show_difficulty_dialog()
}

gui2::dialogs::campaign_difficulty difficulty_dlg(campaign);
difficulty_dlg.show();

// Return if canceled, since otherwise load_data_.difficulty will be set to 'CANCEL'
if(!difficulty_dlg.show()) {
return false;
}

load_data_.difficulty = difficulty_dlg.selected_difficulty();
load_data_.select_difficulty = false;

// Exit loop
break;
Expand Down

0 comments on commit bf153a1

Please sign in to comment.