sourcemm/ISmmPlugin.h
branchsourcemm-1.6.0
changeset 351 7347be0355ae
parent 348 716af2e7be78
child 355 8f221ded1568
     1.1 --- a/sourcemm/ISmmPlugin.h	Fri Sep 21 16:54:52 2007 +0000
     1.2 +++ b/sourcemm/ISmmPlugin.h	Fri Sep 21 18:03:57 2007 +0000
     1.3 @@ -33,6 +33,7 @@
     1.4  public:
     1.5  	/**
     1.6  	 * @brief Called on plugin load.
     1.7 +	 *
     1.8  	 * NOTE - As of API 7, this is called as DLLInit() executes - after the parameters are known, but before 
     1.9  	 *  the original GameDLL function is called.  Therefore, you cannot hook it, but you don't need to - 
    1.10  	 *  Load() is basically your hook.
    1.11 @@ -40,22 +41,24 @@
    1.12  	 *  However, take care to note that if your plugin is unloaded, and the gamedll/engine have cached
    1.13  	 *  an interface you've passed, something will definitely crash.  Be careful.
    1.14  	 *
    1.15 -	 * @param id	Internal id of plugin.  Saved globally by PLUGIN_SAVEVARS()
    1.16 -	 * @param ismm	External API for SourceMM.  Saved globally by PLUGIN_SAVEVARS()
    1.17 -	 * @param list	Contains a list of factories.  Hook a factory call by setting one equal to your own function.
    1.18 -	 * @param late	Set to true if your plugin was loaded late (not at server load).
    1.19 -	 * @param error Error message buffer
    1.20 -	 * @param maxlen Size of error message buffer
    1.21 -	 * @return		True if successful, return false to reject the load.
    1.22 +	 * @param id		Internal id of plugin.  Saved globally by PLUGIN_SAVEVARS()
    1.23 +	 * @param ismm		External API for SourceMM.  Saved globally by PLUGIN_SAVEVARS()
    1.24 +	 * @param list		Contains a list of factories.  Hook a factory call by setting one equal to your own function.
    1.25 +	 * @param late		Set to true if your plugin was loaded late (not at server load).
    1.26 +	 * @param error		Error message buffer
    1.27 +	 * @param maxlen	Size of error message buffer
    1.28 +	 * @return			True if successful, return false to reject the load.
    1.29  	 */
    1.30  	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late) =0;
    1.31  
    1.32  	/**
    1.33 -	 * @brief Called when your plugin is "queried".  This is useful for rejecting a loaded
    1.34 -	 *  state.  For example, if your plugin wants to stop operating, it can simply return
    1.35 -	 *  false and copy an error message.  This will notify other plugins or MM:S of something
    1.36 -	 *  bad that happened.  NOTE - MM:S will not cache the return state, so if you return false,
    1.37 -	 *  your plugin will not actually be paused or unloaded.  This callback will be called when:
    1.38 +	 * @brief Called when your plugin is "queried".  
    1.39 +	 * 
    1.40 +	 * This is useful for rejecting a loaded state.  For example, if your plugin wants 
    1.41 +	 * to stop operating, it can simply return false and copy an error message.  This 
    1.42 +	 * will notify other plugins or MM:S of something bad that happened.  NOTE - MM:S 
    1.43 +	 * will not cache the return state, so if you return false,  your plugin will not 
    1.44 +	 * actually be paused or unloaded.  This callback will be called when:
    1.45  	 *  - Another plugin requests it
    1.46  	 *  - Someone types "meta list", it will show up as "REFUSED"
    1.47  	 *  - When Metamod need to re-check the plugin's status
    1.48 @@ -132,10 +135,11 @@
    1.49  	virtual const char *GetLogTag() =0;
    1.50  public:
    1.51  	/**
    1.52 -	 * @brief Called when all plugins have been loaded - API version 4
    1.53 +	 * @brief Called when all plugins have been loaded.  
    1.54  	 *
    1.55 -	 * This is useful for knowing when it's safe to request things another plugin might have.
    1.56 -	 * NOTE for API 7 - This is called after DLLInit(). 
    1.57 +	 * This is called after DLLInit(), and thus the mod has been mostly initialized. 
    1.58 +	 * It is also safe to assume that all other (automatically loaded) plugins are now 
    1.59 +	 * ready to start interacting, because they are all loaded.
    1.60  	 */
    1.61  	virtual void AllPluginsLoaded()
    1.62  	{
    1.63 @@ -148,35 +152,45 @@
    1.64  class IMetamodListener
    1.65  {
    1.66  public:
    1.67 -	virtual ~IMetamodListener() { }
    1.68 +	virtual ~IMetamodListener()
    1.69 +	{
    1.70 +	}
    1.71  public:
    1.72  	/**
    1.73  	 * @brief Called when a plugin is loaded.
    1.74  	 *
    1.75  	 * @param id		Id of the plugin.
    1.76  	 */
    1.77 -	virtual void OnPluginLoad(PluginId id) { }
    1.78 +	virtual void OnPluginLoad(PluginId id)
    1.79 +	{
    1.80 +	}
    1.81  
    1.82  	/**
    1.83  	 * @brief Called when a plugin is unloaded.
    1.84  	 *
    1.85  	 * @param id		Id of the plugin.
    1.86  	 */
    1.87 -	virtual void OnPluginUnload(PluginId id) { }
    1.88 +	virtual void OnPluginUnload(PluginId id)
    1.89 +	{
    1.90 +	}
    1.91  
    1.92  	/**
    1.93  	 * @brief Called when a plugin is paused.
    1.94  	 *
    1.95  	 * @param id		Id of the plugin.
    1.96  	 */
    1.97 -	virtual void OnPluginPause(PluginId id) { }
    1.98 +	virtual void OnPluginPause(PluginId id)
    1.99 +	{
   1.100 +	}
   1.101  
   1.102  	/**
   1.103  	 * @brief Called when a plugin is unpaused.
   1.104  	 *
   1.105  	 * @param id		Id of the plugin.
   1.106  	 */
   1.107 -	virtual void OnPluginUnpause(PluginId id) { }
   1.108 +	virtual void OnPluginUnpause(PluginId id)
   1.109 +	{
   1.110 +	}
   1.111  
   1.112  	/**
   1.113  	 * @brief Called when the level is loaded (after GameInit, before ServerActivate).
   1.114 @@ -195,7 +209,9 @@
   1.115  	/**
   1.116  	 * @brief Called when the level is shut down.  May be called more than once.
   1.117  	 */
   1.118 -	virtual void OnLevelShutdown() { }
   1.119 +	virtual void OnLevelShutdown()
   1.120 +	{
   1.121 +	}
   1.122  
   1.123  	/**
   1.124  	 * @brief Called when engineFactory() is used through Metamod:Source's wrapper.
   1.125 @@ -308,7 +324,8 @@
   1.126  	 * This callback is provided to all plugins regardless of which (or how many)
   1.127  	 * called EnableVSPListener(), but only if at least one did in fact enable it.
   1.128  	 *
   1.129 -	 * This callback is only available for plugins using API v1:5 (SourceMM 1.4+).
   1.130 +	 * This callback is only available for plugins using API v1:5 (Metamod:Source 1.4+).
   1.131 +	 * If a plugin loads lately, it may still call EnableVSPListener().
   1.132  	 *
   1.133  	 * @param iface			Interface pointer.  If NULL, then the VSP listening construct
   1.134  	 *						failed to initialize and is not available.
   1.135 @@ -317,7 +334,8 @@
   1.136  	{
   1.137  	}
   1.138  
   1.139 -	/* @brief Called when Metamod:Source is about to remove a concommand or convar.
   1.140 +	/**
   1.141 +	 * @brief Called when Metamod:Source is about to remove a concommand or convar.
   1.142  	 * This can also be called if ISmmAPI::UnregisterConCmdBase is used by a plugin.
   1.143  	 *
   1.144  	 * @param id			Id of the plugin that created the concommand or convar.