Switched from MEMFUNC to STATICFUNC for simplicity
authorDavid Anderson <dvander@alliedmods.net>
Sun May 01 18:46:06 2005 +0000 (2005-05-01)
changeset 53797ecc5394d6
parent 52 948ae76c45b5
child 54 7253f31cb91b
Switched from MEMFUNC to STATICFUNC for simplicity
sourcemm/stub_mm/stub_mm.cpp
sourcemm/stub_mm/stub_mm.h
     1.1 --- a/sourcemm/stub_mm/stub_mm.cpp	Sun May 01 18:42:16 2005 +0000
     1.2 +++ b/sourcemm/stub_mm/stub_mm.cpp	Sun May 01 18:46:06 2005 +0000
     1.3 @@ -18,7 +18,7 @@
     1.4  //This has all of the necessary hook declarations.  Read it!
     1.5  #include "meta_hooks.h"
     1.6  
     1.7 -void StubPlugin::ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
     1.8 +void ServerActivate_handler(edict_t *pEdictList, int edictCount, int clientMax)
     1.9  {
    1.10  	META_LOG(g_PLAPI, "ServerActivate() called: edictCount=%d, clientMax=%d", edictCount, clientMax);
    1.11  	RETURN_META(MRES_IGNORED);
    1.12 @@ -36,18 +36,14 @@
    1.13  		return false;
    1.14  	}
    1.15  
    1.16 -	SH_ADD_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_StubPlugin, ServerActivate, true);
    1.17 -
    1.18 -	m_ServerDll_CC = SH_GET_CALLCLASS(IServerGameDLL, m_ServerDll);
    1.19 +	SH_ADD_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, m_ServerDll, ServerActivate_handler, true);
    1.20  
    1.21  	return true;
    1.22  }
    1.23  
    1.24  bool StubPlugin::Unload(char *error, size_t maxlen)
    1.25  {
    1.26 -	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_StubPlugin, ServerActivate, true);
    1.27 -
    1.28 -	SH_RELEASE_CALLCLASS(m_ServerDll_CC);
    1.29 +	SH_REMOVE_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, m_ServerDll, ServerActivate_handler, true);
    1.30  
    1.31  	return true;
    1.32  }
     2.1 --- a/sourcemm/stub_mm/stub_mm.h	Sun May 01 18:42:16 2005 +0000
     2.2 +++ b/sourcemm/stub_mm/stub_mm.h	Sun May 01 18:46:06 2005 +0000
     2.3 @@ -30,9 +30,6 @@
     2.4  	const char *GetVersion();
     2.5  	const char *GetDate();
     2.6  	const char *GetLogTag();
     2.7 -public:
     2.8 -	//Called on ServerActivate.  Same definition as server plugins
     2.9 -	void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
    2.10  private:
    2.11  	IServerGameDLL *m_ServerDll;
    2.12  	IServerGameDLL *m_ServerDll_CC;
    2.13 @@ -42,4 +39,7 @@
    2.14  
    2.15  PLUGIN_GLOBALVARS();
    2.16  
    2.17 +//Called on ServerActivate.  Same definition as server plugins
    2.18 +void ServerActivate_handler(edict_t *pEdictList, int edictCount, int clientMax);
    2.19 +
    2.20  #endif //_INCLUDE_SAMPLEPLUGIN_H