Merge pull request #27 from VoiDeD/convar-cache

Utilize convar cache for FindConVar (r=KyleS, r=psychonic)..
This commit is contained in:
Nicholas Hastings 2014-06-12 19:47:33 -04:00
commit 7677e8af79

View File

@ -497,7 +497,13 @@ Handle_t ConVarManager::FindConVar(const char *name)
ConVarInfo *pInfo;
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);
/* If it doesn't exist, then return an invalid handle */
@ -506,12 +512,6 @@ Handle_t ConVarManager::FindConVar(const char *name)
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 */
pInfo = new ConVarInfo();
pInfo->sourceMod = false;