Added unhooking of virtual tables at map change.

Removed some more debugging output.
This commit is contained in:
Steve Dudenhoeffer 2007-05-04 14:56:57 +00:00
parent 0ac5ce46a7
commit fb5e7dbfdb
6 changed files with 37 additions and 8 deletions

View File

@ -1,10 +1,16 @@
#include <extdll.h> #include <extdll.h>
#include "sdk/amxxmodule.h" #include "sdk/amxxmodule.h"
#include "NEW_Util.h" #include "NEW_Util.h"
#include "CVector.h"
#include "forward.h"
#include "hook.h"
#include "ham_const.h"
edict_t *NEW_FirstEdict; edict_t *NEW_FirstEdict;
bool NEW_Initialized; bool NEW_Initialized;
extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
extern AMX_NATIVE_INFO RegisterNatives[]; extern AMX_NATIVE_INFO RegisterNatives[];
@ -12,7 +18,6 @@ int ReadConfig(void);
void OnAmxxAttach(void) void OnAmxxAttach(void)
{ {
printf("LOLOL");
if (ReadConfig() > 0) if (ReadConfig() > 0)
{ {
MF_AddNatives(RegisterNatives); MF_AddNatives(RegisterNatives);
@ -21,6 +26,24 @@ void OnAmxxAttach(void)
void HamCommand(void); void HamCommand(void);
void OnPluginsUnloaded(void)
{
CVector <Hook *>::iterator end;
for (int i = 0; i < HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
{
end=hooks[i].end();
for (CVector<Hook*>::iterator j=hooks[i].begin();
j!=end;
++j)
{
delete (*j);
}
hooks[i].clear();
}
}
void OnPluginsLoaded(void) void OnPluginsLoaded(void)
{ {
NEW_Initialize(INDEXENT(0)); NEW_Initialize(INDEXENT(0));

View File

@ -203,7 +203,6 @@ static const char* get_localinfo( const char* name , const char* def = 0 )
} }
int read_start_section(char *data) int read_start_section(char *data)
{ {
printf("Section: %s\n", data);
if (strncmp(data, CurrentModName, strlen(CurrentModName))==0) if (strncmp(data, CurrentModName, strlen(CurrentModName))==0)
{ {
data+=strlen(CurrentModName)+1; data+=strlen(CurrentModName)+1;
@ -269,7 +268,6 @@ void process_key(char *data)
hooklist[i].isset=1; hooklist[i].isset=1;
hooklist[i].vtid=value; hooklist[i].vtid=value;
printf("setting \"%s\" to %d", hooklist[i].name, hooklist[i].vtid);
set=1; set=1;
break; break;
@ -279,7 +277,7 @@ void process_key(char *data)
if (set==0) if (set==0)
{ {
printf("stray key in process_key: %s", data); printf("stray key in process_key: %s\n", data);
} }
} }

View File

@ -26,7 +26,6 @@
{ \ { \
if ((*i)->state == FSTATE_OK) \ if ((*i)->state == FSTATE_OK) \
{ \ { \
printf("id=%d\n",(*i)->id); \
thisresult=MF_ExecuteForward((*i)->id,iThis thisresult=MF_ExecuteForward((*i)->id,iThis
#define PRE_END() \ #define PRE_END() \

View File

@ -174,7 +174,6 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
// Don't fail the plugin if this fails, just emit a normal error // Don't fail the plugin if this fails, just emit a normal error
int fwd=hooklist[func].makefunc(amx, function); int fwd=hooklist[func].makefunc(amx, function);
printf("\n\n----> FORWARD = %d\n\n\n",fwd);
if (fwd == -1) if (fwd == -1)
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "Function %s not found.", function); MF_LogError(amx, AMX_ERR_NATIVE, "Function %s not found.", function);

View File

@ -63,7 +63,7 @@
//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading //#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading
/** All plugins are now unloaded */ /** All plugins are now unloaded */
//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded #define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded
/**** METAMOD ****/ /**** METAMOD ****/

View File

@ -39,7 +39,17 @@ void HamCommand(void)
print_srvconsole("-------------------------------------------\n"); print_srvconsole("-------------------------------------------\n");
print_srvconsole("%-24s | %s | %10d\n", "pev", Offsets.IsPevSet() == 0 ? "n" : "y", Offsets.GetPev()); print_srvconsole("%-24s | %s | %10d\n", "pev", Offsets.IsPevSet() == 0 ? "n" : "y", Offsets.GetPev());
print_srvconsole("%-24s | %s | %10d\n", "base", Offsets.IsBaseSet() == 0 ? "n" : "y", Offsets.GetBase()); print_srvconsole("%-24s | %s | %10d\n", "base", Offsets.IsBaseSet() == 0 ? "n" : "y", Offsets.GetBase());
int count=0;
if (Offsets.IsPevSet())
{
Total++;
}
if (Offsets.IsBaseSet())
{
Total++;
}
int count=2;
for (int i=0; i<HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++) for (int i=0; i<HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
{ {
print_srvconsole("%-24s | %s | %10d\n", hooklist[i].name, hooklist[i].isset == 0 ? "n" : "y", hooklist[i].vtid); print_srvconsole("%-24s | %s | %10d\n", hooklist[i].name, hooklist[i].isset == 0 ? "n" : "y", hooklist[i].vtid);