Strip sourcehook containers (#2578)

This commit is contained in:
Benoist
2026-09-17 20:56:47 -04:00
committed by GitHub
parent 3723860af3
commit 82cd96aef6
94 changed files with 512 additions and 671 deletions
+5 -6
View File
@@ -29,13 +29,12 @@
#include <sp_vm_api.h>
#include <IExtensionSys.h>
#include <sh_vector.h>
#include <vector>
struct edict_t;
namespace SourceMod {
using namespace SourceHook;
using namespace SourcePawn;
class SMPlugin;
@@ -51,8 +50,8 @@ public:
virtual IExtension *GetExtensionFromIdent(IdentityToken_t *token) = 0;
virtual void BindChildPlugin(IExtension *ext, SMPlugin *plugin) = 0;
virtual void AddRawDependency(IExtension *myself, IdentityToken_t *token, void *iface) = 0;
virtual const CVector<IExtension *> *ListExtensions() = 0;
virtual void FreeExtensionList(const CVector<IExtension *> *list) = 0;
virtual const std::vector<IExtension *> *ListExtensions() = 0;
virtual void FreeExtensionList(const std::vector<IExtension *> *list) = 0;
virtual void CallOnCoreMapEnd() = 0;
};
@@ -67,13 +66,13 @@ public:
{
extensions_->FreeExtensionList(list_);
}
const CVector<IExtension *> *operator ->()
const std::vector<IExtension *> *operator ->()
{
return list_;
}
private:
IExtensionSys *extensions_;
const CVector<IExtension *> *list_;
const std::vector<IExtension *> *list_;
};
} // namespace SourceMod
+8 -9
View File
@@ -29,12 +29,11 @@
#include <sp_vm_api.h>
#include <IPluginSys.h>
#include <sh_vector.h>
#include <sh_string.h>
#include <vector>
#include <string>
namespace SourceMod {
using namespace SourceHook;
using namespace SourcePawn;
class IChangeableForward;
@@ -47,8 +46,8 @@ enum LibraryAction
struct AutoConfig
{
SourceHook::String autocfg;
SourceHook::String folder;
std::string autocfg;
std::string folder;
bool create;
};
@@ -81,8 +80,8 @@ public:
virtual SMPlugin *FindPluginByConsoleArg(const char *text) = 0;
virtual SMPlugin *FindPluginByHandle(Handle_t hndl, HandleError *errp) = 0;
virtual bool UnloadPlugin(IPlugin *plugin) = 0;
virtual const CVector<SMPlugin *> *ListPlugins() = 0;
virtual void FreePluginList(const CVector<SMPlugin *> *list) = 0;
virtual const std::vector<SMPlugin *> *ListPlugins() = 0;
virtual void FreePluginList(const std::vector<SMPlugin *> *list) = 0;
virtual void AddFunctionsToForward(const char *name, IChangeableForward *fwd) = 0;
};
@@ -97,13 +96,13 @@ public:
{
scripts_->FreePluginList(list_);
}
const CVector<SMPlugin *> *operator ->()
const std::vector<SMPlugin *> *operator ->()
{
return list_;
}
private:
IScriptManager *scripts_;
const CVector<SMPlugin *> *list_;
const std::vector<SMPlugin *> *list_;
};
} // namespace SourceMod
+10 -10
View File
@@ -76,7 +76,7 @@ void ConCmdManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *na
if (!m_Cmds.retrieve(name, &pInfo))
return;
CmdHookList::iterator iter = pInfo->hooks.begin();
auto iter = pInfo->hooks.begin();
while (iter != pInfo->hooks.end())
{
CmdHook *hook = *iter;
@@ -87,7 +87,7 @@ void ConCmdManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *na
// The list is guaranteed to exist.
PluginHookList *list;
pPlugin->GetProperty("CommandList", (void **)&list, false);
for (PluginHookList::iterator hiter = list->begin(); hiter != list->end(); hiter++)
for (auto hiter = list->begin(); hiter != list->end(); hiter++)
{
if (*hiter == hook)
{
@@ -112,7 +112,7 @@ void ConCmdManager::OnPluginDestroyed(IPlugin *plugin)
if (!plugin->GetProperty("CommandList", (void **)&pList, true))
return;
PluginHookList::iterator iter = pList->begin();
auto iter = pList->begin();
while (iter != pList->end())
{
CmdHook *hook = *iter;
@@ -163,7 +163,7 @@ ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int
}
cell_t result = type;
for (CmdHookList::iterator iter = pInfo->hooks.begin(); iter != pInfo->hooks.end(); iter++)
for (auto iter = pInfo->hooks.begin(); iter != pInfo->hooks.end(); iter++)
{
CmdHook *hook = *iter;
@@ -235,7 +235,7 @@ bool ConCmdManager::InternalDispatch(int client, const ICommandArgs *args)
: client;
int dedicatedClient = engine->IsDedicatedServer() ? 0 : g_Players.ListenClient();
for (CmdHookList::iterator iter = pInfo->hooks.begin(); iter != pInfo->hooks.end(); iter++)
for (auto iter = pInfo->hooks.begin(); iter != pInfo->hooks.end(); iter++)
{
CmdHook *hook = *iter;
@@ -398,7 +398,7 @@ void RegisterInPlugin(CmdHook *hook)
const char *orig = hook->info->pCmd->GetName();
/* Insert this into the help list, SORTED alphabetically. */
PluginHookList::iterator iter = pList->begin();
auto iter = pList->begin();
while (iter != pList->end())
{
const char *cmd = (*iter)->info->pCmd->GetName();
@@ -415,7 +415,7 @@ void RegisterInPlugin(CmdHook *hook)
void ConCmdManager::AddToCmdList(ConCmdInfo *info)
{
List<ConCmdInfo *>::iterator iter = m_CmdList.begin();
auto iter = m_CmdList.begin();
ConCmdInfo *pInfo;
bool inserted = false;
const char *orig = NULL;
@@ -451,7 +451,7 @@ void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, Flag
if (!m_Cmds.retrieve(cmd, &pInfo))
return;
for (CmdHookList::iterator iter = pInfo->hooks.begin(); iter != pInfo->hooks.end(); iter++)
for (auto iter = pInfo->hooks.begin(); iter != pInfo->hooks.end(); iter++)
{
if (!iter->admin)
continue;
@@ -471,7 +471,7 @@ void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, Flag
RefPtr<CommandGroup> group(r->value);
for (PluginHookList::iterator iter = group->hooks.begin(); iter != group->hooks.end(); iter++)
for (auto iter = group->hooks.begin(); iter != group->hooks.end(); iter++)
{
CmdHook *hook = *iter;
if (!remove)
@@ -613,7 +613,7 @@ void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
const char *help;
UTIL_ConsolePrint("[SM] Listing commands for: %s", plname);
UTIL_ConsolePrint(" %-17.16s %-8.7s %s", "[Name]", "[Type]", "[Help]");
for (PluginHookList::iterator iter = pList->begin(); iter != pList->end(); iter++)
for (auto iter = pList->begin(); iter != pList->end(); iter++)
{
CmdHook *hook = *iter;
if (hook->type == CmdHook::Server)
+4 -6
View File
@@ -43,16 +43,14 @@
#include "sm_globals.h"
#include "sourcemm_api.h"
#include <IForwardSys.h>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include <IRootConsoleMenu.h>
#include <IAdminSystem.h>
#include "concmd_cleaner.h"
#include "GameHooks.h"
#include <sm_namehashset.h>
using namespace SourceHook;
struct CmdHook;
struct ConCmdInfo;
@@ -137,7 +135,7 @@ struct ConCmdInfo
};
};
typedef List<ConCmdInfo *> ConCmdList;
typedef std::list<ConCmdInfo *> ConCmdList;
class ConCmdManager :
public SMGlobalClass,
@@ -180,7 +178,7 @@ private:
bool CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin);
ConCmdInfo *FindInTrie(const char *name);
public:
inline const List<ConCmdInfo *> & GetCommandList()
inline const std::list<ConCmdInfo *> & GetCommandList()
{
return m_CmdList;
}
+12 -14
View File
@@ -30,7 +30,7 @@
#include "ConVarManager.h"
#include "HalfLife2.h"
#include "sm_stringutil.h"
#include <sh_vector.h>
#include <vector>
#include <sm_namehashset.h>
#include "logic_bridge.h"
#include "sourcemod.h"
@@ -40,7 +40,7 @@
ConVarManager g_ConVarManager;
const ParamType CONVARCHANGE_PARAMS[] = {Param_Cell, Param_String, Param_String};
typedef List<const ConVar *> ConVarList;
typedef std::list<const ConVar *> ConVarList;
NameHashSet<ConVarInfo *, ConVarInfo::ConVarPolicy> convar_cache;
enum {
@@ -114,7 +114,7 @@ void ConVarManager::OnSourceModAllInitialized()
void ConVarManager::OnSourceModShutdown()
{
List<ConVarInfo *>::iterator iter = m_ConVars.begin();
auto iter = m_ConVars.begin();
HandleSecurity sec(NULL, g_pCoreIdent);
/* Iterate list of ConVarInfo structures, remove every one of them */
@@ -217,7 +217,7 @@ void ConVarManager::OnPluginUnloaded(IPlugin *plugin)
}
/* Clear any references to this plugin as the convar creator */
for (List<ConVarInfo *>::iterator iter = m_ConVars.begin(); iter != m_ConVars.end(); ++iter)
for (auto iter = m_ConVars.begin(); iter != m_ConVars.end(); ++iter)
{
ConVarInfo *pInfo = (*iter);
@@ -230,7 +230,7 @@ void ConVarManager::OnPluginUnloaded(IPlugin *plugin)
const IPluginRuntime * pRuntime = plugin->GetRuntime();
/* Remove convar queries for this plugin that haven't returned results yet */
for (List<ConVarQuery>::iterator iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end();)
for (auto iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end();)
{
ConVarQuery &query = (*iter);
if (query.pCallback->GetParentRuntime() == pRuntime)
@@ -246,7 +246,7 @@ void ConVarManager::OnPluginUnloaded(IPlugin *plugin)
void ConVarManager::OnClientDisconnected(int client)
{
/* Remove convar queries for this client that haven't returned results yet */
for (List<ConVarQuery>::iterator iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end();)
for (auto iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end();)
{
ConVarQuery &query = (*iter);
if (query.client == client)
@@ -311,7 +311,6 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
const char *plname = IS_STR_FILLED(plinfo->name) ? plinfo->name : plugin->GetFilename();
ConVarList *pConVarList;
ConVarList::iterator iter;
/* If no convar list... */
if (!plugin->GetProperty("ConVarList", (void **)&pConVarList))
@@ -327,7 +326,7 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
}
/* Iterate convar list and display/reset each one */
for (iter = pConVarList->begin(); iter != pConVarList->end(); iter++)
for (auto iter = pConVarList->begin(); iter != pConVarList->end(); iter++)
{
/*const */ConVar *pConVar = const_cast<ConVar *>(*iter);
if (!wantReset)
@@ -589,7 +588,6 @@ QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char
void ConVarManager::AddConVarToPluginList(IPlugin *plugin, const ConVar *pConVar)
{
ConVarList *pConVarList;
ConVarList::iterator iter;
bool inserted = false;
const char *orig = pConVar->GetName();
@@ -599,14 +597,14 @@ void ConVarManager::AddConVarToPluginList(IPlugin *plugin, const ConVar *pConVar
pConVarList = new ConVarList();
plugin->SetProperty("ConVarList", pConVarList);
}
else if (pConVarList->find(pConVar) != pConVarList->end())
else if (std::find(pConVarList->begin(), pConVarList->end(), pConVar) != pConVarList->end())
{
/* If convar is already in list, then don't add it */
return;
}
/* Insert convar into list which is sorted alphabetically */
for (iter = pConVarList->begin(); iter != pConVarList->end(); iter++)
for (auto iter = pConVarList->begin(); iter != pConVarList->end(); iter++)
{
if (strcmp(orig, (*iter)->GetName()) < 0)
{
@@ -678,9 +676,9 @@ void ConVarManager::OnClientQueryFinished(QueryCvarCookie_t cookie,
{
IPluginFunction *pCallback = NULL;
cell_t value = 0;
List<ConVarQuery>::iterator iter;
for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end(); iter++)
auto iter = m_ConVarQueries.begin();
for (; iter != m_ConVarQueries.end(); iter++)
{
ConVarQuery &query = (*iter);
if (query.cookie == cookie)
@@ -691,7 +689,7 @@ void ConVarManager::OnClientQueryFinished(QueryCvarCookie_t cookie,
}
}
if (pCallback)
if (pCallback && iter != m_ConVarQueries.end())
{
cell_t ret;
+4 -6
View File
@@ -34,7 +34,7 @@
#include "sm_globals.h"
#include "sourcemm_api.h"
#include <sh_list.h>
#include <list>
#include <IPluginSys.h>
#include <IForwardSys.h>
#include <IHandleSys.h>
@@ -45,8 +45,6 @@
#include "PlayerManager.h"
#include <sm_hashmap.h>
using namespace SourceHook;
class IConVarChangeListener
{
public:
@@ -63,7 +61,7 @@ struct ConVarInfo
IChangeableForward *pChangeForward; /**< Forward associated with convar */
ConVar *pVar; /**< The actual convar */
IPlugin *pPlugin; /**< Originally owning plugin */
List<IConVarChangeListener *> changeListeners;
std::list<IConVarChangeListener *> changeListeners;
struct ConVarPolicy
{
@@ -175,8 +173,8 @@ private:
static void AddConVarToPluginList(IPlugin *plugin, const ConVar *pConVar);
private:
HandleType_t m_ConVarType;
List<ConVarInfo *> m_ConVars;
List<ConVarQuery> m_ConVarQueries;
std::list<ConVarInfo *> m_ConVars;
std::list<ConVarQuery> m_ConVarQueries;
};
extern ConVarManager g_ConVarManager;
+3 -3
View File
@@ -76,7 +76,7 @@ class GenericCommandHooker : public IConCommandLinkListener
int hook;
unsigned int refcount;
};
CVector<HackInfo> vtables;
std::vector<HackInfo> vtables;
bool enabled;
SourceHook::MemFuncInfo dispatch;
@@ -144,7 +144,7 @@ class GenericCommandHooker : public IConCommandLinkListener
vtables[i].refcount = 0;
for (ConCommandBaseIterator iter; iter.IsValid(); iter.Next())
MakeHookable(iter.Get());
CVector<HackInfo>::iterator iter = vtables.begin();
auto iter = vtables.begin();
while (iter != vtables.end())
{
if ((*iter).refcount)
@@ -191,7 +191,7 @@ class GenericCommandHooker : public IConCommandLinkListener
if (vtables[index].refcount == 0)
{
SH_REMOVE_HOOK_ID(vtables[index].hook);
vtables.erase(vtables.iterAt(index));
vtables.erase(vtables.begin() + index);
}
}
+8 -10
View File
@@ -41,13 +41,11 @@
#include <sourcemod_version.h>
#include <amtl/os/am-path.h>
#include <amtl/os/am-fsutil.h>
#include <sh_list.h>
#include <list>
#include <IForwardSys.h>
#include <bridge/include/IScriptManager.h>
#include <bridge/include/ILogger.h>
using namespace SourceHook;
#ifdef PLATFORM_WINDOWS
ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
@@ -399,9 +397,9 @@ inline bool SM_CvarExistsInConfig(ke::HashMap<std::string, std::string, StringPo
return cvars.find(cvar_name).found();
}
bool SM_CvarExistsInPlugin(List<const ConVar *> &convars, const char *cvar_name)
bool SM_CvarExistsInPlugin(std::list<const ConVar *> &convars, const char *cvar_name)
{
for (List<const ConVar *>::iterator iter = convars.begin(); iter != convars.end(); iter++)
for (auto iter = convars.begin(); iter != convars.end(); iter++)
{
const ConVar *cvar = (*iter);
#if SOURCE_ENGINE >= SE_ORANGEBOX
@@ -425,7 +423,7 @@ bool SM_CvarExistsInPlugin(List<const ConVar *> &convars, const char *cvar_name)
bool SM_ConfigCheckRegeneration(
const char *file,
ke::HashMap<std::string, std::string, StringPolicy> &existing_cvars,
List<const ConVar *> &convars)
std::list<const ConVar *> &convars)
{
FILE *fp = fopen(file, "rt");
if (!fp)
@@ -438,7 +436,7 @@ bool SM_ConfigCheckRegeneration(
fclose(fp);
/* #1. Check if the plugin's cvar list has a cvar that doesn't exist in the config file. */
for (List<const ConVar *>::iterator iter = convars.begin(); iter != convars.end(); iter++)
for (auto iter = convars.begin(); iter != convars.end(); iter++)
{
const ConVar *cvar = (*iter);
#if SOURCE_ENGINE >= SE_ORANGEBOX
@@ -478,7 +476,7 @@ inline void SM_ExecuteConfigFile(const char *file)
bool SM_GenerateConfigFile(
IPlugin *pl,
const char *file,
List<const ConVar *> &convars,
std::list<const ConVar *> &convars,
bool needs_regeneration = false,
ke::HashMap<std::string, std::string, StringPolicy> *existing_cvars = NULL)
{
@@ -510,7 +508,7 @@ bool SM_GenerateConfigFile(
fprintf(fp, "\n\n");
float x;
for (List<const ConVar *>::iterator iter = convars.begin(); iter != convars.end(); iter++)
for (auto iter = convars.begin(); iter != convars.end(); iter++)
{
const ConVar *cvar = (*iter);
#if SOURCE_ENGINE >= SE_ORANGEBOX
@@ -683,7 +681,7 @@ bool SM_ExecuteConfig(IPlugin *pl, AutoConfig *cfg, bool can_create)
return can_create;
}
List<const ConVar *> *convars = NULL;
std::list<const ConVar *> *convars = NULL;
if (!pl->GetProperty("ConVarList", (void **)&convars, false) || !convars)
{
if (file_exists)
+8 -11
View File
@@ -41,7 +41,7 @@ EventManager g_EventManager;
SH_DECL_HOOK2(IGameEventManager2, FireEvent, SH_NOATTRIB, 0, bool, IGameEvent *, bool);
const ParamType GAMEEVENT_PARAMS[] = {Param_Cell, Param_String, Param_Cell};
typedef List<EventHook *> EventHookList;
typedef std::list<EventHook *> EventHookList;
class EventForwardFilter : public IForwardFilter
{
@@ -64,13 +64,10 @@ EventManager::EventManager() : m_EventType(0)
EventManager::~EventManager()
{
/* Free memory used by EventInfo structs if any */
CStack<EventInfo *>::iterator iter;
for (iter = m_FreeEvents.begin(); iter != m_FreeEvents.end(); iter++)
{
delete (*iter);
while (!m_FreeEvents.empty()) {
delete m_FreeEvents.top();
m_FreeEvents.pop();
}
m_FreeEvents.popall();
}
void EventManager::OnSourceModAllInitialized()
@@ -306,7 +303,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
}
/* Make sure the event was actually being hooked */
if (pHookList->find(pHook) == pHookList->end())
if (std::find(pHookList->begin(), pHookList->end(), pHook) == pHookList->end())
{
return EventHookErr_NotActive;
}
@@ -335,7 +332,7 @@ EventInfo *EventManager::CreateEvent(IPluginContext *pContext, const char *name,
{
pInfo = new EventInfo();
} else {
pInfo = m_FreeEvents.front();
pInfo = m_FreeEvents.top();
m_FreeEvents.pop();
}
@@ -464,7 +461,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
RETURN_META_VALUE(MRES_IGNORED, false);
}
pHook = m_EventStack.front();
pHook = m_EventStack.top();
if (pHook != NULL)
{
@@ -475,7 +472,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
if (pHook->postCopy)
{
info.bDontBroadcast = bDontBroadcast;
info.pEvent = m_EventCopies.front();
info.pEvent = m_EventCopies.top();
info.pOwner = NULL;
hndl = handlesys->CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
+5 -7
View File
@@ -35,16 +35,14 @@
#include "sm_globals.h"
#include "sourcemm_api.h"
#include <sm_namehashset.h>
#include <sh_list.h>
#include <sh_stack.h>
#include <list>
#include <stack>
#include <IHandleSys.h>
#include <IForwardSys.h>
#include <IPluginSys.h>
class IClient;
using namespace SourceHook;
struct EventInfo
{
EventInfo()
@@ -140,9 +138,9 @@ private: // IGameEventManager2 hooks
private:
HandleType_t m_EventType;
NameHashSet<EventHook *> m_EventHooks;
CStack<EventInfo *> m_FreeEvents;
CStack<EventHook *> m_EventStack;
CStack<IGameEvent *> m_EventCopies;
std::stack<EventInfo *> m_FreeEvents;
std::stack<EventHook *> m_EventStack;
std::stack<IGameEvent *> m_EventCopies;
};
extern EventManager g_EventManager;
+4 -4
View File
@@ -827,7 +827,7 @@ void CHalfLife2::AddToFakeCliCmdQueue(int client, int userid, const char *cmd)
{
pFake = new DelayedFakeCliCmd;
} else {
pFake = m_FreeCmds.front();
pFake = m_FreeCmds.top();
m_FreeCmds.pop();
}
@@ -923,7 +923,7 @@ const ICommandArgs *CHalfLife2::PeekCommandStack()
return NULL;
}
return m_CommandStack.front().args;
return m_CommandStack.top().args;
}
void CHalfLife2::PopCommandStack()
@@ -934,9 +934,9 @@ void CHalfLife2::PopCommandStack()
const char *CHalfLife2::CurrentCommandName()
{
#if SOURCE_ENGINE >= SE_ORANGEBOX
return m_CommandStack.front().args->Arg(0);
return m_CommandStack.top().args->Arg(0);
#else
return m_CommandStack.front().cmd;
return m_CommandStack.top().cmd;
#endif
}
+5 -7
View File
@@ -32,9 +32,8 @@
#ifndef _INCLUDE_SOURCEMOD_CHALFLIFE2_H_
#define _INCLUDE_SOURCEMOD_CHALFLIFE2_H_
#include <sh_list.h>
#include <sh_string.h>
#include <sh_tinyhash.h>
#include <list>
#include <string>
#include <am-utility.h>
#include <am-hashset.h>
#include <am-hashmap.h>
@@ -54,7 +53,6 @@ namespace SourceMod {
class ICommandArgs;
} // namespace SourceMod
using namespace SourceHook;
using namespace SourceMod;
static const int ENTREF_MASK = (1 << 31);
@@ -153,7 +151,7 @@ typedef NameHashSet<DataMapCacheInfo> DataMapCache;
struct DelayedFakeCliCmd
{
String cmd;
std::string cmd;
int client;
int userid;
};
@@ -288,8 +286,8 @@ private:
int m_SayTextMsg;
int m_VGUIMenu;
Queue<DelayedFakeCliCmd *> m_CmdQueue;
CStack<DelayedFakeCliCmd *> m_FreeCmds;
CStack<CachedCommandInfo> m_CommandStack;
std::stack<DelayedFakeCliCmd *> m_FreeCmds;
std::stack<CachedCommandInfo> m_CommandStack;
Queue<DelayedKickInfo> m_DelayedKicks;
void *m_pGetCommandLine;
#if SOURCE_ENGINE == SE_CSGO
+4 -5
View File
@@ -33,14 +33,13 @@
#define _INCLUDE_SOURCEMOD_MENUMANAGER_H_
#include <IMenuManager.h>
#include <sh_vector.h>
#include <sh_stack.h>
#include <sh_list.h>
#include <vector>
#include <stack>
#include <list>
#include "sm_globals.h"
#include <string>
using namespace SourceMod;
using namespace SourceHook;
class MenuManager :
public IMenuManager,
@@ -102,7 +101,7 @@ protected:
private:
int m_ShowMenu;
IMenuStyle *m_pDefaultStyle;
CVector<IMenuStyle *> m_Styles;
std::vector<IMenuStyle *> m_Styles;
HandleType_t m_StyleType;
HandleType_t m_MenuType;
std::string m_SelectSound = "";
+2 -2
View File
@@ -144,7 +144,7 @@ void CRadioStyle::OnSourceModShutdown()
while (!m_FreeDisplays.empty())
{
delete m_FreeDisplays.front();
delete m_FreeDisplays.top();
m_FreeDisplays.pop();
}
}
@@ -261,7 +261,7 @@ CRadioDisplay *CRadioStyle::MakeRadioDisplay(CRadioMenu *menu)
}
else
{
display = m_FreeDisplays.front();
display = m_FreeDisplays.top();
m_FreeDisplays.pop();
display->Reset();
}
+5 -5
View File
@@ -39,8 +39,8 @@
#include <IPlayerHelpers.h>
#include "UserMessages.h"
#include "sm_fastlink.h"
#include <sh_stack.h>
#include <sh_string.h>
#include <stack>
#include <string>
#include <compat_wrappers.h>
#include "logic/common_logic.h"
#include "AutoHandleRooter.h"
@@ -106,7 +106,7 @@ public:
CRadioMenuPlayer *GetRadioMenuPlayer(int client);
private:
CRadioMenuPlayer *m_players;
CStack<CRadioDisplay *> m_FreeDisplays;
std::stack<CRadioDisplay *> m_FreeDisplays;
};
class CRadioDisplay : public IMenuPanel
@@ -133,8 +133,8 @@ public: //IMenuPanel
unsigned int GetApproxMemUsage();
bool DirectSet(const char *str);
private:
String m_BufferText;
String m_Title;
std::string m_BufferText;
std::string m_Title;
unsigned int m_NextPos;
int keys;
};
+1 -1
View File
@@ -40,7 +40,7 @@ SH_DECL_HOOK4_void(IServerPluginHelpers, CreateMessage, SH_NOATTRIB, false, edic
ValveMenuStyle g_ValveMenuStyle;
extern const char *g_OptionNumTable[];
extern const char *g_OptionCmdTable[];
CallClass<IServerPluginHelpers> *g_pSPHCC = NULL;
SourceHook::CallClass<IServerPluginHelpers> *g_pSPHCC = NULL;
ValveMenuStyle::ValveMenuStyle() : m_players(new CValveMenuPlayer[256+1])
{
+2 -3
View File
@@ -34,11 +34,10 @@
#include <IMenuManager.h>
#include <IPlayerHelpers.h>
#include <sh_vector.h>
#include <vector>
#include "sm_globals.h"
#include <TimerSys.h>
using namespace SourceHook;
using namespace SourceMod;
class VoteMenuHandler :
@@ -97,7 +96,7 @@ private:
unsigned int m_Clients;
unsigned int m_TotalClients;
unsigned int m_Items;
CVector<unsigned int> m_Votes;
std::vector<unsigned int> m_Votes;
IBaseMenu *m_pCurMenu;
bool m_bStarted;
bool m_bCancelled;
+3 -4
View File
@@ -82,8 +82,7 @@ void NextMapManager::OnSourceModShutdown()
SH_REMOVE_HOOK(ConCommand, Dispatch, changeLevelCmd, SH_STATIC(CmdChangeLevelCallback), false);
}
SourceHook::List<MapChangeData *>::iterator iter;
iter = m_mapHistory.begin();
auto iter = m_mapHistory.begin();
while (iter != m_mapHistory.end())
{
@@ -186,7 +185,7 @@ void NextMapManager::OnSourceModLevelChange( const char *mapName )
historydiff = (m_mapHistory.size() * -1);
}
for (SourceHook::List<MapChangeData *>::iterator iter = m_mapHistory.begin(); historydiff++ < 0; iter = m_mapHistory.erase(iter))
for (auto iter = m_mapHistory.begin(); historydiff++ < 0; iter = m_mapHistory.erase(iter))
{
delete (MapChangeData *)*iter;
}
@@ -213,7 +212,7 @@ void NextMapManager::ForceChangeLevel( const char *mapName, const char* changeRe
NextMapManager::NextMapManager()
{
m_tempChangeInfo = MapChangeData();
m_mapHistory = SourceHook::List<MapChangeData *>();
m_mapHistory = std::list<MapChangeData *>();
}
#if SOURCE_ENGINE >= SE_ORANGEBOX
+2 -2
View File
@@ -34,7 +34,7 @@
#include "sm_globals.h"
#include <eiface.h>
#include "sh_list.h"
#include <list>
#include "sm_stringutil.h"
#include <amtl/am-string.h>
@@ -92,7 +92,7 @@ public:
#endif
public:
SourceHook::List<MapChangeData *> m_mapHistory;
std::list<MapChangeData *> m_mapHistory;
private:
MapChangeData m_tempChangeInfo;
+18 -31
View File
@@ -65,7 +65,7 @@ IForward *ServerExitHibernation = NULL;
const unsigned int *g_NumPlayersToAuth = NULL;
int lifestate_offset = -1;
List<ICommandTargetProcessor *> target_processors;
std::list<ICommandTargetProcessor *> target_processors;
ConVar sm_debug_connect("sm_debug_connect", "1", 0, "Log Debug information about potential connection issues.");
@@ -348,8 +348,7 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
m_onActivate->Execute(NULL);
m_onActivate2->Execute(NULL);
List<IClientListener *>::iterator iter;
for (iter = m_hooks.begin(); iter != m_hooks.end(); iter++)
for (auto iter = m_hooks.begin(); iter != m_hooks.end(); iter++)
{
if ((*iter)->GetClientListenerVersion() >= 5)
{
@@ -451,9 +450,8 @@ void PlayerManager::RunAuthChecks()
const char *steamId = pPlayer->GetSteam2Id();
/* Send to extensions */
List<IClientListener *>::iterator iter;
IClientListener *pListener;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnClientAuthorized(client, steamId ? steamId : authstr);
@@ -565,9 +563,8 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
pPlayer->m_OriginalLangId = pPlayer->m_LangId;
}
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
if (!pListener->InterceptClientConnect(client, reject, maxrejectlen))
@@ -611,9 +608,8 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
if (orig_value)
{
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnClientConnected(client);
@@ -726,9 +722,8 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
/* :TODO: kick the bot if it's rejected */
return;
}
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnClientConnected(client);
@@ -748,7 +743,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
const char *steamId = pPlayer->GetSteam2Id();
/* Now do authorization */
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnClientAuthorized(client, steamId ? steamId : pPlayer->m_AuthID.c_str());
@@ -779,9 +774,8 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
pPlayer->Connect();
m_PlayerCount++;
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnClientPutInServer(client);
@@ -862,9 +856,8 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
m_PlayerCount--;
}
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnClientDisconnecting(client);
@@ -893,9 +886,8 @@ void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
m_cldisconnect_post->PushCell(client);
m_cldisconnect_post->Execute(&res, NULL);
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnClientDisconnected(client);
@@ -1073,7 +1065,7 @@ void ListPluginsToClient(CPlayer *player, const CCommand &args)
return;
}
SourceHook::List<SMPlugin *> m_FailList;
std::list<SMPlugin *> m_FailList;
size_t i = 0;
for (; i < plugins->size(); i++)
@@ -1240,7 +1232,7 @@ void PlayerManager::OnClientCommandKeyValues(edict_t *pEntity, KeyValues *pComma
KeyValueStack *pStk = new KeyValueStack;
pStk->pBase = pCommand;
pStk->pCurRoot.push(pStk->pBase);
pStk->pCurRoot.push_front(pStk->pBase);
pStk->m_bDeleteOnDestroy = false;
Handle_t hndl = handlesys->CreateHandle(g_KeyValueType, pStk, g_pCoreIdent, g_pCoreIdent, NULL);
@@ -1285,7 +1277,7 @@ void PlayerManager::OnClientCommandKeyValues_Post(edict_t *pEntity, KeyValues *p
KeyValueStack *pStk = new KeyValueStack;
pStk->pBase = pCommand;
pStk->pCurRoot.push(pStk->pBase);
pStk->pCurRoot.push_front(pStk->pBase);
pStk->m_bDeleteOnDestroy = false;
Handle_t hndl = handlesys->CreateHandle(g_KeyValueType, pStk, g_pCoreIdent, g_pCoreIdent, NULL);
@@ -1381,9 +1373,8 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
}
/* Notify Extensions */
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
if (pListener->GetClientListenerVersion() >= 13)
@@ -1892,8 +1883,7 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
}
}
List<ICommandTargetProcessor *>::iterator iter;
for (iter = target_processors.begin(); iter != target_processors.end(); iter++)
for (auto iter = target_processors.begin(); iter != target_processors.end(); iter++)
{
ICommandTargetProcessor *pProcessor = (*iter);
if (pProcessor->ProcessCommandTarget(info))
@@ -1976,9 +1966,8 @@ void PlayerManager::MaxPlayersChanged( int newvalue /*= -1*/ )
}
/* Notify Extensions */
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
if (pListener->GetClientListenerVersion() >= 8)
@@ -2501,8 +2490,7 @@ void CPlayer::DoPostConnectAuthorization()
{
bool delay = false;
List<IClientListener *>::iterator iter;
for (iter = g_Players.m_hooks.begin();
for (auto iter = g_Players.m_hooks.begin();
iter != g_Players.m_hooks.end();
iter++)
{
@@ -2561,8 +2549,7 @@ void CPlayer::NotifyPostAdminChecks()
/* Block beforehand so they can't double-call */
m_bAdminCheckSignalled = true;
List<IClientListener *>::iterator iter;
for (iter = g_Players.m_hooks.begin();
for (auto iter = g_Players.m_hooks.begin();
iter != g_Players.m_hooks.end();
iter++)
{
+9 -11
View File
@@ -39,17 +39,15 @@
#include <IPlayerHelpers.h>
#include <IAdminSystem.h>
#include <ITranslator.h>
#include <sh_string.h>
#include <sh_list.h>
#include <sh_vector.h>
#include <string>
#include <list>
#include <vector>
#include <am-string.h>
#include <am-deque.h>
#include "ConVarManager.h"
#include <steam/steamclientpublic.h>
using namespace SourceHook;
class IClient;
#define PLAYER_LIFE_UNKNOWN 0
@@ -131,9 +129,9 @@ private:
bool m_IsInGame = false;
bool m_IsAuthorized = false;
bool m_bIsInKickQueue = false;
String m_Name;
String m_Ip;
String m_IpNoPort;
std::string m_Name;
std::string m_Ip;
std::string m_IpNoPort;
std::string m_AuthID;
std::string m_Steam2Id;
std::string m_Steam3Id;
@@ -142,7 +140,7 @@ private:
edict_t *m_pEdict = nullptr;
IPlayerInfo *m_Info = nullptr;
IClient *m_pIClient = nullptr;
String m_LastPassword;
std::string m_LastPassword;
bool m_bAdminCheckSignalled = false;
int m_iIndex;
unsigned int m_LangId = SOURCEMOD_LANGUAGE_ENGLISH;
@@ -252,7 +250,7 @@ private:
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
void InvalidatePlayer(CPlayer *pPlayer);
private:
List<IClientListener *> m_hooks;
std::list<IClientListener *> m_hooks;
IForward *m_clconnect;
IForward *m_clconnect_post;
IForward *m_cldisconnect;
@@ -273,7 +271,7 @@ private:
int m_PlayersSinceActive;
bool m_bServerActivated;
unsigned int *m_AuthQueue;
String m_PassInfoVar;
std::string m_PassInfoVar;
bool m_QueryLang;
bool m_bAuthstringValidation; // are we validating admins with steam before authorizing?
bool m_bIsListenServer;
+15 -19
View File
@@ -178,12 +178,11 @@ TimerSystem::TimerSystem()
TimerSystem::~TimerSystem()
{
CStack<ITimer *>::iterator iter;
for (iter=m_FreeTimers.begin(); iter!=m_FreeTimers.end(); iter++)
while (!m_FreeTimers.empty())
{
delete (*iter);
delete m_FreeTimers.top();
m_FreeTimers.pop();
}
m_FreeTimers.popall();
}
void TimerSystem::OnSourceModAllInitialized()
@@ -251,13 +250,12 @@ void TimerSystem::GameFrame(bool simulating)
}
}
void TimerSystem::ProcessRepeatTimers(double curtime, List<ITimer*>& timerList)
void TimerSystem::ProcessRepeatTimers(double curtime, std::list<ITimer*>& timerList)
{
ITimer *pTimer;
TimerIter iter;
ResultType res;
for (iter=timerList.begin(); iter!=timerList.end(); )
for (auto iter=timerList.begin(); iter!=timerList.end(); )
{
pTimer = (*iter);
if (curtime >= pTimer->m_ToExec)
@@ -284,8 +282,7 @@ void TimerSystem::RunFrame(bool timerThink)
//// One-off timers
ITimer *pTimer;
TimerIter iter;
for (iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); )
for (auto iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); )
{
pTimer = (*iter);
@@ -323,14 +320,13 @@ void TimerSystem::RunFrame(bool timerThink)
ITimer *TimerSystem::CreateTimer(ITimedEvent *pCallbacks, float fInterval, void *pData, int flags)
{
ITimer *pTimer;
TimerIter iter;
const double to_exec = GetSimulatedTime() + fInterval;
if (m_FreeTimers.empty())
{
pTimer = new ITimer;
} else {
pTimer = m_FreeTimers.front();
pTimer = m_FreeTimers.top();
m_FreeTimers.pop();
}
@@ -338,21 +334,21 @@ ITimer *TimerSystem::CreateTimer(ITimedEvent *pCallbacks, float fInterval, void
if (flags & TIMER_FLAG_REPEAT)
{
List<ITimer*>& timerList = pTimer->m_Flags & TIMER_FLAG_TICK_PRECISE ? m_HighSpeedLoopTimers : m_LowSpeedLoopTimers;
std::list<ITimer*>& timerList = pTimer->m_Flags & TIMER_FLAG_TICK_PRECISE ? m_HighSpeedLoopTimers : m_LowSpeedLoopTimers;
timerList.push_back(pTimer);
goto return_timer;
}
if (m_SingleTimers.size() >= 1)
{
iter = --m_SingleTimers.end();
auto iter = --m_SingleTimers.end();
if ((*iter)->m_ToExec <= to_exec)
{
goto normal_insert_end;
}
}
for (iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); iter++)
for (auto iter=m_SingleTimers.begin(); iter!=m_SingleTimers.end(); iter++)
{
if ((*iter)->m_ToExec >= to_exec)
{
@@ -398,7 +394,7 @@ void TimerSystem::FireTimerOnce(ITimer *pTimer, bool delayExec)
return;
}
List<ITimer*>& timerList = pTimer->m_Flags & TIMER_FLAG_TICK_PRECISE ? m_HighSpeedLoopTimers : m_LowSpeedLoopTimers;
std::list<ITimer*>& timerList = pTimer->m_Flags & TIMER_FLAG_TICK_PRECISE ? m_HighSpeedLoopTimers : m_LowSpeedLoopTimers;
pTimer->m_Listener->OnTimerEnd(pTimer, pTimer->m_pData);
timerList.remove(pTimer);
m_FreeTimers.push(pTimer);
@@ -423,7 +419,7 @@ void TimerSystem::KillTimer(ITimer *pTimer)
if (pTimer->m_Flags & TIMER_FLAG_REPEAT)
{
List<ITimer*>& timerList = pTimer->m_Flags & TIMER_FLAG_TICK_PRECISE ? m_HighSpeedLoopTimers : m_LowSpeedLoopTimers;
std::list<ITimer*>& timerList = pTimer->m_Flags & TIMER_FLAG_TICK_PRECISE ? m_HighSpeedLoopTimers : m_LowSpeedLoopTimers;
timerList.remove(pTimer);
} else {
m_SingleTimers.remove(pTimer);
@@ -432,10 +428,10 @@ void TimerSystem::KillTimer(ITimer *pTimer)
m_FreeTimers.push(pTimer);
}
CStack<ITimer *> s_tokill;
std::stack<ITimer *> s_tokill;
void TimerSystem::RemoveMapChangeTimers()
{
const auto KillMapchangeTimers = [](List<ITimer*>& timerList) {
const auto KillMapchangeTimers = [](std::list<ITimer*>& timerList) {
for (ITimer* pTimer : timerList)
{
if (pTimer->m_Flags & TIMER_FLAG_NO_MAPCHANGE)
@@ -452,7 +448,7 @@ void TimerSystem::RemoveMapChangeTimers()
while (!s_tokill.empty())
{
KillTimer(s_tokill.front());
KillTimer(s_tokill.top());
s_tokill.pop();
}
}
+7 -10
View File
@@ -33,16 +33,13 @@
#define _INCLUDE_SOURCEMOD_CTIMERSYS_H_
#include <ITimerSystem.h>
#include <sh_stack.h>
#include <sh_list.h>
#include <stack>
#include <list>
#include "sourcemm_api.h"
#include "sm_globals.h"
using namespace SourceHook;
using namespace SourceMod;
typedef List<ITimer *>::iterator TimerIter;
class SourceMod::ITimer
{
public:
@@ -83,12 +80,12 @@ public:
void RemoveMapChangeTimers();
void GameFrame(bool simulating);
private:
void ProcessRepeatTimers(double curtime, List<ITimer*>& timerList);
void ProcessRepeatTimers(double curtime, std::list<ITimer*>& timerList);
private:
List<ITimer*> m_SingleTimers;
List<ITimer*> m_LowSpeedLoopTimers;
List<ITimer*> m_HighSpeedLoopTimers;
CStack<ITimer *> m_FreeTimers;
std::list<ITimer*> m_SingleTimers;
std::list<ITimer*> m_LowSpeedLoopTimers;
std::list<ITimer*> m_HighSpeedLoopTimers;
std::stack<ITimer *> m_FreeTimers;
IMapTimer *m_pMapTimer;
/* This is stuff for our manual ticking escapades. */
+2 -2
View File
@@ -85,7 +85,7 @@
return false; \
}
typedef List<Handle_t> PBHandleList;
typedef std::list<Handle_t> PBHandleList;
class SMProtobufMessage
{
@@ -97,7 +97,7 @@ public:
~SMProtobufMessage()
{
PBHandleList::iterator iter = childHandles.begin();
auto iter = childHandles.begin();
while (iter != childHandles.end())
{
Handle_t &hndl = (*iter);
+9 -13
View File
@@ -72,12 +72,11 @@ UserMessages::UserMessages()
UserMessages::~UserMessages()
{
CStack<ListenerInfo *>::iterator iter;
for (iter=m_FreeListeners.begin(); iter!=m_FreeListeners.end(); iter++)
while (!m_FreeListeners.empty())
{
delete (*iter);
delete m_FreeListeners.top();
m_FreeListeners.pop();
}
m_FreeListeners.popall();
}
void UserMessages::OnSourceModStartup(bool late)
@@ -413,7 +412,7 @@ bool UserMessages::InternalHook(int msg_id, IBitBufUserMessageListener *pListene
{
pInfo = new ListenerInfo;
} else {
pInfo = m_FreeListeners.front();
pInfo = m_FreeListeners.top();
m_FreeListeners.pop();
}
@@ -465,7 +464,6 @@ bool UserMessages::InternalUnhook(int msg_id, IBitBufUserMessageListener *pListe
#endif
{
MsgList *pList;
MsgIter iter;
ListenerInfo *pInfo;
bool deleted = false;
@@ -475,7 +473,7 @@ bool UserMessages::InternalUnhook(int msg_id, IBitBufUserMessageListener *pListe
}
pList = (intercept) ? &m_msgIntercepts[msg_id] : &m_msgHooks[msg_id];
for (iter=pList->begin(); iter!=pList->end(); iter++)
for (auto iter=pList->begin(); iter!=pList->end(); iter++)
{
pInfo = (*iter);
if (pInfo->Callback == pListener && pInfo->IsNew == isNew)
@@ -645,13 +643,12 @@ void UserMessages::OnMessageEnd_Post()
}
MsgList *pList;
MsgIter iter;
ListenerInfo *pInfo;
m_InHook = false;
pList = &m_msgIntercepts[m_CurId];
for (iter=pList->begin(); iter!=pList->end(); )
for (auto iter=pList->begin(); iter!=pList->end(); )
{
pInfo = (*iter);
if (m_BlockEndPost && !pInfo->IsNew)
@@ -678,7 +675,7 @@ void UserMessages::OnMessageEnd_Post()
}
pList = &m_msgHooks[m_CurId];
for (iter=pList->begin(); iter!=pList->end(); )
for (auto iter=pList->begin(); iter!=pList->end(); )
{
pInfo = (*iter);
if (m_BlockEndPost && !pInfo->IsNew)
@@ -713,7 +710,6 @@ void UserMessages::OnMessageEnd_Pre()
}
MsgList *pList;
MsgIter iter;
ListenerInfo *pInfo;
ResultType res;
@@ -721,7 +717,7 @@ void UserMessages::OnMessageEnd_Pre()
bool handled = false;
pList = &m_msgIntercepts[m_CurId];
for (iter=pList->begin(); iter!=pList->end(); )
for (auto iter=pList->begin(); iter!=pList->end(); )
{
pInfo = (*iter);
pInfo->IsHooked = true;
@@ -805,7 +801,7 @@ void UserMessages::OnMessageEnd_Pre()
#endif
pList = &m_msgHooks[m_CurId];
for (iter=pList->begin(); iter!=pList->end(); )
for (auto iter=pList->begin(); iter!=pList->end(); )
{
pInfo = (*iter);
pInfo->IsHooked = true;
+6 -8
View File
@@ -38,10 +38,9 @@
#include "sm_stringutil.h"
#include "CellRecipientFilter.h"
#include "sm_globals.h"
#include <sh_list.h>
#include <sh_stack.h>
#include <list>
#include <stack>
using namespace SourceHook;
using namespace SourceMod;
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV
@@ -72,8 +71,7 @@ struct ListenerInfo
bool IsNew;
};
typedef List<ListenerInfo *> MsgList;
typedef List<ListenerInfo *>::iterator MsgIter;
typedef std::list<ListenerInfo *> MsgList;
class UserMessages :
public IUserMessages,
@@ -130,9 +128,9 @@ private:
#endif
void _DecRefCounter();
private:
List<ListenerInfo *> m_msgHooks[255];
List<ListenerInfo *> m_msgIntercepts[255];
CStack<ListenerInfo *> m_FreeListeners;
std::list<ListenerInfo *> m_msgHooks[255];
std::list<ListenerInfo *> m_msgIntercepts[255];
std::stack<ListenerInfo *> m_FreeListeners;
IRecipientFilter *m_CurRecFilter;
#ifndef USE_PROTOBUF_USERMESSAGES
unsigned char m_pBase[2500];
+4 -7
View File
@@ -26,7 +26,7 @@
// or <http://www.sourcemod.net/license.php>.
#include "sm_globals.h"
#include <sh_list.h>
#include <list>
#include <convar.h>
#include "concmd_cleaner.h"
#include "sm_stringutil.h"
@@ -45,8 +45,6 @@ SH_DECL_HOOK1_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
SH_DECL_HOOK1_void(ICvar, RegisterConCommandBase, SH_NOATTRIB, 0, ConCommandBase *);
#endif
using namespace SourceHook;
struct ConCommandInfo
{
ConCommandBase *pBase;
@@ -54,7 +52,7 @@ struct ConCommandInfo
char name[64];
};
List<ConCommandInfo *> tracked_bases;
std::list<ConCommandInfo *> tracked_bases;
IConCommandLinkListener *IConCommandLinkListener::head = NULL;
ConCommandBase *FindConCommandBase(const char *name);
@@ -99,7 +97,7 @@ public:
void UnlinkConCommandBase(ConCommandBase *pBase)
{
ConCommandInfo *pInfo;
List<ConCommandInfo *>::iterator iter = tracked_bases.begin();
auto iter = tracked_bases.begin();
IConCommandLinkListener *listener = IConCommandLinkListener::head;
while (listener)
@@ -137,10 +135,9 @@ public:
void RemoveTarget(ConCommandBase *pBase, IConCommandTracker *cls)
{
List<ConCommandInfo *>::iterator iter;
ConCommandInfo *pInfo;
iter = tracked_bases.begin();
auto iter = tracked_bases.begin();
while (iter != tracked_bases.end())
{
pInfo = (*iter);
+8 -14
View File
@@ -233,8 +233,7 @@ AdminCache::~AdminCache()
DumpAdminCache(AdminCache_Overrides, false);
DumpAdminCache(AdminCache_Groups, false);
List<AuthMethod *>::iterator iter;
for (iter=m_AuthMethods.begin();
for (auto iter=m_AuthMethods.begin();
iter!=m_AuthMethods.end();
iter++)
{
@@ -759,8 +758,7 @@ bool AdminCache::GetGroupCommandOverride(GroupId id, const char *name, OverrideT
AuthMethod *AdminCache::GetMethodByIndex(unsigned int index)
{
List<AuthMethod *>::iterator iter;
for (iter=m_AuthMethods.begin();
for (auto iter=m_AuthMethods.begin();
iter!=m_AuthMethods.end();
iter++)
{
@@ -974,8 +972,7 @@ void AdminCache::InvalidateAdminCache(bool unlink_admins)
}
}
/* Wipe the identity cache first */
List<AuthMethod *>::iterator iter;
for (iter=m_AuthMethods.begin();
for (auto iter=m_AuthMethods.begin();
iter!=m_AuthMethods.end();
iter++)
{
@@ -998,7 +995,6 @@ void AdminCache::InvalidateAdminCache(bool unlink_admins)
void AdminCache::DumpAdminCache(AdminCachePart part, bool rebuild)
{
List<IAdminListener *>::iterator iter;
IAdminListener *pListener;
if (part == AdminCache_Overrides)
@@ -1007,7 +1003,7 @@ void AdminCache::DumpAdminCache(AdminCachePart part, bool rebuild)
DumpCommandOverrideCache(Override_CommandGroup);
if (rebuild && !m_destroying)
{
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnRebuildOverrideCache();
@@ -1021,7 +1017,7 @@ void AdminCache::DumpAdminCache(AdminCachePart part, bool rebuild)
InvalidateGroupCache();
if (rebuild && !m_destroying)
{
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnRebuildGroupCache();
@@ -1033,7 +1029,7 @@ void AdminCache::DumpAdminCache(AdminCachePart part, bool rebuild)
InvalidateAdminCache(true);
if (rebuild && !m_destroying)
{
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
for (auto iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
pListener->OnRebuildAdminCache((part == AdminCache_Groups));
@@ -1058,9 +1054,8 @@ const char *AdminCache::GetAdminName(AdminId id)
bool AdminCache::GetMethodIndex(const char *name, unsigned int *_index)
{
List<AuthMethod *>::iterator iter;
unsigned int index = 0;
for (iter=m_AuthMethods.begin();
for (auto iter=m_AuthMethods.begin();
iter!=m_AuthMethods.end();
iter++,index++)
{
@@ -1962,8 +1957,7 @@ AdminUser *AdminCache::GetUser(AdminId aid)
const char *AdminCache::GetMethodName(unsigned int index)
{
List<AuthMethod *>::iterator iter;
for (iter=m_AuthMethods.begin();
for (auto iter=m_AuthMethods.begin();
iter!=m_AuthMethods.end();
iter++)
{
+5 -7
View File
@@ -36,14 +36,12 @@
#include <IAdminSystem.h>
#include "sm_memtable.h"
#include <sm_trie.h>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include <IForwardSys.h>
#include <sm_hashmap.h>
#include <sm_namehashset.h>
using namespace SourceHook;
#define GRP_MAGIC_SET 0xDEADFADE
#define GRP_MAGIC_UNSET 0xFACEFACE
#define USR_MAGIC_SET 0xDEADFACE
@@ -70,7 +68,7 @@ struct AdminGroup
struct AuthMethod
{
String name;
std::string name;
StringHashMap<AdminId> identities;
AuthMethod(const char *name)
@@ -214,8 +212,8 @@ public:
int m_LastGroup;
int m_FreeGroupList;
StringHashMap<GroupId> m_Groups;
List<IAdminListener *> m_hooks;
List<AuthMethod *> m_AuthMethods;
std::list<IAdminListener *> m_hooks;
std::list<AuthMethod *> m_AuthMethods;
NameHashSet<AuthMethod *> m_AuthTables;
IForward *m_pCacheFwd;
int m_FirstUser;
+1 -2
View File
@@ -109,10 +109,9 @@ SWThreadHandle *BaseWorker::PopThreadFromQueue()
if (!m_ThreadQueue.size())
return NULL;
SourceHook::List<SWThreadHandle *>::iterator begin;
SWThreadHandle *swt;
begin = m_ThreadQueue.begin();
auto begin = m_ThreadQueue.begin();
swt = (*begin);
m_ThreadQueue.erase(begin);
+2 -2
View File
@@ -32,7 +32,7 @@
#ifndef _INCLUDE_SOURCEMOD_BASEWORKER_H
#define _INCLUDE_SOURCEMOD_BASEWORKER_H
#include "sh_list.h"
#include <list>
#include "ThreadSupport.h"
#define SM_DEFAULT_THREADS_PER_FRAME 1
@@ -96,7 +96,7 @@ public: //BaseWorker
virtual void AddThreadToQueue(SWThreadHandle *pHandle);
virtual SWThreadHandle *PopThreadFromQueue();
protected:
SourceHook::List<SWThreadHandle *> m_ThreadQueue;
std::list<SWThreadHandle *> m_ThreadQueue;
unsigned int m_perFrame;
volatile WorkerState m_state;
IThreadWorkerCallbacks *m_pHooks;
+1 -1
View File
@@ -205,7 +205,7 @@ void DBManager::RemoveDriver(IDBDriver *pDriver)
{
if (m_drivers[i] == pDriver)
{
m_drivers.erase(m_drivers.iterAt(i));
m_drivers.erase(m_drivers.begin() + i);
break;
}
}
+4 -7
View File
@@ -33,9 +33,9 @@
#define _INCLUDE_DATABASE_MANAGER_H_
#include "common_logic.h"
#include <sh_vector.h>
#include <vector>
#include <am-string.h>
#include <sh_list.h>
#include <list>
#include <IThreader.h>
#include <IPluginSys.h>
#include <condition_variable>
@@ -48,9 +48,6 @@
#include <am-refcounting.h>
#include "DatabaseConfBuilder.h"
using namespace SourceHook;
class DBManager :
public IDBManager,
public SMGlobalClass,
@@ -105,12 +102,12 @@ private:
void CancelPluginOperations(IdentityToken_t *identity);
void FinalizeOperation(IDBThreadOperation *op, bool driver_unloading);
private:
CVector<IDBDriver *> m_drivers;
std::vector<IDBDriver *> m_drivers;
/* Threading stuff */
PrioQueue<IDBThreadOperation *> m_OpQueue;
Queue<IDBThreadOperation *> m_ThinkQueue;
CVector<bool> m_drSafety; /* which drivers are safe? */
std::vector<bool> m_drSafety; /* which drivers are safe? */
std::unique_ptr<std::thread> m_Worker;
std::condition_variable m_QueueEvent;
std::mutex m_ThinkLock;
+39 -54
View File
@@ -356,7 +356,7 @@ void CExtension::MarkAllLoaded()
void CExtension::AddPlugin(CPlugin *pPlugin)
{
/* Unfortunately we have to do this :( */
if (m_Dependents.find(pPlugin) == m_Dependents.end())
if (std::find(m_Dependents.begin(), m_Dependents.end(), pPlugin) == m_Dependents.end())
{
m_Dependents.push_back(pPlugin);
}
@@ -399,7 +399,7 @@ bool CLocalExtension::IsLoaded()
void CExtension::AddDependency(const IfaceInfo *pInfo)
{
if (m_Deps.find(*pInfo) == m_Deps.end())
if (std::find(m_Deps.begin(), m_Deps.end(), *pInfo) == m_Deps.end())
{
m_Deps.push_back(*pInfo);
}
@@ -411,8 +411,7 @@ void CExtension::AddChildDependent(CExtension *pOther, SMInterface *iface)
info.iface = iface;
info.owner = pOther;
List<IfaceInfo>::iterator iter;
for (iter = m_ChildDeps.begin();
for (auto iter = m_ChildDeps.begin();
iter != m_ChildDeps.end();
iter++)
{
@@ -492,11 +491,9 @@ void CExtensionManager::OnSourceModShutdown()
void CExtensionManager::Shutdown()
{
List<CExtension *>::iterator iter;
while ((iter = m_Libs.begin()) != m_Libs.end())
while (m_Libs.begin() != m_Libs.end())
{
UnloadExtension((*iter));
UnloadExtension((*m_Libs.begin()));
}
}
@@ -585,14 +582,13 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOn
IExtension *CExtensionManager::FindExtensionByFile(const char *file)
{
List<CExtension *>::iterator iter;
CExtension *pExt;
/* Chomp off the path */
char lookup[PLATFORM_MAX_PATH];
libsys->GetFileFromPath(lookup, sizeof(lookup), file);
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
for (auto iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
pExt = (*iter);
if (pExt->IsSameFile(lookup))
@@ -606,12 +602,11 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file)
IExtension *CExtensionManager::FindExtensionByName(const char *ext)
{
List<CExtension *>::iterator iter;
CExtension *pExt;
IExtensionInterface *pAPI;
const char *name;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
for (auto iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
pExt = (*iter);
if (!pExt->IsLoaded())
@@ -720,9 +715,7 @@ void CExtensionManager::BindChildPlugin(IExtension *pParent, SMPlugin *pPlugin)
void CExtensionManager::OnPluginDestroyed(IPlugin *plugin)
{
List<CExtension *>::iterator iter;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
for (auto iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
(*iter)->DropRefsTo(static_cast<CPlugin *>(plugin));
}
@@ -735,7 +728,7 @@ CExtension *CExtensionManager::FindByOrder(unsigned int num)
return NULL;
}
List<CExtension *>::iterator iter = m_Libs.begin();
auto iter = m_Libs.begin();
while (iter != m_Libs.end())
{
@@ -756,7 +749,8 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
CExtension *pExt = (CExtension *)_pExt;
if (m_Libs.find(pExt) == m_Libs.end())
auto iter = std::find(m_Libs.begin(), m_Libs.end(), pExt);
if (iter == m_Libs.end())
return false;
/* Tell it to unload */
@@ -770,13 +764,13 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
g_ShareSys.RemoveInterfaces(_pExt);
m_Libs.remove(pExt);
List<CExtension *> UnloadQueue;
std::list<CExtension *> UnloadQueue;
/* Handle dependencies */
if (pExt->IsLoaded())
{
/* Unload any dependent plugins */
List<CPlugin *>::iterator p_iter = pExt->m_Dependents.begin();
auto p_iter = pExt->m_Dependents.begin();
while (p_iter != pExt->m_Dependents.end())
{
/* We have to manually unlink ourselves here, since we're no longer being managed */
@@ -784,8 +778,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
p_iter = pExt->m_Dependents.erase(p_iter);
}
List<String>::iterator s_iter;
for (s_iter = pExt->m_Libraries.begin();
for (auto s_iter = pExt->m_Libraries.begin();
s_iter != pExt->m_Libraries.end();
s_iter++)
{
@@ -793,10 +786,9 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
}
/* Notify and/or unload all dependencies */
List<CExtension *>::iterator c_iter;
CExtension *pDep;
IExtensionInterface *pAPI;
for (c_iter = m_Libs.begin(); c_iter != m_Libs.end(); c_iter++)
for (auto c_iter = m_Libs.begin(); c_iter != m_Libs.end(); c_iter++)
{
pDep = (*c_iter);
if ((pAPI=pDep->GetAPI()) == NULL)
@@ -805,7 +797,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
continue;
/* Now, get its dependency list */
bool dropped = false;
List<IfaceInfo>::iterator i_iter = pDep->m_Deps.begin();
auto i_iter = pDep->m_Deps.begin();
while (i_iter != pDep->m_Deps.end())
{
if ((*i_iter).owner == _pExt)
@@ -860,8 +852,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
pExt->Unload();
delete pExt;
List<CExtension *>::iterator iter;
for (iter=UnloadQueue.begin(); iter!=UnloadQueue.end(); iter++)
for (auto iter=UnloadQueue.begin(); iter!=UnloadQueue.end(); iter++)
{
/* NOTE: This is safe because the unload function backs out of anything not present */
UnloadExtension((*iter));
@@ -872,10 +863,9 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
void CExtensionManager::MarkAllLoaded()
{
List<CExtension *>::iterator iter;
CExtension *pExt;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
for (auto iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
pExt = (*iter);
if (!pExt->IsLoaded())
@@ -910,7 +900,6 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
const char *cmd = command->Arg(2);
if (strcmp(cmd, "list") == 0)
{
List<CExtension *>::iterator iter;
CExtension *pExt;
unsigned int num = 1;
@@ -932,7 +921,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
break;
}
}
for (iter = m_Libs.begin(); iter != m_Libs.end(); iter++,num++)
for (auto iter = m_Libs.begin(); iter != m_Libs.end(); iter++,num++)
{
pExt = (*iter);
if (pExt->IsLoaded())
@@ -1021,7 +1010,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
return;
}
List<CExtension *>::iterator iter = m_Libs.begin();
auto iter = m_Libs.begin();
CExtension *pExt = NULL;
while (iter != m_Libs.end())
{
@@ -1124,23 +1113,21 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
}
else
{
List<CPlugin *> plugins;
std::list<CPlugin *> plugins;
if (pExt->m_ChildDeps.size())
{
rootmenu->ConsolePrint("[SM] Unloading %s will unload the following extensions: ", pExt->GetFilename());
List<CExtension *>::iterator iter;
CExtension *pOther;
/* Get list of all extensions */
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
for (auto iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
List<IfaceInfo>::iterator i_iter;
pOther = (*iter);
if (!pOther->IsLoaded() || pOther == pExt)
{
continue;
}
/* Get their dependencies */
for (i_iter=pOther->m_Deps.begin();
for (auto i_iter=pOther->m_Deps.begin();
i_iter!=pOther->m_Deps.end();
i_iter++)
{
@@ -1154,12 +1141,12 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
{
rootmenu->ConsolePrint(" -> %s", pOther->GetFilename());
/* Add to plugin unload list */
List<CPlugin *>::iterator p_iter;
for (p_iter=pOther->m_Dependents.begin();
for (auto p_iter=pOther->m_Dependents.begin();
p_iter!=pOther->m_Dependents.end();
p_iter++)
{
if (plugins.find((*p_iter)) == plugins.end())
auto lookup = std::find(plugins.begin(), plugins.end(), (*p_iter));
if (lookup == plugins.end())
{
plugins.push_back((*p_iter));
}
@@ -1171,17 +1158,17 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommand
if (pExt->m_Dependents.size())
{
rootmenu->ConsolePrint("[SM] Unloading %s will unload the following plugins: ", pExt->GetFilename());
List<CPlugin *>::iterator iter;
CPlugin *pPlugin;
for (iter = pExt->m_Dependents.begin(); iter != pExt->m_Dependents.end(); iter++)
for (auto iter = pExt->m_Dependents.begin(); iter != pExt->m_Dependents.end(); iter++)
{
pPlugin = (*iter);
if (plugins.find(pPlugin) == plugins.end())
auto lookup = std::find(plugins.begin(), plugins.end(), pPlugin);
if (lookup == plugins.end())
{
plugins.push_back(pPlugin);
}
}
for (iter = plugins.begin(); iter != plugins.end(); iter++)
for (auto iter = plugins.begin(); iter != plugins.end(); iter++)
{
pPlugin = (*iter);
rootmenu->ConsolePrint(" -> %s", pPlugin->GetFilename());
@@ -1277,12 +1264,12 @@ bool CExtensionManager::LibraryExists(const char *library)
{
CExtension *pExt;
for (List<CExtension *>::iterator iter = m_Libs.begin();
for (auto iter = m_Libs.begin();
iter != m_Libs.end();
iter++)
{
pExt = (*iter);
for (List<String>::iterator s_iter = pExt->m_Libraries.begin();
for (auto s_iter = pExt->m_Libraries.begin();
s_iter != pExt->m_Libraries.end();
s_iter++)
{
@@ -1325,9 +1312,8 @@ IExtension *CExtensionManager::LoadExternal(IExtensionInterface *pInterface,
void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax)
{
IExtensionInterface *pAPI;
List<CExtension *>::iterator iter;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
for (auto iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
if ((pAPI = (*iter)->GetAPI()) == NULL)
{
@@ -1343,9 +1329,8 @@ void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount,
void CExtensionManager::CallOnCoreMapEnd()
{
IExtensionInterface *pAPI;
List<CExtension *>::iterator iter;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
for (auto iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
if ((pAPI = (*iter)->GetAPI()) == NULL)
{
@@ -1358,17 +1343,17 @@ void CExtensionManager::CallOnCoreMapEnd()
}
}
const CVector<IExtension *> *CExtensionManager::ListExtensions()
const std::vector<IExtension *> *CExtensionManager::ListExtensions()
{
CVector<IExtension *> *list = new CVector<IExtension *>();
for (List<CExtension *>::iterator iter = m_Libs.begin(); iter != m_Libs.end(); iter++)
std::vector<IExtension *> *list = new std::vector<IExtension *>();
for (auto iter = m_Libs.begin(); iter != m_Libs.end(); iter++)
list->push_back(*iter);
return list;
}
void CExtensionManager::FreeExtensionList(const CVector<IExtension *> *list)
void CExtensionManager::FreeExtensionList(const std::vector<IExtension *> *list)
{
delete const_cast<CVector<IExtension *> *>(list);
delete const_cast<std::vector<IExtension *> *>(list);
}
bool CLocalExtension::IsSameFile(const char *file)
+13 -14
View File
@@ -34,8 +34,8 @@
#include <IExtensionSys.h>
#include <ILibrarySys.h>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include "common_logic.h"
#include <IPluginSys.h>
#include <IRootConsoleMenu.h>
@@ -46,7 +46,6 @@
class CPlayer;
using namespace SourceMod;
using namespace SourceHook;
class CExtension;
@@ -95,14 +94,14 @@ protected:
protected:
IdentityToken_t *m_pIdentToken;
IExtensionInterface *m_pAPI;
String m_File;
String m_RealFile;
String m_Path;
String m_Error;
List<IfaceInfo> m_Deps; /** Dependencies */
List<IfaceInfo> m_ChildDeps; /** Children who might depend on us */
List<SMInterface *> m_Interfaces;
List<String> m_Libraries;
std::string m_File;
std::string m_RealFile;
std::string m_Path;
std::string m_Error;
std::list<IfaceInfo> m_Deps; /** Dependencies */
std::list<IfaceInfo> m_ChildDeps; /** Children who might depend on us */
std::list<SMInterface *> m_Interfaces;
std::list<std::string> m_Libraries;
unsigned int unload_code;
bool m_bFullyLoaded;
bool m_bRequired;
@@ -178,8 +177,8 @@ public:
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
void CallOnCoreMapEnd();
void AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface);
const CVector<IExtension *> *ListExtensions();
void FreeExtensionList(const CVector<IExtension *> *list);
const std::vector<IExtension *> *ListExtensions();
void FreeExtensionList(const std::vector<IExtension *> *list);
public:
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
void Shutdown();
@@ -191,7 +190,7 @@ public:
private:
CExtension *FindByOrder(unsigned int num);
private:
List<CExtension *> m_Libs;
std::list<CExtension *> m_Libs;
};
extern CExtensionManager g_Extensions;
+6 -9
View File
@@ -31,8 +31,8 @@
#include <string.h>
#include <stdlib.h>
#include <sstream>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include "GameConfigs.h"
#include "stringutil.h"
#include <IGameHelpers.h>
@@ -53,8 +53,6 @@
#include <dlfcn.h>
#endif
using namespace SourceHook;
GameConfigManager g_GameConfigs;
IGameConfig *g_pGameConf = NULL;
static char g_Game[256];
@@ -791,7 +789,7 @@ public:
(!had_game && matched_engine) ||
(matched_engine && matched_game))
{
if (fileList->find(cur_file) == fileList->end())
if (std::find(fileList->begin(), fileList->end(), cur_file) == fileList->end())
{
fileList->push_back(cur_file);
}
@@ -806,7 +804,7 @@ public:
return SMCResult_Continue;
}
public:
List<String> *fileList;
std::list<std::string> *fileList;
unsigned int state;
unsigned int ignoreLevel;
char cur_file[PLATFORM_MAX_PATH];
@@ -857,7 +855,7 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
/* Otherwise, it's time to parse the master. */
SMCError err;
SMCStates state = {0, 0};
List<String> fileList;
std::list<std::string> fileList;
master_reader.fileList = &fileList;
const char *pEngine[2] = { m_pBaseEngine, m_pEngine };
@@ -885,8 +883,7 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
}
/* Go through each file we found and parse it. */
List<String>::iterator iter;
for (iter = fileList.begin(); iter != fileList.end(); iter++)
for (auto iter = fileList.begin(); iter != fileList.end(); iter++)
{
ke::SafeSprintf(path, sizeof(path), "%s/%s", m_File, (*iter).c_str());
if (!EnterFile(path, error, maxlength))
+1 -4
View File
@@ -36,10 +36,7 @@
#include <memory>
#include <vector>
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
#include <sh_vector.h>
#include "sm_symtable.h"
using namespace SourceHook;
#endif
using namespace SourceMod;
@@ -89,7 +86,7 @@ public:
const DynLibInfo *GetLibraryInfo(const void *libPtr);
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
private:
CVector<LibSymbolTable *> m_SymTables;
std::vector<LibSymbolTable *> m_SymTables;
#ifdef PLATFORM_APPLE
struct dyld_all_image_infos *m_ImageList;
SInt32 m_OSXMajor;
+3 -7
View File
@@ -49,7 +49,7 @@ unsigned int CNativeOwner::GetMarkSerial()
void CNativeOwner::AddDependent(CPlugin *pPlugin)
{
if (m_Dependents.find(pPlugin) == m_Dependents.end())
if (std::find(m_Dependents.begin(), m_Dependents.end(), pPlugin) == m_Dependents.end())
m_Dependents.push_back(pPlugin);
}
@@ -78,10 +78,8 @@ void CNativeOwner::UnbindWeakRef(const WeakNative &ref)
void CNativeOwner::DropEverything()
{
List<WeakNative>::iterator iter;
/* Unbind and remove all weak references to us */
iter = m_WeakRefs.begin();
auto iter = m_WeakRefs.begin();
while (iter != m_WeakRefs.end())
{
UnbindWeakRef((*iter));
@@ -103,9 +101,7 @@ void CNativeOwner::DropEverything()
void CNativeOwner::DropWeakRefsTo(CPlugin *pPlugin)
{
List<WeakNative>::iterator iter;
iter = m_WeakRefs.begin();
auto iter = m_WeakRefs.begin();
while (iter != m_WeakRefs.end())
{
WeakNative & ref = (*iter);
+3 -5
View File
@@ -32,7 +32,7 @@
#define _INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
#include <sp_vm_types.h>
#include <sh_list.h>
#include <list>
#include <am-vector.h>
#include "common_logic.h"
#include "Native.h"
@@ -55,8 +55,6 @@ struct WeakNative
uint32_t idx;
};
using namespace SourceHook;
class CNativeOwner
{
public:
@@ -76,9 +74,9 @@ private:
void DropWeakRefsTo(CPlugin *pPlugin);
void UnbindWeakRef(const WeakNative & ref);
protected:
List<CPlugin *> m_Dependents;
std::list<CPlugin *> m_Dependents;
unsigned int m_nMarkSerial;
List<WeakNative> m_WeakRefs;
std::list<WeakNative> m_WeakRefs;
std::vector<const sp_nativeinfo_t *> m_natives;
std::vector<ke::RefPtr<Native> > m_fakes;
};
+2 -3
View File
@@ -33,10 +33,9 @@
#define _INCLUDE_SOURCEMOD_PHRASECOLLECTION_H_
#include <string.h>
#include <sh_vector.h>
#include <vector>
#include <ITranslator.h>
using namespace SourceHook;
using namespace SourceMod;
class CPhraseCollection : public IPhraseCollection
@@ -60,7 +59,7 @@ public:
size_t *pOutLength,
const char **pFailPhrase);
private:
CVector<IPhraseFile *> m_Files;
std::vector<IPhraseFile *> m_Files;
};
#endif //_INCLUDE_SOURCEMOD_PHRASECOLLECTION_H_
+7 -8
View File
@@ -705,7 +705,7 @@ void CPlugin::DependencyDropped(CPlugin *pOwner)
return;
for (auto lib_iter=pOwner->m_Libraries.begin(); lib_iter!=pOwner->m_Libraries.end(); lib_iter++) {
if (m_RequiredLibs.find(*lib_iter) != m_RequiredLibs.end()) {
if (std::find(m_RequiredLibs.begin(), m_RequiredLibs.end(), *lib_iter) != m_RequiredLibs.end()) {
m_LibraryMissing = true;
break;
}
@@ -776,10 +776,9 @@ void CPlugin::AddConfig(bool autoCreate, const char *cfg, const char *folder)
void CPlugin::DropEverything()
{
CPlugin *pOther;
List<WeakNative>::iterator wk_iter;
/* Tell everyone that depends on us that we're about to drop */
for (List<CPlugin *>::iterator iter = m_Dependents.begin();
for (auto iter = m_Dependents.begin();
iter != m_Dependents.end();
iter++)
{
@@ -1293,7 +1292,7 @@ void CPlugin::ForEachLibrary(ke::Function<void(const char *)> callback)
void CPlugin::AddRequiredLib(const char *name)
{
if (m_RequiredLibs.find(name) == m_RequiredLibs.end())
if (std::find(m_RequiredLibs.begin(), m_RequiredLibs.end(), name) == m_RequiredLibs.end())
m_RequiredLibs.push_back(name);
}
@@ -2378,9 +2377,9 @@ void CPluginManager::SyncMaxClients(int max_clients)
(*iter)->SyncMaxClients(max_clients);
}
const CVector<SMPlugin *> *CPluginManager::ListPlugins()
const std::vector<SMPlugin *> *CPluginManager::ListPlugins()
{
CVector<SMPlugin *> *list = new CVector<SMPlugin *>();
std::vector<SMPlugin *> *list = new std::vector<SMPlugin *>();
for (PluginIter iter(m_plugins); !iter.done(); iter.next())
list->push_back((*iter));
@@ -2388,9 +2387,9 @@ const CVector<SMPlugin *> *CPluginManager::ListPlugins()
return list;
}
void CPluginManager::FreePluginList(const CVector<SMPlugin *> *list)
void CPluginManager::FreePluginList(const std::vector<SMPlugin *> *list)
{
delete const_cast<CVector<SMPlugin *> *>(list);
delete const_cast<std::vector<SMPlugin *> *>(list);
}
void CPluginManager::ForEachPlugin(ke::Function<void(CPlugin *)> callback)
+11 -13
View File
@@ -41,10 +41,10 @@
#include <IPluginSys.h>
#include <IHandleSys.h>
#include <IForwardSys.h>
#include <sh_list.h>
#include <sh_stack.h>
#include <sh_vector.h>
#include <sh_string.h>
#include <list>
#include <stack>
#include <vector>
#include <string>
#include "common_logic.h"
#include <IRootConsoleMenu.h>
#include <sm_hashmap.h>
@@ -61,8 +61,6 @@
class CPlayer;
using namespace SourceHook;
enum LoadRes
{
LoadRes_Successful,
@@ -195,7 +193,7 @@ public:
m_Libraries.push_back(name);
}
inline bool HasLibrary(const char *name) {
return m_Libraries.find(name) != m_Libraries.end();
return std::find(m_Libraries.begin(), m_Libraries.end(), name) != m_Libraries.end();
}
void LibraryActions(LibraryAction action);
void SyncMaxClients(int max_clients);
@@ -274,13 +272,13 @@ private:
IPluginContext *m_pContext;
sp_pubvar_t *m_MaxClientsVar;
StringHashMap<void *> m_Props;
CVector<AutoConfig *> m_configs;
List<String> m_Libraries;
std::vector<AutoConfig *> m_configs;
std::list<std::string> m_Libraries;
bool m_bGotAllLoaded;
int m_FileVersion;
// Information that survives past eviction.
List<String> m_RequiredLibs;
std::list<std::string> m_RequiredLibs;
IdentityToken_t *m_ident;
time_t m_LastFileModTime;
Handle_t m_handle;
@@ -348,8 +346,8 @@ public: //IScriptManager
SMPlugin *FindPluginByHandle(Handle_t hndl, HandleError *errp) {
return static_cast<SMPlugin *>(PluginFromHandle(hndl, errp));
}
const CVector<SMPlugin *> *ListPlugins();
void FreePluginList(const CVector<SMPlugin *> *plugins);
const std::vector<SMPlugin *> *ListPlugins();
void FreePluginList(const std::vector<SMPlugin *> *plugins);
public: //SMGlobalClass
void OnSourceModAllInitialized();
@@ -506,7 +504,7 @@ private:
IdentityToken_t *m_MyIdent;
/* Dynamic native stuff */
List<FakeNative *> m_Natives;
std::list<FakeNative *> m_Natives;
bool m_LoadingLocked;
+4 -7
View File
@@ -43,8 +43,7 @@ RootConsoleMenu::RootConsoleMenu()
RootConsoleMenu::~RootConsoleMenu()
{
List<ConsoleEntry *>::iterator iter;
for (iter=m_Menu.begin(); iter!=m_Menu.end(); iter++)
for (auto iter=m_Menu.begin(); iter!=m_Menu.end(); iter++)
{
delete (*iter);
}
@@ -101,7 +100,7 @@ bool RootConsoleMenu::AddRootConsoleCommand3(const char *cmd,
return false;
/* Sort this into the menu */
List<ConsoleEntry *>::iterator iter = m_Menu.begin();
auto iter = m_Menu.begin();
ConsoleEntry *pEntry;
bool inserted = false;
while (iter != m_Menu.end())
@@ -138,9 +137,8 @@ bool RootConsoleMenu::RemoveRootConsoleCommand(const char *cmd, IRootConsoleComm
{
m_Commands.remove(cmd);
List<ConsoleEntry *>::iterator iter;
ConsoleEntry *pEntry;
for (iter=m_Menu.begin(); iter!=m_Menu.end(); iter++)
for (auto iter=m_Menu.begin(); iter!=m_Menu.end(); iter++)
{
pEntry = (*iter);
if (pEntry->command.compare(cmd) == 0)
@@ -201,9 +199,8 @@ void RootConsoleMenu::GotRootCmd(const ICommandArgs *cmd)
ConsolePrint("SourceMod Menu:");
ConsolePrint("Usage: sm <command> [arguments]");
List<ConsoleEntry *>::iterator iter;
ConsoleEntry *pEntry;
for (iter=m_Menu.begin(); iter!=m_Menu.end(); iter++)
for (auto iter=m_Menu.begin(); iter!=m_Menu.end(); iter++)
{
pEntry = (*iter);
DrawGenericOption(pEntry->command.c_str(), pEntry->description.c_str());
+5 -6
View File
@@ -29,17 +29,16 @@
#include "common_logic.h"
#include <IRootConsoleMenu.h>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include <sm_namehashset.h>
using namespace SourceMod;
using namespace SourceHook;
struct ConsoleEntry
{
String command;
String description;
std::string command;
std::string description;
IRootConsoleCommand *cmd;
static inline bool matches(const char *name, const ConsoleEntry *entry)
@@ -84,7 +83,7 @@ public:
void GotRootCmd(const ICommandArgs *cmd);
private:
NameHashSet<ConsoleEntry *> m_Commands;
List<ConsoleEntry *> m_Menu;
std::list<ConsoleEntry *> m_Menu;
};
extern RootConsoleMenu g_RootMenu;
+1 -1
View File
@@ -233,7 +233,7 @@ void ShareSystem::DestroyIdentType(IdentityType_t type)
void ShareSystem::RemoveInterfaces(IExtension *pExtension)
{
List<IfaceInfo>::iterator iter = m_Interfaces.begin();
auto iter = m_Interfaces.begin();
while (iter != m_Interfaces.end())
{
+2 -4
View File
@@ -37,14 +37,12 @@
#include <am-string.h>
#include <am-utility.h>
#include <am-refcounting.h>
#include <sh_list.h>
#include <list>
#include <sm_hashmap.h>
#include <sm_namehashset.h>
#include "common_logic.h"
#include "Native.h"
using namespace SourceHook;
namespace SourceMod
{
struct IdentityToken_t
@@ -133,7 +131,7 @@ private:
private:
typedef NameHashSet<ke::RefPtr<Native>, Native> NativeCache;
List<IfaceInfo> m_Interfaces;
std::list<IfaceInfo> m_Interfaces;
HandleType_t m_TypeRoot;
IdentityToken_t m_IdentRoot;
HandleType_t m_IfaceType;
+8 -9
View File
@@ -34,8 +34,8 @@
#include "common_logic.h"
#include <sm_hashmap.h>
#include <sh_string.h>
#include <sh_vector.h>
#include <string>
#include <vector>
#include "sm_memtable.h"
#include "ITextParsers.h"
#include <ITranslator.h>
@@ -44,7 +44,6 @@
/* :TODO: write a templatized version of tries? */
using namespace SourceMod;
using namespace SourceHook;
class Translator;
enum PhraseParseState
@@ -83,15 +82,15 @@ private:
void ParseWarning(const char *message, ...);
private:
StringHashMap<int> m_PhraseLookup;
String m_File;
std::string m_File;
Translator *m_pTranslator;
PhraseParseState m_ParseState;
int m_CurPhrase;
BaseMemTable *m_pMemory;
BaseStringTable *m_pStringTab;
unsigned int m_LangCount;
String m_ParseError;
String m_LastPhraseString;
std::string m_ParseError;
std::string m_LastPhraseString;
bool m_FileLogged;
};
@@ -152,13 +151,13 @@ public: //ITranslator
private:
bool AddLanguage(const char *langcode, const char *description);
private:
CVector<Language *> m_Languages;
CVector<CPhraseFile *> m_Files;
std::vector<Language *> m_Languages;
std::vector<CPhraseFile *> m_Files;
BaseStringTable *m_pStringTab;
StringHashMap<unsigned int> m_LCodeLookup;
StringHashMap<unsigned int> m_LAliases;
bool m_InLanguageSection;
String m_CustomError;
std::string m_CustomError;
unsigned int m_ServerLang;
char m_InitialLang[4];
};
+2 -2
View File
@@ -60,7 +60,7 @@
#include <bridge/include/CoreProvider.h>
#include <bridge/include/IScriptManager.h>
#include <bridge/include/IExtensionBridge.h>
#include <sh_vector.h>
#include <vector>
using namespace SourceMod;
using namespace SourcePawn;
@@ -129,7 +129,7 @@ class CMMPluginIterator
public IPluginsListener
{
public:
CMMPluginIterator(const CVector<SMPlugin *> *list)
CMMPluginIterator(const std::vector<SMPlugin *> *list)
: m_hasStarted(false)
{
for(auto iter = list->begin(); iter != list->end(); ++iter) {
+1 -1
View File
@@ -285,7 +285,7 @@ public:
private:
IDatabase *m_pDatabase;
IPluginFunction *m_pFunction;
String m_Query;
std::string m_Query;
cell_t m_Data;
IdentityToken_t *m_Identity;
IQuery *m_pQuery;
+6 -8
View File
@@ -29,7 +29,7 @@
* Version: $Id$
*/
#include <sh_list.h>
#include <list>
#include <sm_namehashset.h>
#include "common_logic.h"
#include "CellArray.h"
@@ -42,8 +42,6 @@
#include <bridge/include/ILogger.h>
#include <bridge/include/IFileSystemBridge.h>
using namespace SourceHook;
struct maplist_info_t
{
bool bIsCompat;
@@ -168,7 +166,7 @@ public:
m_pMapCycleFile = bridge->FindConVar("mapcyclefile");
/* Dump everything we know about. */
List<maplist_info_t *> compat;
std::list<maplist_info_t *> compat;
DumpCache(&compat);
/* All this is to add the default entry back in. */
@@ -206,7 +204,7 @@ public:
}
/* Now, re-add compat stuff back in if we can. */
List<maplist_info_t *>::iterator iter = compat.begin();
auto iter = compat.begin();
while (iter != compat.end())
{
if (m_ListLookup.contains((*iter)->name))
@@ -666,11 +664,11 @@ private:
return true;
}
void DumpCache(List<maplist_info_t *> *compat_list)
void DumpCache(std::list<maplist_info_t *> *compat_list)
{
m_ListLookup.clear();
List<maplist_info_t *>::iterator iter = m_MapLists.begin();
auto iter = m_MapLists.begin();
while (iter != m_MapLists.end())
{
if (compat_list != NULL && (*iter)->bIsCompat)
@@ -690,7 +688,7 @@ private:
time_t m_ConfigLastChanged;
ConVar *m_pMapCycleFile;
NameHashSet<maplist_info_t *> m_ListLookup;
List<maplist_info_t *> m_MapLists;
std::list<maplist_info_t *> m_MapLists;
MapListState m_CurState;
unsigned int m_IgnoreLevel;
maplist_info_t *m_pCurMapList;
+9 -8
View File
@@ -30,7 +30,8 @@
*/
#include "common_logic.h"
#include <sh_stack.h>
#include <stack>
#include <vector>
#include <IMenuManager.h>
#include <IPlayerHelpers.h>
#include "DebugReporter.h"
@@ -175,13 +176,13 @@ public:
while (!m_FreePanelHandlers.empty())
{
delete m_FreePanelHandlers.front();
delete m_FreePanelHandlers.top();
m_FreePanelHandlers.pop();
}
while (!m_FreeMenuHandlers.empty())
{
delete m_FreeMenuHandlers.front();
delete m_FreeMenuHandlers.top();
m_FreeMenuHandlers.pop();
}
}
@@ -241,7 +242,7 @@ public:
handler = new CPanelHandler;
m_PanelHandlers.push_back(handler);
} else {
handler = m_FreePanelHandlers.front();
handler = m_FreePanelHandlers.top();
m_FreePanelHandlers.pop();
}
handler->m_pFunc = pFunction;
@@ -263,7 +264,7 @@ public:
{
handler = new CMenuHandler(pFunction, flags);
} else {
handler = m_FreeMenuHandlers.front();
handler = m_FreeMenuHandlers.top();
m_FreeMenuHandlers.pop();
handler->m_pBasic = pFunction;
handler->m_Flags = flags;
@@ -280,9 +281,9 @@ public:
private:
HandleType_t m_PanelType;
HandleType_t m_TempPanelType;
CStack<CPanelHandler *> m_FreePanelHandlers;
CStack<CMenuHandler *> m_FreeMenuHandlers;
CVector<CPanelHandler *> m_PanelHandlers;
std::stack<CPanelHandler *> m_FreePanelHandlers;
std::stack<CMenuHandler *> m_FreeMenuHandlers;
std::vector<CPanelHandler *> m_PanelHandlers;
} g_MenuHelpers;
/**
+8 -11
View File
@@ -35,8 +35,8 @@
#include <IGameHelpers.h>
#include <ISourceMod.h>
#include <ITranslator.h>
#include <sh_string.h>
#include <sh_list.h>
#include <string>
#include <list>
#include "GameConfigs.h"
#include "CellArray.h"
#include "AutoHandleRooter.h"
@@ -46,7 +46,6 @@
#include <bridge/include/CoreProvider.h>
#include <bridge/include/IVEngineServerBridge.h>
using namespace SourceHook;
using namespace SourceMod;
#ifndef PRIu64
@@ -75,9 +74,9 @@ class PlayerLogicHelpers :
struct SimpleMultiTargetFilter
{
IPlugin *plugin;
SourceHook::String pattern;
std::string pattern;
IPluginFunction *fun;
SourceHook::String phrase;
std::string phrase;
bool phraseIsML;
SimpleMultiTargetFilter(IPlugin *plugin, const char *pattern, IPluginFunction *fun,
@@ -87,7 +86,7 @@ class PlayerLogicHelpers :
}
};
List<SimpleMultiTargetFilter *> simpleMultis;
std::list<SimpleMultiTargetFilter *> simpleMultis;
bool filterEnabled;
public:
@@ -107,7 +106,7 @@ public:
void RemoveMultiTargetFilter(const char *pattern, IPluginFunction *fun)
{
List<SimpleMultiTargetFilter *>::iterator iter = simpleMultis.begin();
auto iter = simpleMultis.begin();
while (iter != simpleMultis.end()) {
if ((*iter)->fun == fun && strcmp((*iter)->pattern.c_str(), pattern) == 0) {
@@ -127,9 +126,7 @@ public:
public: //ICommandTargetProcessor
bool ProcessCommandTarget(cmd_target_info_t *info)
{
List<SimpleMultiTargetFilter *>::iterator iter;
for (iter = simpleMultis.begin(); iter != simpleMultis.end(); iter++) {
for (auto iter = simpleMultis.begin(); iter != simpleMultis.end(); iter++) {
SimpleMultiTargetFilter *smtf = (*iter);
if (strcmp(smtf->pattern.c_str(), info->pattern) == 0) {
CellArray *array = new CellArray(1);
@@ -206,7 +203,7 @@ public: //IPluginsListener
void OnPluginDestroyed(IPlugin *plugin)
{
List<SimpleMultiTargetFilter *>::iterator iter = simpleMultis.begin();
auto iter = simpleMultis.begin();
while (iter != simpleMultis.end()) {
if ((*iter)->plugin != plugin) {
+6 -9
View File
@@ -34,12 +34,10 @@
#include <IHandleSys.h>
#include <ITimerSystem.h>
#include <IPluginSys.h>
#include <sh_stack.h>
#include <stack>
#include "DebugReporter.h"
#include <bridge/include/CoreProvider.h>
using namespace SourceHook;
#define TIMER_DATA_HNDL_CLOSE (1<<9)
#define TIMER_HNDL_CLOSE (1<<9)
@@ -74,17 +72,16 @@ public:
TimerInfo *CreateTimerInfo();
void DeleteTimerInfo(TimerInfo *pInfo);
private:
CStack<TimerInfo *> m_FreeTimers;
std::stack<TimerInfo *> m_FreeTimers;
};
TimerNatives::~TimerNatives()
{
CStack<TimerInfo *>::iterator iter;
for (iter=m_FreeTimers.begin(); iter!=m_FreeTimers.end(); iter++)
while (!m_FreeTimers.empty())
{
delete (*iter);
delete m_FreeTimers.top();
m_FreeTimers.pop();
}
m_FreeTimers.popall();
}
void TimerNatives::OnSourceModAllInitialized()
@@ -118,7 +115,7 @@ TimerInfo *TimerNatives::CreateTimerInfo()
{
pInfo = new TimerInfo;
} else {
pInfo = m_FreeTimers.front();
pInfo = m_FreeTimers.top();
m_FreeTimers.pop();
}
+9 -8
View File
@@ -79,7 +79,7 @@ HandleType_t htConCmdIter = 0;
struct GlobCmdIter
{
bool started;
List<ConCmdInfo *>::iterator iter;
std::list<ConCmdInfo *>::iterator iter;
};
class ConsoleHelpers :
@@ -1056,7 +1056,7 @@ static cell_t ReadCommandIterator(IPluginContext *pContext, const cell_t *params
return pContext->ThrowNativeError("Invalid GlobCmdIter Handle %x", params[1]);
}
const List<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
std::list<ConCmdInfo *>& cmds = const_cast<decltype(cmds)>(g_ConCmds.GetCommandList());
if (!iter->started)
{
@@ -1395,7 +1395,7 @@ static cell_t sm_CommandIteratorNext(IPluginContext *pContext, const cell_t *par
return pContext->ThrowNativeError("Invalid CommandIterator Handle %x", params[1]);
}
const List<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
std::list<ConCmdInfo *>& cmds = const_cast<decltype(cmds)>(g_ConCmds.GetCommandList());
if (!iter->started)
{
@@ -1427,7 +1427,7 @@ static cell_t sm_CommandIteratorAdminFlags(IPluginContext *pContext, const cell_
{
return pContext->ThrowNativeError("Invalid CommandIterator Handle %x", params[1]);
}
const List<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
const std::list<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
if (!iter->started || iter->iter == cmds.end())
{
return pContext->ThrowNativeError("Invalid CommandIterator position");
@@ -1448,7 +1448,7 @@ static cell_t sm_CommandIteratorConVarFlags(IPluginContext *pContext, const cell
{
return pContext->ThrowNativeError("Invalid CommandIterator Handle %x", params[1]);
}
const List<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
const std::list<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
if (!iter->started || iter->iter == cmds.end())
{
return pContext->ThrowNativeError("Invalid CommandIterator position");
@@ -1469,7 +1469,7 @@ static cell_t sm_CommandIteratorGetDesc(IPluginContext *pContext, const cell_t *
{
return pContext->ThrowNativeError("Invalid CommandIterator Handle %x", params[1]);
}
const List<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
const std::list<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
if (!iter->started || iter->iter == cmds.end())
{
return pContext->ThrowNativeError("Invalid CommandIterator position");
@@ -1492,7 +1492,7 @@ static cell_t sm_CommandIteratorGetName(IPluginContext *pContext, const cell_t *
{
return pContext->ThrowNativeError("Invalid CommandIterator Handle %x", params[1]);
}
const List<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
const std::list<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
if (!iter->started || iter->iter == cmds.end())
{
return pContext->ThrowNativeError("Invalid CommandIterator position");
@@ -1515,7 +1515,8 @@ static cell_t sm_CommandIteratorPlugin(IPluginContext *pContext, const cell_t *p
{
return pContext->ThrowNativeError("Invalid CommandIterator Handle %x", params[1]);
}
const List<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
const std::list<ConCmdInfo *> &cmds = g_ConCmds.GetCommandList();
if (!iter->started || iter->iter == cmds.end())
{
return pContext->ThrowNativeError("Invalid CommandIterator position");
+14 -14
View File
@@ -537,7 +537,7 @@ static cell_t smn_CreateKeyValues(IPluginContext *pCtx, const cell_t *params)
is_empty = (firstkey[0] == '\0');
pStk = new KeyValueStack;
pStk->pBase = new KeyValues(name, is_empty ? NULL : firstkey, (is_empty||(firstvalue[0]=='\0')) ? NULL : firstvalue);
pStk->pCurRoot.push(pStk->pBase);
pStk->pCurRoot.push_front(pStk->pBase);
return handlesys->CreateHandle(g_KeyValueType, pStk, pCtx->GetIdentity(), g_pCoreIdent, NULL);
}
@@ -566,7 +566,7 @@ static cell_t smn_KeyValuesFromAddress(IPluginContext *pCtx, const cell_t *param
*/
KeyValueStack *pStk = new KeyValueStack;
pStk->pBase = reinterpret_cast<KeyValues *>(addr);
pStk->pCurRoot.push(pStk->pBase);
pStk->pCurRoot.push_front(pStk->pBase);
pStk->m_bDeleteOnDestroy = false;
return handlesys->CreateHandle(g_KeyValueType, pStk, pCtx->GetIdentity(), g_pCoreIdent, NULL);
@@ -597,7 +597,7 @@ static cell_t smn_KvJumpToKey(IPluginContext *pCtx, const cell_t *params)
{
return 0;
}
pStk->pCurRoot.push(pSubKey);
pStk->pCurRoot.push_front(pSubKey);
return 1;
}
@@ -624,7 +624,7 @@ static cell_t smn_KvJumpToKeySymbol(IPluginContext *pCtx, const cell_t *params)
{
return 0;
}
pStk->pCurRoot.push(pSubKey);
pStk->pCurRoot.push_front(pSubKey);
return 1;
}
@@ -658,7 +658,7 @@ static cell_t smn_KvGotoFirstSubKey(IPluginContext *pCtx, const cell_t *params)
{
return 0;
}
pStk->pCurRoot.push(pFirstSubKey);
pStk->pCurRoot.push_front(pFirstSubKey);
return 1;
}
@@ -690,8 +690,8 @@ static cell_t smn_KvGotoNextKey(IPluginContext *pCtx, const cell_t *params)
{
return 0;
}
pStk->pCurRoot.pop();
pStk->pCurRoot.push(pSubKey);
pStk->pCurRoot.pop_front();
pStk->pCurRoot.push_front(pSubKey);
return 1;
}
@@ -716,7 +716,7 @@ static cell_t smn_KvGoBack(IPluginContext *pCtx, const cell_t *params)
{
return 0;
}
pStk->pCurRoot.pop();
pStk->pCurRoot.pop_front();
return 1;
}
@@ -742,7 +742,7 @@ static cell_t smn_KvRewind(IPluginContext *pCtx, const cell_t *params)
{
while (pStk->pCurRoot.size() > 1)
{
pStk->pCurRoot.pop();
pStk->pCurRoot.pop_front();
}
}
else
@@ -750,7 +750,7 @@ static cell_t smn_KvRewind(IPluginContext *pCtx, const cell_t *params)
auto root = pStk->pCurRoot.begin();
if (root != pStk->pCurRoot.end())
{
pStk->pCurRoot.push(*root);
pStk->pCurRoot.push_front(*root);
}
}
@@ -965,7 +965,7 @@ static cell_t smn_KvDeleteThis(IPluginContext *pContext, const cell_t *params)
}
KeyValues *pValues = pStk->pCurRoot.front();
pStk->pCurRoot.pop();
pStk->pCurRoot.pop_front();
KeyValues *pRoot = pStk->pCurRoot.front();
/* We have to manually verify this since Valve sucks
@@ -982,7 +982,7 @@ static cell_t smn_KvDeleteThis(IPluginContext *pContext, const cell_t *params)
pValues->deleteThis();
if (pNext)
{
pStk->pCurRoot.push(pNext);
pStk->pCurRoot.push_front(pNext);
return 1;
} else {
return -1;
@@ -992,7 +992,7 @@ static cell_t smn_KvDeleteThis(IPluginContext *pContext, const cell_t *params)
}
/* Push this back on :( */
pStk->pCurRoot.push(pValues);
pStk->pCurRoot.push_front(pValues);
return 0;
}
@@ -1056,7 +1056,7 @@ static cell_t smn_KvSavePosition(IPluginContext *pContext, const cell_t *params)
}
KeyValues *pValues = pStk->pCurRoot.front();
pStk->pCurRoot.push(pValues);
pStk->pCurRoot.push_front(pValues);
return 1;
}
+2 -2
View File
@@ -33,7 +33,7 @@
#define _INCLUDE_SOURCEMOD_KVWRAPPER_H_
#include <IHandleSys.h>
#include <sh_stack.h>
#include <deque>
using namespace SourceMod;
@@ -42,7 +42,7 @@ class KeyValues;
struct KeyValueStack
{
KeyValues *pBase;
SourceHook::CStack<KeyValues *> pCurRoot;
std::deque<KeyValues *> pCurRoot;
bool m_bDeleteOnDestroy = true;
};
+1 -2
View File
@@ -79,8 +79,7 @@ static cell_t sm_GetMapHistory(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Invalid Map History Index");
}
SourceHook::List<MapChangeData *>::iterator iter;
iter = g_NextMap.m_mapHistory.end();
auto iter = g_NextMap.m_mapHistory.end();
iter--;
for (int i=0; i<params[1]; i++)
+8 -10
View File
@@ -51,8 +51,8 @@ bf_read g_ReadBitBuf;
int g_MsgPlayers[SM_MAXPLAYERS+1];
bool g_IsMsgInExec = false;
typedef List<MsgListenerWrapper *> MsgWrapperList;
typedef List<MsgListenerWrapper *>::iterator MsgWrapperIter;
typedef std::list<MsgListenerWrapper *> MsgWrapperList;
typedef MsgWrapperList::iterator MsgWrapperIter;
class UsrMessageNatives :
public SMGlobalClass,
@@ -72,17 +72,15 @@ public:
bool FindListener(int msgid, IPluginContext *pCtx, IPluginFunction *pHook, bool intercept, MsgWrapperIter *iter);
bool DeleteListener(IPluginContext *pCtx, MsgWrapperIter iter);
private:
CStack<MsgListenerWrapper *> m_FreeListeners;
std::stack<MsgListenerWrapper *> m_FreeListeners;
};
UsrMessageNatives::~UsrMessageNatives()
{
CStack<MsgListenerWrapper *>::iterator iter;
for (iter=m_FreeListeners.begin(); iter!=m_FreeListeners.end(); iter++)
{
delete (*iter);
while (!m_FreeListeners.empty()) {
delete m_FreeListeners.top();
m_FreeListeners.pop();
}
m_FreeListeners.popall();
}
void UsrMessageNatives::OnSourceModAllInitialized()
@@ -175,13 +173,13 @@ MsgListenerWrapper *UsrMessageNatives::CreateListener(IPluginContext *pCtx)
{
pListener = new MsgListenerWrapper;
} else {
pListener = m_FreeListeners.front();
pListener = m_FreeListeners.top();
m_FreeListeners.pop();
}
if (!pl->GetProperty("MsgListeners", reinterpret_cast<void **>(&pList)))
{
pList = new List<MsgListenerWrapper *>;
pList = new std::list<MsgListenerWrapper *>;
pl->SetProperty("MsgListeners", pList);
}
+3 -3
View File
@@ -32,7 +32,7 @@
#include <stdio.h>
#include "sourcemod.h"
#include "sourcemm_api.h"
#include <sh_string.h>
#include <string>
#include "CoreConfig.h"
#include "Logger.h"
#include "sm_stringutil.h"
@@ -58,7 +58,7 @@ SH_DECL_HOOK0(IVEngineServer, GetMapEntitiesString, SH_NOATTRIB, 0, const char *
SourceModBase g_SourceMod;
SourceHook::String g_BaseDir;
std::string g_BaseDir;
ISourcePawnEnvironment *g_pPawnEnv = NULL;
IdentityToken_t *g_pCoreIdent = NULL;
IForward *g_pOnMapInit = nullptr;
@@ -667,7 +667,7 @@ void SourceModBase::RemoveGameFrameHook(GAME_FRAME_HOOK hook)
{
if (m_frame_hooks[i] == hook)
{
m_frame_hooks.erase(m_frame_hooks.iterAt(i));
m_frame_hooks.erase(m_frame_hooks.begin() + i);
return;
}
}
+3 -5
View File
@@ -34,10 +34,8 @@
#include "sm_globals.h"
#include <ISourceMod.h>
#include <sh_stack.h>
#include <sh_vector.h>
using namespace SourceHook;
#include <stack>
#include <vector>
#if defined _DEBUG
# define IF_DEBUG_SPEW
@@ -147,7 +145,7 @@ private:
bool m_ExecOnMapEnd;
unsigned int m_target;
bool m_GotBasePath;
CVector<GAME_FRAME_HOOK> m_frame_hooks;
std::vector<GAME_FRAME_HOOK> m_frame_hooks;
};
void UTIL_ConsolePrintVa(const char *fmt, va_list ap);
+1 -1
View File
@@ -42,7 +42,7 @@ enum SDKFuncConfSource
SDKConf_Address
};
using ParamVector = SourceHook::CVector<ParamInfo>;
using ParamVector = std::vector<ParamInfo>;
bool GetHandleIfValidOrError(HandleType_t type, void **object, IPluginContext *pContext, cell_t param)
{
+2 -3
View File
@@ -34,7 +34,6 @@
#include "extension.h"
#include <sourcehook.h>
#include <sh_vector.h>
#include <sourcehook_pibuilder.h>
#include <registers.h>
#include <vector>
@@ -153,7 +152,7 @@ public:
class DHooksInfo
{
public:
SourceHook::CVector<ParamInfo> params;
std::vector<ParamInfo> params;
int offset;
unsigned int returnFlag;
ReturnType returnType;
@@ -273,7 +272,7 @@ public:
HookType hookType;
CallingConvention callConv;
ThisPointerType thisType;
SourceHook::CVector<ParamInfo> params;
std::vector<ParamInfo> params;
int offset;
void *funcAddr;
IPluginFunction *callback;
+5 -5
View File
@@ -81,11 +81,11 @@ private:
/* ---------- */
DatabaseInfo m_Info;
String m_Host;
String m_Database;
String m_User;
String m_Pass;
String m_Schema;
std::string m_Host;
std::string m_Database;
std::string m_User;
std::string m_Pass;
std::string m_Schema;
bool m_bPersistent;
};
+3 -6
View File
@@ -40,10 +40,9 @@ PgDriver::PgDriver()
m_Handle = BAD_HANDLE;
}
void CloseDBList(List<PgDatabase *> &l)
void CloseDBList(std::list<PgDatabase *> &l)
{
List<PgDatabase *>::iterator iter;
for (iter=l.begin(); iter!=l.end(); iter++)
for (auto iter=l.begin(); iter!=l.end(); iter++)
{
PgDatabase *db = (*iter);
while (!db->Close())
@@ -56,7 +55,6 @@ void CloseDBList(List<PgDatabase *> &l)
void PgDriver::Shutdown()
{
List<PgDatabase *>::iterator iter;
CloseDBList(m_PermDbs);
if (m_Handle != BAD_HANDLE)
@@ -191,8 +189,7 @@ IDatabase *PgDriver::Connect(const DatabaseInfo *info, bool persistent, char *er
if (persistent)
{
/* Try to find a matching persistent connection */
List<PgDatabase *>::iterator iter;
for (iter=m_PermDbs.begin();
for (auto iter=m_PermDbs.begin();
iter!=m_PermDbs.end();
iter++)
{
+3 -5
View File
@@ -41,13 +41,11 @@
#include <libpq-fe.h>
#include <sh_string.h>
#include <sh_list.h>
#include <string>
#include <list>
#include <mutex>
using namespace SourceMod;
using namespace SourceHook;
#define M_CLIENT_MULTI_RESULTS ((1) << 17) /* Enable/disable multi-results */
@@ -72,7 +70,7 @@ public:
private:
std::mutex m_Lock;
Handle_t m_Handle;
List<PgDatabase *> m_PermDbs;
std::list<PgDatabase *> m_PermDbs;
};
extern PgDriver g_PgDriver;
+2 -4
View File
@@ -1854,9 +1854,8 @@ void SDKHooks::HandleEntityCreated(CBaseEntity *pEntity, int index, cell_t ref)
cell_t bcompatRef = gamehelpers->EntityToBCompatRef(pEntity);
// Send OnEntityCreated to SM listeners
SourceHook::List<ISMEntityListener *>::iterator iter;
ISMEntityListener *pListener = NULL;
for (iter = m_EntListeners.begin(); iter != m_EntListeners.end(); iter++)
for (auto iter = m_EntListeners.begin(); iter != m_EntListeners.end(); iter++)
{
pListener = (*iter);
pListener->OnEntityCreated(pEntity, pName ? pName : "");
@@ -1875,9 +1874,8 @@ void SDKHooks::HandleEntityDeleted(CBaseEntity *pEntity)
cell_t bcompatRef = gamehelpers->EntityToBCompatRef(pEntity);
// Send OnEntityDestroyed to SM listeners
SourceHook::List<ISMEntityListener *>::iterator iter;
ISMEntityListener *pListener = NULL;
for (iter = m_EntListeners.begin(); iter != m_EntListeners.end(); iter++)
for (auto iter = m_EntListeners.begin(); iter != m_EntListeners.end(); iter++)
{
pListener = (*iter);
pListener->OnEntityDestroyed(pEntity);
+2 -2
View File
@@ -6,7 +6,7 @@
#include "smsdk_ext.h"
#include <ISDKHooks.h>
#include <convar.h>
#include <sh_list.h>
#include <list>
#include <am-vector.h>
#include <vtable_hook_helper.h>
@@ -262,7 +262,7 @@ public: // ISDKHooks
public: // IServerGameDLL
void LevelShutdown();
private:
SourceHook::List<ISMEntityListener *> m_EntListeners;
std::list<ISMEntityListener *> m_EntListeners;
public:
/**
+2 -4
View File
@@ -237,8 +237,7 @@ void SDKTools::OnHandleDestroy(HandleType_t type, void *object)
void SDKTools::SDK_OnUnload()
{
SourceHook::List<ValveCall *>::iterator iter;
for (iter = g_RegCalls.begin();
for (auto iter = g_RegCalls.begin();
iter != g_RegCalls.end();
iter++)
{
@@ -395,8 +394,7 @@ bool SDKTools::QueryInterfaceDrop(SMInterface *pInterface)
void SDKTools::NotifyInterfaceDrop(SMInterface *pInterface)
{
SourceHook::List<ValveCall *>::iterator iter;
for (iter = g_RegCalls.begin();
for (auto iter = g_RegCalls.begin();
iter != g_RegCalls.end();
iter++)
{
+8 -8
View File
@@ -33,6 +33,8 @@
#include "output.h"
#include "am-string.h"
#include <list>
ISourcePawnEngine *spengine = NULL;
EntityOutputManager g_OutputManager;
CDetour *fireOutputDetour = NULL;
@@ -138,11 +140,9 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
if (!pOutputName->hooks.empty())
{
SourceHook::List<omg_hooks *>::iterator _iter;
omg_hooks *hook;
_iter = pOutputName->hooks.begin();
auto _iter = pOutputName->hooks.begin();
// by default we'll call the game's output func, unless a plugin overrides it
bool fireOriginal = true;
@@ -221,7 +221,7 @@ omg_hooks *EntityOutputManager::NewHook()
}
else
{
hook = g_OutputManager.FreeHooks.front();
hook = g_OutputManager.FreeHooks.top();
g_OutputManager.FreeHooks.pop();
}
@@ -256,14 +256,14 @@ void EntityOutputManager::CleanUpHook(omg_hooks *hook)
OnHookRemoved();
IPlugin *pPlugin = plsys->FindPluginByContext(hook->pf->GetParentContext());
SourceHook::List<omg_hooks *> *pList = NULL;
std::list<omg_hooks *> *pList = NULL;
if (!pPlugin->GetProperty("OutputHookList", (void **)&pList, false) || !pList)
{
return;
}
SourceHook::List<omg_hooks *>::iterator p_iter = pList->begin();
auto p_iter = pList->begin();
omg_hooks *pluginHook;
@@ -283,11 +283,11 @@ void EntityOutputManager::CleanUpHook(omg_hooks *hook)
void EntityOutputManager::OnPluginDestroyed(IPlugin *plugin)
{
SourceHook::List<omg_hooks *> *pList = NULL;
std::list<omg_hooks *> *pList = NULL;
if (plugin->GetProperty("OutputHookList", (void **)&pList, true))
{
SourceHook::List<omg_hooks *>::iterator p_iter = pList->begin();
auto p_iter = pList->begin();
omg_hooks *hook;
while (p_iter != pList->end())
+4 -4
View File
@@ -34,8 +34,8 @@
#include <jit/jit_helpers.h>
#include <jit/x86/x86_macros.h>
#include "sh_list.h"
#include "sh_stack.h"
#include <list>
#include <stack>
#include "sm_trie_tpl.h"
#include "CDetour/detours.h"
@@ -62,7 +62,7 @@ struct omg_hooks
*/
struct OutputNameStruct
{
SourceHook::List<omg_hooks *> hooks;
std::list<omg_hooks *> hooks;
char Name[50];
};
@@ -124,7 +124,7 @@ private:
// Maps classname to a ClassNameStruct
IBasicTrie *ClassNames;
SourceHook::CStack<omg_hooks *> FreeHooks; //Stores hook pointers to avoid calls to new
std::stack<omg_hooks *> FreeHooks; //Stores hook pointers to avoid calls to new
int HookCount;
+8 -16
View File
@@ -65,14 +65,12 @@ cell_t HookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
OutputNameStruct *pOutputName = g_OutputManager.FindOutputPointer((const char *)classname, outputname, true);
//Check for an existing identical hook
SourceHook::List<omg_hooks *>::iterator _iter;
omg_hooks *hook;
IPluginFunction *pFunction;
pFunction = pContext->GetFunctionById(params[3]);
for (_iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
for (auto _iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
{
hook = (omg_hooks *)*_iter;
if (hook->pf == pFunction && hook->entity_ref == gamehelpers->EntityToReference(pEntity))
@@ -95,11 +93,11 @@ cell_t HookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
g_OutputManager.OnHookAdded();
IPlugin *pPlugin = plsys->FindPluginByContext(pContext);
SourceHook::List<omg_hooks *> *pList = NULL;
std::list<omg_hooks *> *pList = NULL;
if (!pPlugin->GetProperty("OutputHookList", (void **)&pList, false) || !pList)
{
pList = new SourceHook::List<omg_hooks *>;
pList = new std::list<omg_hooks *>;
pPlugin->SetProperty("OutputHookList", pList);
}
@@ -126,14 +124,12 @@ cell_t HookEntityOutput(IPluginContext *pContext, const cell_t *params)
OutputNameStruct *pOutputName = g_OutputManager.FindOutputPointer((const char *)classname, outputname, true);
//Check for an existing identical hook
SourceHook::List<omg_hooks *>::iterator _iter;
omg_hooks *hook;
IPluginFunction *pFunction;
pFunction = pContext->GetFunctionById(params[3]);
for (_iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
for (auto _iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
{
hook = (omg_hooks *)*_iter;
if (hook->pf == pFunction && hook->entity_ref == -1)
@@ -158,11 +154,11 @@ cell_t HookEntityOutput(IPluginContext *pContext, const cell_t *params)
g_OutputManager.OnHookAdded();
IPlugin *pPlugin = plsys->FindPluginByContext(pContext);
SourceHook::List<omg_hooks *> *pList = NULL;
std::list<omg_hooks *> *pList = NULL;
if (!pPlugin->GetProperty("OutputHookList", (void **)&pList, false) || !pList)
{
pList = new SourceHook::List<omg_hooks *>;
pList = new std::list<omg_hooks *>;
pPlugin->SetProperty("OutputHookList", pList);
}
@@ -193,14 +189,12 @@ cell_t UnHookEntityOutput(IPluginContext *pContext, const cell_t *params)
}
//Check for an existing identical hook
SourceHook::List<omg_hooks *>::iterator _iter;
omg_hooks *hook;
IPluginFunction *pFunction;
pFunction = pContext->GetFunctionById(params[3]);
for (_iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
for (auto _iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
{
hook = (omg_hooks *)*_iter;
if (hook->pf == pFunction && hook->entity_ref == -1)
@@ -250,14 +244,12 @@ cell_t UnHookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
}
//Check for an existing identical hook
SourceHook::List<omg_hooks *>::iterator _iter;
omg_hooks *hook;
IPluginFunction *pFunction;
pFunction = pContext->GetFunctionById(params[3]);
for (_iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
for (auto _iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
{
hook = (omg_hooks *)*_iter;
/* We're not serial checking and just removing by index here - This was always allowed so is left for bcompat */
+2 -2
View File
@@ -31,7 +31,7 @@
#include "extension.h"
#include "vhelpers.h"
#include <sh_vector.h>
#include <vector>
struct TeamInfo
{
@@ -41,7 +41,7 @@ struct TeamInfo
char m_iScore[64] = { 0 };
SourceHook::CVector<TeamInfo> g_Teams;
std::vector<TeamInfo> g_Teams;
void InitTeamNatives()
{
+1 -2
View File
@@ -419,8 +419,7 @@ void TempEntityManager::Shutdown()
return;
}
SourceHook::List<TempEntityInfo *>::iterator iter;
for (iter=m_TEList.begin(); iter!=m_TEList.end(); iter++)
for (auto iter=m_TEList.begin(); iter!=m_TEList.end(); iter++)
{
delete (*iter);
}
+6 -6
View File
@@ -34,8 +34,8 @@
#include "extension.h"
#include <irecipientfilter.h>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include <stdio.h>
class TempEntityInfo
@@ -61,7 +61,7 @@ private:
private:
void *m_Me;
ServerClass *m_Sc;
SourceHook::String m_Name;
std::string m_Name;
};
class TempEntityManager
@@ -79,7 +79,7 @@ public:
void DumpList();
void DumpProps(FILE *fp);
private:
SourceHook::List<TempEntityInfo *> m_TEList;
std::list<TempEntityInfo *> m_TEList;
IBasicTrie *m_TempEntInfo;
void *m_ListHead;
int m_NameOffs;
@@ -91,7 +91,7 @@ private:
struct TEHookInfo
{
TempEntityInfo *te;
SourceHook::List<IPluginFunction *> lst;
std::list<IPluginFunction *> lst;
};
class TempEntHooks : public IPluginsListener
@@ -110,7 +110,7 @@ private:
size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter);
private:
IBasicTrie *m_TEHooks;
SourceHook::List<TEHookInfo *> m_HookInfo;
std::list<TEHookInfo *> m_HookInfo;
size_t m_HookCount;
};
+6 -8
View File
@@ -61,8 +61,7 @@ void TempEntHooks::Shutdown()
}
plsys->RemovePluginsListener(this);
SourceHook::List<TEHookInfo *>::iterator iter;
for (iter=m_HookInfo.begin(); iter!=m_HookInfo.end(); iter++)
for (auto iter=m_HookInfo.begin(); iter!=m_HookInfo.end(); iter++)
{
delete (*iter);
}
@@ -77,13 +76,13 @@ void TempEntHooks::Shutdown()
void TempEntHooks::OnPluginUnloaded(IPlugin *plugin)
{
SourceHook::List<TEHookInfo *>::iterator iter = m_HookInfo.begin();
auto iter = m_HookInfo.begin();
IPluginContext *pContext = plugin->GetBaseContext();
/* For each hook list... */
while (iter != m_HookInfo.end())
{
SourceHook::List<IPluginFunction *>::iterator f_iter = (*iter)->lst.begin();
auto f_iter = (*iter)->lst.begin();
/* Find the hooks on the given temp entity */
while (f_iter != (*iter)->lst.end())
@@ -177,8 +176,8 @@ bool TempEntHooks::RemoveHook(const char *name, IPluginFunction *pFunc)
if (m_TEHooks->Retrieve(name, reinterpret_cast<void **>(&pInfo)))
{
SourceHook::List<IPluginFunction *>::iterator iter;
if ((iter=pInfo->lst.find(pFunc)) != pInfo->lst.end())
auto iter = std::find(pInfo->lst.begin(), pInfo->lst.end(), pFunc);
if (iter != pInfo->lst.end())
{
pInfo->lst.erase(iter);
if (pInfo->lst.empty())
@@ -205,7 +204,6 @@ void TempEntHooks::OnPlaybackTempEntity(IRecipientFilter &filter, float delay, c
if (m_TEHooks->Retrieve(name, reinterpret_cast<void **>(&pInfo)))
{
SourceHook::List<IPluginFunction *>::iterator iter;
IPluginFunction *pFunc;
size_t size;
cell_t res = static_cast<ResultType>(Pl_Continue);
@@ -214,7 +212,7 @@ void TempEntHooks::OnPlaybackTempEntity(IRecipientFilter &filter, float delay, c
g_CurrentTE = pInfo->te;
size = _FillInPlayers(g_TEPlayers, &filter);
for (iter=pInfo->lst.begin(); iter!=pInfo->lst.end(); iter++)
for (auto iter=pInfo->lst.begin(); iter!=pInfo->lst.end(); iter++)
{
pFunc = (*iter);
pFunc->PushString(name);
+2 -2
View File
@@ -46,7 +46,7 @@ ValveCall::~ValveCall()
{
while (!stk.empty())
{
unsigned char *ptr = stk.front();
unsigned char *ptr = stk.top();
delete [] ptr;
stk.pop();
}
@@ -65,7 +65,7 @@ unsigned char *ValveCall::stk_get()
{
ptr = new unsigned char[stackSize];
} else {
ptr = stk.front();
ptr = stk.top();
stk.pop();
}
return ptr;
+2 -2
View File
@@ -32,7 +32,7 @@
#ifndef _INCLUDE_SOURCEMOD_VALVE_CALLER_H_
#define _INCLUDE_SOURCEMOD_VALVE_CALLER_H_
#include <sh_stack.h>
#include <stack>
#include <extensions/IBinTools.h>
#include "vdecoder.h"
@@ -51,7 +51,7 @@ struct ValveCall
size_t stackSize; /**< Stack size */
size_t stackEnd; /**< End of the bintools stack */
unsigned char *retbuf; /**< Return buffer */
SourceHook::CStack<unsigned char *> stk; /**< Parameter stack */
std::stack<unsigned char *> stk; /**< Parameter stack */
unsigned char *stk_get();
void stk_put(unsigned char *ptr);
+24 -24
View File
@@ -30,7 +30,7 @@
*/
#include <stdlib.h>
#include <sh_string.h>
#include <string>
#include "extension.h"
#include "vcallbuilder.h"
#include "vnatives.h"
@@ -43,8 +43,8 @@
#include "am-string.h"
#include <sm_argbuffer.h>
SourceHook::List<ValveCall *> g_RegCalls;
SourceHook::List<ICallWrapper *> g_CallWraps;
std::list<ValveCall *> g_RegCalls;
std::list<ICallWrapper *> g_CallWraps;
#define ENTINDEX_TO_CBASEENTITY(ref, buffer) \
buffer = gamehelpers->ReferenceToEntity(ref); \
@@ -626,31 +626,31 @@ static cell_t SetClientViewEntity(IPluginContext *pContext, const cell_t *params
return pContext->ThrowNativeError("Entity %d is not valid", params[2]);
}
CBaseEntity *pClientEntity = player->GetEdict()->GetUnknown()->GetBaseEntity();
sm_sendprop_info_t info;
ServerClass *pServerClass = gamehelpers->FindEntityServerClass(pClientEntity);
if (pServerClass && gamehelpers->FindSendPropInfo(pServerClass->GetName(), "m_hViewEntity", &info))
{
CBaseHandle &hViewEntity = *(CBaseHandle *)((char *)pClientEntity + info.actual_offset);
gamehelpers->SetHandleEntity(hViewEntity, pEdict);
gamehelpers->SetEdictStateChanged(player->GetEdict(), info.actual_offset);
}
else
{
sm_datatable_info_t info;
if (gamehelpers->FindDataMapInfo(gamehelpers->GetDataMap(pClientEntity), "m_hViewEntity", &info))
{
CBaseHandle &hViewEntity = *(CBaseHandle *)((char *)pClientEntity + info.actual_offset);
gamehelpers->SetHandleEntity(hViewEntity, pEdict);
}
}
CBaseEntity *pClientEntity = player->GetEdict()->GetUnknown()->GetBaseEntity();
sm_sendprop_info_t info;
ServerClass *pServerClass = gamehelpers->FindEntityServerClass(pClientEntity);
if (pServerClass && gamehelpers->FindSendPropInfo(pServerClass->GetName(), "m_hViewEntity", &info))
{
CBaseHandle &hViewEntity = *(CBaseHandle *)((char *)pClientEntity + info.actual_offset);
gamehelpers->SetHandleEntity(hViewEntity, pEdict);
gamehelpers->SetEdictStateChanged(player->GetEdict(), info.actual_offset);
}
else
{
sm_datatable_info_t info;
if (gamehelpers->FindDataMapInfo(gamehelpers->GetDataMap(pClientEntity), "m_hViewEntity", &info))
{
CBaseHandle &hViewEntity = *(CBaseHandle *)((char *)pClientEntity + info.actual_offset);
gamehelpers->SetHandleEntity(hViewEntity, pEdict);
}
}
engine->SetView(player->GetEdict(), pEdict);
return 1;
}
static SourceHook::String *g_lightstyle[MAX_LIGHTSTYLES] = {NULL};
static std::string *g_lightstyle[MAX_LIGHTSTYLES] = {NULL};
static cell_t SetLightStyle(IPluginContext *pContext, const cell_t *params)
{
int style = params[1];
@@ -666,7 +666,7 @@ static cell_t SetLightStyle(IPluginContext *pContext, const cell_t *params)
* this or not on shutdown, but for ~4K of memory MAX, it doesn't seem worth it yet.
* So, it's a :TODO:!
*/
g_lightstyle[style] = new SourceHook::String();
g_lightstyle[style] = new std::string();
}
char *str;
+2 -2
View File
@@ -32,9 +32,9 @@
#ifndef _INCLUDE_SDKTOOLS_VNATIVES_H_
#define _INCLUDE_SDKTOOLS_VNATIVES_H_
#include <sh_list.h>
#include <list>
extern SourceHook::List<ValveCall *> g_RegCalls;
extern std::list<ValveCall *> g_RegCalls;
extern sp_nativeinfo_t g_Natives[];
extern sp_nativeinfo_t g_SoundNatives[];
+9 -12
View File
@@ -139,12 +139,11 @@ void SoundHooks::Shutdown()
void SoundHooks::OnPluginUnloaded(IPlugin *plugin)
{
SoundHookIter iter;
IPluginContext *pContext = plugin->GetBaseContext();
if (m_AmbientCount)
{
for (iter=m_AmbientFuncs.begin(); iter!=m_AmbientFuncs.end(); )
for (auto iter=m_AmbientFuncs.begin(); iter!=m_AmbientFuncs.end(); )
{
if ((*iter)->GetParentContext() == pContext)
{
@@ -159,7 +158,7 @@ void SoundHooks::OnPluginUnloaded(IPlugin *plugin)
}
if (m_NormalCount)
{
for (iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); )
for (auto iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); )
{
if ((*iter)->GetParentContext() == pContext)
{
@@ -190,10 +189,10 @@ void SoundHooks::AddHook(int type, IPluginFunction *pFunc)
bool SoundHooks::RemoveHook(int type, IPluginFunction *pFunc)
{
SoundHookIter iter;
if (type == NORMAL_SOUND_HOOK)
{
if ((iter=m_NormalFuncs.find(pFunc)) != m_NormalFuncs.end())
auto iter = std::find(m_NormalFuncs.begin(), m_NormalFuncs.end(), pFunc);
if (iter != m_NormalFuncs.end())
{
m_NormalFuncs.erase(iter);
_DecRefCounter(NORMAL_SOUND_HOOK);
@@ -206,7 +205,8 @@ bool SoundHooks::RemoveHook(int type, IPluginFunction *pFunc)
}
else if (type == AMBIENT_SOUND_HOOK)
{
if ((iter=m_AmbientFuncs.find(pFunc)) != m_AmbientFuncs.end())
auto iter = std::find(m_AmbientFuncs.begin(), m_AmbientFuncs.end(), pFunc);
if (iter != m_AmbientFuncs.end())
{
m_AmbientFuncs.erase(iter);
_DecRefCounter(AMBIENT_SOUND_HOOK);
@@ -224,14 +224,13 @@ bool SoundHooks::RemoveHook(int type, IPluginFunction *pFunc)
void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol,
soundlevel_t soundlevel, int fFlags, int pitch, float delay)
{
SoundHookIter iter;
IPluginFunction *pFunc;
cell_t vec[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)};
cell_t res = static_cast<ResultType>(Pl_Continue);
char buffer[PLATFORM_MAX_PATH];
ke::SafeStrcpy(buffer, sizeof(buffer), samp);
for (iter=m_AmbientFuncs.begin(); iter!=m_AmbientFuncs.end(); iter++)
for (auto iter=m_AmbientFuncs.begin(); iter!=m_AmbientFuncs.end(); iter++)
{
pFunc = (*iter);
pFunc->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
@@ -340,7 +339,6 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
float soundtime, int speakerentity)
#endif
{
SoundHookIter iter;
IPluginFunction *pFunc;
cell_t res = static_cast<ResultType>(Pl_Continue);
char buffer[PLATFORM_MAX_PATH];
@@ -355,7 +353,7 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
int nSeed = 0;
#endif
for (iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); iter++)
for (auto iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); iter++)
{
int players[SM_MAXPLAYERS], size;
size = _FillInPlayers(players, &filter);
@@ -503,7 +501,6 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan
float soundtime, int speakerentity)
#endif
{
SoundHookIter iter;
IPluginFunction *pFunc;
cell_t res = static_cast<ResultType>(Pl_Continue);
cell_t sndlevel = static_cast<cell_t>(ATTN_TO_SNDLVL(flAttenuation));
@@ -519,7 +516,7 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan
int nSeed = 0;
#endif
for (iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); iter++)
for (auto iter=m_NormalFuncs.begin(); iter!=m_NormalFuncs.end(); iter++)
{
int players[SM_MAXPLAYERS], size;
size = _FillInPlayers(players, &filter);
+3 -5
View File
@@ -32,15 +32,13 @@
#ifndef _INCLUDE_SOURCEMOD_VSOUND_H_
#define _INCLUDE_SOURCEMOD_VSOUND_H_
#include <sh_list.h>
#include <list>
#include "extension.h"
#include "CellRecipientFilter.h"
#define NORMAL_SOUND_HOOK 0
#define AMBIENT_SOUND_HOOK 1
typedef SourceHook::List<IPluginFunction *>::iterator SoundHookIter;
class SoundHooks : public IPluginsListener
{
public: //IPluginsListener
@@ -99,8 +97,8 @@ private:
void _IncRefCounter(int type);
void _DecRefCounter(int type);
private:
SourceHook::List<IPluginFunction *> m_AmbientFuncs;
SourceHook::List<IPluginFunction *> m_NormalFuncs;
std::list<IPluginFunction *> m_AmbientFuncs;
std::list<IPluginFunction *> m_NormalFuncs;
size_t m_NormalCount;
size_t m_AmbientCount;
};
+1 -1
View File
@@ -72,7 +72,7 @@ private:
sqlite3 *m_sq3;
std::recursive_mutex m_FullLock;
bool m_Persistent;
String m_LastError;
std::string m_LastError;
int m_LastErrorCode;
};
+3 -6
View File
@@ -77,9 +77,8 @@ SqDriver::~SqDriver()
{
std::lock_guard<std::mutex> lock(m_OpenLock);
List<SqDbInfo>::iterator iter;
SqDatabase *sqdb;
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
{
// Don't let SqDatabase try to remove itself from m_Cache
// now that we're gone.
@@ -258,8 +257,7 @@ IDatabase *SqDriver::Connect(const DatabaseInfo *info, bool persistent, char *er
if (persistent)
{
/* See if anything in the cache matches */
List<SqDbInfo>::iterator iter;
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
{
if ((*iter).path.compare(fullpath) == 0)
{
@@ -298,8 +296,7 @@ void SqDriver::RemovePersistent(IDatabase *pdb)
{
std::lock_guard<std::mutex> lock(m_OpenLock);
List<SqDbInfo>::iterator iter;
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
{
if ((*iter).db == pdb)
{
+4 -5
View File
@@ -34,17 +34,16 @@
#define SOURCEMOD_SQL_DRIVER_CODE
#include <IDBDriver.h>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include <mutex>
#include "sqlite-source/sqlite3.h"
using namespace SourceMod;
using namespace SourceHook;
struct SqDbInfo
{
String path;
std::string path;
IDatabase *db;
};
@@ -73,7 +72,7 @@ public:
private:
Handle_t m_Handle;
std::mutex m_OpenLock;
List<SqDbInfo> m_Cache;
std::list<SqDbInfo> m_Cache;
bool m_bThreadSafe;
bool m_bShutdown;
};
+2 -1
View File
@@ -35,6 +35,7 @@
#include <am-refcounting.h>
#include "SqDatabase.h"
#include "SqResults.h"
#include <string>
class SqQuery :
public IPreparedQuery
@@ -86,7 +87,7 @@ private:
sqlite3_stmt *m_pStmt;
SqResults *m_pResults;
unsigned int m_ParamCount;
String m_LastError;
std::string m_LastError;
int m_LastErrorCode;
unsigned int m_AffectedRows;
unsigned int m_InsertID;
+1 -1
View File
@@ -42,7 +42,7 @@ SqResults::SqResults(SqQuery *query) :
m_ColCount = sqlite3_column_count(m_pStmt);
if (m_ColCount)
{
m_ColNames = new String[m_ColCount];
m_ColNames = new std::string[m_ColCount];
for (unsigned int i=0; i<m_ColCount; i++)
{
m_ColNames[i].assign(sqlite3_column_name(m_pStmt, i));
+1 -1
View File
@@ -86,7 +86,7 @@ private:
SqField *GetField(unsigned int col);
private:
sqlite3_stmt *m_pStmt; /** DOES NOT CHANGE */
String *m_ColNames; /** DOES NOT CHANGE */
std::string *m_ColNames; /** DOES NOT CHANGE */
unsigned int m_ColCount; /** DOES NOT CHANGE */
BaseStringTable m_Strings; /** DOES NOT CHANGE */
BaseMemTable *m_pMemory; /** DOES NOT CHANGE */
+7 -7
View File
@@ -328,7 +328,7 @@ void TopMenu::RemoveFromMenu(unsigned int object_id)
}
/* Remove the category from the list, then delete it. */
m_Categories.erase(m_Categories.iterAt(i));
m_Categories.erase(m_Categories.begin() + i);
delete cat;
break;
}
@@ -358,7 +358,7 @@ void TopMenu::RemoveFromMenu(unsigned int object_id)
{
if (parent_cat->obj_list[i] == obj)
{
parent_cat->obj_list.erase(parent_cat->obj_list.iterAt(i));
parent_cat->obj_list.erase(parent_cat->obj_list.begin() + i);
/* If this category now has no items, mark root as changed
* so clients won't get the category drawn anymore.
@@ -936,7 +936,7 @@ void TopMenu::SortCategoryIfNeeded(unsigned int category)
return;
}
CVector<unsigned int> to_sort;
std::vector<unsigned int> to_sort;
for (size_t i = 0; i < cat->obj_list.size(); i++)
{
to_sort.push_back(i);
@@ -966,7 +966,7 @@ void TopMenu::SortCategoryIfNeeded(unsigned int category)
{
/* Place in the final list, then remove from the temporary list */
cat->sorted.push_back(cat->obj_list[to_sort[j]]);
to_sort.erase(to_sort.iterAt(j));
to_sort.erase(to_sort.begin() + j);
break;
}
}
@@ -999,7 +999,7 @@ void TopMenu::SortCategoriesIfNeeded()
return;
}
CVector<unsigned int> to_sort;
std::vector<unsigned int> to_sort;
for (unsigned int i = 0; i < (unsigned int)m_Categories.size(); i++)
{
to_sort.push_back(i);
@@ -1016,7 +1016,7 @@ void TopMenu::SortCategoriesIfNeeded()
{
/* Add to the real list and remove from the temporary */
m_SortedCats.push_back(to_sort[j]);
to_sort.erase(to_sort.iterAt(j));
to_sort.erase(to_sort.begin() + j);
break;
}
}
@@ -1089,7 +1089,7 @@ bool TopMenu::LoadConfiguration(const char *file, char *error, size_t maxlength)
bool TopMenu::OnIdentityRemoval(IdentityToken_t *owner)
{
/* First sweep the categories owned by us */
CVector<unsigned int> obj_list;
std::vector<unsigned int> obj_list;
for (size_t i = 0; i < m_Categories.size(); i++)
{
if (m_Categories[i]->obj->owner == owner)
+11 -12
View File
@@ -32,14 +32,13 @@
#ifndef _INCLUDE_SOURCEMOD_TOP_MENU_H_
#define _INCLUDE_SOURCEMOD_TOP_MENU_H_
#include <sh_list.h>
#include <sh_vector.h>
#include <list>
#include <vector>
#include <ITopMenus.h>
#include "smsdk_ext.h"
#include "sm_memtable.h"
#include <sm_namehashset.h>
using namespace SourceHook;
using namespace SourceMod;
#define TOPMENU_DISPLAY_BUFFER_SIZE 128
@@ -47,7 +46,7 @@ using namespace SourceMod;
struct config_category_t
{
int name;
CVector<int> commands;
std::vector<int> commands;
};
struct config_root_t
@@ -56,7 +55,7 @@ struct config_root_t
{
}
BaseStringTable strings;
CVector<config_category_t *> cats;
std::vector<config_category_t *> cats;
};
struct topmenu_object_t
@@ -85,9 +84,9 @@ struct topmenu_object_t
struct topmenu_category_t
{
CVector<topmenu_object_t *> obj_list; /** Full object list */
CVector<topmenu_object_t *> sorted; /** Sorted items */
CVector<topmenu_object_t *> unsorted; /** Unsorted items */
std::vector<topmenu_object_t *> obj_list; /** Full object list */
std::vector<topmenu_object_t *> sorted; /** Sorted items */
std::vector<topmenu_object_t *> unsorted; /** Unsorted items */
topmenu_object_t *obj; /** Bound object */
unsigned int serial; /** Serial number */
bool reorder; /** Whether ordering needs updating */
@@ -181,10 +180,10 @@ private:
private:
config_root_t m_Config; /* Configuration from file */
topmenu_player_t *m_clients; /* Client array */
CVector<unsigned int> m_SortedCats; /* Sorted categories */
CVector<unsigned int> m_UnsortedCats; /* Un-sorted categories */
CVector<topmenu_category_t *> m_Categories; /* Category array */
CVector<topmenu_object_t *> m_Objects; /* Object array */
std::vector<unsigned int> m_SortedCats; /* Sorted categories */
std::vector<unsigned int> m_UnsortedCats; /* Un-sorted categories */
std::vector<topmenu_category_t *> m_Categories; /* Category array */
std::vector<topmenu_object_t *> m_Objects; /* Object array */
NameHashSet<topmenu_object_t *> m_ObjLookup; /* Object lookup trie */
unsigned int m_SerialNo; /* Serial number for updating */
ITopMenuObjectCallbacks *m_pTitle; /* Title callbacks */
+5 -13
View File
@@ -56,9 +56,7 @@ ITopMenu *TopMenuManager::CreateTopMenu(ITopMenuObjectCallbacks *callbacks)
void TopMenuManager::OnClientConnected(int client)
{
List<TopMenu *>::iterator iter;
for (iter = m_TopMenus.begin(); iter != m_TopMenus.end(); iter++)
for (auto iter = m_TopMenus.begin(); iter != m_TopMenus.end(); iter++)
{
(*iter)->OnClientConnected(client);
}
@@ -66,9 +64,7 @@ void TopMenuManager::OnClientConnected(int client)
void TopMenuManager::OnClientDisconnected(int client)
{
List<TopMenu *>::iterator iter;
for (iter = m_TopMenus.begin(); iter != m_TopMenus.end(); iter++)
for (auto iter = m_TopMenus.begin(); iter != m_TopMenus.end(); iter++)
{
(*iter)->OnClientDisconnected(client);
}
@@ -81,9 +77,7 @@ void TopMenuManager::OnServerActivated(int max_clients)
return;
}
List<TopMenu *>::iterator iter;
for (iter = m_TopMenus.begin(); iter != m_TopMenus.end(); iter++)
for (auto iter = m_TopMenus.begin(); iter != m_TopMenus.end(); iter++)
{
(*iter)->OnServerActivated(max_clients);
}
@@ -93,7 +87,7 @@ void TopMenuManager::OnServerActivated(int max_clients)
void TopMenuManager::OnPluginUnloaded(IPlugin *plugin)
{
List<TopMenu *>::iterator iter = m_TopMenus.begin();
auto iter = m_TopMenus.begin();
while (iter != m_TopMenus.end())
{
@@ -120,9 +114,7 @@ void TopMenuManager::DestroyTopMenu(ITopMenu *topmenu)
void TopMenuManager::OnMaxPlayersChanged( int newvalue )
{
List<TopMenu *>::iterator iter;
for (iter = m_TopMenus.begin(); iter != m_TopMenus.end(); iter++)
for (auto iter = m_TopMenus.begin(); iter != m_TopMenus.end(); iter++)
{
(*iter)->OnMaxPlayersChanged(newvalue);
}
+2 -3
View File
@@ -36,10 +36,9 @@
#include <ITopMenus.h>
#include <IPlayerHelpers.h>
#include <IPluginSys.h>
#include <sh_list.h>
#include <list>
using namespace SourceMod;
using namespace SourceHook;
class TopMenu;
@@ -60,7 +59,7 @@ public:
void OnPluginUnloaded(IPlugin *plugin);
void OnMaxPlayersChanged(int newvalue);
private:
List<TopMenu *> m_TopMenus;
std::list<TopMenu *> m_TopMenus;
};
extern TopMenuManager g_TopMenus;
+3 -5
View File
@@ -34,11 +34,9 @@
#include <IWebternet.h>
#include <ITextParsers.h>
#include <sh_string.h>
#include <string>
#include "MemoryDownloader.h"
using namespace SourceHook;
struct UpdatePart
{
UpdatePart* next;
@@ -72,8 +70,8 @@ namespace SourceMod
MemoryDownloader mdl;
unsigned int ustate;
unsigned int ignoreLevel;
SourceHook::String curfile;
SourceHook::String url;
std::string curfile;
std::string url;
char checksum[33];
UpdatePart *partFirst;
UpdatePart *partLast;
+8 -11
View File
@@ -36,20 +36,18 @@
#include <stdlib.h>
#include "extension.h"
#include "Updater.h"
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#define DEFAULT_UPDATE_URL "http://www.sourcemod.net/update/"
using namespace SourceHook;
SmUpdater g_Updater; /**< Global singleton for extension's main interface */
SMEXT_LINK(&g_Updater);
IWebternet *webternet;
static List<String *> update_errors;
static std::list<std::string *> update_errors;
static IThreadHandle *update_thread;
static String update_url;
static std::string update_url;
bool SmUpdater::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
@@ -90,7 +88,7 @@ void SmUpdater::SDK_OnUnload()
}
/* Clear message tables */
List<String *>::iterator iter = update_errors.begin();
auto iter = update_errors.begin();
while (iter != update_errors.end())
{
iter = update_errors.erase(iter);
@@ -120,9 +118,8 @@ void SmUpdater::NotifyInterfaceDrop(SMInterface *pInterface)
static void PumpUpdate(void *data)
{
String *str;
std::string *str;
bool new_files = false;
List<String *>::iterator iter;
char path[PLATFORM_MAX_PATH];
UpdatePart *temp;
@@ -185,7 +182,7 @@ skip_create:
{
smutils->LogError(myself, "--- BEGIN ERRORS FROM AUTOMATIC UPDATER ---");
for (iter = update_errors.begin();
for (auto iter = update_errors.begin();
iter != update_errors.end();
iter++)
{
@@ -244,7 +241,7 @@ void AddUpdateError(const char *fmt, ...)
smutils->FormatArgs(buffer, sizeof(buffer), fmt, ap);
va_end(ap);
update_errors.push_back(new String(buffer));
update_errors.push_back(new std::string(buffer));
}
const char *SmUpdater::GetExtensionVerString()
+4 -6
View File
@@ -34,9 +34,7 @@
#include <new>
#include <stdlib.h>
#include <sh_stack.h>
using namespace SourceHook;
#include <stack>
/*
A circular, doubly-linked List with one sentinel node
@@ -109,7 +107,7 @@ public:
while (!m_FreeNodes.empty())
{
free(m_FreeNodes.front());
free(m_FreeNodes.top());
m_FreeNodes.pop();
}
}
@@ -122,7 +120,7 @@ public:
{
node = (QueueNode *)malloc(sizeof(QueueNode));
} else {
node = m_FreeNodes.front();
node = m_FreeNodes.top();
m_FreeNodes.pop();
}
@@ -169,7 +167,7 @@ public:
private:
QueueNode *m_Head;
size_t m_Size;
CStack<QueueNode *> m_FreeNodes;
std::stack<QueueNode *> m_FreeNodes;
public:
class iterator
{