Gameconfig: Export game config manager to AMXX API

This commit is contained in:
Arkshine
2015-06-23 20:04:17 +02:00
parent 4b2ba10300
commit 14513e6f70
4 changed files with 30 additions and 1 deletions

View File

@ -516,7 +516,21 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
if (!g_LibSys.PathExists(path))
{
return false;
g_LibSys.PathFormat(path, sizeof(path), "%s.txt", m_File);
if (!EnterFile(path, error, maxlength))
{
return false;
}
build_pathname_r(path, sizeof(path), "%s/gamedata/custom/%s.txt", dataDir, m_File);
if (g_LibSys.PathExists(path))
{
g_LibSys.PathFormat(path, sizeof(path), "custom/%s.txt", m_File);
return EnterFile(path, error, maxlength);
}
return true;
}
SMCError err;

View File

@ -31,6 +31,7 @@
#include "messages.h"
#include "trie_natives.h"
#include "CDataPack.h"
#include "CGameConfigs.h"
CList<CModule, const char*> g_modules;
CList<CScript, AMX*> g_loadedscripts;
@ -1810,6 +1811,11 @@ int amx_Execv()
return AMX_ERR_NOTFOUND;
}
IGameConfigManager *MNF_GetConfigManager()
{
return &ConfigManager;
}
void Module_CacheFunctions()
{
func_s *pFunc;
@ -1824,6 +1830,7 @@ void Module_CacheFunctions()
REGISTER_FUNC("Format", MNF_Format)
REGISTER_FUNC("RegisterFunction", MNF_RegisterFunction);
REGISTER_FUNC("RegisterFunctionEx", MNF_RegisterFunctionEx);
REGISTER_FUNC("GetConfigManager", MNF_GetConfigManager);
// Amx scripts loading / unloading / managing
REGISTER_FUNC("GetAmxScript", MNF_GetAmxScript)