1.1 --- a/core/smn_keyvalues.cpp Wed Nov 21 01:21:32 2007 +0000
1.2 +++ b/core/smn_keyvalues.cpp Wed Nov 21 06:49:40 2007 +0000
1.3 @@ -406,6 +406,34 @@
1.4 return 1;
1.5 }
1.6
1.7 +static cell_t smn_KvJumpToKeySymbol(IPluginContext *pCtx, const cell_t *params)
1.8 +{
1.9 + Handle_t hndl = static_cast<Handle_t>(params[1]);
1.10 + HandleError herr;
1.11 + HandleSecurity sec;
1.12 + char *name;
1.13 + KeyValueStack *pStk;
1.14 +
1.15 + sec.pOwner = NULL;
1.16 + sec.pIdentity = g_pCoreIdent;
1.17 +
1.18 + if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
1.19 + != HandleError_None)
1.20 + {
1.21 + return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
1.22 + }
1.23 +
1.24 + KeyValues *pSubKey = pStk->pCurRoot.front();
1.25 + pSubKey = pSubKey->FindKey(params[2]);
1.26 + if (!pSubKey)
1.27 + {
1.28 + return 0;
1.29 + }
1.30 + pStk->pCurRoot.push(pSubKey);
1.31 +
1.32 + return 1;
1.33 +}
1.34 +
1.35 static cell_t smn_KvGotoFirstSubKey(IPluginContext *pCtx, const cell_t *params)
1.36 {
1.37 Handle_t hndl = static_cast<Handle_t>(params[1]);
1.38 @@ -937,6 +965,7 @@
1.39 {"KvGetUInt64", smn_KvGetUInt64},
1.40 {"CreateKeyValues", smn_CreateKeyValues},
1.41 {"KvJumpToKey", smn_KvJumpToKey},
1.42 + {"KvJumpToKeySymbol", smn_KvJumpToKeySymbol},
1.43 {"KvGotoNextKey", smn_KvGotoNextKey},
1.44 {"KvJumpFirstSubKey", smn_KvGotoFirstSubKey}, /* BACKWARDS COMPAT SHIM */
1.45 {"KvGotoFirstSubKey", smn_KvGotoFirstSubKey},
2.1 --- a/plugins/include/keyvalues.inc Wed Nov 21 01:21:32 2007 +0000
2.2 +++ b/plugins/include/keyvalues.inc Wed Nov 21 06:49:40 2007 +0000
2.3 @@ -192,6 +192,15 @@
2.4 native bool:KvJumpToKey(Handle:kv, const String:key[], bool:create=false);
2.5
2.6 /**
2.7 + * Sets the current position in the KeyValues tree to the given key.
2.8 + *
2.9 + * @param kv KeyValues Handle.
2.10 + * @param id KeyValues id.
2.11 + * @return True if the key exists, false if it does not.
2.12 + */
2.13 +native bool:KvJumpToKeySymbol(Handle:kv, id);
2.14 +
2.15 +/**
2.16 * Sets the current position in the KeyValues tree to the first sub key.
2.17 * This native adds to the internal traversal stack.
2.18 *