fixed amb1069 - map prefixes still didn't work

This commit is contained in:
David Anderson 2007-10-25 23:54:51 +00:00
parent dbf6143747
commit a2e3f8682f

View File

@ -413,6 +413,7 @@ int C_Spawn(edict_t *pent)
VectorHolder.clear(); VectorHolder.clear();
char map_pluginsfile_path[256]; char map_pluginsfile_path[256];
char prefixed_map_pluginsfile[256];
char configs_dir[256]; char configs_dir[256];
// ###### Load modules // ###### Load modules
@ -423,26 +424,27 @@ int C_Spawn(edict_t *pent)
LoadExtraPluginsToPCALM(configs_dir); LoadExtraPluginsToPCALM(configs_dir);
char temporaryMap[64], *tmap_ptr; char temporaryMap[64], *tmap_ptr;
strncpy(temporaryMap,STRING(gpGlobals->mapname),sizeof(temporaryMap)-1); snprintf(temporaryMap, sizeof(temporaryMap), "%s", STRING(gpGlobals->mapname));
prefixed_map_pluginsfile[0] = '\0';
if ((tmap_ptr = strchr(temporaryMap, '_')) != NULL) if ((tmap_ptr = strchr(temporaryMap, '_')) != NULL)
{ {
// this map has a prefix // this map has a prefix
*tmap_ptr = '\0'; *tmap_ptr = '\0';
snprintf(map_pluginsfile_path, sizeof(map_pluginsfile_path)-1, snprintf(prefixed_map_pluginsfile,
"%s/maps/plugins-%s.ini", sizeof(prefixed_map_pluginsfile),
configs_dir, "%s/maps/plugins-%s.ini",
temporaryMap); configs_dir,
g_plugins.CALMFromFile(map_pluginsfile_path); temporaryMap);
g_plugins.CALMFromFile(prefixed_map_pluginsfile);
} }
snprintf(map_pluginsfile_path, sizeof(map_pluginsfile_path)-1, snprintf(map_pluginsfile_path,
"%s/maps/plugins-%s.ini", sizeof(map_pluginsfile_path),
configs_dir, "%s/maps/plugins-%s.ini",
STRING(gpGlobals->mapname)); configs_dir,
STRING(gpGlobals->mapname));
g_plugins.CALMFromFile(map_pluginsfile_path); g_plugins.CALMFromFile(map_pluginsfile_path);
int loaded = countModules(CountModules_Running); // Call after attachModules so all modules don't have pending stat int loaded = countModules(CountModules_Running); // Call after attachModules so all modules don't have pending stat
@ -484,6 +486,11 @@ int C_Spawn(edict_t *pent)
g_plugins.loadPluginsFromFile(get_localinfo("amxx_plugins", "addons/amxmodx/configs/plugins.ini")); g_plugins.loadPluginsFromFile(get_localinfo("amxx_plugins", "addons/amxmodx/configs/plugins.ini"));
LoadExtraPluginsFromDir(configs_dir); LoadExtraPluginsFromDir(configs_dir);
g_plugins.loadPluginsFromFile(map_pluginsfile_path, false); g_plugins.loadPluginsFromFile(map_pluginsfile_path, false);
if (prefixed_map_pluginsfile[0] != '\0')
{
g_plugins.loadPluginsFromFile(prefixed_map_pluginsfile, false);
}
g_plugins.Finalize(); g_plugins.Finalize();
g_plugins.InvalidateCache(); g_plugins.InvalidateCache();