multi_do_escape: use player number from network layer

The network layer already has the player number.  Use that instead of
reloading it from the message body.
This commit is contained in:
Kp 2022-10-23 23:00:24 +00:00
parent 49698fbf86
commit 8fd6ff2025

View file

@ -1859,10 +1859,9 @@ static void multi_do_controlcen_destroy(const d_robot_info_array &Robot_info, fi
} }
} }
static void multi_do_escape(fvmobjptridx &vmobjptridx, const multiplayer_rspan<multiplayer_command_t::MULTI_ENDLEVEL_START> buf) static void multi_do_escape(fvmobjptridx &vmobjptridx, const playernum_t pnum, const multiplayer_rspan<multiplayer_command_t::MULTI_ENDLEVEL_START> buf)
{ {
digi_play_sample(SOUND_HUD_MESSAGE, F1_0); digi_play_sample(SOUND_HUD_MESSAGE, F1_0);
const playernum_t pnum = buf[1];
auto &plr = *vmplayerptr(pnum); auto &plr = *vmplayerptr(pnum);
const auto &&objnum = vmobjptridx(plr.objnum); const auto &&objnum = vmobjptridx(plr.objnum);
#if defined(DXX_BUILD_DESCENT_II) #if defined(DXX_BUILD_DESCENT_II)
@ -2554,6 +2553,7 @@ void multi_send_endlevel_start()
#endif #endif
{ {
multi_command<multiplayer_command_t::MULTI_ENDLEVEL_START> buf; multi_command<multiplayer_command_t::MULTI_ENDLEVEL_START> buf;
/* Obsolete - reclaim player number field on next multiplayer protocol version bump */
buf[1] = Player_num; buf[1] = Player_num;
#if defined(DXX_BUILD_DESCENT_I) #if defined(DXX_BUILD_DESCENT_I)
buf[2] = static_cast<uint8_t>(secret); buf[2] = static_cast<uint8_t>(secret);
@ -5723,7 +5723,7 @@ static void multi_process_data(const d_level_shared_robot_info_state &LevelShare
break; break;
#endif #endif
case multiplayer_command_t::MULTI_ENDLEVEL_START: case multiplayer_command_t::MULTI_ENDLEVEL_START:
multi_do_escape(vmobjptridx, multi_subspan_first<multiplayer_command_t::MULTI_ENDLEVEL_START>(data)); multi_do_escape(vmobjptridx, pnum, multi_subspan_first<multiplayer_command_t::MULTI_ENDLEVEL_START>(data));
break; break;
case multiplayer_command_t::MULTI_CLOAK: case multiplayer_command_t::MULTI_CLOAK:
multi_do_cloak(vmobjptr, pnum); multi_do_cloak(vmobjptr, pnum);