mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-10 02:42:04 +00:00
Faction Select: open to any previously selected leader
This commit is contained in:
parent
b2e6bd5bdc
commit
4ffd212c91
@ -108,6 +108,8 @@ void tfaction_select::pre_show(twindow& window)
|
||||
list.add_row(data);
|
||||
}
|
||||
|
||||
list.select_row(flg_manager_.current_faction_index());
|
||||
|
||||
on_faction_select(window);
|
||||
}
|
||||
|
||||
@ -119,6 +121,10 @@ void tfaction_select::on_faction_select(twindow& window)
|
||||
return;
|
||||
}
|
||||
|
||||
// Since set_current_faction overrides the current leader, save a copy of the previous leader index so the
|
||||
// leader dropdown can be set to the appropriate initial selection.
|
||||
const int previous_leader_selection = flg_manager_.current_leader_index();
|
||||
|
||||
flg_manager_.set_current_faction(selected_row);
|
||||
|
||||
std::vector<config> leaders;
|
||||
@ -140,7 +146,7 @@ void tfaction_select::on_faction_select(twindow& window)
|
||||
|
||||
tmenu_button& leader_dropdown = find_widget<tmenu_button>(&window, "leader_menu", false);
|
||||
|
||||
leader_dropdown.set_values(leaders, flg_manager_.current_leader_index());
|
||||
leader_dropdown.set_values(leaders, previous_leader_selection);
|
||||
leader_dropdown.set_active(leaders.size() > 1 && !flg_manager_.is_saved_game());
|
||||
|
||||
on_leader_select(window);
|
||||
|
Loading…
x
Reference in New Issue
Block a user