* avoid undefined behavior from UNREACHABLE on reachable code paths
UNREACHABLE expands to __assume(false) / __builtin_unreachable() in
release builds, which is undefined behavior if the code is ever actually
reached. Many UNREACHABLE sites only guard against unexpected-but-
possible runtime states (values from tables, mission/save files, network
packets, scripting, or user input), so reaching them should degrade
gracefully rather than invoke UB.
Replace UNREACHABLE with Assertion(false, ...) at all such sites. It
still pops an error in debug builds, but in release it is a harmless
no-op that simply falls through to the following code. Sites that are
genuinely unreachable by local invariants (e.g. a switch over a bounded
random number) are left as UNREACHABLE.
A few converted sites had no safe fall-through -- an uninitialized read,
null dereference, or null call would have followed -- so they also get a
minimal recovery: initialize the value, guard the dereference, return
early, or skip the offending item.
Where the converted site was a simple guard of the form
if (x) { Assertion(false, ...); return; }
hoist the check onto the invariant instead:
Assertion(!x, ...);
if (x) { return; }
This states the expectation directly and shows the offending value in
the debug popup, while keeping the same graceful runtime degradation.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* addendum
After consultation with Lafiel, use UNREACHABLE in situations that are effectively impossible even if not provably impossible. UNREACHABLE = "this shouldn't ever happen"; Assertion = "if this ever happens, it's a coding error". Also fix a few other sites and change a couple to Warnings.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
* Add lab panning controls and align to pof tools
* pan based on camera view coords not world coords
* reset view option
* change scrolling to use mouse wheel
* Better ui for controls reference
* clang
1. Change `ai_profile_lookup` and `multi_xfer_lookup` to use `const char *`, since all the other lookup functions do
2. Remove several unneeded `const_cast`s, some of which are now made possible by the non-const `data()` overload in C++17
3. Change `campaign_link` to use `const char*`
4. Use better string management in `test::FSTestFixture::init_cmdline()`
* First draft of prop object type
* Add prop editor dialog in FRED
* prop sexps
* lua table prop support
* lab support
* lua mission access to props
* prop collision support
* use std::optional so the object->instance id is always valid
* allow props to block suns
* minor cleanup and remove arbitrary limit. Still limited to 500 objects.
* Sort props by category
* cleanup
* implement collision hooks
* parse prop flags and further ensure props are inited and closed correctly
* Add Cyborg's multi suggestions
* fix missing header
* add props to empty slots if available
* add multi signature
* fix rebase issues and match collisions to the new multithread style
* appease Clang the Conquerer
* save/parse mission prop classes by name
* Clean up comments and finish TODOs
* fix string errors
* clang wants this to be static now
* address feedback
* address feedback
* Use model num from prop info instead
* merge prop and ship collision group sexps together
* fix rebase bug
* address feedback
* fix name shadowing
* ship heavy submodel
* clang
---------
Co-authored-by: Asteroth <[email protected]>
* Fix some issues preventing various secondary types from firing in the lab
* Add ability to fire turrets from the lab
* const char*, mjn please
* more cleanup
* range-based for loop
* Update comment
* coverity - using `std::move` instead of copying, and change some parameters from value to reference
* coverity - fix or mark potential copy-paste mistakes
* coverity - various checking of parameter and return values
* coverity - miscellaneous fixes, and change some 'intentional' markers to 'false positive' markers
1. Add const qualifier where appropriate to API methods
2. Change `TonemapperAlgorithm` from enum to enum class, for type safety and token scope
3. Update saving of lighting profile in FRED
4. Add saving of lighting profile in qtFRED
5. Add lighting profile (and asteroid) initialization to qtFRED
* Add imgui
* migrate render options
* remove wmcgui
* Add subsystem selection and highlighting
* Add a syntactic sugar extension for imgui
* don't rebuild the mission list every frame
* Add imgui_sugar extension
* Move helper functions out of lab_ui, add function to display consolidated table text for object
* add button to export cubemap
* fix entering and exiting the lab
* refactor some of this for greater cleanness
* use techroom lighting when no mission background is set
* minor things
* add imguizmo
* add imguizmo
* Add imgui
* migrate render options
* remove wmcgui
* Add subsystem selection and highlighting
* Add a syntactic sugar extension for imgui
* don't rebuild the mission list every frame
* Move helper functions out of lab_ui, add function to display consolidated table text for object
* add button to export cubemap
* fix entering and exiting the lab
* refactor some of this for greater cleanness
* minor things
* add imguizmo
* add imguizmo
* Add button to reset changes made in the render dialog
* refactoring
* unfuck rebase
* fix issue with loose mission files
* use with_CollapsingHeader for greater uniformity
* add weapon selection functionality
* make primaries and secondaries fire again
* implement animation triggers
* avoid crash when switching back and forth between ships with and without team colors
* add control to set team color setting to renderer texture dialog
* make sure the table text updates when the ship class changes
* let rotating subsystems rotate
* do not add imgui.h to pstypes
* code cleanup
* add subsys highlighter from fred
* Highlight non-modelled subsystems as well
* add cmdline flag to show the imgui demo dialogue
* fix compiler warnings reported by CI
* fix error when building the subsystem list
* refactor variable/method naming
* code cleanup
* remove vestigial code
* update to imgui 1.89.1
* add credits entry for imgui
* use the imgui namespace
* Separate the background dialog out into its own window
* make sure the subsystem highlights are placed correctly
Co-authored-by: Fabian Woltermann <[email protected]>