diff --git a/core/ConCmdManager.cpp b/core/ConCmdManager.cpp index d57abc54..c9661bdf 100644 --- a/core/ConCmdManager.cpp +++ b/core/ConCmdManager.cpp @@ -45,7 +45,7 @@ using namespace ke; ConCmdManager g_ConCmds; -typedef ke::LinkedList PluginHookList; +typedef std::list PluginHookList; void RegisterInPlugin(CmdHook *hook); ConCmdManager::ConCmdManager() @@ -381,7 +381,7 @@ bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction, pHook->admin->eflags = pHook->admin->flags; pInfo->eflags = pHook->admin->eflags; - cmdgroup->hooks.append(pHook); + cmdgroup->hooks.push_back(pHook); pInfo->hooks.append(pHook); RegisterInPlugin(pHook); return true; @@ -426,13 +426,13 @@ void RegisterInPlugin(CmdHook *hook) const char *cmd = (*iter)->info->pCmd->GetName(); if (strcmp(orig, cmd) < 0) { - pList->insertBefore(iter, hook); + pList->emplace(iter, hook); return; } iter++; } - pList->append(hook); + pList->emplace_back(hook); } void ConCmdManager::AddToCmdList(ConCmdInfo *info) diff --git a/core/ConCmdManager.h b/core/ConCmdManager.h index cf37193a..ee788d21 100644 --- a/core/ConCmdManager.h +++ b/core/ConCmdManager.h @@ -32,8 +32,14 @@ #ifndef _INCLUDE_SOURCEMOD_CONCMDMANAGER_H_ #define _INCLUDE_SOURCEMOD_CONCMDMANAGER_H_ +#include #include +#include +#include +#include +#include + #include "sm_globals.h" #include "sourcemm_api.h" #include @@ -43,11 +49,6 @@ #include #include "concmd_cleaner.h" #include "GameHooks.h" -#include -#include -#include -#include -#include using namespace SourceHook; @@ -56,7 +57,7 @@ struct ConCmdInfo; struct CommandGroup : public ke::Refcounted { - ke::LinkedList hooks; + std::list hooks; }; struct AdminCmdInfo diff --git a/core/logic/ForwardSys.cpp b/core/logic/ForwardSys.cpp index bc31f7f7..e85cf3a6 100644 --- a/core/logic/ForwardSys.cpp +++ b/core/logic/ForwardSys.cpp @@ -61,7 +61,7 @@ IForward *CForwardManager::CreateForward(const char *name, ExecType et, unsigned { scripts->AddFunctionsToForward(name, fwd); - m_managed.append(fwd); + m_managed.push_back(fwd); } return fwd; @@ -78,7 +78,7 @@ IChangeableForward *CForwardManager::CreateForwardEx(const char *name, ExecType if (fwd) { - m_unmanaged.append(fwd); + m_unmanaged.push_back(fwd); } return fwd; @@ -751,9 +751,9 @@ bool CForward::AddFunction(IPluginFunction *func) return false; if (func->IsRunnable()) - m_functions.append(func); + m_functions.push_back(func); else - m_paused.append(func); + m_paused.push_back(func); return true; } @@ -780,7 +780,7 @@ const char *CForward::GetForwardName() unsigned int CForward::GetFunctionCount() { - return m_functions.length(); + return m_functions.size(); } ExecType CForward::GetExecType() diff --git a/core/logic/NativeOwner.h b/core/logic/NativeOwner.h index ac7876da..bc25d4b0 100644 --- a/core/logic/NativeOwner.h +++ b/core/logic/NativeOwner.h @@ -33,7 +33,6 @@ #include #include -#include #include #include "common_logic.h" #include "Native.h" diff --git a/core/logic/PluginSys.cpp b/core/logic/PluginSys.cpp index 8a71953b..fef36d54 100644 --- a/core/logic/PluginSys.cpp +++ b/core/logic/PluginSys.cpp @@ -45,7 +45,6 @@ #include "Logger.h" #include "frame_tasks.h" #include -#include #include #include @@ -790,7 +789,7 @@ void CPlugin::BindFakeNativesTo(CPlugin *other) CPluginManager::CPluginIterator::CPluginIterator(ReentrantList& in) { for (PluginIter iter(in); !iter.done(); iter.next()) - mylist.append(*iter); + mylist.push_back(*iter); current = mylist.begin(); g_PluginSys.AddPluginsListener(this); } @@ -1033,7 +1032,7 @@ void CPluginManager::LoadAutoPlugin(const char *plugin) void CPluginManager::AddPlugin(CPlugin *pPlugin) { - m_plugins.append(pPlugin); + m_plugins.push_back(pPlugin); m_LoadLookup.insert(pPlugin->GetFilename(), pPlugin); pPlugin->SetRegistered(); @@ -1536,12 +1535,12 @@ CPlugin *CPluginManager::GetPluginByCtx(const sp_context_t *ctx) unsigned int CPluginManager::GetPluginCount() { - return m_plugins.length(); + return m_plugins.size(); } void CPluginManager::AddPluginsListener(IPluginsListener *listener) { - m_listeners.append(listener); + m_listeners.push_back(listener); } void CPluginManager::RemovePluginsListener(IPluginsListener *listener) @@ -1715,7 +1714,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const ICommandArg rootmenu->ConsolePrint("[SM] Listing %d plugin%s:", plnum, (plnum > 1) ? "s" : ""); } - ke::LinkedList fail_list; + std::list fail_list; for (PluginIter iter(m_plugins); !iter.done(); iter.next(), id++) { CPlugin *pl = (*iter); @@ -1727,7 +1726,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const ICommandArg len += ke::SafeSprintf(buffer, sizeof(buffer), " %0*d <%s>", plpadding, id, GetStatusText(pl->GetDisplayStatus())); /* Plugin has failed to load. */ - fail_list.append(pl); + fail_list.push_back(pl); } else { @@ -2351,7 +2350,7 @@ public: { ke::RefPtr wrapper = new PluginsListenerV1Wrapper(listener); - v1_wrappers_.append(wrapper); + v1_wrappers_.push_back(wrapper); g_PluginSys.AddPluginsListener(wrapper); } diff --git a/core/logic/PluginSys.h b/core/logic/PluginSys.h index 8ced63da..0b250cda 100644 --- a/core/logic/PluginSys.h +++ b/core/logic/PluginSys.h @@ -320,8 +320,8 @@ public: void Release(); void OnPluginDestroyed(IPlugin *plugin) override; private: - ke::LinkedList mylist; - ke::LinkedList::iterator current; + std::list mylist; + std::list::iterator current; }; friend class CPluginManager::CPluginIterator; public: //IScriptManager @@ -476,7 +476,7 @@ private: private: ReentrantList m_listeners; ReentrantList m_plugins; - ke::LinkedList m_iterators; + std::list m_iterators; typedef decltype(m_listeners)::iterator ListenerIter; typedef decltype(m_plugins)::iterator PluginIter; diff --git a/public/ReentrantList.h b/public/ReentrantList.h index fad52bba..b37670c2 100644 --- a/public/ReentrantList.h +++ b/public/ReentrantList.h @@ -27,14 +27,15 @@ #ifndef _include_sourcemod_reentrant_iterator_h_ #define _include_sourcemod_reentrant_iterator_h_ +#include +#include #include -#include #include namespace SourceMod { -// ReentrantList is a wrapper around a LinkedList, with special attention twoard +// ReentrantList is a wrapper around a std::list, with special attention twoard // reentrancy. The list may be mutated during iteration as long as its iterator // protocol is obeyed: iterators may only be used on the stack in a LIFO manner, // and it is illegal to request access to an iterator's item after the list has @@ -43,16 +44,15 @@ namespace SourceMod { // We guard against this using assertions. If an item in a list is removed, and // this affects any active iterators, those iterators cannot be used until their // next() function is called. -template -class ReentrantList : public ke::LinkedList +template +class ReentrantList : public std::list { - typedef typename ke::LinkedList BaseType; - typedef typename ke::LinkedList::iterator BaseTypeIter; + typedef typename std::list BaseType; + typedef typename std::list::iterator BaseTypeIter; public: - ReentrantList(AllocPolicy ap = AllocPolicy()) - : ke::LinkedList(ap), - top_(nullptr) + ReentrantList() + : top_(nullptr) { } @@ -150,12 +150,12 @@ public: template void insertBefore(iterator& where, U &&obj) { - BaseType::insertBefore(where.impl_, std::forward(obj)); + BaseType::insert(where.impl_, std::forward(obj)); } template bool contains(const U &obj) { - return BaseType::find(obj) != BaseType::end(); + return std::find(BaseType::begin(), BaseType::end(), obj) != BaseType::end(); } private: