Utilize convar cache for FindConVar.
This commit is contained in:
parent
c37dbe131e
commit
d5c267b291
@ -497,7 +497,13 @@ Handle_t ConVarManager::FindConVar(const char *name)
|
|||||||
ConVarInfo *pInfo;
|
ConVarInfo *pInfo;
|
||||||
Handle_t hndl;
|
Handle_t hndl;
|
||||||
|
|
||||||
/* Search for convar */
|
/* Check convar cache to find out if we already have a handle */
|
||||||
|
if (convar_cache_lookup(name, &pInfo))
|
||||||
|
{
|
||||||
|
return pInfo->handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Couldn't find it in cache, so search for it */
|
||||||
pConVar = icvar->FindVar(name);
|
pConVar = icvar->FindVar(name);
|
||||||
|
|
||||||
/* If it doesn't exist, then return an invalid handle */
|
/* If it doesn't exist, then return an invalid handle */
|
||||||
@ -506,12 +512,6 @@ Handle_t ConVarManager::FindConVar(const char *name)
|
|||||||
return BAD_HANDLE;
|
return BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this point, the convar exists. So, find out if we already have a handle */
|
|
||||||
if (convar_cache_lookup(name, &pInfo))
|
|
||||||
{
|
|
||||||
return pInfo->handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create and initialize ConVarInfo structure */
|
/* Create and initialize ConVarInfo structure */
|
||||||
pInfo = new ConVarInfo();
|
pInfo = new ConVarInfo();
|
||||||
pInfo->sourceMod = false;
|
pInfo->sourceMod = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user