Added macro so that ConCommands created with the SDK's CON_COMMAND and CON_COMMAND_F macros can be properly registered and unregisterd
1 /* ======== SourceMM ========
2 * Copyright (C) 2004-2005 Metamod:Source Development Team
3 * No warranties of any kind
7 * Author(s): David "BAILOPAN" Anderson
8 * ============================
11 #ifndef _INCLUDE_CPLUGIN_H
12 #define _INCLUDE_CPLUGIN_H
15 * @brief Implementation of Plugin API and Management routines
21 #include "IPluginManager.h"
25 * History of plugin versions: (M=min, C=current)
26 * 1: Initial interface
27 * 2: Added GetLogTag()
28 * 3: Moved GetApiVersion() to top (2005-04-16)
29 * 4: Added AllPluginsLoaded() callback (2005-04-18)
30 * MC 5: Bumped version for SourceHook V4 (2005-05-01)
33 #define PLAPI_MIN_VERSION 5
38 * @brief Implements Plugin Manager API
40 class CPluginManager : public ISmmPluginManager
44 * @brief Internal structure for holding plugin data
64 PluginId Load(const char *file, PluginId source, bool &already, char *error, size_t maxlen);
65 bool Unload(PluginId id, bool force, char *error, size_t maxlen);
66 bool Pause(PluginId id, char *error, size_t maxlen);
67 bool Unpause(PluginId id, char *error, size_t maxlen);
70 bool Query(PluginId id, const char *&file, factories *&list, Pl_Status &status, PluginId &source);
73 * @brief Finds a plugin by Id
75 * @param id Id of plugin
76 * @return CPlugin on success, NULL otherwise
78 CPlugin *FindById(PluginId id);
81 * @brief Attempts to reload a failed plugin
83 * @param id Id of plugin
84 * @param error Error message buffer
85 * @param len Maximum length of buffer
86 * @return True on success, false otherwise
88 bool Retry(PluginId id, char *error, size_t len);
91 std::list<SourceMM::CPluginManager::CPlugin *>::iterator _begin();
92 std::list<SourceMM::CPluginManager::CPlugin *>::iterator _end();
94 //These are identical internal functions for the wrappers above.
95 CPlugin *_Load(const char *file, PluginId source, char *error, size_t maxlen);
96 bool _Unload(CPlugin *pl, bool force, char *error, size_t maxlen);
97 bool _Pause(CPlugin *pl, char *error, size_t maxlen);
98 bool _Unpause(CPlugin *pl, char *error, size_t maxlen);
101 std::list<CPlugin *> m_Plugins;
106 typedef std::list<SourceMM::CPluginManager::CPlugin *>::iterator PluginIter;
108 /** @brief Singleton for plugin manager */
109 extern SourceMM::CPluginManager g_PluginMngr;
111 #endif //_INCLUDE_CPLUGIN_H