1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-20 13:54:14 +01:00

Replaced std::list with List class

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4098
This commit is contained in:
David Anderson 2005-08-12 17:33:59 +00:00
parent f73ef50b79
commit 05f9912d4e
8 changed files with 37 additions and 41 deletions

View File

@ -389,7 +389,7 @@ bool CPluginManager::UnloadAll()
{
PluginIter i;
std::list<SourceMM::CPluginManager::CPlugin *> remqueue;
List<SourceMM::CPluginManager::CPlugin *> remqueue;
for (i=m_Plugins.begin(); i!=m_Plugins.end(); i++)
remqueue.push_back( (*i) );
@ -476,7 +476,7 @@ void CPluginManager::RemovePluginCmd(ISmmPlugin *api, ConCommandBase *pCmd)
void CPluginManager::UnregAllConCmds(CPlugin *pl)
{
std::list<ConCommandBase *>::iterator i;
List<ConCommandBase *>::iterator i;
for (i=pl->m_Cvars.begin(); i!=pl->m_Cvars.end(); i++)
g_SMConVarAccessor.Unregister( (*i) );

View File

@ -21,8 +21,8 @@
#include <convar.h>
#include "IPluginManager.h"
#include "oslink.h"
#include <list>
#include <string>
#include "smm_list.h"
#include "smm_string.h"
/**
* History of plugin versions: (M=min, C=current)
@ -30,10 +30,12 @@
* 2: Added GetLogTag()
* 3: Moved GetApiVersion() to top (2005-04-16)
* 4: Added AllPluginsLoaded() callback (2005-04-18)
* MC 5: Bumped version for SourceHook V4 (2005-05-01)
* 5: Bumped version for SourceHook V4 (2005-05-01)
* 6: Added functions for console printing (2005-05-26)
* MC 7: Changed template libraries (2005-08-11)
*/
#define PLAPI_MIN_VERSION 5
#define PLAPI_MIN_VERSION 6
namespace SourceMM
{
@ -52,14 +54,14 @@ namespace SourceMM
CPlugin();
public:
PluginId m_Id;
std::string m_File;
String m_File;
Pl_Status m_Status;
PluginId m_Source;
ISmmPlugin *m_API;
HINSTANCE m_Lib;
factories fac_list;
std::list<ConCommandBase *> m_Cvars;
std::list<ConCommandBase *> m_Cmds;
List<ConCommandBase *> m_Cvars;
List<ConCommandBase *> m_Cmds;
};
public:
CPluginManager();
@ -100,8 +102,8 @@ namespace SourceMM
bool Retry(PluginId id, char *error, size_t len);
//Internal iterators
std::list<SourceMM::CPluginManager::CPlugin *>::iterator _begin();
std::list<SourceMM::CPluginManager::CPlugin *>::iterator _end();
List<SourceMM::CPluginManager::CPlugin *>::iterator _begin();
List<SourceMM::CPluginManager::CPlugin *>::iterator _end();
private:
//These are identical internal functions for the wrappers above.
CPlugin *_Load(const char *file, PluginId source, char *error, size_t maxlen);
@ -111,12 +113,12 @@ namespace SourceMM
void UnregAllConCmds(CPlugin *pl);
private:
PluginId m_LastId;
std::list<CPlugin *> m_Plugins;
List<CPlugin *> m_Plugins;
bool m_AllLoaded;
};
};
typedef std::list<SourceMM::CPluginManager::CPlugin *>::iterator PluginIter;
typedef List<SourceMM::CPluginManager::CPlugin *>::iterator PluginIter;
/** @brief Singleton for plugin manager */
extern SourceMM::CPluginManager g_PluginMngr;

View File

@ -20,7 +20,7 @@
#include <sourcehook/sourcehook.h>
#include "ISmmAPI.h"
#define PLAPI_VERSION 6
#define PLAPI_VERSION 7
#define PLAPI_NAME "ISmmPlugin"
struct factories

View File

