Hidden windows don't receive events, so the only way to close is outside its handler, which there should be no cases of here. The function window_exists could return a false positive if a new window was created with the same pointer value as a deleted one. Will later disable window_exists function.
Replace with a disabled check for window_event_result::deleted, which will be enabled when all newmenu subfunctions return a window_event_result. There are currently no instances of a subfunction closing the window itself (which is preferred).
Make the listbox handlers and all sub-handlers (when_selected callbacks) return a window_event_result. Makes code more readable and removes one use of window_close, making it easier to inform event system if a window closes in future.
Return window_event_result::deleted if Game_wind was closed somewhere in response to an event handled by game_handler, so in future the event code can use that instead of window_exists to avoid tripping up.
gcc permits strlen("") in a constexpr context, but clang prohibits it.
Kreator reports that this broke the OS X build. Use sizeof(), which
produces approximately the same result and works in both compilers.
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/251>
Fixes: 63ca86698e ("Added communication for tracker written by A Future Pilot")
Kreator reports that clang warns that `i` may be uninitialized in
write_key_text. This is a valid warning, but gcc does not generate it.
Refactor write_key_text to eliminate the warning and simplify the code.
Reported-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/252>
Fixes: 20776fcfbc ("Use range_for/vcwallptr for write_key_text")
Mako88 reports that e335cdacb3 broke
reading historical high score files.
Code analysis shows that the size of the high score file must match the
size of struct all_scores, but this was not enforced anywhere. Commit
e335cdacb3 changed the size of struct
all_scores. Restore it to its previous size, and add a static_assert to
break the build if anyone tries to change it again.
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/241>
Fixes: e335cdacb3 ("Reverted 81d7db279b and rather removed the terminator byte from string length in nm_set_item_input(). This also fixes possible 9 character length for pilot callsigns. Had to fix up COOL_SAYING_LEN as it was not considering the termintor but considering the original D2 source, this was a mess to begin with (def = 50, text string = 60, input field len = 45). Made score saying 50 characters as this seems to be the maximum witdth without overlapping.")
Mako88 reports that 2a19da88d4 changed
robot movement. That commit reordered the operations in a way that
tends to truncate small values prematurely. Restore the original order
of operations.
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/247>
Fixes: 2a19da88d4 ("Pass object_base &to move_towards_vector")
multi_do_reappear is overloaded to be used both on ghosts and on live
players. This causes a diagnostic because the *_id checks expect
exactly one type: either test for ghost or test for player, but not test
for and accept both. Open code the type check to support both.