Make wall_dialog_handler return window_event_result::close instead of closing itself

This ensures the event system will know what's going on. Also remove the 'likely' branch prediction macro from close_wall_window because close_wall_window will only be called outside of the wall dialog's handler (to open a different dialog or close the editor).
This commit is contained in:
Chris Taylor 2016-10-27 18:07:57 +08:00
parent fd3e60be54
commit bd3078b672

View file

@ -378,7 +378,7 @@ static window_event_result wall_dialog_created(UI_DIALOG *const w, wall_dialog *
void close_wall_window() void close_wall_window()
{ {
if (likely(MainWindow)) if (MainWindow)
ui_close_dialog(exchange(MainWindow, nullptr)); ui_close_dialog(exchange(MainWindow, nullptr));
} }
@ -574,8 +574,7 @@ window_event_result wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wal
Update_flags |= UF_WORLD_CHANGED; Update_flags |= UF_WORLD_CHANGED;
if (GADGET_PRESSED(wd->quitButton.get()) || keypress == KEY_ESC) if (GADGET_PRESSED(wd->quitButton.get()) || keypress == KEY_ESC)
{ {
close_wall_window(); return window_event_result::close;
return window_event_result::handled;
} }
wd->old_wall_num = Cursegp->sides[Curside].wall_num; wd->old_wall_num = Cursegp->sides[Curside].wall_num;