From fc5e049e4aba5a4c1cb24551703155de44601dff Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 3 Jun 2006 21:34:43 +0000 Subject: [PATCH] expanded MF_OverrideNatives API function a bit, to exclude named module(s) --- amxmodx/modules.cpp | 9 ++++++++- amxmodx/sdk/amxxmodule.cpp | 2 +- amxmodx/sdk/amxxmodule.h | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index 500e82d9..86fde976 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -1311,13 +1311,20 @@ const char * MNF_GetPlayerName(int id) return GET_PLAYER_POINTER_I(id)->name.c_str(); } -void MNF_OverrideNatives(AMX_NATIVE_INFO *natives) +void MNF_OverrideNatives(AMX_NATIVE_INFO *natives, const char *name) { //HACKHACK - we should never have had to do this //find a better solution for SourceMod!!! for (CList::iterator a = g_modules.begin(); a ; ++a) { CModule &cm = (*a); + if (cm.getStatusValue() != MODULE_LOADED) + continue; + const amxx_module_info_s *p = cm.getInfoNew(); + if (!p || !p->name) + continue; + if (strcmp(p->name, name)==0) + continue; cm.rewriteNativeLists(natives); } } diff --git a/amxmodx/sdk/amxxmodule.cpp b/amxmodx/sdk/amxxmodule.cpp index 3492febb..b83c9903 100755 --- a/amxmodx/sdk/amxxmodule.cpp +++ b/amxmodx/sdk/amxxmodule.cpp @@ -2779,7 +2779,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_FindLibrary(NULL, LibType_Class); MF_AddLibraries(NULL, LibType_Class, NULL); MF_RemoveLibraries(NULL); - MF_OverrideNatives(NULL); + MF_OverrideNatives(NULL, NULL); } #endif diff --git a/amxmodx/sdk/amxxmodule.h b/amxmodx/sdk/amxxmodule.h index e74febf4..aec781f1 100755 --- a/amxmodx/sdk/amxxmodule.h +++ b/amxmodx/sdk/amxxmodule.h @@ -2179,7 +2179,7 @@ typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); -typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/, const char * /*myname*/); typedef const char * (*PFN_GETLOCALINFO) (const char * /*name*/, const char * /*def*/); typedef int (*PFN_AMX_REREGISTER) (AMX * /*amx*/, AMX_NATIVE_INFO * /*list*/, int /*list*/); typedef void * (*PFN_REGISTERFUNCTIONEX) (void * /*pfn*/, const char * /*desc*/); @@ -2324,7 +2324,7 @@ void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } int MF_FindLibrary (const char *name, LibType type) { } size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } size_t MF_RemoveLibraries (void *parent) { } -void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives, const char *myname) { } const char * MF_GetLocalInfo (const char *name, const char *def) { } int MF_AmxReRegister (AMX *amx, AMX_NATIVE_INFO *list, int number) { return 0; } void * MF_RegisterFunctionEx (void *pfn, const char *description) { }