Skip to content

Commit 9a5013a

Browse files
committed
ui: top menu options handlers simplified and moved to one function
1 parent c14bb7f commit 9a5013a

File tree

1 file changed

+23
-35
lines changed

1 file changed

+23
-35
lines changed

src/widget/widget_top_menu_game.cpp

+23-35
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static void menu_file_replay_map(int param) {
555555
});
556556
}
557557

558-
static void top_menu_file_handle(menu_item &item) {
558+
void top_menu_file_handle(menu_item &item) {
559559
if (item.id == "new_game") { menu_file_new_game(0); }
560560
else if (item.id == "replay_map") { menu_file_replay_map(0); }
561561
else if (item.id == "load_game") { menu_file_load_game(0); }
@@ -564,45 +564,33 @@ static void top_menu_file_handle(menu_item &item) {
564564
else if (item.id == "exit_game") { menu_file_exit_city(0); }
565565
}
566566

567-
static void menu_options_sound(int param) {
568-
widget_top_menu_clear_state();
569-
window_sound_options_show(window_city_show);
570-
}
571-
572-
static void menu_options_speed(int param) {
573-
widget_top_menu_clear_state();
574-
window_speed_options_show(window_city_show);
575-
}
576-
577-
static void menu_options_difficulty(int param) {
578-
widget_top_menu_clear_state();
579-
window_difficulty_options_show(window_city_show);
580-
}
581-
582-
static void menu_options_autosave(int param) {
583-
g_settings.toggle_monthly_autosave();
584-
set_text_for_autosave();
585-
}
586-
587-
static void menu_options_change_enh(int param) {
588-
window_config_show([] {});
589-
}
590-
591-
static void menu_options_hotkeys(int param) {
592-
window_hotkey_config_show([] {});
593-
}
594-
595567
void top_menu_widget::options_handle(menu_item &item) {
596568
if (item.id == "display_options") {
597569
widget_top_menu_clear_state();
598570
ui::display_options_window::show(window_city_show);
599571
}
600-
else if (item.id == "sound_options") { menu_options_sound(0); }
601-
else if (item.id == "speed_options") { menu_options_speed(0); }
602-
else if (item.id == "difficulty_options") { menu_options_difficulty(0); }
603-
else if (item.id == "autosave_options") { menu_options_autosave(0); }
604-
else if (item.id == "hotkeys_options") { menu_options_hotkeys(0); }
605-
else if (item.id == "enhanced_options") { menu_options_change_enh(0); }
572+
else if (item.id == "sound_options") {
573+
widget_top_menu_clear_state();
574+
window_sound_options_show(window_city_show);
575+
}
576+
else if (item.id == "speed_options") {
577+
widget_top_menu_clear_state();
578+
window_speed_options_show(window_city_show);
579+
}
580+
else if (item.id == "difficulty_options") {
581+
widget_top_menu_clear_state();
582+
window_difficulty_options_show(window_city_show);
583+
}
584+
else if (item.id == "autosave_options") {
585+
g_settings.toggle_monthly_autosave();
586+
set_text_for_autosave();
587+
}
588+
else if (item.id == "hotkeys_options") {
589+
window_hotkey_config_show([] {});
590+
}
591+
else if (item.id == "enhanced_options") {
592+
window_config_show([] {});
593+
}
606594
}
607595

608596
void top_menu_widget::help_handle(menu_item &item) {

0 commit comments

Comments
 (0)