This will allow checking for window_event_result::deleted, instead of relying on window_exists, which could return a false positive if a new window was allocated with the same pointer value as the deleted one.
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).
In particular, window_event_result::deleted so the event system doesn't have to rely on the somewhat problematic window_exists. If a gadget is manipulated, it still returns at least window_event_result::handled so all the other gadgets in all the other windows don't have to be checked (that weren't already checked).
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 will be used to inform the event system in future, in removing calls to window_exists. This applies to if the handler returns a window_event_result::close (which is and should be instead of the handler calling window_close itself, at least in most cases).
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")
Some custom levels attempt to use texture overrides that reference
textures that are not yet paged in. It is not legal to access the data
of a paged-out texture, but ogl_loadbmtexture_f attempted to access it
anyway, causing a crash. Page in the texture before calling
ogl_loadbmtexture_f. Old versions of the engine would have cached
garbage data when this happened.
Reported-by: kreator <https://github.com/dxx-rebirth/dxx-rebirth/issues/228>
Fixes: 3c20c24ac0 ("Disable piggy_bitmap_page_out_all")
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.