broke api! refactored a bunch of very, very old things
authorDavid Anderson <dvander@alliedmods.net>
Sat Oct 06 15:47:59 2007 +0000 (2007-10-06)
changeset 37517ca1d5645ac
parent 374 a37e0bd37610
child 376 f2d55f90f697
broke api! refactored a bunch of very, very old things
sourcemm/ISmmAPI.h
sourcemm/ISmmPlugin.h
sourcemm/metamod.cpp
sourcemm/metamod.h
sourcemm/metamod_plugins.h
     1.1 --- a/sourcemm/ISmmAPI.h	Fri Oct 05 19:53:57 2007 +0000
     1.2 +++ b/sourcemm/ISmmAPI.h	Sat Oct 06 15:47:59 2007 +0000
     1.3 @@ -68,7 +68,7 @@
     1.4  	 * @param msg			Formatted string.
     1.5  	 */
     1.6  	virtual void LogMsg(ISmmPlugin *pl, const char *msg, ...) =0;
     1.7 -public:
     1.8 +
     1.9  	/**
    1.10  	 * @brief Returns an interface factory for the HL2 engine.
    1.11  	 *
    1.12 @@ -76,7 +76,7 @@
    1.13  	 *						If syn is false, the true function is returned.
    1.14  	 * @return				CreateInterfaceFn function pointer.
    1.15  	 */
    1.16 -	virtual CreateInterfaceFn engineFactory(bool syn=true) =0;
    1.17 +	virtual CreateInterfaceFn GetEngineFactory(bool syn=true) =0;
    1.18  
    1.19  	/**
    1.20  	 * @brief Returns an interface factory for the HL2 physics engine.
    1.21 @@ -85,7 +85,7 @@
    1.22  	 *						If syn is false, the true function is returned.
    1.23  	 * @return				CreateInterfaceFn function pointer.
    1.24  	 */
    1.25 -	virtual CreateInterfaceFn physicsFactory(bool syn=true) =0;
    1.26 +	virtual CreateInterfaceFn GetPhysicsFactory(bool syn=true) =0;
    1.27  
    1.28  	/**
    1.29  	 * @brief Returns an interface factory for the HL2 file system.
    1.30 @@ -94,7 +94,7 @@
    1.31  	 *						If syn is false, the true function is returned.
    1.32  	 * @return				CreateInterfaceFn function pointer.
    1.33  	 */
    1.34 -	virtual CreateInterfaceFn fileSystemFactory(bool syn=true) =0;
    1.35 +	virtual CreateInterfaceFn GetFileSystemFactory(bool syn=true) =0;
    1.36  
    1.37  	/**
    1.38  	 * @brief Returns an interface factory for the GameDLL.
    1.39 @@ -103,38 +103,14 @@
    1.40  	 *						If syn is false, the true function is returned.
    1.41  	 * @return				CreateInterfaceFn function pointer.
    1.42  	 */
    1.43 -	virtual CreateInterfaceFn serverFactory(bool syn=true) =0;
    1.44 +	virtual CreateInterfaceFn GetServerFactory(bool syn=true) =0;
    1.45  
    1.46  	/**
    1.47  	 * @brief Returns a CGlobalVars pointer from the HL2 Engine.
    1.48  	 *
    1.49  	 * @return				CGlobalVars pointer.
    1.50  	 */
    1.51 -	virtual CGlobalVars *pGlobals() =0;
    1.52 -
    1.53 -	/**
    1.54 -	 * @brief Used with SourceHook, sets teh last meta return value.
    1.55 -	 * Note: Do not call this directly, use the Metamod macros.
    1.56 -	 *
    1.57 -	 * @param res			META_RETURN value to set.
    1.58 -	 */
    1.59 -	virtual void SetLastMetaReturn(META_RES res) =0;
    1.60 -
    1.61 -	/**
    1.62 -	 * @brief Used with SourceHook, returns the last meta return value.
    1.63 -	 * Note: This is only valid inside a hook function.
    1.64 -	 *
    1.65 -	 * @return				Last META_RETURN value set by a plugin.
    1.66 -	 */
    1.67 -	virtual META_RES GetLastMetaReturn() =0;
    1.68 -
    1.69 -public:		// Added in 1.00-RC2 (0:0)
    1.70 -	/**
    1.71 -	 * @brief Allows access to Metamod's ConCommandBaseAccessor.
    1.72 -	 *
    1.73 -	 * @return				Returns IConCommandBaseAccessor pointer.
    1.74 -	 */
    1.75 -	virtual IConCommandBaseAccessor *GetCvarBaseAccessor() =0;
    1.76 +	virtual CGlobalVars *GetCGlobals() =0;
    1.77  
    1.78  	/**
    1.79  	 * @brief Registers a ConCommandBase.
    1.80 @@ -143,7 +119,7 @@
    1.81  	 * @param pCommand		ConCommandBase to register.
    1.82  	 * @return				True if successful, false otherwise.
    1.83  	 */
    1.84 -	virtual bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0;
    1.85 +	virtual bool RegisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0;
    1.86  
    1.87  	/**
    1.88  	 * @brief Unregisters a ConCommandBase.
    1.89 @@ -151,7 +127,7 @@
    1.90  	 * @param plugin		Parent plugin API pointer.
    1.91  	 * @param pCommand		ConCommandBase to unlink.
    1.92  	 */
    1.93 -	virtual void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0;
    1.94 +	virtual void UnregisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0;
    1.95  	
    1.96  	/**
    1.97  	 * @brief Prints an unformatted string to the remote server console.
    1.98 @@ -171,14 +147,6 @@
    1.99  	 */
   1.100  	virtual void ConPrintf(const char *fmt, ...) =0;
   1.101  
   1.102 -public:		// Added in 1.1.0 (1:0)
   1.103 -	/**
   1.104 -	 * @brief Checks if ConPrint/ConPrintf will mirror to rcon.
   1.105 -	 *
   1.106 -	 * @return				True if remote printing available, false otherwise.
   1.107 -	 */
   1.108 -	virtual bool RemotePrintingAvailable() =0;
   1.109 -
   1.110  	/**
   1.111  	 * @brief Returns the Metamod Version numbers as major version and minor (API) version.
   1.112  	 * Changes to minor version are guaranteed to be backwards compatible.
   1.113 @@ -217,7 +185,6 @@
   1.114  	  */
   1.115  	virtual void *MetaFactory(const char *iface, int *ret, PluginId *id) =0;
   1.116  
   1.117 -public:		// Added in 1.1.2 (1:1)
   1.118  	/**
   1.119  	 * @brief Given a base interface name, such as ServerGameDLL or ServerGameDLL003, 
   1.120  	 * reformats the string to increase the number, then returns the new number.
   1.121 @@ -229,7 +196,6 @@
   1.122  	 */
   1.123  	virtual int FormatIface(char iface[], unsigned int maxlength) =0;
   1.124  
   1.125 -public:		// Added in 1.2 (1:2)
   1.126  	/**
   1.127  	 * @brief Searches for an interface, eliminating the need to loop through FormatIface().
   1.128  	 * 
   1.129 @@ -261,7 +227,6 @@
   1.130  	 */
   1.131  	virtual void PathFormat(char *buffer, size_t len, const char *fmt, ...) =0;
   1.132  
   1.133 -public:		// Added in 1.2.2 (1:3)
   1.134  	/**
   1.135  	 * @brief Prints text in the specified client's console. Same as 
   1.136  	 * IVEngineServer::ClientPrintf except that it allows for string formatting.
   1.137 @@ -271,7 +236,6 @@
   1.138  	 */
   1.139  	virtual void ClientConPrintf(edict_t *client, const char *fmt, ...) =0;
   1.140  
   1.141 -public:		// Added in 1.3 (1:4)
   1.142  	/**
   1.143  	 * @brief Wrapper around InterfaceSearch().  Assumes no maximum.
   1.144  	 * This is designed to replace the fact that searches only went upwards.
   1.145 @@ -290,7 +254,6 @@
   1.146  	 */
   1.147  	virtual void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1) =0;
   1.148  
   1.149 -public:		// Added in 1.4 (1:5)
   1.150  	/**
   1.151  	 * @brief Tells SourceMM to add VSP hooking capability to plugins.  
   1.152  	 *
   1.153 @@ -338,7 +301,6 @@
   1.154  	 */
   1.155  	virtual const char *GetUserMessage(int index, int *size=NULL) =0;
   1.156  
   1.157 -public:		// Added in 1.5.0 (1:6)
   1.158  	/**
   1.159  	 * @brief Returns the highest interface version of IServerPluginCallbacks 
   1.160  	 * that the engine supports.  This is useful for games that run on older 
   1.161 @@ -350,7 +312,6 @@
   1.162  	 */
   1.163  	virtual int GetVSPVersion() =0;
   1.164  
   1.165 -public:		// Added in 1.6.0 (1:7)
   1.166  	/**
   1.167  	 * @brief Returns the engine interface that MM:S is using as a backend.
   1.168  	 *
   1.169 @@ -386,7 +347,7 @@
   1.170   * 1.3   Added new interface search API.
   1.171   * 1.4	 Added VSP listener and user message API.
   1.172   * 1.5.0 Added API for getting highest supported version of IServerPluginCallbacks.
   1.173 - * 1.6.0 Added API for Orange Box.
   1.174 + * 1.6.0 Added API for Orange Box.  Broke backwards compatibility.
   1.175   */
   1.176  
   1.177  #endif //_INCLUDE_ISMM_API_H
     2.1 --- a/sourcemm/ISmmPlugin.h	Fri Oct 05 19:53:57 2007 +0000
     2.2 +++ b/sourcemm/ISmmPlugin.h	Sat Oct 06 15:47:59 2007 +0000
     2.3 @@ -37,7 +37,7 @@
     2.4  #include <sourcehook.h>
     2.5  #include "ISmmAPI.h"
     2.6  
     2.7 -#define PLAPI_VERSION	12
     2.8 +#define PLAPI_VERSION	13
     2.9  #define PLAPI_NAME		"ISmmPlugin"
    2.10  
    2.11  class ISmmAPI;
    2.12 @@ -389,10 +389,10 @@
    2.13  	g_PLID = id;
    2.14  
    2.15  #define META_LOG				g_SMAPI->LogMsg
    2.16 -#define META_REGCMD(name)		g_SMAPI->RegisterConCmdBase(g_PLAPI, name##_command)
    2.17 -#define META_REGCVAR(var)		g_SMAPI->RegisterConCmdBase(g_PLAPI, var)
    2.18 -#define META_UNREGCMD(name)		g_SMAPI->UnregisterConCmdBase(g_PLAPI, name##_command)
    2.19 -#define META_UNREGCVAR(var)		g_SMAPI->UnregisterConCmdBase(g_PLAPI, var)
    2.20 +#define META_REGCMD(name)		g_SMAPI->RegisterConCommandBase(g_PLAPI, name##_command)
    2.21 +#define META_REGCVAR(var)		g_SMAPI->RegisterConCommandBase(g_PLAPI, var)
    2.22 +#define META_UNREGCMD(name)		g_SMAPI->UnregisterConCommandBase(g_PLAPI, name##_command)
    2.23 +#define META_UNREGCVAR(var)		g_SMAPI->UnregisterConCommandBase(g_PLAPI, var)
    2.24  #define	META_CONPRINT			g_SMAPI->ConPrint
    2.25  #define META_CONPRINTF			g_SMAPI->ConPrintf
    2.26  
     3.1 --- a/sourcemm/metamod.cpp	Fri Oct 05 19:53:57 2007 +0000
     3.2 +++ b/sourcemm/metamod.cpp	Sat Oct 06 15:47:59 2007 +0000
     3.3 @@ -801,7 +801,7 @@
     3.4  	LogMessage("[%s] %s", pl->GetLogTag(), buffer);
     3.5  }
     3.6  
     3.7 -CreateInterfaceFn MetamodSource::engineFactory(bool syn/* =true */)
     3.8 +CreateInterfaceFn MetamodSource::GetEngineFactory(bool syn/* =true */)
     3.9  {
    3.10  	if (syn)
    3.11  	{
    3.12 @@ -811,7 +811,7 @@
    3.13  	return engine_factory;
    3.14  }
    3.15  
    3.16 -CreateInterfaceFn MetamodSource::physicsFactory(bool syn/* =true */)
    3.17 +CreateInterfaceFn MetamodSource::GetPhysicsFactory(bool syn/* =true */)
    3.18  {
    3.19  	if (syn)
    3.20  	{
    3.21 @@ -821,7 +821,7 @@
    3.22  	return physics_factory;
    3.23  }
    3.24  
    3.25 -CreateInterfaceFn MetamodSource::fileSystemFactory(bool syn/* =true */)
    3.26 +CreateInterfaceFn MetamodSource::GetFileSystemFactory(bool syn/* =true */)
    3.27  {
    3.28  	if (syn)
    3.29  	{
    3.30 @@ -831,7 +831,7 @@
    3.31  	return filesystem_factory;
    3.32  }
    3.33  
    3.34 -CreateInterfaceFn MetamodSource::serverFactory(bool syn/* =true */)
    3.35 +CreateInterfaceFn MetamodSource::GetServerFactory(bool syn/* =true */)
    3.36  {
    3.37  	if (syn)
    3.38  	{
    3.39 @@ -841,7 +841,7 @@
    3.40  	return gamedll_info.factory;
    3.41  }
    3.42  
    3.43 -CGlobalVars *MetamodSource::pGlobals()
    3.44 +CGlobalVars *MetamodSource::GetCGlobals()
    3.45  {
    3.46  	return gpGlobals;
    3.47  }
    3.48 @@ -1148,7 +1148,7 @@
    3.49  	return provider->GetConCommandBaseAccessor();
    3.50  }
    3.51  
    3.52 -bool MetamodSource::RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand)
    3.53 +bool MetamodSource::RegisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand)
    3.54  {
    3.55  	if (provider->IsConCommandBaseACommand(pCommand))
    3.56  	{
    3.57 @@ -1162,7 +1162,7 @@
    3.58  	return provider->RegisterConCommandBase(pCommand);
    3.59  }
    3.60  
    3.61 -void MetamodSource::UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand)
    3.62 +void MetamodSource::UnregisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand)
    3.63  {
    3.64  	if (provider->IsConCommandBaseACommand(pCommand))
    3.65  	{
     4.1 --- a/sourcemm/metamod.h	Fri Oct 05 19:53:57 2007 +0000
     4.2 +++ b/sourcemm/metamod.h	Sat Oct 06 15:47:59 2007 +0000
     4.3 @@ -51,23 +51,23 @@
     4.4   */
     4.5  #define SOURCEMM_VERSION	SVN_FILE_VERSION_STRING
     4.6  #define SOURCEMM_DATE		__DATE__
     4.7 -#define SM_VERS_API_MAJOR	1		//increase this on a breaking change
     4.8 -#define SM_VERS_API_MINOR	7		//increase this on a non-breaking API change
     4.9 +#define SM_VERS_API_MAJOR	2		//increase this on a breaking change
    4.10 +#define SM_VERS_API_MINOR	0		//increase this on a non-breaking API change
    4.11  
    4.12  class MetamodSource : public ISmmAPI
    4.13  {
    4.14  public:
    4.15  	void LogMsg(ISmmPlugin *pl, const char *msg, ...);
    4.16 -	CreateInterfaceFn engineFactory(bool syn=true);
    4.17 -	CreateInterfaceFn physicsFactory(bool syn=true);
    4.18 -	CreateInterfaceFn fileSystemFactory(bool syn=true);
    4.19 -	CreateInterfaceFn serverFactory(bool syn=true);
    4.20 -	CGlobalVars *pGlobals();
    4.21 +	CreateInterfaceFn GetEngineFactory(bool syn=true);
    4.22 +	CreateInterfaceFn GetPhysicsFactory(bool syn=true);
    4.23 +	CreateInterfaceFn GetFileSystemFactory(bool syn=true);
    4.24 +	CreateInterfaceFn GetServerFactory(bool syn=true);
    4.25 +	CGlobalVars *GetCGlobals();
    4.26  	void SetLastMetaReturn(META_RES res);
    4.27  	META_RES GetLastMetaReturn();
    4.28  	IConCommandBaseAccessor *GetCvarBaseAccessor();
    4.29 -	bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
    4.30 -	void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
    4.31 +	bool RegisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
    4.32 +	void UnregisterConCommandBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
    4.33  	void ConPrint(const char *str);
    4.34  	void ConPrintf(const char *fmt, ...);
    4.35  	bool RemotePrintingAvailable();
     5.1 --- a/sourcemm/metamod_plugins.h	Fri Oct 05 19:53:57 2007 +0000
     5.2 +++ b/sourcemm/metamod_plugins.h	Sat Oct 06 15:47:59 2007 +0000
     5.3 @@ -48,17 +48,19 @@
     5.4   *     4: Added AllPluginsLoaded() callback (2005-04-18)
     5.5   *     5: Bumped version for SourceHook V4 (2005-05-01)
     5.6   *     6: Added functions for console printing (2005-05-26)
     5.7 - * M   7: Changed template libraries (2005-08-11)
     5.8 + *     7: Changed template libraries (2005-08-11)
     5.9   * 	      New loading structure mechanism
    5.10   *        New SourceHook version
    5.11   *     8: New SourceHook version (2005-12-23)
    5.12   *        New ISmmAPI additions
    5.13   *     9: New ISmmPluginManager additions
    5.14 - *  C 10: Added VSP listen functions to ISmmAPI and IMetamodListener (2007-02-09)
    5.15 - *  C 11: New SourceHook version V5 (May, 2007)
    5.16 + *    10: Added VSP listen functions to ISmmAPI and IMetamodListener (2007-02-09)
    5.17 + *    11: New SourceHook version v4.5 (May, 2007)
    5.18 + *    12: Orange Box API
    5.19 + * MC 13: Breaking of API for next SH version and other API changes
    5.20   */
    5.21  
    5.22 -#define PLAPI_MIN_VERSION	7
    5.23 +#define PLAPI_MIN_VERSION	13
    5.24  
    5.25  namespace SourceMM
    5.26  {