Commit graph

805 commits

Author SHA1 Message Date
Kp 983ad86e4b Use enum class for trigger number 2021-09-04 12:17:14 +00:00
Kp 6ab3fb262b Add convenience function underlying_value
Add a helper to deduce the enum type of a value, and use an appropriate
std::underlying_type<T> expression for that enum type.  This avoids the
need to repeat the type of the enum at the site of each cast, and moves
the casts into the helper to make the callers easier to read.
2021-09-04 12:17:14 +00:00
Kp c58d26a791 Use trgnum_t more consistently 2021-09-04 12:17:14 +00:00
Kp 5d39c52b0c Remote write-only field UI_GADGET::status 2021-08-26 03:13:46 +00:00
Kp 40c22d0663 Move render_frame helper inline
Most call sites had the correct lifetime already, and those that did not
can easily gain it with an extra block scope.
2021-08-26 03:13:45 +00:00
Kp 56c98f5345 Improve error reporting for PHYSFSX_openWriteBuffered
Return the PHYSFS error code on failure, so that callers can report why
the open failed.
2021-07-25 23:00:56 +00:00
Kp 1c13d3c8d3 Improve error reporting for PHYSFSX_openReadBuffered
Return the PHYSFS error code on failure, so that callers can report why
the open failed.
2021-07-25 23:00:56 +00:00
Kp d980648823 Use structured bindings for more zip calls 2021-06-28 03:37:51 +00:00
Kp e1aac6949a Replace __attribute_warn_unused_result with C++17 [[nodiscard]]
This eliminates a configure test, and may help readers understand the
annotation more readily.
2021-06-28 03:37:51 +00:00
Kp 028f4f8a56 Use structured bindings to access enumerated ranges 2021-06-28 03:37:50 +00:00
Kp 7b12aac1bb Transpose returned values for enumerate() of non-tuple
Match the order used for tuple.
2021-06-28 03:37:50 +00:00
Kp 1dba8e40ec Move PHYSFSX_addRelToSearchPath pathname to caller
Some callers will need access to the computed path.  Change the callers
to pass in a buffer for this path, and have PHYSFSX_addRelToSearchPath
fill that buffer directly.
2021-06-28 03:37:49 +00:00
Kp 391a539ad2 Use enum class for PHYSFSX_addRelToSearchPath append/prepend parameter 2021-06-28 03:37:49 +00:00
Kp 6a425bb2a7 Drop unnecessary includes 2021-02-20 23:46:51 +00:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp 318ed5b684 Simplify info_display_default
Commit 8a437a759c made show_all always
true.
2020-12-27 22:03:09 +00:00
Kp c3e2d1841c Simplify info_display_segsize
Commit 8a437a759c made show_all always
true.
2020-12-27 22:03:09 +00:00
Kp 7fde0a00a0 Simplify info_display_object_placement
Commit 8a437a759c changed the logic to
always set show_all to 1.  This renders the short-circuit logic in
info_display_object_placement irrelevant, as show_all will always force
the information to draw.  Remove the variables that were used to decide
whether a redraw was required.
2020-12-27 22:03:09 +00:00
Kp c1d6150015 Pass grs_font& to gr_set_curfont 2020-12-27 22:03:09 +00:00
Kp 834f009dd7 Use enum class for wallnum_t 2020-12-26 21:17:29 +00:00
Kp 92aeee1efc Fix array underflow in GotoPrevWall when no walls exist 2020-12-26 21:17:29 +00:00
Kp fc63029833 Move more symbols into namespaces 2020-12-26 21:17:29 +00:00
Kp e2565e6120 Move some group structures inside #if 0
Some group functionality was disabled in 2665869c24, but the globals
to support the disabled code were not removed.  Move them into a
corresponding #if 0, since they have no value with the group code
disabled.

