diff --git a/common/include/ui.h b/common/include/ui.h index 3b2dc1191..e59efa72c 100644 --- a/common/include/ui.h +++ b/common/include/ui.h @@ -216,10 +216,10 @@ enum dialog_flags }; template -using ui_subfunction_t = int (*)(struct UI_DIALOG *,const d_event &, T *); +using ui_subfunction_t = window_event_result (*)(struct UI_DIALOG *,const d_event &, T *); template -using ui_subclass_subfunction_t = int (*)(T *,const d_event &, void *); +using ui_subclass_subfunction_t = window_event_result (*)(T *,const d_event &, void *); struct UI_DIALOG : embed_window_pointer_t { diff --git a/common/ui/dialog.cpp b/common/ui/dialog.cpp index 6a6defb41..c704e49ce 100644 --- a/common/ui/dialog.cpp +++ b/common/ui/dialog.cpp @@ -91,14 +91,16 @@ static void ui_dialog_draw(UI_DIALOG *dlg) // The dialog handler borrows heavily from the newmenu_handler static window_event_result ui_dialog_handler(window *wind,const d_event &event, UI_DIALOG *dlg) { + window_event_result rval{window_event_result::ignored}; + if (event.type == EVENT_WINDOW_CLOSED || event.type == EVENT_WINDOW_ACTIVATED || event.type == EVENT_WINDOW_DEACTIVATED) return window_event_result::ignored; if (dlg->d_callback) - if ((*dlg->d_callback)(dlg, event, dlg->d_userdata)) - return window_event_result::handled; // event handled + if ((rval = (*dlg->d_callback)(dlg, event, dlg->d_userdata)) == window_event_result::handled) + return rval; // event handled if (!window_exists(wind)) return window_event_result::handled; @@ -121,7 +123,7 @@ static window_event_result ui_dialog_handler(window *wind,const d_event &event, case EVENT_WINDOW_DRAW: { ui_dialog_draw(dlg); - window_event_result rval = ui_dialog_do_gadgets(dlg, event); + rval = ui_dialog_do_gadgets(dlg, event); if (rval != window_event_result::close) { d_event event2 = { EVENT_UI_DIALOG_DRAW }; diff --git a/common/ui/file.cpp b/common/ui/file.cpp index 75abf87a2..341c18408 100644 --- a/common/ui/file.cpp +++ b/common/ui/file.cpp @@ -114,9 +114,9 @@ struct ui_file_browser } -static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_browser *const b) +static window_event_result browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_browser *const b) { - int rval = 0; + window_event_result rval = window_event_result::ignored; if (event.type == EVENT_UI_DIALOG_DRAW) { @@ -129,7 +129,7 @@ static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_b ui_dputs_at(dlg, 20, 60, b->spaces.data()); ui_dputs_at( dlg, 20, 60, b->view_dir ); - return 1; + return window_event_result::handled; } if (GADGET_PRESSED(b->button2.get())) @@ -137,13 +137,13 @@ static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_b b->filename_list.reset(); b->directory_list.reset(); ui_close_dialog(dlg); - return 1; + return window_event_result::handled; } if (GADGET_PRESSED(b->help_button.get())) { ui_messagebox( -1, -1, 1, "Sorry, no help is available!", "Ok" ); - rval = 1; + rval = window_event_result::handled; } if (event.type == EVENT_UI_LISTBOX_MOVED) @@ -154,7 +154,7 @@ static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_b if ((ui_event_get_gadget(event) == b->listbox2.get()) && (b->listbox2->current_item >= 0) && b->directory_list[b->listbox2->current_item]) ui_inputbox_set_text(b->user_file.get(), b->directory_list[b->listbox2->current_item]); - rval = 1; + rval = window_event_result::handled; } if (GADGET_PRESSED(b->button1.get()) || GADGET_PRESSED(b->user_file.get()) || event.type == EVENT_UI_LISTBOX_SELECTED) @@ -190,7 +190,7 @@ static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_b { // Looks like a valid filename that already exists! ui_close_dialog(dlg); - return 1; + return window_event_result::handled; } // File doesn't exist, but can we create it? @@ -200,7 +200,7 @@ static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_b // Looks like a valid filename! PHYSFS_delete(b->filename); ui_close_dialog(dlg); - return 1; + return window_event_result::handled; } } else @@ -214,7 +214,7 @@ static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_b { b->directory_list.reset(); ui_close_dialog(dlg); - return 1; + return window_event_result::handled; } ui_inputbox_set_text(b->user_file.get(), b->filespec); @@ -223,7 +223,7 @@ static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_b { b->filename_list.reset(); ui_close_dialog(dlg); - return 1; + return window_event_result::handled; } ui_listbox_change(dlg, b->listbox1.get(), b->filename_list.get_count(), b->filename_list.get()); @@ -234,7 +234,7 @@ static int browser_handler(UI_DIALOG *const dlg, const d_event &event, ui_file_b } - rval = 1; + rval = window_event_result::handled; } return rval; diff --git a/common/ui/menu.cpp b/common/ui/menu.cpp index 89ff4d402..d2f3bedd6 100644 --- a/common/ui/menu.cpp +++ b/common/ui/menu.cpp @@ -49,24 +49,24 @@ struct menu } -static int menu_handler(UI_DIALOG *,const d_event &event, menu *m) +static window_event_result menu_handler(UI_DIALOG *,const d_event &event, menu *m) { for (int i=0; inum_buttons; i++ ) { if (GADGET_PRESSED(m->button_g[i].get())) { *(m->choice) = i+1; - return 1; + return window_event_result::handled; } } if ( (*(m->choice)==0) && B1_JUST_RELEASED ) { *(m->choice) = -1; - return 1; + return window_event_result::handled; } - return 0; + return window_event_result::ignored; } int MenuX( int x, int y, int NumButtons, const char *const text[] ) diff --git a/common/ui/message.cpp b/common/ui/message.cpp index bf537c1fe..38910887c 100644 --- a/common/ui/message.cpp +++ b/common/ui/message.cpp @@ -61,7 +61,7 @@ struct messagebox } -static int messagebox_handler(UI_DIALOG *dlg,const d_event &event, messagebox *m) +static window_event_result messagebox_handler(UI_DIALOG *dlg,const d_event &event, messagebox *m) { if (event.type == EVENT_UI_DIALOG_DRAW) { @@ -83,7 +83,7 @@ static int messagebox_handler(UI_DIALOG *dlg,const d_event &event, messagebox *m grd_curscreen->sc_canvas.cv_font = temp_font; - return 1; + return window_event_result::handled; } for (uint_fast32_t i=0; i < m->button->count(); i++ ) @@ -91,11 +91,11 @@ static int messagebox_handler(UI_DIALOG *dlg,const d_event &event, messagebox *m if (GADGET_PRESSED(m->button_g[i].get())) { *(m->choice) = i+1; - return 1; + return window_event_result::handled; } } - return 0; + return window_event_result::ignored; } int (ui_messagebox)( short xc, short yc, const char * text, const ui_messagebox_tie &Button ) diff --git a/similar/editor/centers.cpp b/similar/editor/centers.cpp index 454d9f167..aa0c11d71 100644 --- a/similar/editor/centers.cpp +++ b/similar/editor/centers.cpp @@ -76,7 +76,7 @@ struct centers_dialog } -static int centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog *c); +static window_event_result centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog *c); //------------------------------------------------------------------------- // Called from the editor... does one instance of the centers dialog box @@ -108,7 +108,7 @@ int do_centers_dialog() } namespace dsx { -static int centers_dialog_created(UI_DIALOG *const w, centers_dialog *const c) +static window_event_result centers_dialog_created(UI_DIALOG *const w, centers_dialog *const c) { #if defined(DXX_BUILD_DESCENT_I) int i = 80; @@ -135,7 +135,7 @@ static int centers_dialog_created(UI_DIALOG *const w, centers_dialog *const c) for (i=0; i < N_robot_types; i++) c->robotMatFlag[i] = ui_add_gadget_checkbox( w, 128 + (i%d)*92, 20+(i/d)*24, 16, 16, 0, Robot_names[i].data()); c->old_seg_num = -2; // Set to some dummy value so everything works ok on the first frame. - return 1; + return window_event_result::handled; } } @@ -147,7 +147,7 @@ void close_centers_window() } } -int centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog *c) +window_event_result centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog *c) { switch(event.type) { @@ -156,13 +156,13 @@ int centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog * case EVENT_WINDOW_CLOSE: std::default_delete()(c); MainWindow = NULL; - return 0; + return window_event_result::ignored; default: break; } // int robot_flags; int keypress = 0; - int rval = 0; + window_event_result rval = window_event_result::ignored; Assert(MainWindow != NULL); @@ -208,7 +208,7 @@ int centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog * Update_flags |= UF_WORLD_CHANGED; fuelcen_activate( Cursegp, i ); } - rval = 1; + rval = window_event_result::handled; } } @@ -222,7 +222,7 @@ int centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog * f |= mask; else f &= ~mask; - rval = 1; + rval = window_event_result::handled; } } @@ -242,7 +242,7 @@ int centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog * if (GADGET_PRESSED(c->quitButton.get()) || keypress==KEY_ESC) { close_centers_window(); - return 1; + return window_event_result::handled; } c->old_seg_num = Cursegp; diff --git a/similar/editor/eswitch.cpp b/similar/editor/eswitch.cpp index 3728c8c23..a6cdae77f 100644 --- a/similar/editor/eswitch.cpp +++ b/similar/editor/eswitch.cpp @@ -281,7 +281,7 @@ static int trigger_turn_all_ON() return 1; } -static int trigger_dialog_handler(UI_DIALOG *dlg,const d_event &event, trigger_dialog *t); +static window_event_result trigger_dialog_handler(UI_DIALOG *dlg,const d_event &event, trigger_dialog *t); //------------------------------------------------------------------------- // Called from the editor... does one instance of the trigger dialog box @@ -308,7 +308,7 @@ int do_trigger_dialog() return 1; } -static int trigger_dialog_created(UI_DIALOG *const w, trigger_dialog *const t) +static window_event_result trigger_dialog_created(UI_DIALOG *const w, trigger_dialog *const t) { // These are the checkboxes for each door flag. int i = 44; @@ -336,7 +336,7 @@ static int trigger_dialog_created(UI_DIALOG *const w, trigger_dialog *const t) t->enable_all_triggers = ui_add_gadget_button(w, 155, i, 140, 26, "All Triggers ON", trigger_turn_all_ON); i += 29; t->old_trigger_num = -2; // Set to some dummy value so everything works ok on the first frame. - return 1; + return window_event_result::handled; } void close_trigger_window() @@ -347,7 +347,7 @@ void close_trigger_window() } } -int trigger_dialog_handler(UI_DIALOG *dlg,const d_event &event, trigger_dialog *t) +window_event_result trigger_dialog_handler(UI_DIALOG *dlg,const d_event &event, trigger_dialog *t) { switch(event.type) { @@ -356,17 +356,17 @@ int trigger_dialog_handler(UI_DIALOG *dlg,const d_event &event, trigger_dialog * case EVENT_WINDOW_CLOSE: std::default_delete()(t); MainWindow = NULL; - return 0; + return window_event_result::ignored; default: break; } int keypress = 0; - int rval = 0; + window_event_result rval = window_event_result::ignored; Assert(MainWindow != NULL); if (!Markedsegp) { close_trigger_window(); - return 0; + return window_event_result::ignored; } //------------------------------------------------------------ @@ -409,7 +409,7 @@ int trigger_dialog_handler(UI_DIALOG *dlg,const d_event &event, trigger_dialog * //------------------------------------------------------------ if (IS_CHILD(Markedsegp->children[Markedside])) { - rval = 1; + rval = window_event_result::handled; if (GADGET_PRESSED(t->triggerFlag[0].get())) trigger_flag_Markedside(TRIGGER_CONTROL_DOORS, t->triggerFlag[0]->flag); @@ -432,7 +432,7 @@ int trigger_dialog_handler(UI_DIALOG *dlg,const d_event &event, trigger_dialog * else if (GADGET_PRESSED(t->triggerFlag[9].get())) trigger_flag_Markedside(TRIGGER_SECRET_EXIT, t->triggerFlag[9]->flag); else - rval = 0; + rval = window_event_result::ignored; } else range_for (auto &i, t->triggerFlag) @@ -478,7 +478,7 @@ int trigger_dialog_handler(UI_DIALOG *dlg,const d_event &event, trigger_dialog * if (GADGET_PRESSED(t->quitButton.get()) || keypress == KEY_ESC) { close_trigger_window(); - return 1; + return window_event_result::handled; } t->old_trigger_num = trigger_num; diff --git a/similar/editor/med.cpp b/similar/editor/med.cpp index a8a2af18f..8573331c8 100644 --- a/similar/editor/med.cpp +++ b/similar/editor/med.cpp @@ -318,7 +318,7 @@ static int padnum=0; static void init_editor_screen(); static void gamestate_restore_check(); -static int editor_handler(UI_DIALOG *dlg,const d_event &event, unused_ui_userdata_t *data); +static window_event_result editor_handler(UI_DIALOG *dlg,const d_event &event, unused_ui_userdata_t *data); namespace dsx { void init_editor() @@ -957,14 +957,14 @@ int RestoreGameState() { } // Handler for the main editor dialog -int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) +window_event_result editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) { editor_view *new_cv; int keypress = 0; - int rval = 0; + window_event_result rval = window_event_result::ignored; if (event.type == EVENT_WINDOW_CREATED) - return 0; + return window_event_result::ignored; if (event.type == EVENT_KEY_COMMAND) keypress = event_key_get(event); @@ -972,7 +972,7 @@ int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) { close_editor(); EditorWindow = NULL; - return 0; + return window_event_result::ignored; } // Update the windows @@ -994,7 +994,7 @@ int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) print_status_bar(status_line); TimedAutosave(mine_filename); // shows the time, hence here set_editor_time_of_day(); - return 1; + return window_event_result::handled; } if ((selected_gadget == GameViewBox.get() && !render_3d_in_big_window) || @@ -1025,7 +1025,7 @@ int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) Update_flags |= UF_ED_STATE_CHANGED; } - rval = 1; + rval = window_event_result::handled; } break; @@ -1093,7 +1093,7 @@ int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) { KeyFunction[keypress](); keypress = 0; - rval = 1; + rval = window_event_result::handled; } switch (keypress) @@ -1111,15 +1111,15 @@ int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) break; case KEY_SHIFTED + KEY_L: ToggleLighting(); - rval = 1; + rval = window_event_result::handled; break; case KEY_F1: render_3d_in_big_window = !render_3d_in_big_window; Update_flags |= UF_ALL; - rval = 1; + rval = window_event_result::handled; break; default: - if (!rval) + if (rval == window_event_result::ignored) { char kdesc[100]; GetKeyDescription( kdesc, keypress ); @@ -1132,7 +1132,7 @@ int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) if (ModeFlag) { ui_close_dialog(EditorWindow); - return 0; + return window_event_result::ignored; } // if (EditorWindow->keyboard_focus_gadget == GameViewBox) current_view=NULL; @@ -1154,10 +1154,10 @@ int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) // DO TEXTURE STUFF if (texpage_do(event)) - rval = 1; + rval = window_event_result::handled; if (objpage_do(event)) - rval = 1; + rval = window_event_result::handled; // Process selection of Cursegp using mouse. @@ -1274,7 +1274,7 @@ int editor_handler(UI_DIALOG *, const d_event &event, unused_ui_userdata_t *) LargeView.ev_matrix = vm_matrix_x_matrix(LargeView.ev_matrix,MouseRotMat); LargeView.ev_changed = 1; Large_view_index = -1; // say not one of the orthogonal views - rval = 1; + rval = window_event_result::handled; } } diff --git a/similar/editor/medrobot.cpp b/similar/editor/medrobot.cpp index 7cfe6fb5e..77c55fc2f 100644 --- a/similar/editor/medrobot.cpp +++ b/similar/editor/medrobot.cpp @@ -84,7 +84,7 @@ struct robot_dialog } namespace dsx { -static int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r); +static window_event_result robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r); } static void call_init_ai_object(object &objp, ai_behavior behavior) @@ -482,7 +482,7 @@ int do_robot_dialog() return 1; } -static int robot_dialog_created(UI_DIALOG *const w, robot_dialog *const r) +static window_event_result robot_dialog_created(UI_DIALOG *const w, robot_dialog *const r) { r->quitButton = ui_add_gadget_button(w, 20, 286, 40, 32, "Done", NULL); r->prev_powerup_type = ui_add_gadget_button(w, GOODY_X+50, GOODY_Y-3, 25, 22, "<<", GoodyPrevType); @@ -515,7 +515,7 @@ static int robot_dialog_created(UI_DIALOG *const w, robot_dialog *const r) r->old_object = -2; // Set to some dummy value so everything works ok on the first frame. if ( Cur_object_index == object_none) LocalObjectSelectNextinMine(); - return 1; + return window_event_result::handled; } void robot_close_window() @@ -528,7 +528,7 @@ void robot_close_window() } namespace dsx { -int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r) +window_event_result robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r) { switch(event.type) { @@ -537,7 +537,7 @@ int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r) case EVENT_WINDOW_CLOSE: std::default_delete()(r); MainWindow = NULL; - return 0; + return window_event_result::ignored; default: break; } @@ -545,7 +545,7 @@ int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r) fix64 Temp; int first_object_index; int keypress = 0; - int rval = 0; + window_event_result rval = window_event_result::ignored; if (event.type == EVENT_KEY_COMMAND) keypress = event_key_get(event); @@ -611,7 +611,7 @@ int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r) if (behavior != b) { behavior = b; // Set the ai_state to the cooresponding radio button call_init_ai_object(objp, b); - rval = 1; + rval = window_event_result::handled; } } } @@ -716,7 +716,7 @@ int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r) if (GADGET_PRESSED(r->quitButton.get()) || keypress == KEY_ESC) { robot_close_window(); - return 1; + return window_event_result::handled; } r->old_object = Cur_object_index; @@ -751,7 +751,7 @@ struct object_dialog } -static int object_dialog_handler(UI_DIALOG *dlg,const d_event &event, object_dialog *o); +static window_event_result object_dialog_handler(UI_DIALOG *dlg,const d_event &event, object_dialog *o); void object_close_window() { @@ -785,7 +785,7 @@ int do_object_dialog() return 1; } -static int object_dialog_created(UI_DIALOG *const w, object_dialog *const o, const object_dialog::creation_context *const c) +static window_event_result object_dialog_created(UI_DIALOG *const w, object_dialog *const o, const object_dialog::creation_context *const c) { o->quitButton = ui_add_gadget_button(w, 20, 286, 40, 32, "Done", NULL ); o->quitButton->hotkey = KEY_ENTER; @@ -802,10 +802,11 @@ static int object_dialog_created(UI_DIALOG *const w, object_dialog *const o, con o->ztext = ui_add_gadget_inputbox(w, 30, 192, message); ui_gadget_calc_keys(w); w->keyboard_focus_gadget = o->initialMode[0].get(); - return 1; + + return window_event_result::handled; } -static int object_dialog_handler(UI_DIALOG *dlg,const d_event &event, object_dialog *o) +static window_event_result object_dialog_handler(UI_DIALOG *dlg,const d_event &event, object_dialog *o) { switch(event.type) { @@ -814,13 +815,13 @@ static int object_dialog_handler(UI_DIALOG *dlg,const d_event &event, object_dia case EVENT_WINDOW_CLOSE: std::default_delete()(o); MattWindow = NULL; - return 0; + return window_event_result::ignored; default: break; } const auto &&obj = vobjptr(Cur_object_index); int keypress = 0; - int rval = 0; + window_event_result rval = window_event_result::ignored; if (event.type == EVENT_KEY_COMMAND) keypress = event_key_get(event); @@ -851,7 +852,7 @@ static int object_dialog_handler(UI_DIALOG *dlg,const d_event &event, object_dia obj->mtype.spin_rate.z = fl2f(atof(o->ztext->text.get())); object_close_window(); - return 1; + return window_event_result::handled; } return rval; diff --git a/similar/editor/medwall.cpp b/similar/editor/medwall.cpp index 43ebc9eba..af2c78a53 100644 --- a/similar/editor/medwall.cpp +++ b/similar/editor/medwall.cpp @@ -87,7 +87,7 @@ struct count_wall } -static int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd); +static window_event_result wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd); //--------------------------------------------------------------------- // Add a wall (removable 2 sided) @@ -344,7 +344,7 @@ int do_wall_dialog() return 1; } -static int wall_dialog_created(UI_DIALOG *const w, wall_dialog *const wd) +static window_event_result wall_dialog_created(UI_DIALOG *const w, wall_dialog *const wd) { wd->quitButton = ui_add_gadget_button(w, 20, 252, 48, 40, "Done", NULL); // These are the checkboxes for each door flag. @@ -372,7 +372,8 @@ static int wall_dialog_created(UI_DIALOG *const w, wall_dialog *const wd) wd->bind_trigger = ui_add_gadget_button(w, 155, i, 140, 22, "Bind to Trigger", bind_wall_to_trigger); i += 25; wd->bind_control = ui_add_gadget_button(w, 155, i, 140, 22, "Bind to Control", bind_wall_to_control_center); i+=25; wd->old_wall_num = -2; // Set to some dummy value so everything works ok on the first frame. - return 1; + + return window_event_result::handled; } void close_wall_window() @@ -381,7 +382,7 @@ void close_wall_window() ui_close_dialog(exchange(MainWindow, nullptr)); } -int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd) +window_event_result wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd) { switch(event.type) { @@ -389,7 +390,7 @@ int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd) return wall_dialog_created(dlg, wd); case EVENT_WINDOW_CLOSE: std::default_delete()(wd); - return 0; + return window_event_result::ignored; default: break; } @@ -397,7 +398,7 @@ int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd) fix DeltaTime; fix64 Temp; int keypress = 0; - int rval = 0; + window_event_result rval = window_event_result::ignored; if (event.type == EVENT_KEY_COMMAND) keypress = event_key_get(event); @@ -442,7 +443,7 @@ int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd) w->flags |= WALL_DOOR_LOCKED; else w->flags &= ~WALL_DOOR_LOCKED; - rval = 1; + rval = window_event_result::handled; } else if (GADGET_PRESSED(wd->doorFlag[1].get())) { @@ -450,7 +451,7 @@ int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd) w->flags |= WALL_DOOR_AUTO; else w->flags &= ~WALL_DOOR_AUTO; - rval = 1; + rval = window_event_result::handled; } //------------------------------------------------------------ @@ -461,7 +462,7 @@ int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd) if (GADGET_PRESSED(wd->keyFlag[i].get())) { w->keys = 1<flags |= WALL_ILLUSION_OFF; else w->flags &= ~WALL_ILLUSION_OFF; - rval = 1; + rval = window_event_result::handled; } } else for ( int i=2; i < 3; i++ ) @@ -574,7 +575,7 @@ int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd) if (GADGET_PRESSED(wd->quitButton.get()) || keypress == KEY_ESC) { close_wall_window(); - return 1; + return window_event_result::handled; } wd->old_wall_num = Cursegp->sides[Curside].wall_num;