From bc8e37332c427fee0c06934f2a9be370bdbaf627 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 2 Feb 2013 17:32:46 +0900 Subject: [PATCH] Make qw's cl.players dynamically allocated. --- qw/include/client.h | 2 +- qw/source/cl_main.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qw/include/client.h b/qw/include/client.h index cd9591629..c9481f209 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -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; diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index dd73f987a..f3e07da90 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -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");