added new native KvJumpToKeySymbol

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401713
This commit is contained in:
Matt Woodrow
2007-11-21 06:49:40 +00:00
parent 58ff2d14af
commit 64a07ce198
2 changed files with 38 additions and 0 deletions
+29
View File
@@ -406,6 +406,34 @@ static cell_t smn_KvJumpToKey(IPluginContext *pCtx, const cell_t *params)
return 1;
}
static cell_t smn_KvJumpToKeySymbol(IPluginContext *pCtx, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError herr;
HandleSecurity sec;
char *name;
KeyValueStack *pStk;
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
}
KeyValues *pSubKey = pStk->pCurRoot.front();
pSubKey = pSubKey->FindKey(params[2]);
if (!pSubKey)
{
return 0;
}
pStk->pCurRoot.push(pSubKey);
return 1;
}
static cell_t smn_KvGotoFirstSubKey(IPluginContext *pCtx, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
@@ -937,6 +965,7 @@ REGISTER_NATIVES(keyvaluenatives)
{"KvGetUInt64", smn_KvGetUInt64},
{"CreateKeyValues", smn_CreateKeyValues},
{"KvJumpToKey", smn_KvJumpToKey},
{"KvJumpToKeySymbol", smn_KvJumpToKeySymbol},
{"KvGotoNextKey", smn_KvGotoNextKey},
{"KvJumpFirstSubKey", smn_KvGotoFirstSubKey}, /* BACKWARDS COMPAT SHIM */
{"KvGotoFirstSubKey", smn_KvGotoFirstSubKey},