diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 0e93339a..96f440a1 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -41,6 +41,7 @@ #include "natives.h" #include "binlog.h" #include "optimizer.h" +#include "libraries.h" plugin_info_t Plugin_info = { @@ -488,6 +489,8 @@ void C_ServerDeactivate_Post() { if (!g_initialized) RETURN_META(MRES_IGNORED); + + modules_callPluginsUnloading(); detachReloadModules(); g_auth.clear(); @@ -1278,6 +1281,8 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason) return (FALSE); } + modules_callPluginsUnloading(); + g_auth.clear(); g_forwards.clear(); g_commands.clear(); diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index 685954eb..3b034902 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -839,7 +839,7 @@ bool ConvertModuleName(const char *pathString, String &path) return true; } -bool LoadModule(const char *shortname, PLUG_LOADTIME now) +bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify) { char pathString[512]; String path; @@ -851,8 +851,17 @@ bool LoadModule(const char *shortname, PLUG_LOADTIME now) get_localinfo("amxx_modulesdir", "addons/amxmodx/modules"), shortname); - if (!ConvertModuleName(pathString, path)) - return false; + if (simplify) + { + if (!ConvertModuleName(pathString, path)) + return false; + } else { + path.assign(pathString); + FILE *fp = fopen(path.c_str(), "rb"); + if (!fp) + return false; + fclose(fp); + } CList::iterator a = g_modules.find(path.c_str()); @@ -937,27 +946,37 @@ int loadModules(const char* filename, PLUG_LOADTIME now) return 0; } - char moduleName[256]; String line; + char moduleName[256]; + char buffer[255]; int loaded = 0; String path; while (!feof(fp)) { - if (!line._fread(fp) || line.size() < 1) + fgets(buffer, sizeof(buffer)-1, fp); + + if (buffer[0] == ';' || buffer[0] == '\n') continue; + + bool simplify = true; + if (buffer[0] == '>') + { + simplify = false; + line.assign(&buffer[1]); + } else { + line.assign(buffer); + } line.trim(); + *moduleName = 0; if (sscanf(line.c_str(), "%s", moduleName) == EOF) continue; - if (moduleName[0] == ';') - continue; - - if (LoadModule(moduleName, now)) + if (LoadModule(moduleName, now, simplify)) loaded++; } diff --git a/amxmodx/modules.h b/amxmodx/modules.h index 63d13490..90116530 100755 --- a/amxmodx/modules.h +++ b/amxmodx/modules.h @@ -72,7 +72,7 @@ typedef enum } PlayerProp; int CheckModules(AMX *amx, char error[128]); -bool LoadModule(const char *shortname, PLUG_LOADTIME now); +bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify=true); const char *StrCaseStr(const char *as, const char *bs); class Debugger;