Use array<> for netgame_info members
This commit is contained in:
parent
d13e0c9840
commit
d0db98fe01
|
@ -521,23 +521,23 @@ struct netgame_info : prohibit_void_ptr<netgame_info>
|
|||
short ShowEnemyNames;
|
||||
short BrightPlayers;
|
||||
short InvulAppear;
|
||||
callsign_t team_name[2];
|
||||
int locations[MAX_PLAYERS];
|
||||
short kills[MAX_PLAYERS][MAX_PLAYERS];
|
||||
ushort segments_checksum;
|
||||
short team_kills[2];
|
||||
short killed[MAX_PLAYERS];
|
||||
short player_kills[MAX_PLAYERS];
|
||||
int KillGoal;
|
||||
fix PlayTimeAllowed;
|
||||
fix level_time;
|
||||
int control_invul_time;
|
||||
int monitor_vector;
|
||||
int player_score[MAX_PLAYERS];
|
||||
ubyte player_flags[MAX_PLAYERS];
|
||||
short PacketsPerSec;
|
||||
ubyte PacketLossPrevention;
|
||||
ubyte NoFriendlyFire;
|
||||
array<callsign_t, 2> team_name;
|
||||
array<uint32_t, MAX_PLAYERS> locations;
|
||||
array<array<uint16_t, MAX_PLAYERS>, MAX_PLAYERS> kills;
|
||||
array<uint16_t, 2> team_kills;
|
||||
array<uint16_t, MAX_PLAYERS> killed;
|
||||
array<uint16_t, MAX_PLAYERS> player_kills;
|
||||
array<uint32_t, MAX_PLAYERS> player_score;
|
||||
array<uint8_t, MAX_PLAYERS> player_flags;
|
||||
#ifdef USE_TRACKER
|
||||
ubyte Tracker;
|
||||
#endif
|
||||
|
|
|
@ -2264,7 +2264,11 @@ void net_udp_send_game_info(struct _sockaddr sender_addr, ubyte info_upid)
|
|||
PUT_INTEL_SHORT(buf + len, Netgame.ShowEnemyNames); len += 2;
|
||||
PUT_INTEL_SHORT(buf + len, Netgame.BrightPlayers); len += 2;
|
||||
PUT_INTEL_SHORT(buf + len, Netgame.InvulAppear); len += 2;
|
||||
memcpy(&buf[len], Netgame.team_name, 2*(CALLSIGN_LEN+1)); len += 2*(CALLSIGN_LEN+1);
|
||||
range_for (const auto &i, Netgame.team_name)
|
||||
{
|
||||
memcpy(&buf[len], static_cast<const char *>(i), (CALLSIGN_LEN+1));
|
||||
len += CALLSIGN_LEN + 1;
|
||||
}
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
{
|
||||
PUT_INTEL_INT(buf + len, Netgame.locations[i]); len += 4;
|
||||
|
@ -2464,7 +2468,11 @@ static void net_udp_process_game_info(ubyte *data, int data_len, struct _sockadd
|
|||
Netgame.ShowEnemyNames = GET_INTEL_SHORT(&(data[len])); len += 2;
|
||||
Netgame.BrightPlayers = GET_INTEL_SHORT(&(data[len])); len += 2;
|
||||
Netgame.InvulAppear = GET_INTEL_SHORT(&(data[len])); len += 2;
|
||||
memcpy(Netgame.team_name, &(data[len]), 2*(CALLSIGN_LEN+1)); len += 2*(CALLSIGN_LEN+1);
|
||||
range_for (auto &i, Netgame.team_name)
|
||||
{
|
||||
i.copy(reinterpret_cast<const char *>(&data[len]), (CALLSIGN_LEN+1));
|
||||
len += CALLSIGN_LEN + 1;
|
||||
}
|
||||
for (unsigned i = 0; i < MAX_PLAYERS; i++)
|
||||
{
|
||||
Netgame.locations[i] = GET_INTEL_INT(&(data[len])); len += 4;
|
||||
|
|
Loading…
Reference in a new issue