diff --git a/core/interfaces/IPluginSys.h b/core/interfaces/IPluginSys.h index 8dce1d39..a82164cb 100644 --- a/core/interfaces/IPluginSys.h +++ b/core/interfaces/IPluginSys.h @@ -2,7 +2,7 @@ #define _INCLUDE_SOURCEMOD_PLUGINMNGR_INTERFACE_H_ #include -#include +#include #define SMINTERFACE_PLUGINMANAGER_NAME "IPluginManager" #define SMINTERFACE_PLUGINMANAGER_VERSION 1 @@ -27,6 +27,7 @@ namespace SourceMod enum PluginStatus { Plugin_Running=0, /* Plugin is running */ + Plugin_Loaded, /* Plugin is loaded but not initialized */ Plugin_Paused, /* Plugin is paused */ Plugin_Stopped, /* Plugin is paused for map changes, too */ Plugin_Error, /* Plugin has a blocking error */ @@ -46,59 +47,66 @@ namespace SourceMod /** * @brief Encapsulates a run-time plugin as maintained by SourceMod. */ - class IPlugin : public IUnloadableParent + class IPlugin /*: public IUnloadableParent*/ { public: - UnloadableParentType GetParentType() + /*UnloadableParentType GetParentType() { return ParentType_Module; - } + }*/ public: /** * @brief Returns the lifetime of a plugin. */ - virtual PluginLifetime GetLifetime() =0; + virtual PluginLifetime GetLifetime() const =0; /** * @brief Returns the current API context being used in the plugin. * * @return Pointer to an IPluginContext, or NULL if not loaded. */ - virtual SourcePawn::IPluginContext *GetBaseContext() =0; + virtual SourcePawn::IPluginContext *GetBaseContext() const =0; /** * @brief Returns the context structure being used in the plugin. * - * @brief Pointer to an sp_context_t, or NULL if not loaded. + * @return Pointer to an sp_context_t, or NULL if not loaded. */ - virtual sp_context_t *GetContext() =0; + virtual sp_context_t *GetContext() const =0; /** - * @brief Returns information about the plugin. + * @brief Returns the plugin file structure. * - * @brief Pointer to an sm_plugininfo_t, or NULL if not loaded. + * @return Pointer to an sp_plugin_t, or NULL if not loaded. */ - virtual sm_plugininfo_t *GetPublicInfo() =0; + virtual const sp_plugin_t *GetPluginStructure() const =0; + + /** + * @brief Returns information about the plugin by reference. + * + * @return Pointer to a sm_plugininfo_t object, NULL if plugin is not loaded. + */ + virtual const sm_plugininfo_t *GetPublicInfo() const =0; /** * @brief Returns the plugin filename (relative to plugins dir). */ - virtual const char *GetFilename() =0; + virtual const char *GetFilename() const =0; /** * @brief Returns true if a plugin is in debug mode, false otherwise. */ - virtual bool IsDebugging() =0; + virtual bool IsDebugging() const =0; /** * @brief Returns the plugin status. */ - virtual PluginStatus GetStatus() =0; + virtual PluginStatus GetStatus() const =0; /** * @brief Sets whether the plugin is paused or not. * - * @return True on successful pause, false otherwise. + * @return True on successful state change, false otherwise. */ virtual bool SetPauseState(bool paused) =0; @@ -110,12 +118,12 @@ namespace SourceMod /** * @brief Returns whether the plugin is locked from being updated on mapchange. */ - virtual bool GetLockForUpdates() =0; + virtual bool GetLockForUpdates() const =0; /** * @brief Returns the unique serial number of a plugin. */ - virtual unsigned int GetSerial() =0; + virtual unsigned int GetSerial() const =0; }; @@ -125,7 +133,7 @@ namespace SourceMod class IPluginIterator { public: - virtual void ~IPluginIterator() + virtual ~IPluginIterator() { }; public: diff --git a/core/msvc8/sourcemod_mm.vcproj b/core/msvc8/sourcemod_mm.vcproj index 53913af5..d402be95 100644 --- a/core/msvc8/sourcemod_mm.vcproj +++ b/core/msvc8/sourcemod_mm.vcproj @@ -255,6 +255,10 @@ RelativePath="..\systems\LibrarySys.h" > + + + + GetContext(); - IVirtualMachine *vm = ctx->GetVirtualMachine(); - - vm->FreeContext(_ctx); - delete ctx; } diff --git a/plugins/include/sourcemod.inc b/plugins/include/sourcemod.inc index 7791cd90..ab600e12 100644 --- a/plugins/include/sourcemod.inc +++ b/plugins/include/sourcemod.inc @@ -52,7 +52,7 @@ forward bool:OnPluginLoad(Handle:myself, bool:late, String:error[], err_max); * * @noreturn */ -forward OnPluginRequirements(); +forward OnCreatePlugin(); /** * Called when the plugin is about to be unloaded. diff --git a/plugins/test.sma b/plugins/test.sma index 8be4e022..2803c672 100644 --- a/plugins/test.sma +++ b/plugins/test.sma @@ -6,7 +6,7 @@ public Plugin:myinfo = author = "BAILOPAN", description = "Tests Stuff", version = "1.0.0.0", - url = "http://www.sourceomd.net/" + url = "http://www.sourcemod.net/" } public OnPluginInit() diff --git a/sourcepawn/include/sp_vm_api.h b/sourcepawn/include/sp_vm_api.h index 9a1ba692..1859324d 100644 --- a/sourcepawn/include/sp_vm_api.h +++ b/sourcepawn/include/sp_vm_api.h @@ -343,7 +343,7 @@ namespace SourcePawn virtual IPluginContext *CreateBaseContext(sp_context_t *ctx) =0; /** - * Frees a context. + * Frees a base context. Does not free the sp_context_t it holds. * * @param ctx Context pointer to free. */