Embedding it in d_level_shared_robot_info_state is reasonable from a
relational perspective, but interferes with referencing
d_robot_info_array when only a forward declaration of
d_level_shared_robot_info_state is available.
clang-13 needed an operator==(const exact_type<T>&) defined to avoid an
ambiguity. Now that C++20 mode is enabled, switch to a
compiler-generated operator== instead of manually defining the
equivalent function.
In C++ 20 mode, clang-13 gets confused about how to handle operator==.
Rewrite the test to encourage it to pick the correct version.
```
common/include/gr.h:129:12: error: use of overloaded operator '==' is ambiguous (with operand types 'dcx::grs_main_bitmap *' and 'exact_type<dcx::grs_bitmap>')
if (this == &r)
~~~~ ^ ~~
common/include/pack.h:31:17: note: candidate function (with reversed parameter order)
constexpr bool operator==(const T *rhs) const { return p == rhs; }
^
common/include/gr.h:129:12: note: built-in candidate operator==(struct dcx::grs_bitmap *, struct dcx::grs_bitmap *)
if (this == &r)
```
clang-13 in C++20 mode fails:
```
similar/main/newmenu.cpp:202:18: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'exact_type<const dcx::grs_font>' and 'exact_
type<const dcx::grs_font>') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
return &cv_font == &game_font ? "\202" : "\207"; // 135
~~~~~~~~ ^ ~~~~~~~~~~
common/include/pack.h:31:17: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
constexpr bool operator==(const T *rhs) const { return p == rhs; }
^
```
Add an operator== that exactly matches the input types so that clang
does not attempt a conversion.
C++20 deprecates `array_name[A,B]`. For this use case, `A` is needed
for its side effects, but is not intended as an index operation. Add
parentheses to satisfy the deprecation warning, without changing the
meaning of the code.
If the song originates in an m3u playlist, no temporary buffer is
needed. Avoid allocating and initializing one, and instead pass the
pointer directly from the CMLevelMusicPath field.
- Skip reading unused alpha channel in TGA screenshot path. The alpha
channel is discarded, so skip even retrieving it from OpenGL.
- Perform the red/blue swap in place, instead of copying into an
additional buffer.
gamedata_read_tbl is only called if (D1 || (D2 && EDITOR)). Exclude
defining it for (D2 && !EDITOR). From there, also exclude defining or
reading the alias list, which is only written by a function
called by gamedata_read_tbl.
Reported-by: heftig <https://github.com/dxx-rebirth/dxx-rebirth/issues/642>
This produces a better error message than a static_assert failure, since
gcc points directly to the call which resolved to the deleted overload.
When the caller is correct, this produces the same result as the prior
version.
splitpath_t is designed for MS-DOS paths, even though Rebirth now runs
on many platforms that never used DOS conventions. Most of the members
of splitpath_t are unused on all platforms. Remove them, and switch to
returning an initialized version of the structure.
Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/637>
Fixes: 8faed77f5f ("Properly record the event of reset_rear_view() while switching levels to make it work right when rewinding as well; Properly record Countdown seconds for each newdemo frame instead of second change to get display showing up right while playback and still preserving backwards compability; Suspend Game_wind when playing endlevel movie while demo playback")
This loop is run once before the `if()` test, then again at the top of
both the true and false branches of the `if`. Remove the runs inside
the conditional, since they should produce the same result as the run
that occurs before the conditional.
clang rejects the entire database if any entry lacks a 'file' key,
regardless of whether the entry is used.
Fixes: bc6d043f5d ("Extend SConstruct compilation_database support to cover Program()")
The existing handling always wrote to slot 0, but did so in a convoluted
way. The variable names suggest this was not intended, but no one has
ever reported it as broken, and some otherwise valid data files may
depend on this quirk.
D1 and D2 used logically equivalent code, but it was not the same text,
so the unification project split this with a `#ifdef`. Since the code
does the same thing in both games, combine it into a non-guarded
statement.
Two tests in series examined the object for a type of OBJ_ROBOT. Fold
the test together.
The next test also examines ->type. Move that to an else since it
cannot be true if the first test was true.
The segment list is written to `hit_data`, but `hit_data` goes out of
scope before the segment list is read back. Skip collecting it, since
it was effectively write-only on this path.