Add GameData methodmap (#766)

This commit is contained in:
peace-maker
2018-10-11 20:27:56 -07:00
committed by Michael Flaherty
parent ccfd2ffe38
commit 1b795a70b0
4 changed files with 91 additions and 51 deletions
+10 -1
View File
@@ -67,7 +67,10 @@ static cell_t smn_LoadGameConfigFile(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Unable to open %s: %s", filename, error);
}
return handlesys->CreateHandle(g_GameConfigsType, gc, pCtx->GetIdentity(), g_pCoreIdent, NULL);
Handle_t hndl = handlesys->CreateHandle(g_GameConfigsType, gc, pCtx->GetIdentity(), g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
g_GameConfigs.CloseGameConfigFile(gc);
return hndl;
}
static cell_t smn_GameConfGetOffset(IPluginContext *pCtx, const cell_t *params)
@@ -167,5 +170,11 @@ REGISTER_NATIVES(gameconfignatives)
{"GameConfGetOffset", smn_GameConfGetOffset},
{"GameConfGetKeyValue", smn_GameConfGetKeyValue},
{"GameConfGetAddress", smn_GameConfGetAddress},
// Transitional syntax support.
{"GameData.GameData", smn_LoadGameConfigFile},
{"GameData.GetOffset", smn_GameConfGetOffset},
{"GameData.GetKeyValue", smn_GameConfGetKeyValue},
{"GameData.GetAddress", smn_GameConfGetAddress},
{NULL, NULL}
};