expanded MF_OverrideNatives API function a bit, to exclude named module(s)

This commit is contained in:
David Anderson 2006-06-03 21:34:43 +00:00
parent 1c2749fdf6
commit fc5e049e4a
3 changed files with 11 additions and 4 deletions

View File

@ -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<CModule, const char *>::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);
}
}

View File

@ -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

View File

@ -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) { }