From 091d958b0c22e1bfd88144b4cda0c7ca00f4cf28 Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 28 Mar 2012 18:11:06 +0000 Subject: Got rid of sPluginManagerState /pluginlist now also shows the number of active plugins Fixed crash caused by lingering bound Lua commands http://forum.mc-server.org/showthread.php?tid=212&pid=2541#pid2541 Added error messages when binding commands to an invalid plugin git-svn-id: http://mc-server.googlecode.com/svn/trunk@440 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPluginManager.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source/cPluginManager.h') diff --git a/source/cPluginManager.h b/source/cPluginManager.h index b42db94d6..d2099ebd7 100644 --- a/source/cPluginManager.h +++ b/source/cPluginManager.h @@ -32,8 +32,8 @@ public: //tolua_export static cPluginManager * GetPluginManager(); //tolua_export typedef std::list< cPlugin* > PluginList; - cPlugin* GetPlugin( const char* a_Plugin ); //tolua_export - const PluginList & GetAllPlugins(); // >> EXPORTED IN MANUALBINDINGS << + cPlugin* GetPlugin( const char* a_Plugin ) const; //tolua_export + const PluginList & GetAllPlugins() const; // >> EXPORTED IN MANUALBINDINGS << void ReloadPlugins(); //tolua_export bool AddPlugin( cPlugin* a_Plugin ); @@ -41,7 +41,7 @@ public: //tolua_export bool AddLuaPlugin( cPlugin_Lua* a_Plugin ); void AddHook( cPlugin* a_Plugin, PluginHook a_Hook ); //tolua_export - unsigned int GetNumPlugins(); //tolua_export + unsigned int GetNumPlugins() const; //tolua_export bool CallHook( PluginHook a_Hook, unsigned int a_NumArgs, ... ); @@ -50,14 +50,20 @@ public: //tolua_export void RemoveLuaPlugin( std::string a_FileName ); //tolua_export cPlugin_Lua* GetLuaPlugin( lua_State* a_State ); //tolua_export - cLuaCommandBinder* GetLuaCommandBinder() { return m_LuaCommandBinder; } + cLuaCommandBinder* GetLuaCommandBinder() const { return m_LuaCommandBinder; } + + bool HasPlugin( cPlugin* a_Plugin ) const; private: friend class cRoot; cPluginManager(); ~cPluginManager(); - struct sPluginManagerState; - sPluginManagerState* m_pState; + typedef std::list< cPlugin_Lua* > LuaPluginList; + typedef std::map< cPluginManager::PluginHook, cPluginManager::PluginList > HookMap; + + LuaPluginList m_LuaPlugins; + PluginList m_Plugins; + HookMap m_Hooks; void ReloadPluginsNow(); void UnloadPluginsNow(); -- cgit v1.2.3