Fixes: 2665869c24 ("Mark editor groups broken")
2020-12-26 21:17:29 +00:00
Kp faa4d2ce34 Use enum class for vertnum_t 2020-12-26 21:17:29 +00:00
Kp 38770bea12 Remove remap_side_uvs
It has never worked correctly.  It compares real vertex numbers (as used
to index in Vertices[]) to abstract vertex numbers (always in the range
of [0, 7], as used on a theoretical segment.
2020-12-26 21:17:29 +00:00
Kp 9d62300898 Make find_edge more like automap_find_edge
Both have similar purposes, but search for different matching data
structures.
2020-12-26 21:17:29 +00:00
Kp 10b43d4ba0 Enable quick exit from is_free_vertex
Once the loop has determined a vertex is used at least twice, there is
no need to count how many more times it is used.  Return immediately
after detecting the second use.
2020-12-26 21:17:29 +00:00
Kp 95d8095c6d Simplify med_set_vertex
- Make it static
- Remove the update of Num_vertices, since the caller reverses that
  update.
- Remove the reversal, since it is no longer needed.
- Remove the test and update of Vertices.count, because the caller
  always passes a vertex number that makes the test false.
2020-12-26 21:17:29 +00:00
Kp 90d43d6519 Simplify compress_vertices 2020-12-26 21:17:29 +00:00
Kp c58a69dbec Return vertnum_t from med_add_vertex 2020-12-26 21:17:29 +00:00
Kp 479884288c Always delegate to window_create for send_creation_events 2020-12-20 20:39:07 +00:00
Kp b1b2300c7d Use enum class for wall_key 2020-12-19 16:13:26 +00:00
Kp 47c33cbd55 Use enum class for WALL_IS_DOORWAY_FLAG
This reduces the size of the debug information substantially.
2020-12-19 16:13:26 +00:00
Kp 200952c3d9 Add type-specific tag wrappers for newmenu calls
Make the compiler check that title, subtitle, and filename are passed in
the right places.
2020-12-19 16:13:26 +00:00
Kp 5c7fc7d143 Remove unused UI_DIALOG d_callback
Every user now uses inheritance and a virtual function override.  Make
callback_handler pure virtual, delete its body, and then delete the
member variables that existed only for use in that body.  Remove the
constructor parameters that initialized those variables, and update all
derived classes accordingly.
2020-12-19 16:13:26 +00:00
Kp 2709676f8d Rename ui_create_dialog to window_create
The requirement to call send_creation_events from outside the
constructor makes the presence of a helper function convenient.  Rename
ui_create_dialog to window_create, and move it to window.h.
2020-12-19 16:13:26 +00:00
Kp d309c141e7 Switch non-format uses of nm_messagebox to nm_messagebox_str 2020-10-22 02:26:16 +00:00
Kp ae657007fe Remove send_creation_events parameter
It is always nullptr.
2020-10-22 02:26:16 +00:00
Kp 2869566866 Remove unused ui_create_dialog parameter createdata
It is always nullptr.  Remove the parameter and pass nullptr where the
parameter was used.
2020-10-22 02:26:16 +00:00
Kp 261acf0ebc Simplify object_dialog callback_handler
The window is a C++ object; it does not need to access a global to get a
pointer to its own data.
2020-10-22 02:26:16 +00:00
Kp d61f3014b9 Remove sole use of non-nullptr createdata
object_dialog needs one parameter.  Move that handling to the
constructor.
2020-10-22 02:26:16 +00:00
Kp ffb653c0b8 Pass control_info & to various functions
Switch from a direct global reference to passing control_info& as a
parameter.
2020-10-12 03:28:26 +00:00
Kp f8185494ad Pass UI_DIALOG& to ui_add_gadget_icon 2020-10-12 03:28:26 +00:00
Kp 4f572bbe23 Pass UI_DIALOG& to ui_add_gadget_userbox 2020-10-12 03:28:26 +00:00
Kp 95598a34e3 Pass UI_DIALOG& to ui_add_gadget_inputbox 2020-10-12 03:28:26 +00:00
Kp 466f431c91 Pass UI_DIALOG& to ui_add_gadget_checkbox 2020-10-12 03:28:26 +00:00
Kp 506f24ed04 Pass UI_GADGET_RADIO& to ui_radio_set_value 2020-10-12 03:28:26 +00:00
Kp f531c7d43e Pass UI_DIALOG& to ui_add_gadget_radio 2020-10-12 03:28:26 +00:00
Kp a563b5edf7 Pass UI_DIALOG& to ui_add_gadget_button 2020-10-12 03:28:26 +00:00
Kp 6dce3f90c2 Pass UI_DIALOG& to ui_close_dialog 2020-10-12 03:28:26 +00:00