Callers are expected to filter out invalid numbers. Even if they do
not, the only use of the number is to match entries in Stuck_objects.
An invalid match could cause a call to vobjptr() with an invalid index,
but that would be diagnosed by the valptridx checking, so no invalid
memory access will occur.
Many callers of kill_stuck_objects call it twice, once for each of two
walls. Move the flush_fcd_cache up to occur only once, rather than once
per wall.
After fixing the bogus lifeleft assignment, the D2 version is equivalent
to a more thorough version of the D1 version. Delete the D1 version and
use the D2 version for both games.
This assignment looks bogus. If the signature saved when the object
became stuck is different from the signature of the object currently
using that slot, then remove_obsolete_stuck_objects kills the object
using that slot. Signatures are defined to change when the object slot
is freed and reused. Therefore, this statement kills the new object
that took the slot of the obsolete object. This new object may be
important, such as a spawned robot or a weapon.
Locked doors, including the exit door, were permanently impassable in
Descent 1 because the door has state WALL_DOOR_OPENING even after it has
flags WALL_DOOR_OPENED.
Fixes: fd01d4c673 ("Reorder wall_is_doorway to favor likely results")
Reported by: zicodxx @ https://github.com/dxx-rebirth/dxx-rebirth/issues/40
Modifying a by-value temporary does not affect the underlying container,
so modifying it is almost always a bug. Require use of a by-reference
capture when modification is desired.
sed -i -e 's/range_for\s*(\s*\(const\s\+\)\?auto\s\+\([[:alpha:]_]\)/range_for (const auto \2/g'