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,23 +424,24 @@ 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,
sizeof(prefixed_map_pluginsfile),
"%s/maps/plugins-%s.ini", "%s/maps/plugins-%s.ini",
configs_dir, configs_dir,
temporaryMap); temporaryMap);
g_plugins.CALMFromFile(map_pluginsfile_path); g_plugins.CALMFromFile(prefixed_map_pluginsfile);
} }
snprintf(map_pluginsfile_path, sizeof(map_pluginsfile_path)-1, snprintf(map_pluginsfile_path,
sizeof(map_pluginsfile_path),
"%s/maps/plugins-%s.ini", "%s/maps/plugins-%s.ini",
configs_dir, configs_dir,
STRING(gpGlobals->mapname)); STRING(gpGlobals->mapname));
@ -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();