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.
Commit 1a9fba804d made an incorrect simplification. It observed that
thief robots are not boss robots and vice versa, and from that changed:
```
if (is_thief) { drop_stolen_items(); }
if (is_boss) { start_boss_death_sequence(); }
else if (death_roll) { start_robot_death_sequence(); }
else { regular_death(); }
```
to
```
if (is_thief) { drop_stolen_items(); }
else if (is_boss) { start_boss_death_sequence(); }
else if (death_roll) { start_robot_death_sequence(); }
else { regular_death(); }
```
This was incorrect, because although a thief is not a boss, a thief does
need to proceed through the other non-boss if tests. This error caused
a thief not to explode on death, and instead continue to fly around and
absorb weapon fire.
Fix the logic error by removing the incorrect `else`, so that a thief
can be tested for is_boss, get false, and then proceed through the
non-boss death logic.
Fixes: 1a9fba804d ("Avoid repeated valptridx dereferences in multibot.cpp")
gcc-12 warns that the snprintf to initialize `tempname` may be
truncated. The variable is never used after it is initialized, so
delete the initialization and declaration.
Previously, the supplied pointer was converted to an array index, then
passed to valptridx::idx for validation. If the index_type is smaller
than std::size_t, this would truncate the value before validation.
Certain out-of-range indexes would be in-range after truncation, and
incorrectly not be reported.
Reorder the check to validate the index against the array size before
truncation.
Players are not robots, but the show-path cheat tried to pretend they
are, and triggered a BUG warning[1] when looking up robot information
from the player object. Fix this by passing in the robot_info when the
caller is providing a robot, and a named `nullptr` value (as
`create_path_unused_robot_info`) when the caller is providing a
non-robot object.
[1] As below, but repeated many times
```
similar/main/ai.cpp:1905: BUG: object 0x555555858550 has type 4, expected 2
similar/main/ai.cpp:1974: BUG: object 0x555555858550 has type 4, expected 2
```