Make qw's cl.players dynamically allocated.

This commit is contained in:
Bill Currie 2013-02-02 17:32:46 +09:00
parent 13677bc5d3
commit bc8e37332c
2 changed files with 5 additions and 1 deletions

View file

@ -266,7 +266,7 @@ typedef struct {
int cdtrack; // cd audio
// all player information
player_info_t players[MAX_CLIENTS];
player_info_t *players;
lightstyle_t lightstyle[MAX_LIGHTSTYLES];
} client_state_t;

View file

@ -395,7 +395,10 @@ CL_ClearState (void)
// wipe the entire cl structure
if (cl.serverinfo)
Info_Destroy (cl.serverinfo);
if (cl.players)
free (cl.players);
memset (&cl, 0, sizeof (cl));
cl.players = calloc (MAX_CLIENTS, sizeof (player_info_t));
r_data->force_fullscreen = 0;
cl.maxclients = MAX_CLIENTS;
@ -1219,6 +1222,7 @@ CL_Init (void)
cls.downloadname = dstring_newstr ();
cls.downloadurl = dstring_newstr ();
cl.serverinfo = Info_ParseString ("", MAX_INFO_STRING, 0);
cl.players = calloc (MAX_CLIENTS, sizeof (player_info_t));
// register our commands
Cmd_AddCommand ("version", CL_Version_f, "Report version information");