Fix harmless type mismatch
`get_weapon_id` must be called only on objects of type `OBJ_WEAPON`. One path in `multi_compute_kill` could call `get_weapon_id` on an object that is either a robot or a weapon. The code tested for a robot, but only after performing an access that assumed it had a weapon. Reorder the tests to prevent the type mismatch diagnostic. Reported-by: ryusei117 <https://github.com/dxx-rebirth/dxx-rebirth/issues/302#issuecomment-275546550>
This commit is contained in:
parent
8c706a88bd
commit
4881b7c57a
|
@ -781,8 +781,7 @@ static void multi_compute_kill(const objptridx_t killer, const vobjptridx_t kill
|
|||
else if ((killer_type != OBJ_PLAYER) && (killer_type != OBJ_GHOST))
|
||||
{
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
const auto killer_id = get_weapon_id(killer);
|
||||
if (killer_id == weapon_id_type::PMINE_ID && killer_type != OBJ_ROBOT)
|
||||
if (killer_type != OBJ_ROBOT && get_weapon_id(killer) == weapon_id_type::PMINE_ID)
|
||||
{
|
||||
if (killed_pnum == Player_num)
|
||||
HUD_init_message_literal(HM_MULTI, "You were killed by a mine!");
|
||||
|
|
Loading…
Reference in a new issue