Skip to content

Commit

Permalink
Statistics Dialog: keep the same stat selected between scenario selec…
Browse files Browse the repository at this point in the history
…tions

Fixes #3223, closes #3226.
  • Loading branch information
Vultraz committed Jun 10, 2018
1 parent 802443e commit f1d2f85
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/gui/dialogs/statistics_dialog.cpp
Expand Up @@ -168,6 +168,7 @@ void statistics_dialog::update_lists(window& window)
// Update primary stats list
//
listbox& stat_list = find_widget<listbox>(&window, "stats_list_main", false);
const int last_selected_stat_row = stat_list.get_selected_row();

stat_list.clear();
main_stat_table_.clear();
Expand All @@ -180,6 +181,11 @@ void statistics_dialog::update_lists(window& window)
add_stat_row(window, _("Losses"), stats.deaths);
add_stat_row(window, _("Kills"), stats.killed);

// Reselect previously selected row. Do this *before* calling on_primary_list_select.
if(last_selected_stat_row != -1) {
stat_list.select_row(last_selected_stat_row);
}

// Update unit count list
on_primary_list_select(window);

Expand Down

0 comments on commit f1d2f85

Please sign in to comment.