Fix blank player names in multiplayer

Reading from Players[] while not in a game is not well-defined.  Get the
local player's callsign from InterfaceUniqueState instead.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/435>
Fixes: bea95ce1df ("Reset definedness of per-game globals on new game")
This commit is contained in:
Kp 2019-07-20 20:08:29 +00:00
parent 4759ad660f
commit 03130aac2c

View file

@ -1398,7 +1398,7 @@ void net_udp_init()
UDP_MData = {}; UDP_MData = {};
net_udp_noloss_init_mdata_queue(); net_udp_noloss_init_mdata_queue();
UDP_Seq.type = UPID_REQUEST; UDP_Seq.type = UPID_REQUEST;
UDP_Seq.player.callsign = get_local_player().callsign; UDP_Seq.player.callsign = InterfaceUniqueState.PilotName;
UDP_Seq.player.rank=GetMyNetRanking(); UDP_Seq.player.rank=GetMyNetRanking();
@ -4106,7 +4106,7 @@ void net_udp_read_sync_packet(const uint8_t * data, uint_fast32_t data_len, cons
// Discover my player number // Discover my player number
callsign_t temp_callsign = get_local_player().callsign; auto &temp_callsign = InterfaceUniqueState.PilotName;
Player_num = MULTI_PNUM_UNDEF; Player_num = MULTI_PNUM_UNDEF;