Replace SourceHook::List with ke::LinkedList in ForwardSys.

This commit is contained in:
David Anderson 2015-09-18 21:13:18 -07:00
parent 0810c4b217
commit c1396de2fc
2 changed files with 15 additions and 15 deletions

View File

@ -34,6 +34,8 @@
#include <bridge/include/IScriptManager.h>
#include <amtl/am-string.h>
using namespace ke;
CForwardManager g_Forwards;
// Genesis turns to its source, reduction occurs stepwise although the essence
@ -58,7 +60,7 @@ IForward *CForwardManager::CreateForward(const char *name, ExecType et, unsigned
{
scripts->AddFunctionsToForward(name, fwd);
m_managed.push_back(fwd);
m_managed.append(fwd);
}
return fwd;
@ -75,7 +77,7 @@ IChangeableForward *CForwardManager::CreateForwardEx(const char *name, ExecType
if (fwd)
{
m_unmanaged.push_back(fwd);
m_unmanaged.append(fwd);
}
return fwd;
@ -615,7 +617,7 @@ bool CForward::RemoveFunction(IPluginContext *pContext, funcid_t index)
bool CForward::RemoveFunction(IPluginFunction *func)
{
bool found = false;
List<IPluginFunction *> *lst;
LinkedList<IPluginFunction *> *lst;
if (func->IsRunnable())
lst = &m_functions;
@ -667,16 +669,16 @@ bool CForward::AddFunction(IPluginFunction *func)
return false;
if (func->IsRunnable())
m_functions.push_back(func);
m_functions.append(func);
else
m_paused.push_back(func);
m_paused.append(func);
return true;
}
bool CForward::IsFunctionRegistered(IPluginFunction *func)
{
List<IPluginFunction *> *lst;
LinkedList<IPluginFunction *> *lst;
if (func->IsRunnable())
lst = &m_functions;
else
@ -696,7 +698,7 @@ const char *CForward::GetForwardName()
unsigned int CForward::GetFunctionCount()
{
return m_functions.size();
return m_functions.length();
}
ExecType CForward::GetExecType()

View File

@ -31,12 +31,10 @@
#include <IForwardSys.h>
#include <IPluginSys.h>
#include "common_logic.h"
#include <sh_list.h>
#include <amtl/am-linkedlist.h>
#include "ISourceMod.h"
using namespace SourceHook;
typedef List<IPluginFunction *>::iterator FuncIter;
typedef ke::LinkedList<IPluginFunction *>::iterator FuncIter;
/* :TODO: a global name max define for sourcepawn, should mirror compiler's sNAMEMAX */
#define FORWARDS_NAME_MAX 64
@ -129,8 +127,8 @@ protected:
/* :TODO: I want a caching list type here.
* Destroying these things and using new/delete for their members feels bad.
*/
mutable List<IPluginFunction *> m_functions;
mutable List<IPluginFunction *> m_paused;
mutable ke::LinkedList<IPluginFunction *> m_functions;
mutable ke::LinkedList<IPluginFunction *> m_paused;
FuncIteratorGuard *m_IterGuard;
/* Type and name information */
@ -172,8 +170,8 @@ public: //IPluginsListener
public: //SMGlobalClass
void OnSourceModAllInitialized();
private:
List<CForward *> m_managed;
List<CForward *> m_unmanaged;
ke::LinkedList<CForward *> m_managed;
ke::LinkedList<CForward *> m_unmanaged;
};
extern CForwardManager g_Forwards;