```
ui/UIStatic.cpp:113:15: runtime error: downcast of address 0x7b9f03ae6a00 which does not point to an object of type 'UIPrimativeItem'
0x7b9f03ae6a00: note: object is of type 'UITextItem'
00 00 00 00 d0 f9 57 02 00 00 00 00 ff be be be 00 ff 00 00 03 00 00 00 be be be be 70 64 dd 02
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'UITextItem'
[lines as per 51fb3fea609e81d3897c33d901dce0b7be68c082; ±1 line]
f0 UIStatic::SetTitle (this=0x7ccff4a8b200, item=0x7bfff384a030) at ui/UIStatic.cpp:113
f1 newuiSheet::UpdateChanges (this=0x7bfff3a8ee38) at Descent3/newui_core.cpp:1721
f2 newuiMenu::DoUI (this=0x7bfff3a8e4c0) at Descent3/newui_core.cpp:921
f3 OptionsMenu () at Descent3/config.cpp:1432
f4 MainMenu () at Descent3/menu.cpp:837
f5 MainLoop () at Descent3/descent.cpp:541
f6 Descent3 () at Descent3/descent.cpp:503
f7 oeD3LnxApp::run (this=0x7bfff3901050) at Descent3/sdlmain.cpp:142
f8 main (argc=1, argv=0x7fffffffdae8) at Descent3/sdlmain.cpp:322
```
In `SetTitle`, `CopyUIItem()` returns a `UIItem *` backed by the same class
that `item` is, which is not guaranteed to be a UIPrimativeItem object. That
guarantee only holds in the `SetBackground` function.
Fixes: df209742fc (bogus cast added)
Fixes: 51fb3fea60 (added UITextItem in the options dialog)
Likely with the change to SDL's 'captured mouse' mode, mouse movements
during fullscreen became deltas *from the last movement*, not from
the last sampled position or frame. In order to correctly measure the
mouse movement, the deltas must be summed up and then reset when 'read'
at input-processing time.
Moving to summing the deltas threw many other mouse-related calibration
factors out of whack, so these factors are re-determined empirically
across a range of mice, from 400dpi 125hz to 30,000dpi 8khz. Reasonable
defaults are chosen targeting an 'average' mouse of 1000dpi, and the
mouse sensitivity precision is increased to allow finer user tuning.
Devirtualization is an optimization in the generated assembly: when a
class C is polymorphic but also final, ``((C *)ptr)->func()`` can be
turned from an indirect into a static call.
Join the license header with historical comments using a separator so IDEs can correctly parse the initial header.
Also use .gitattributes to ensure all files are LF.
The vast majority of this is fixing up `char *` that should be `const char *`
but a handful of other fixes, like potential buffer overflows that GCC
noticed, etc, were applied as well.
This removes `-Wno-write-strings` from CMakeLists.txt, as it is no longer
necessary, as there is no longer a flood of compiler warning spam when
building.
This does not fix all compiler warnings; there are still a handful, and they
are legitimate, but they can be dealt with in a future commit.
The MACINTOSH define refers to MacOS Classic (not OS X) which we do not
plan to support. Rather than carry the cruft forever, let's delete it.
NOTE: legacy/ is unused but we're keeping it around, so MACINTOSH uses
there are left alone.
Process used for this commit:
```
git rm -r mac
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" \) \
-exec unifdef -UMACINTOSH -o {} {} \;
git restore legacy
git add .
```
Test Plan:
On Mac, build both Debug and Release
```
cmake --build --preset mac --config Debug
cmake --build --preset mac --config Release
```
- tabs to spaces
- use Unix line endings everywhere
- newline at end of file
- remove trailing white space
- no space between keywords and opening parenthesis
- use 2 spaces to indent
Most of these warnings are due to the use of NULL instead of 0 or NULL instead of '\0'.
Some are macro redefinitions. None of them are pointer storage related. Those will be
in another PR.