Fix partial_range exception sending game information

Netgame.players is [MAX_PLAYERS], not [MAX_PLAYERS+4].
This commit is contained in:
Kp 2014-08-09 04:13:46 +00:00
parent 104333391f
commit 125218aa5a

View file

@ -2224,7 +2224,7 @@ void net_udp_send_game_info(struct _sockaddr sender_addr, ubyte info_upid)
PUT_INTEL_SHORT(buf + len, DXX_VERSION_MAJORi); len += 2;
PUT_INTEL_SHORT(buf + len, DXX_VERSION_MINORi); len += 2;
PUT_INTEL_SHORT(buf + len, DXX_VERSION_MICROi); len += 2;
for (i = 0; i < MAX_PLAYERS+4; i++)
for (i = 0; i < MAX_PLAYERS; i++)
{
memcpy(&buf[len], Netgame.players[i].callsign, CALLSIGN_LEN+1); len += CALLSIGN_LEN+1;
buf[len] = Netgame.players[i].connected; len++;
@ -2435,7 +2435,7 @@ static void net_udp_process_game_info(ubyte *data, int data_len, struct _sockadd
Netgame.protocol.udp.program_iver[0] = GET_INTEL_SHORT(&(data[len])); len += 2;
Netgame.protocol.udp.program_iver[1] = GET_INTEL_SHORT(&(data[len])); len += 2;
Netgame.protocol.udp.program_iver[2] = GET_INTEL_SHORT(&(data[len])); len += 2;
range_for (auto &i, partial_range(Netgame.players, MAX_PLAYERS+4))
range_for (auto &i, Netgame.players)
{
i.callsign.copy_lower(reinterpret_cast<const char *>(&data[len]), CALLSIGN_LEN);
len += CALLSIGN_LEN+1;