The existing code checks that w.m_ptr is not nullptr before using it.
clang's flow analysis is unable to prove that w.m_ptr does not become
nullptr after it was first checked, even though `w` is const. This
causes clang to include calls to null_pointer_exception::report, which
is not instantiated for wall. That in turn causes a link error.
Rewrite the code to let clang see that the value tested is the value
used, and that no nullptr dereference can happen here.
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.
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.
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.
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")
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.
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.
- 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.
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.
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.
Support for ORTHO_VIEWS has been broken since commit
db514a5ded in December 2004.
`git blame HEAD -L872,+4 -- similar/editor/meddraw.cpp`:
```
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 872) }
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 873) } else
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 874) #if ORTHO_VIEWS
db514a5ded main/editor/meddraw.c (Bradley Bell 2004-12-19 13:54:27 +0000 875) else if ( screen_canvas == TopViewBox->canvas )
```
When ORTHO_VIEWS is true, this code expands to `} else else if (...)`; a
double-else is not legal, so the code cannot have been compiled with
ORTHO_VIEWS enabled. All 4 of the relevant lines date to db514a5ded,
which itself is an import of files from the D1X editor.
When joystick support is not present, `event_joystick_get_button` is not
declared in joy.h.
Fixes: c24864b180 ("make menus controllable with joystick")
Define separate enum values for rotation data in both the high bits,
where it is usually kept, and the low bits, where it is sometimes used
for math or comparisons.
Define an enum value to represent the composite of the index and the
rotation, since the composite is not suitable for use as an array
subscript. Add helper functions to extract the component pieces.
tmap1 cannot be rotated, so checking for it inside
convert_to_d1_tmap_num is wrong. tmap2 can be rotated, and checking for
it outside convert_to_d1_tmap_num is cleaner.
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment. Eventually, segment will be
removed. Adjust references to go through unique_segment to support this
change.
segment inherits unique_segment, so unique_segment members can be
referenced from an instance of segment. Eventually, segment will be
removed. Adjust references to go through unique_segment to support this
change.