Test that guided missile's parent is still a player

If a guided missile is in flight, and its owning player dies, the
player's type is changed to OBJ_GHOST.  The damage that killed the
player should have put the guided missile into autonomous mode, so for
this purpose, return that the missile is not actively guided.

Reported-by: Johnsondr80 <https://github.com/dxx-rebirth/dxx-rebirth/issues/437>
This commit is contained in:
Kp 2019-08-21 02:54:08 +00:00
parent 6d0cd8513e
commit 653a705e90

View file

@ -1579,7 +1579,10 @@ static bool is_active_guided_missile(d_level_unique_object_state &LevelUniqueObj
if (obj->ctype.laser_info.parent_type != OBJ_PLAYER)
return false;
auto &vcobjptr = LevelUniqueObjectState.get_objects().vcptr;
const auto pnum = get_player_id(vcobjptr(obj->ctype.laser_info.parent_num));
auto &parent_obj = *vcobjptr(obj->ctype.laser_info.parent_num);
if (parent_obj.type != OBJ_PLAYER)
return false;
const auto pnum = get_player_id(parent_obj);
return LevelUniqueObjectState.Guided_missile.get_player_active_guided_missile(pnum) == obj;
}
#endif