mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 22:34:33 +01:00
Close conflicting windows in main menu
* The main buttons close the other main windows in the main menu * Only close other windows if the next is not open already
This commit is contained in:
committed by
Michael Steenbeek
parent
3a0318ff04
commit
4ea29bbf80
@@ -136,15 +136,41 @@ static void window_title_menu_scenarioselect_callback(const utf8 *path)
|
||||
|
||||
static void window_title_menu_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
rct_window *windowToOpen = NULL;
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_START_NEW_GAME:
|
||||
window_scenarioselect_open(window_title_menu_scenarioselect_callback);
|
||||
windowToOpen = window_find_by_class(WC_SCENARIO_SELECT);
|
||||
if (windowToOpen != NULL) {
|
||||
window_bring_to_front(windowToOpen);
|
||||
}
|
||||
else {
|
||||
window_close_by_class(WC_LOADSAVE);
|
||||
window_close_by_class(WC_SERVER_LIST);
|
||||
window_scenarioselect_open(window_title_menu_scenarioselect_callback);
|
||||
}
|
||||
break;
|
||||
case WIDX_CONTINUE_SAVED_GAME:
|
||||
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
|
||||
windowToOpen = window_find_by_class(WC_LOADSAVE);
|
||||
if (windowToOpen != NULL) {
|
||||
window_bring_to_front(windowToOpen);
|
||||
}
|
||||
else {
|
||||
window_close_by_class(WC_SCENARIO_SELECT);
|
||||
window_close_by_class(WC_SERVER_LIST);
|
||||
game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
|
||||
}
|
||||
break;
|
||||
case WIDX_MULTIPLAYER:
|
||||
window_server_list_open();
|
||||
windowToOpen = window_find_by_class(WC_SERVER_LIST);
|
||||
if (windowToOpen != NULL) {
|
||||
window_bring_to_front(windowToOpen);
|
||||
}
|
||||
else {
|
||||
window_close_by_class(WC_SCENARIO_SELECT);
|
||||
window_close_by_class(WC_LOADSAVE);
|
||||
window_server_list_open();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user