Replaced std::list with List class
authorDavid Anderson <dvander@alliedmods.net>
Fri Aug 12 17:33:59 2005 +0000 (2005-08-12)
changeset 977d3a2a8d5bf5
parent 96 e023f17b7b73
child 98 4c46acf7e76f
Replaced std::list with List class
sourcemm/CPlugin.cpp
sourcemm/CPlugin.h
sourcemm/ISmmPlugin.h
sourcemm/concommands.cpp
sourcemm/concommands.h
sourcemm/sourcemm.cpp
sourcemm/sourcemm.h
sourcemm/sourcemm.vcproj
     1.1 --- a/sourcemm/CPlugin.cpp	Fri Aug 12 17:33:31 2005 +0000
     1.2 +++ b/sourcemm/CPlugin.cpp	Fri Aug 12 17:33:59 2005 +0000
     1.3 @@ -389,7 +389,7 @@
     1.4  {
     1.5  	PluginIter i;
     1.6  
     1.7 -	std::list<SourceMM::CPluginManager::CPlugin *> remqueue;
     1.8 +	List<SourceMM::CPluginManager::CPlugin *> remqueue;
     1.9  
    1.10  	for (i=m_Plugins.begin(); i!=m_Plugins.end(); i++)
    1.11  		remqueue.push_back( (*i) );
    1.12 @@ -476,7 +476,7 @@
    1.13  
    1.14  void CPluginManager::UnregAllConCmds(CPlugin *pl)
    1.15  {
    1.16 -	std::list<ConCommandBase *>::iterator i;
    1.17 +	List<ConCommandBase *>::iterator i;
    1.18  
    1.19  	for (i=pl->m_Cvars.begin(); i!=pl->m_Cvars.end(); i++)
    1.20  		g_SMConVarAccessor.Unregister( (*i) );
     2.1 --- a/sourcemm/CPlugin.h	Fri Aug 12 17:33:31 2005 +0000
     2.2 +++ b/sourcemm/CPlugin.h	Fri Aug 12 17:33:59 2005 +0000
     2.3 @@ -21,8 +21,8 @@
     2.4  #include <convar.h>
     2.5  #include "IPluginManager.h"
     2.6  #include "oslink.h"
     2.7 -#include <list>
     2.8 -#include <string>
     2.9 +#include "smm_list.h"
    2.10 +#include "smm_string.h"
    2.11  
    2.12  /**
    2.13   * History of plugin versions: (M=min, C=current)
    2.14 @@ -30,10 +30,12 @@
    2.15   *    2: Added GetLogTag()
    2.16   *    3: Moved GetApiVersion() to top  (2005-04-16)
    2.17   *    4: Added AllPluginsLoaded() callback (2005-04-18)
    2.18 - * MC 5: Bumped version for SourceHook V4 (2005-05-01)
    2.19 + *    5: Bumped version for SourceHook V4 (2005-05-01)
    2.20 + *    6: Added functions for console printing (2005-05-26)
    2.21 + * MC 7: Changed template libraries (2005-08-11)
    2.22   */
    2.23  
    2.24 -#define PLAPI_MIN_VERSION	5
    2.25 +#define PLAPI_MIN_VERSION	6
    2.26  
    2.27  namespace SourceMM
    2.28  {
    2.29 @@ -52,14 +54,14 @@
    2.30  			CPlugin();
    2.31  		public:
    2.32  			PluginId m_Id;
    2.33 -			std::string m_File;
    2.34 +			String m_File;
    2.35  			Pl_Status m_Status;
    2.36  			PluginId m_Source;
    2.37  			ISmmPlugin *m_API;
    2.38  			HINSTANCE m_Lib;
    2.39  			factories fac_list;
    2.40 -			std::list<ConCommandBase *> m_Cvars;
    2.41 -			std::list<ConCommandBase *> m_Cmds;
    2.42 +			List<ConCommandBase *> m_Cvars;
    2.43 +			List<ConCommandBase *> m_Cmds;
    2.44  		};
    2.45  	public:
    2.46  		CPluginManager();
    2.47 @@ -100,8 +102,8 @@
    2.48  		bool Retry(PluginId id, char *error, size_t len);
    2.49  
    2.50  		//Internal iterators
    2.51 -		std::list<SourceMM::CPluginManager::CPlugin *>::iterator _begin();
    2.52 -		std::list<SourceMM::CPluginManager::CPlugin *>::iterator _end();
    2.53 +		List<SourceMM::CPluginManager::CPlugin *>::iterator _begin();
    2.54 +		List<SourceMM::CPluginManager::CPlugin *>::iterator _end();
    2.55  	private:
    2.56  		//These are identical internal functions for the wrappers above.
    2.57  		CPlugin *_Load(const char *file, PluginId source, char *error, size_t maxlen);
    2.58 @@ -111,12 +113,12 @@
    2.59  		void UnregAllConCmds(CPlugin *pl);
    2.60  	private:
    2.61  		PluginId m_LastId;
    2.62 -		std::list<CPlugin *> m_Plugins;
    2.63 +		List<CPlugin *> m_Plugins;
    2.64  		bool m_AllLoaded;
    2.65  	};
    2.66  };
    2.67  
    2.68 -typedef std::list<SourceMM::CPluginManager::CPlugin *>::iterator PluginIter;
    2.69 +typedef List<SourceMM::CPluginManager::CPlugin *>::iterator PluginIter;
    2.70  
    2.71  /** @brief Singleton for plugin manager */
    2.72  extern SourceMM::CPluginManager g_PluginMngr;
     3.1 --- a/sourcemm/ISmmPlugin.h	Fri Aug 12 17:33:31 2005 +0000
     3.2 +++ b/sourcemm/ISmmPlugin.h	Fri Aug 12 17:33:59 2005 +0000
     3.3 @@ -20,7 +20,7 @@
     3.4  #include <sourcehook/sourcehook.h>
     3.5  #include "ISmmAPI.h"
     3.6  
     3.7 -#define PLAPI_VERSION	6
     3.8 +#define PLAPI_VERSION	7
     3.9  #define PLAPI_NAME		"ISmmPlugin"
    3.10  
    3.11  struct factories
     4.1 --- a/sourcemm/concommands.cpp	Fri Aug 12 17:33:31 2005 +0000
     4.2 +++ b/sourcemm/concommands.cpp	Fri Aug 12 17:33:59 2005 +0000
     4.3 @@ -12,7 +12,8 @@
     4.4  #include "CSmmAPI.h"
     4.5  #include "concommands.h"
     4.6  #include "CPlugin.h"
     4.7 -#include <string>
     4.8 +#include "smm_string.h"
     4.9 +#include "smm_list.h"
    4.10  
    4.11  /**
    4.12   * @brief Console Command Implementations
    4.13 @@ -49,7 +50,7 @@
    4.14  
    4.15  void SMConVarAccessor::MarkCommandsAsGameDLL()
    4.16  {
    4.17 -	for (std::list<ConCommandBase*>::iterator iter = m_RegisteredCommands.begin();
    4.18 +	for (List<ConCommandBase*>::iterator iter = m_RegisteredCommands.begin();
    4.19  		iter != m_RegisteredCommands.end(); ++iter)
    4.20  	{
    4.21  		(*iter)->AddFlags(FCVAR_GAMEDLL);
    4.22 @@ -202,7 +203,7 @@
    4.23  					CONMSG("Plugin %d is not loaded.\n", id);
    4.24  				} else {
    4.25  					CONMSG("Console commands for %s:\n", pl->m_API->GetName());
    4.26 -					std::list<ConCommandBase *>::iterator ci;
    4.27 +					List<ConCommandBase *>::iterator ci;
    4.28  					size_t count = 0;
    4.29  
    4.30  					for (ci=pl->m_Cmds.begin(); ci!=pl->m_Cmds.end(); ci++)
    4.31 @@ -233,7 +234,7 @@
    4.32  					CONMSG("Plugin %d is not loaded.\n", id);
    4.33  				} else {
    4.34  					CONMSG("Registered cvars for %s:\n", pl->m_API->GetName());
    4.35 -					std::list<ConCommandBase *>::iterator ci;
    4.36 +					List<ConCommandBase *>::iterator ci;
    4.37  					size_t count = 0;
    4.38  
    4.39  					for (ci=pl->m_Cvars.begin(); ci!=pl->m_Cvars.end(); ci++)
    4.40 @@ -461,22 +462,6 @@
    4.41  	CONMSG("  version      - Version information\n");
    4.42  }
    4.43  
    4.44 -int UTIL_CmpNocase(const std::string &s1, const std::string &s2)
    4.45 -{
    4.46 -	std::string::const_iterator p1 = s1.begin();
    4.47 -	std::string::const_iterator p2 = s2.begin();
    4.48 -
    4.49 -	while (p1 != s1.end() && p2 != s2.end())
    4.50 -	{
    4.51 -		if(toupper(*p1) != toupper(*p2))
    4.52 -			return (toupper(*p1)<toupper(*p2)) ? -1 : 1;
    4.53 -		++p1;
    4.54 -		++p2;
    4.55 -	}
    4.56 -
    4.57 -	return (s2.size() == s1.size()) ? 0 : (s1.size() < s2.size()) ? -1 : 1;	// size is unsigned
    4.58 -}
    4.59 -
    4.60  CAlwaysRegisterableCommand::CAlwaysRegisterableCommand()
    4.61  {
    4.62  	Create("", NULL, FCVAR_UNREGISTERED|FCVAR_GAMEDLL);
    4.63 @@ -504,7 +489,7 @@
    4.64  
    4.65  	while (pPtr)
    4.66  	{
    4.67 -		if (pPtr == this && pPtr->IsCommand() && UTIL_CmpNocase(GetName(), pPtr->GetName()) == 0)
    4.68 +		if (pPtr == this && pPtr->IsCommand() && stricmp(GetName(), pPtr->GetName()) == 0)
    4.69  			break;
    4.70  		ConCommandBase *pPrev = NULL;
    4.71  		while (pPtr)
     5.1 --- a/sourcemm/concommands.h	Fri Aug 12 17:33:31 2005 +0000
     5.2 +++ b/sourcemm/concommands.h	Fri Aug 12 17:33:59 2005 +0000
     5.3 @@ -20,11 +20,11 @@
     5.4  #include <eiface.h>
     5.5  #include "sourcemm.h"
     5.6  #include <convar.h>
     5.7 -#include <list>
     5.8 +#include "smm_list.h"
     5.9  
    5.10  class SMConVarAccessor : public IConCommandBaseAccessor
    5.11  {
    5.12 -	std::list<ConCommandBase*> m_RegisteredCommands;
    5.13 +	List<ConCommandBase*> m_RegisteredCommands;
    5.14  public:
    5.15  	virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
    5.16  	bool Register(ConCommandBase *pCommand);
     6.1 --- a/sourcemm/sourcemm.cpp	Fri Aug 12 17:33:31 2005 +0000
     6.2 +++ b/sourcemm/sourcemm.cpp	Fri Aug 12 17:33:59 2005 +0000
     6.3 @@ -34,8 +34,8 @@
     6.4  EngineInfo g_Engine = {NULL, NULL, NULL, NULL};
     6.5  SourceHook::CSourceHookImpl g_SourceHook;
     6.6  SourceHook::ISourceHook *g_SHPtr;
     6.7 -std::string g_ModPath;
     6.8 -std::string g_BinPath;
     6.9 +String g_ModPath;
    6.10 +String g_BinPath;
    6.11  PluginId g_PLID = Pl_Console;		//Technically, SourceMM is the "Console" plugin... :p
    6.12  bool bInShutdown = false;
    6.13  bool bInFirstLevel = true;
     7.1 --- a/sourcemm/sourcemm.h	Fri Aug 12 17:33:31 2005 +0000
     7.2 +++ b/sourcemm/sourcemm.h	Fri Aug 12 17:33:59 2005 +0000
     7.3 @@ -78,10 +78,10 @@
     7.4  extern SourceHook::CSourceHookImpl g_SourceHook;
     7.5  
     7.6  /** @brief Mod path (important!)*/
     7.7 -extern std::string g_ModPath;
     7.8 +extern String g_ModPath;
     7.9  
    7.10  /** @brief Path to server binary */
    7.11 -extern std::string g_BinPath;
    7.12 +extern String g_BinPath;
    7.13  
    7.14  /** @brief Global variable for SourceHook macros */
    7.15  extern SourceHook::ISourceHook *g_SHPtr;
     8.1 --- a/sourcemm/sourcemm.vcproj	Fri Aug 12 17:33:31 2005 +0000
     8.2 +++ b/sourcemm/sourcemm.vcproj	Fri Aug 12 17:33:59 2005 +0000
     8.3 @@ -181,6 +181,15 @@
     8.4  				RelativePath=".\resource.h">
     8.5  			</File>
     8.6  			<File
     8.7 +				RelativePath=".\smm_list.h">
     8.8 +			</File>
     8.9 +			<File
    8.10 +				RelativePath=".\smm_string.h">
    8.11 +			</File>
    8.12 +			<File
    8.13 +				RelativePath=".\smm_vector.h">
    8.14 +			</File>
    8.15 +			<File
    8.16  				RelativePath=".\sourcemm.h">
    8.17  			</File>
    8.18  			<File