@ -12,7 +12,8 @@
#include "CSmmAPI.h"
#include "concommands.h"
#include "CPlugin.h"
#include <string>
#include "smm_string.h"
#include "smm_list.h"
/**
* @brief Console Command Implementations
@ -49,7 +50,7 @@ bool SMConVarAccessor::Register(ConCommandBase *pCommand)
void SMConVarAccessor::MarkCommandsAsGameDLL()
{
for (std::list<ConCommandBase*>::iterator iter = m_RegisteredCommands.begin();
for (List<ConCommandBase*>::iterator iter = m_RegisteredCommands.begin();
iter != m_RegisteredCommands.end(); ++iter)
{
(*iter)->AddFlags(FCVAR_GAMEDLL);
@ -202,7 +203,7 @@ CON_COMMAND(meta, "Metamod:Source Menu")
CONMSG("Plugin %d is not loaded.\n", id);
} else {
CONMSG("Console commands for %s:\n", pl->m_API->GetName());
std::list<ConCommandBase *>::iterator ci;
List<ConCommandBase *>::iterator ci;
size_t count = 0;
for (ci=pl->m_Cmds.begin(); ci!=pl->m_Cmds.end(); ci++)
@ -233,7 +234,7 @@ CON_COMMAND(meta, "Metamod:Source Menu")
CONMSG("Plugin %d is not loaded.\n", id);
} else {
CONMSG("Registered cvars for %s:\n", pl->m_API->GetName());
std::list<ConCommandBase *>::iterator ci;
List<ConCommandBase *>::iterator ci;
size_t count = 0;
for (ci=pl->m_Cvars.begin(); ci!=pl->m_Cvars.end(); ci++)
@ -461,22 +462,6 @@ CON_COMMAND(meta, "Metamod:Source Menu")
CONMSG(" version - Version information\n");
}
int UTIL_CmpNocase(const std::string &s1, const std::string &s2)
{
std::string::const_iterator p1 = s1.begin();
std::string::const_iterator p2 = s2.begin();
while (p1 != s1.end() && p2 != s2.end())
{
if(toupper(*p1) != toupper(*p2))
return (toupper(*p1)<toupper(*p2)) ? -1 : 1;
++p1;
++p2;
}
return (s2.size() == s1.size()) ? 0 : (s1.size() < s2.size()) ? -1 : 1; // size is unsigned
}
CAlwaysRegisterableCommand::CAlwaysRegisterableCommand()
{
Create("", NULL, FCVAR_UNREGISTERED|FCVAR_GAMEDLL);
@ -504,7 +489,7 @@ void CAlwaysRegisterableCommand::BringToFront()
while (pPtr)
{
if (pPtr == this && pPtr->IsCommand() && UTIL_CmpNocase(GetName(), pPtr->GetName()) == 0)
if (pPtr == this && pPtr->IsCommand() && stricmp(GetName(), pPtr->GetName()) == 0)
break;
ConCommandBase *pPrev = NULL;
while (pPtr)

View File

@ -20,11 +20,11 @@
#include <eiface.h>
#include "sourcemm.h"
#include <convar.h>
#include <list>
#include "smm_list.h"
class SMConVarAccessor : public IConCommandBaseAccessor
{
std::list<ConCommandBase*> m_RegisteredCommands;
List<ConCommandBase*> m_RegisteredCommands;
public:
virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
bool Register(ConCommandBase *pCommand);

View File

@ -34,8 +34,8 @@ GameDllInfo g_GameDll = {false, NULL, NULL};
EngineInfo g_Engine = {NULL, NULL, NULL, NULL};
SourceHook::CSourceHookImpl g_SourceHook;
SourceHook::ISourceHook *g_SHPtr;
std::string g_ModPath;
std::string g_BinPath;
String g_ModPath;
String g_BinPath;
PluginId g_PLID = Pl_Console; //Technically, SourceMM is the "Console" plugin... :p
bool bInShutdown = false;
bool bInFirstLevel = true;

View File

@ -78,10 +78,10 @@ extern EngineInfo g_Engine;
extern SourceHook::CSourceHookImpl g_SourceHook;
/** @brief Mod path (important!)*/
extern std::string g_ModPath;
extern String g_ModPath;
/** @brief Path to server binary */
extern std::string g_BinPath;
extern String g_BinPath;
/** @brief Global variable for SourceHook macros */
extern SourceHook::ISourceHook *g_SHPtr;

View File

@ -180,6 +180,15 @@
<File
RelativePath=".\resource.h">
</File>
<File
RelativePath=".\smm_list.h">
</File>
<File
RelativePath=".\smm_string.h">
</File>
<File
RelativePath=".\smm_vector.h">
</File>
<File
RelativePath=".\sourcemm.h">
</File>