Fix failure to remove expired walls
std::remove_if can be called on an iterator that returns a proxy object,
but the results of that call are not generally useful. When remove_if
attempts to move-assign over removed elements, it instead assigns over
the temporary proxy object. If the proxy object has typical move
semantics, move-assigning over it has no effect on the underlying
container.
Revert to using partial_range on the underlying container.
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/283>
Fixes: 1f434f98ad
("Use valptridx for ActiveDoors")
This commit is contained in:
parent
656d0879cc
commit
4a01fab66d
|
@ -1240,14 +1240,14 @@ namespace dsx {
|
||||||
void wall_frame_process()
|
void wall_frame_process()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
const auto &&r = make_range(vactdoorptr);
|
const auto &&r = partial_range(ActiveDoors, ActiveDoors.get_count());
|
||||||
auto &&i = std::remove_if(r.begin(), r.end(), ad_removal_predicate());
|
auto &&i = std::remove_if(r.begin(), r.end(), ad_removal_predicate());
|
||||||
ActiveDoors.set_count(std::distance(r.begin(), i));
|
ActiveDoors.set_count(std::distance(r.begin(), i));
|
||||||
}
|
}
|
||||||
#if defined(DXX_BUILD_DESCENT_II)
|
#if defined(DXX_BUILD_DESCENT_II)
|
||||||
if (Newdemo_state != ND_STATE_PLAYBACK)
|
if (Newdemo_state != ND_STATE_PLAYBACK)
|
||||||
{
|
{
|
||||||
const auto &&r = make_range(vclwallptr);
|
const auto &&r = partial_range(CloakingWalls, CloakingWalls.get_count());
|
||||||
cw_removal_predicate rp;
|
cw_removal_predicate rp;
|
||||||
std::remove_if(r.begin(), r.end(), std::ref(rp));
|
std::remove_if(r.begin(), r.end(), std::ref(rp));
|
||||||
CloakingWalls.set_count(rp.num_cloaking_walls);
|
CloakingWalls.set_count(rp.num_cloaking_walls);
|
||||||
|
|
Loading…
Reference in a new issue