Replace SourceHook::List with ke::LinkedList in ForwardSys.
This commit is contained in:
parent
0810c4b217
commit
c1396de2fc
@ -34,6 +34,8 @@
|
|||||||
#include <bridge/include/IScriptManager.h>
|
#include <bridge/include/IScriptManager.h>
|
||||||
#include <amtl/am-string.h>
|
#include <amtl/am-string.h>
|
||||||
|
|
||||||
|
using namespace ke;
|
||||||
|
|
||||||
CForwardManager g_Forwards;
|
CForwardManager g_Forwards;
|
||||||
|
|
||||||
// Genesis turns to its source, reduction occurs stepwise although the essence
|
// 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);
|
scripts->AddFunctionsToForward(name, fwd);
|
||||||
|
|
||||||
m_managed.push_back(fwd);
|
m_managed.append(fwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fwd;
|
return fwd;
|
||||||
@ -75,7 +77,7 @@ IChangeableForward *CForwardManager::CreateForwardEx(const char *name, ExecType
|
|||||||
|
|
||||||
if (fwd)
|
if (fwd)
|
||||||
{
|
{
|
||||||
m_unmanaged.push_back(fwd);
|
m_unmanaged.append(fwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fwd;
|
return fwd;
|
||||||
@ -615,7 +617,7 @@ bool CForward::RemoveFunction(IPluginContext *pContext, funcid_t index)
|
|||||||
bool CForward::RemoveFunction(IPluginFunction *func)
|
bool CForward::RemoveFunction(IPluginFunction *func)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
List<IPluginFunction *> *lst;
|
LinkedList<IPluginFunction *> *lst;
|
||||||
|
|
||||||
if (func->IsRunnable())
|
if (func->IsRunnable())
|
||||||
lst = &m_functions;
|
lst = &m_functions;
|
||||||
@ -667,16 +669,16 @@ bool CForward::AddFunction(IPluginFunction *func)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (func->IsRunnable())
|
if (func->IsRunnable())
|
||||||
m_functions.push_back(func);
|
m_functions.append(func);
|
||||||
else
|
else
|
||||||
m_paused.push_back(func);
|
m_paused.append(func);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CForward::IsFunctionRegistered(IPluginFunction *func)
|
bool CForward::IsFunctionRegistered(IPluginFunction *func)
|
||||||
{
|
{
|
||||||
List<IPluginFunction *> *lst;
|
LinkedList<IPluginFunction *> *lst;
|
||||||
if (func->IsRunnable())
|
if (func->IsRunnable())
|
||||||
lst = &m_functions;
|
lst = &m_functions;
|
||||||
else
|
else
|
||||||
@ -696,7 +698,7 @@ const char *CForward::GetForwardName()
|
|||||||
|
|
||||||
unsigned int CForward::GetFunctionCount()
|
unsigned int CForward::GetFunctionCount()
|
||||||
{
|
{
|
||||||
return m_functions.size();
|
return m_functions.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecType CForward::GetExecType()
|
ExecType CForward::GetExecType()
|
||||||
|
@ -31,12 +31,10 @@
|
|||||||
#include <IForwardSys.h>
|
#include <IForwardSys.h>
|
||||||
#include <IPluginSys.h>
|
#include <IPluginSys.h>
|
||||||
#include "common_logic.h"
|
#include "common_logic.h"
|
||||||
#include <sh_list.h>
|
#include <amtl/am-linkedlist.h>
|
||||||
#include "ISourceMod.h"
|
#include "ISourceMod.h"
|
||||||
|
|
||||||
using namespace SourceHook;
|
typedef ke::LinkedList<IPluginFunction *>::iterator FuncIter;
|
||||||
|
|
||||||
typedef List<IPluginFunction *>::iterator FuncIter;
|
|
||||||
|
|
||||||
/* :TODO: a global name max define for sourcepawn, should mirror compiler's sNAMEMAX */
|
/* :TODO: a global name max define for sourcepawn, should mirror compiler's sNAMEMAX */
|
||||||
#define FORWARDS_NAME_MAX 64
|
#define FORWARDS_NAME_MAX 64
|
||||||
@ -129,8 +127,8 @@ protected:
|
|||||||
/* :TODO: I want a caching list type here.
|
/* :TODO: I want a caching list type here.
|
||||||
* Destroying these things and using new/delete for their members feels bad.
|
* Destroying these things and using new/delete for their members feels bad.
|
||||||
*/
|
*/
|
||||||
mutable List<IPluginFunction *> m_functions;
|
mutable ke::LinkedList<IPluginFunction *> m_functions;
|
||||||
mutable List<IPluginFunction *> m_paused;
|
mutable ke::LinkedList<IPluginFunction *> m_paused;
|
||||||
FuncIteratorGuard *m_IterGuard;
|
FuncIteratorGuard *m_IterGuard;
|
||||||
|
|
||||||
/* Type and name information */
|
/* Type and name information */
|
||||||
@ -172,8 +170,8 @@ public: //IPluginsListener
|
|||||||
public: //SMGlobalClass
|
public: //SMGlobalClass
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
private:
|
private:
|
||||||
List<CForward *> m_managed;
|
ke::LinkedList<CForward *> m_managed;
|
||||||
List<CForward *> m_unmanaged;
|
ke::LinkedList<CForward *> m_unmanaged;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CForwardManager g_Forwards;
|
extern CForwardManager g_Forwards;
|
||||||
|
Loading…
Reference in New Issue
Block a user