Fix #455. Since there is no reason to show both quit windows may as well just close the previous one.

This commit is contained in:
Duncan Frost 2014-09-16 21:06:47 +01:00
parent 4a77bec8fa
commit f37928c06a
1 changed files with 34 additions and 32 deletions

View File

@ -125,46 +125,48 @@ void window_save_prompt_open()
// Check if window is already open // Check if window is already open
window = window_bring_to_front_by_id(WC_SAVE_PROMPT, 0); window = window_bring_to_front_by_id(WC_SAVE_PROMPT, 0);
if (window == NULL) { if (window){
if (prompt_mode == PM_QUIT) { window_close(window);
widgets = window_quit_prompt_widgets; }
enabled_widgets =
(1 << WQIDX_CLOSE) |
(1 << WQIDX_OK) |
(1 << WQIDX_CANCEL);
x = 177;
y = 34;
} else {
widgets = window_save_prompt_widgets;
enabled_widgets =
(1 << WIDX_CLOSE) |
(1 << WIDX_SAVE) |
(1 << WIDX_DONT_SAVE) |
(1 << WIDX_CANCEL);
x = 260;
y = 50;
}
window = window_create( if (prompt_mode == PM_QUIT) {
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2) - x/2, widgets = window_quit_prompt_widgets;
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - y/2), enabled_widgets =
(1 << WQIDX_CLOSE) |
(1 << WQIDX_OK) |
(1 << WQIDX_CANCEL);
x = 177;
y = 34;
} else {
widgets = window_save_prompt_widgets;
enabled_widgets =
(1 << WIDX_CLOSE) |
(1 << WIDX_SAVE) |
(1 << WIDX_DONT_SAVE) |
(1 << WIDX_CANCEL);
x = 260;
y = 50;
}
window = window_create(
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2) - x / 2,
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - y / 2),
x, x,
y, y,
(uint32*)window_save_prompt_events, (uint32*)window_save_prompt_events,
WC_SAVE_PROMPT, WC_SAVE_PROMPT,
WF_TRANSPARENT | WF_STICK_TO_FRONT WF_TRANSPARENT | WF_STICK_TO_FRONT
); );
window->widgets = widgets; window->widgets = widgets;
window->enabled_widgets = enabled_widgets; window->enabled_widgets = enabled_widgets;
window_init_scroll_widgets(window); window_init_scroll_widgets(window);
window->colours[0] = 154; window->colours[0] = 154;
// Pause the game // Pause the game
RCT2_GLOBAL(0x009DEA6E, uint8) |= 2; RCT2_GLOBAL(0x009DEA6E, uint8) |= 2;
pause_sounds(); pause_sounds();
window_invalidate_by_id(0x80 | WC_TOP_TOOLBAR, 0); window_invalidate_by_id(0x80 | WC_TOP_TOOLBAR, 0);
}
stringId = prompt_mode + STR_LOAD_GAME; stringId = prompt_mode + STR_LOAD_GAME;
if (stringId == STR_LOAD_GAME && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) if (stringId == STR_LOAD_GAME && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)