Switch smn_console off KTrie (bug 5884 part 10, r=ds).
This commit is contained in:
parent
0235d57625
commit
3000445af9
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 sw=4 tw=99 noet :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||||
@ -46,6 +46,7 @@
|
|||||||
#include "ConsoleDetours.h"
|
#include "ConsoleDetours.h"
|
||||||
#include "ConCommandBaseIterator.h"
|
#include "ConCommandBaseIterator.h"
|
||||||
#include "logic_bridge.h"
|
#include "logic_bridge.h"
|
||||||
|
#include <sm_namehashset.h>
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||||
#include <netmessages.pb.h>
|
#include <netmessages.pb.h>
|
||||||
@ -133,12 +134,11 @@ public:
|
|||||||
}
|
}
|
||||||
bool GetFlags(const char *name, int *flags)
|
bool GetFlags(const char *name, int *flags)
|
||||||
{
|
{
|
||||||
ConCommandBase **ppCmd;
|
|
||||||
ConCommandBase *pCmd;
|
ConCommandBase *pCmd;
|
||||||
if ((ppCmd=m_CmdFlags.retrieve(name)))
|
if (m_CmdFlags.retrieve(name, &pCmd))
|
||||||
{
|
{
|
||||||
TrackConCommandBase((*ppCmd), this);
|
TrackConCommandBase(pCmd, this);
|
||||||
*flags = (*ppCmd)->GetFlags();
|
*flags = pCmd->GetFlags();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((pCmd=FindCommandBase(name)))
|
else if ((pCmd=FindCommandBase(name)))
|
||||||
@ -155,12 +155,11 @@ public:
|
|||||||
}
|
}
|
||||||
bool SetFlags(const char *name, int flags)
|
bool SetFlags(const char *name, int flags)
|
||||||
{
|
{
|
||||||
ConCommandBase **ppCmd;
|
|
||||||
ConCommandBase *pCmd;
|
ConCommandBase *pCmd;
|
||||||
if ((ppCmd=m_CmdFlags.retrieve(name)))
|
if (m_CmdFlags.retrieve(name, &pCmd))
|
||||||
{
|
{
|
||||||
(*ppCmd)->SetFlags(flags);
|
pCmd->SetFlags(flags);
|
||||||
TrackConCommandBase((*ppCmd), this);
|
TrackConCommandBase(pCmd, this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((pCmd=FindCommandBase(name)))
|
else if ((pCmd=FindCommandBase(name)))
|
||||||
@ -176,7 +175,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
KTrie<ConCommandBase *> m_CmdFlags;
|
struct ConCommandPolicy
|
||||||
|
{
|
||||||
|
static inline bool matches(const char *name, ConCommandBase *base)
|
||||||
|
{
|
||||||
|
return strcmp(name, base->GetName()) == 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
NameHashSet<ConCommandBase *, ConCommandPolicy> m_CmdFlags;
|
||||||
} s_CommandFlagsHelper;
|
} s_CommandFlagsHelper;
|
||||||
|
|
||||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||||
|
Loading…
Reference in New Issue
Block a user