1.1 --- a/core/smn_gameconfigs.cpp Mon Jan 11 20:09:34 2010 -0800
1.2 +++ b/core/smn_gameconfigs.cpp Mon Jan 11 22:46:44 2010 -0800
1.3 @@ -128,6 +128,35 @@
1.4 return 1;
1.5 }
1.6
1.7 +
1.8 +static cell_t smn_GameConfGetAddress(IPluginContext *pCtx, const cell_t *params)
1.9 +{
1.10 + Handle_t hndl = static_cast<Handle_t>(params[1]);
1.11 + HandleError herr;
1.12 + HandleSecurity sec;
1.13 + IGameConfig *gc;
1.14 +
1.15 + sec.pOwner = NULL;
1.16 + sec.pIdentity = g_pCoreIdent;
1.17 +
1.18 + if ((herr=g_HandleSys.ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
1.19 + != HandleError_None)
1.20 + {
1.21 + return pCtx->ThrowNativeError("Invalid game config handle %x (error %d)", hndl, herr);
1.22 + }
1.23 +
1.24 + char *key;
1.25 + void* val;
1.26 + pCtx->LocalToString(params[2], &key);
1.27 +
1.28 + if (!gc->GetAddress(key, &val))
1.29 + {
1.30 + return NULL;
1.31 + }
1.32 +
1.33 + return (cell_t)val;
1.34 +}
1.35 +
1.36 static GameConfigsNatives s_GameConfigsNatives;
1.37
1.38 REGISTER_NATIVES(gameconfignatives)
1.39 @@ -135,5 +164,6 @@
1.40 {"LoadGameConfigFile", smn_LoadGameConfigFile},
1.41 {"GameConfGetOffset", smn_GameConfGetOffset},
1.42 {"GameConfGetKeyValue", smn_GameConfGetKeyValue},
1.43 + {"GameConfGetAddress", smn_GameConfGetAddress},
1.44 {NULL, NULL}
1.45 };