Unify Maximum supported clients, raised SDKTools limit (bug 5964, r=psychonic).
authorKyle Sanderson <kyle.leet@gmail.com>
Tue May 06 18:40:35 2014 -0700 (2014-05-06)
changeset 4344c445c3266192
parent 4343 239f64929ce2
child 4345 2b9b95b41208
Unify Maximum supported clients, raised SDKTools limit (bug 5964, r=psychonic).
core/PlayerManager.cpp
core/smn_usermsgs.cpp
extensions/clientprefs/cookie.cpp
extensions/clientprefs/cookie.h
extensions/clientprefs/extension.h
extensions/sdktools/tenatives.cpp
extensions/sdktools/vnatives.cpp
extensions/sdktools/voice.cpp
extensions/sdktools/vsound.cpp
extensions/tf2/extension.h
extensions/topmenus/TopMenu.cpp
extensions/topmenus/TopMenu.h
public/IPlayerHelpers.h
     1.1 --- a/core/PlayerManager.cpp	Mon May 05 11:54:12 2014 -0400
     1.2 +++ b/core/PlayerManager.cpp	Tue May 06 18:40:35 2014 -0700
     1.3 @@ -285,11 +285,11 @@
     1.4  		/* Initialize all players */
     1.5  
     1.6  		m_PlayerCount = 0;
     1.7 -		m_Players = new CPlayer[ABSOLUTE_PLAYER_LIMIT + 1];
     1.8 -		m_AuthQueue = new unsigned int[ABSOLUTE_PLAYER_LIMIT + 1];
     1.9 +		m_Players = new CPlayer[SM_MAXPLAYERS + 1];
    1.10 +		m_AuthQueue = new unsigned int[SM_MAXPLAYERS + 1];
    1.11  		m_FirstPass = true;
    1.12  
    1.13 -		memset(m_AuthQueue, 0, sizeof(unsigned int) * (ABSOLUTE_PLAYER_LIMIT + 1));
    1.14 +		memset(m_AuthQueue, 0, sizeof(unsigned int) * (SM_MAXPLAYERS + 1));
    1.15  
    1.16  		g_NumPlayersToAuth = &m_AuthQueue[0];
    1.17  	}
     2.1 --- a/core/smn_usermsgs.cpp	Mon May 05 11:54:12 2014 -0400
     2.2 +++ b/core/smn_usermsgs.cpp	Tue May 06 18:40:35 2014 -0700
     2.3 @@ -47,7 +47,7 @@
     2.4  bf_read g_ReadBitBuf;
     2.5  #endif
     2.6  
     2.7 -int g_MsgPlayers[256];
     2.8 +int g_MsgPlayers[SM_MAXPLAYERS+1];
     2.9  bool g_IsMsgInExec = false;
    2.10  
    2.11  typedef List<MsgListenerWrapper *> MsgWrapperList;
     3.1 --- a/extensions/clientprefs/cookie.cpp	Mon May 05 11:54:12 2014 -0400
     3.2 +++ b/extensions/clientprefs/cookie.cpp	Tue May 06 18:40:35 2014 -0700
     3.3 @@ -37,7 +37,7 @@
     3.4  
     3.5  CookieManager::CookieManager()
     3.6  {
     3.7 -	for (int i=0; i<=MAXCLIENTS; i++)
     3.8 +	for (int i=0; i<=SM_MAXPLAYERS; i++)
     3.9  	{
    3.10  		connected[i] = false;
    3.11  		statsLoaded[i] = false;
     4.1 --- a/extensions/clientprefs/cookie.h	Mon May 05 11:54:12 2014 -0400
     4.2 +++ b/extensions/clientprefs/cookie.h	Tue May 06 18:40:35 2014 -0700
     4.3 @@ -73,13 +73,13 @@
     4.4  
     4.5  		dbid = -1;
     4.6  
     4.7 -		for (int i=0; i<=MAXCLIENTS; i++)
     4.8 +		for (int i=0; i<=SM_MAXPLAYERS; i++)
     4.9  			data[i] = NULL;
    4.10  	}
    4.11  
    4.12  	~Cookie()
    4.13  	{
    4.14 -		for (int i=0; i<=MAXCLIENTS; i++)
    4.15 +		for (int i=0; i<=SM_MAXPLAYERS; i++)
    4.16  		{
    4.17  			if (data[i] != NULL)
    4.18  				delete data[i];
    4.19 @@ -89,7 +89,7 @@
    4.20  	char name[MAX_NAME_LENGTH+1];
    4.21  	char description[MAX_DESC_LENGTH+1];
    4.22  	int dbid;
    4.23 -	CookieData *data[MAXCLIENTS+1];
    4.24 +	CookieData *data[SM_MAXPLAYERS+1];
    4.25  	CookieAccess access;
    4.26  
    4.27  	static inline bool matches(const char *name, const Cookie *cookie)
    4.28 @@ -133,11 +133,11 @@
    4.29  
    4.30  private:
    4.31  	NameHashSet<Cookie *> cookieFinder;
    4.32 -	SourceHook::List<CookieData *> clientData[MAXCLIENTS+1];
    4.33 +	SourceHook::List<CookieData *> clientData[SM_MAXPLAYERS+1];
    4.34  
    4.35 -	bool connected[MAXCLIENTS+1];
    4.36 -	bool statsLoaded[MAXCLIENTS+1];
    4.37 -	bool statsPending[MAXCLIENTS+1];
    4.38 +	bool connected[SM_MAXPLAYERS+1];
    4.39 +	bool statsLoaded[SM_MAXPLAYERS+1];
    4.40 +	bool statsPending[SM_MAXPLAYERS+1];
    4.41  };
    4.42  
    4.43  extern CookieManager g_CookieManager;
     5.1 --- a/extensions/clientprefs/extension.h	Mon May 05 11:54:12 2014 -0400
     5.2 +++ b/extensions/clientprefs/extension.h	Tue May 06 18:40:35 2014 -0700
     5.3 @@ -32,8 +32,6 @@
     5.4  #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
     5.5  #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
     5.6  
     5.7 -#define MAXCLIENTS 65
     5.8 -
     5.9  #include <stdlib.h>
    5.10  #include <stdarg.h>
    5.11  #include "smsdk_ext.h"
     6.1 --- a/extensions/sdktools/tenatives.cpp	Mon May 05 11:54:12 2014 -0400
     6.2 +++ b/extensions/sdktools/tenatives.cpp	Tue May 06 18:40:35 2014 -0700
     6.3 @@ -37,7 +37,7 @@
     6.4  
     6.5  CellRecipientFilter g_TERecFilter;
     6.6  TempEntityInfo *g_CurrentTE = NULL;
     6.7 -int g_TEPlayers[256];
     6.8 +int g_TEPlayers[SM_MAXPLAYERS+1];
     6.9  bool tenatives_initialized = false;
    6.10  
    6.11  /*************************
     7.1 --- a/extensions/sdktools/vnatives.cpp	Mon May 05 11:54:12 2014 -0400
     7.2 +++ b/extensions/sdktools/vnatives.cpp	Tue May 06 18:40:35 2014 -0700
     7.3 @@ -576,7 +576,7 @@
     7.4  	{
     7.5  		char name[48];
     7.6  		const char *sound_name;
     7.7 -		cell_t player_list[256], total_players = 0;
     7.8 +		cell_t player_list[SM_MAXPLAYERS], total_players = 0;
     7.9  		int maxClients = playerhelpers->GetMaxClients();
    7.10  
    7.11  		int r = (rand() % s_sound_count) + 1;
     8.1 --- a/extensions/sdktools/voice.cpp	Mon May 05 11:54:12 2014 -0400
     8.2 +++ b/extensions/sdktools/voice.cpp	Tue May 06 18:40:35 2014 -0700
     8.3 @@ -51,10 +51,10 @@
     8.4  	Listen_Yes,			/**< Can hear */
     8.5  };
     8.6  
     8.7 -size_t g_VoiceFlags[65];
     8.8 +size_t g_VoiceFlags[SM_MAXPLAYERS+1];
     8.9  size_t g_VoiceHookCount = 0;
    8.10 -ListenOverride g_VoiceMap[65][65];
    8.11 -bool g_ClientMutes[65][65];
    8.12 +ListenOverride g_VoiceMap[SM_MAXPLAYERS+1][SM_MAXPLAYERS+1];
    8.13 +bool g_ClientMutes[SM_MAXPLAYERS+1][SM_MAXPLAYERS+1];
    8.14  
    8.15  SH_DECL_HOOK3(IVoiceServer, SetClientListening, SH_NOATTRIB, 0, bool, int, int, bool);
    8.16  
     9.1 --- a/extensions/sdktools/vsound.cpp	Mon May 05 11:54:12 2014 -0400
     9.2 +++ b/extensions/sdktools/vsound.cpp	Tue May 06 18:40:35 2014 -0700
     9.3 @@ -308,11 +308,11 @@
     9.4  
     9.5  	for (iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); iter++)
     9.6  	{
     9.7 -		int players[64], size;
     9.8 +		int players[SM_MAXPLAYERS], size;
     9.9  		size = _FillInPlayers(players, &filter);
    9.10  		pFunc = (*iter);
    9.11  
    9.12 -		pFunc->PushArray(players, 64, SM_PARAM_COPYBACK);
    9.13 +		pFunc->PushArray(players, SM_ARRAYSIZE(players), SM_PARAM_COPYBACK);
    9.14  		pFunc->PushCellByRef(&size);
    9.15  		pFunc->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
    9.16  		pFunc->PushCellByRef(&iEntIndex);
    9.17 @@ -423,11 +423,11 @@
    9.18  
    9.19  	for (iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); iter++)
    9.20  	{
    9.21 -		int players[64], size;
    9.22 +		int players[SM_MAXPLAYERS], size;
    9.23  		size = _FillInPlayers(players, &filter);
    9.24  		pFunc = (*iter);
    9.25  
    9.26 -		pFunc->PushArray(players, 64, SM_PARAM_COPYBACK);
    9.27 +		pFunc->PushArray(players, SM_ARRAYSIZE(players), SM_PARAM_COPYBACK);
    9.28  		pFunc->PushCellByRef(&size);
    9.29  		pFunc->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
    9.30  		pFunc->PushCellByRef(&iEntIndex);
    10.1 --- a/extensions/tf2/extension.h	Mon May 05 11:54:12 2014 -0400
    10.2 +++ b/extensions/tf2/extension.h	Tue May 06 18:40:35 2014 -0700
    10.3 @@ -42,8 +42,6 @@
    10.4  #include <server_class.h>
    10.5  #include <igameevents.h>
    10.6  
    10.7 -#define MAXPLAYERS 65
    10.8 -
    10.9  /**
   10.10   * @brief Sample implementation of the SDK Extension.
   10.11   * Note: Uncomment one of the pre-defined virtual functions in order to use it.
    11.1 --- a/extensions/topmenus/TopMenu.cpp	Mon May 05 11:54:12 2014 -0400
    11.2 +++ b/extensions/topmenus/TopMenu.cpp	Tue May 06 18:40:35 2014 -0700
    11.3 @@ -93,7 +93,7 @@
    11.4  
    11.5  	size += m_Config.strings.GetMemTable()->GetMemUsage();
    11.6  	size += (m_Config.cats.size() * sizeof(int));
    11.7 -	size += (sizeof(topmenu_player_t) * (ABSOLUTE_PLAYER_LIMIT + 1));
    11.8 +	size += (sizeof(topmenu_player_t) * (SM_MAXPLAYERS + 1));
    11.9  	size += (m_SortedCats.size() * sizeof(unsigned int));
   11.10  	size += (m_UnsortedCats.size() * sizeof(unsigned int));
   11.11  	size += (m_Categories.size() * (sizeof(topmenu_category_t *) + sizeof(topmenu_category_t)));
   11.12 @@ -938,8 +938,8 @@
   11.13  void TopMenu::CreatePlayers(int max_clients)
   11.14  {
   11.15  	m_max_clients = max_clients;
   11.16 -	m_clients = (topmenu_player_t *)malloc(sizeof(topmenu_player_t) * (ABSOLUTE_PLAYER_LIMIT + 1));
   11.17 -	memset(m_clients, 0, sizeof(topmenu_player_t) * (ABSOLUTE_PLAYER_LIMIT + 1));
   11.18 +	m_clients = (topmenu_player_t *)malloc(sizeof(topmenu_player_t) * (SM_MAXPLAYERS + 1));
   11.19 +	memset(m_clients, 0, sizeof(topmenu_player_t) * (SM_MAXPLAYERS + 1));
   11.20  }
   11.21  
   11.22  void TopMenu::TearDownClient(topmenu_player_t *player)
    12.1 --- a/extensions/topmenus/TopMenu.h	Mon May 05 11:54:12 2014 -0400
    12.2 +++ b/extensions/topmenus/TopMenu.h	Tue May 06 18:40:35 2014 -0700
    12.3 @@ -42,8 +42,6 @@
    12.4  using namespace SourceHook;
    12.5  using namespace SourceMod;
    12.6  
    12.7 -#define ABSOLUTE_PLAYER_LIMIT 255  // not 256, so we can send the limit as a byte 
    12.8 -
    12.9  struct config_category_t
   12.10  {
   12.11  	int name;
    13.1 --- a/public/IPlayerHelpers.h	Mon May 05 11:54:12 2014 -0400
    13.2 +++ b/public/IPlayerHelpers.h	Tue May 06 18:40:35 2014 -0700
    13.3 @@ -49,6 +49,8 @@
    13.4  #define SM_REPLY_CONSOLE	0			/**< Reply to console. */
    13.5  #define SM_REPLY_CHAT		1			/**< Reply to chat. */
    13.6  
    13.7 +#define SM_MAXPLAYERS				65		/**< Maxplayer Count */
    13.8 +
    13.9  namespace SourceMod
   13.10  {
   13.11  	/**