sourcemm/ISmmPlugin.h
changeset 9 01b8b7435e67
parent 7 8ef11f6189e4
child 18 8848d3ef28d8
     1.1 --- a/sourcemm/ISmmPlugin.h	Sat Apr 16 20:26:33 2005 +0000
     1.2 +++ b/sourcemm/ISmmPlugin.h	Sat Apr 16 23:33:39 2005 +0000
     1.3 @@ -1,6 +1,21 @@
     1.4 +/* ======== SourceMM ========
     1.5 +* Copyright (C) 2004-2005 Metamod:Source Development Team
     1.6 +* No warranties of any kind
     1.7 +*
     1.8 +* License: zlib/libpng
     1.9 +*
    1.10 +* Author(s): David "BAILOPAN" Anderson
    1.11 +* ============================
    1.12 +*/
    1.13 +
    1.14  #ifndef _INCLUDE_ISMM_PLUGIN_H
    1.15  #define _INCLUDE_ISMM_PLUGIN_H
    1.16  
    1.17 +/**
    1.18 + * @brief Plugin API interface
    1.19 + * @file ISmmPlugin.h
    1.20 + */
    1.21 +
    1.22  #include <interface.h>
    1.23  #include <sourcehook/sourcehook.h>
    1.24  #include "ISmmAPI.h"
    1.25 @@ -22,10 +37,12 @@
    1.26  class ISmmPlugin
    1.27  {
    1.28  public:
    1.29 +	virtual int GetApiVersion() { return PLAPI_VERSION; }
    1.30 +public:
    1.31  	/**
    1.32  	 * @brief Called on plugin load.
    1.33  	 *
    1.34 -	 * @param id Internal id of plugin.
    1.35 +	 * @param id Internal id of plugin.  Saved globally by PLUGIN_SAVEVARS()
    1.36  	 * @param ismm External API for SourceMM.  Saved globally by PLUGIN_SAVEVARS()
    1.37  	 * @param list Contains a list of factories.  Hook a factory call by setting one equal to your own function.
    1.38  	 * @param error Error message buffer
    1.39 @@ -58,8 +75,6 @@
    1.40  	 */
    1.41  	virtual bool Unpause(char *error, size_t maxlen) =0;
    1.42  public:
    1.43 -	virtual int GetApiVersion() { return PLAPI_VERSION; }
    1.44 -public:
    1.45  	virtual const char *GetAuthor() =0;
    1.46  	virtual const char *GetName() =0;
    1.47  	virtual const char *GetDescription() =0;
    1.48 @@ -76,7 +91,8 @@
    1.49  
    1.50  #define PLUGIN_EXPOSE(name, var) \
    1.51  	ISmmAPI *g_SMAPI = NULL; \
    1.52 -	ISmmPlugin *g_PLID = NULL; \
    1.53 +	ISmmPlugin *g_PLAPI = NULL; \
    1.54 +	PluginId g_PLID = (PluginId)0; \
    1.55  	SourceHook::ISourceHook *g_SHPtr = NULL; \
    1.56  	SMM_API void *PL_EXPOSURE(const char *name, int *code) { \
    1.57  		if (name && !strcmp(name, PLAPI_NAME)) { \
    1.58 @@ -88,12 +104,14 @@
    1.59  #define PLUGIN_GLOBALVARS()	\
    1.60  	extern SourceHook::ISourceHook *g_SHPtr; \
    1.61  	extern ISmmAPI *g_SMAPI; \
    1.62 -	extern ISmmPlugin *g_PLID; 
    1.63 +	extern ISmmPlugin *g_PLAPI; \
    1.64 +	extern PluginId g_PLID; 
    1.65  
    1.66  #define PLUGIN_SAVEVARS() \
    1.67  	g_SMAPI = ismm; \
    1.68  	g_SHPtr = ismm->SourceHook(); \
    1.69 -	g_PLID = static_cast<ISmmPlugin *>(this);
    1.70 +	g_PLAPI = static_cast<ISmmPlugin *>(this); \
    1.71 +	g_PLID = id;
    1.72  
    1.73  #define FACTORY_RETURN(mres, value) \
    1.74  	g_SMAPI->SetLastMetaReturn(mres); \