Merge pull request #336 from Arkshine/update/gameconfigs

Update GameConfig
This commit is contained in:
Vincent Herbet 2016-02-09 11:27:10 +01:00
commit 2a90fc0fe8
2 changed files with 14 additions and 4 deletions

View File

@ -637,7 +637,6 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
if (!g_LibSys.PathExists(path)) if (!g_LibSys.PathExists(path))
{ {
#if 0
// Single config file without master // Single config file without master
g_LibSys.PathFormat(path, sizeof(path), "%s.txt", m_File); g_LibSys.PathFormat(path, sizeof(path), "%s.txt", m_File);
@ -645,14 +644,22 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
{ {
return false; return false;
} }
#endif
// Allow customizations of default gamedata files // Allow customizations of default gamedata files
build_pathname_r(path, sizeof(path), "%s/gamedata/custom/%s.txt", dataDir, m_File); build_pathname_r(path, sizeof(path), "%s/gamedata/custom/%s.txt", dataDir, m_File);
if (g_LibSys.PathExists(path)) if (g_LibSys.PathExists(path))
{ {
g_LibSys.PathFormat(path, sizeof(path), "custom/%s.txt", m_File); g_LibSys.PathFormat(path, sizeof(path), "custom/%s.txt", m_File);
return EnterFile(path, error, maxlength);
auto success = EnterFile(path, error, maxlength);
if (success)
{
AMXXLOG_Log("[AMXX] Parsed custom gamedata override file: %s", path);
}
return success;
} }
return true; return true;
} }
@ -719,6 +726,8 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
return false; return false;
} }
AMXXLOG_Log("[AMXX] Parsed custom gamedata override file: %s", path);
customDir->NextEntry(); customDir->NextEntry();
} }

View File

@ -24,6 +24,7 @@ static cell AMX_NATIVE_CALL LoadGameConfigFile(AMX *amx, cell *params)
if (!ConfigManager.LoadGameConfigFile(filename, &config, error, sizeof(error))) if (!ConfigManager.LoadGameConfigFile(filename, &config, error, sizeof(error)))
{ {
ConfigManager.CloseGameConfigFile(config);
LogError(amx, AMX_ERR_NATIVE, "Unable to open %s: %s", filename, error); LogError(amx, AMX_ERR_NATIVE, "Unable to open %s: %s", filename, error);
return 0; return 0;
} }
@ -31,7 +32,7 @@ static cell AMX_NATIVE_CALL LoadGameConfigFile(AMX *amx, cell *params)
int handle = GameConfigHandle.create(); int handle = GameConfigHandle.create();
auto configHandle = GameConfigHandle.lookup(handle); auto configHandle = GameConfigHandle.lookup(handle);
if (!configHandle) if (!configHandle)
{ {
return 0; return 0;