Fix unnecessary ConCommand cache misses (#1256)
This commit is contained in:
parent
13621a1274
commit
5177cfdf97
@ -108,20 +108,20 @@ public:
|
|||||||
listener = listener->next;
|
listener = listener->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (iter != tracked_bases.end())
|
while (iter != tracked_bases.end())
|
||||||
{
|
{
|
||||||
if ((*iter)->pBase == pBase)
|
if ((*iter)->pBase == pBase)
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
iter = tracked_bases.erase(iter);
|
iter = tracked_bases.erase(iter);
|
||||||
pInfo->cls->OnUnlinkConCommandBase(pBase, pBase->GetName());
|
pInfo->cls->OnUnlinkConCommandBase(pBase, pBase->GetName());
|
||||||
delete pInfo;
|
delete pInfo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddTarget(ConCommandBase *pBase, IConCommandTracker *cls)
|
void AddTarget(ConCommandBase *pBase, IConCommandTracker *cls)
|
||||||
|
@ -182,11 +182,19 @@ private:
|
|||||||
{
|
{
|
||||||
static inline bool matches(const char *name, ConCommandBase *base)
|
static inline bool matches(const char *name, ConCommandBase *base)
|
||||||
{
|
{
|
||||||
return strcmp(name, base->GetName()) == 0;
|
const char *conCommandChars = base->GetName();
|
||||||
|
|
||||||
|
ke::AString conCommandName = ke::AString(conCommandChars).lowercase();
|
||||||
|
ke::AString input = ke::AString(name).lowercase();
|
||||||
|
|
||||||
|
return conCommandName == input;
|
||||||
}
|
}
|
||||||
static inline uint32_t hash(const detail::CharsAndLength &key)
|
static inline uint32_t hash(const detail::CharsAndLength &key)
|
||||||
{
|
{
|
||||||
return key.hash();
|
ke::AString original(key.chars());
|
||||||
|
ke::AString lower = original.lowercase();
|
||||||
|
|
||||||
|
return detail::CharsAndLength(lower.chars()).hash();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
NameHashSet<ConCommandBase *, ConCommandPolicy> m_CmdFlags;
|
NameHashSet<ConCommandBase *, ConCommandPolicy> m_CmdFlags;
|
||||||
|
Loading…
Reference in New Issue
Block a user