dvander@370: /** ds@653: * vim: set ts=4 : dvander@370: * =============================================================== dvander@370: * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved. dvander@370: * =============================================================== dvander@370: * dvander@370: * This file is not open source and may not be copied without explicit dvander@370: * written permission of AlliedModders LLC. This file may not be redistributed dvander@370: * in whole or significant part. dvander@370: * For information, see LICENSE.txt or http://www.sourcemod.net/license.php dvander@370: * dvander@370: * Version: $Id$ dvander@370: */ dvander@370: dvander@160: #ifndef _INCLUDE_SOURCEMOD_GLOBALS_H_ dvander@160: #define _INCLUDE_SOURCEMOD_GLOBALS_H_ dvander@160: dvander@162: /** dvander@162: * @file Contains global headers that most files in SourceMod will need. dvander@162: */ dvander@162: dvander@160: #include dvander@160: #include dvander@160: #include "sm_platform.h" dvander@324: #include dvander@160: dvander@160: using namespace SourcePawn; dvander@160: using namespace SourceMod; dvander@160: ds@675: class IServerPluginCallbacks; ds@675: ds@661: /** ds@669: * @brief Lists result codes possible from attempting to set a core configuration option. dvander@663: */ dvander@663: enum ConfigResult ds@661: { ds@669: ConfigResult_Accept = 0, /**< Config option was successfully set */ ds@669: ConfigResult_Reject = 1, /**< Config option was given an invalid value and was rejected */ ds@669: ConfigResult_Ignore = 2 /**< Config option was invalid, but ignored */ dvander@663: }; dvander@663: ds@669: /** ds@669: * @brief Lists possible sources of a config option change ds@669: */ dvander@663: enum ConfigSource dvander@663: { ds@669: ConfigSource_File = 0, /**< Config option was set from config file (core.cfg) */ ds@669: ConfigSource_Console = 1, /**< Config option was set from console command (sm config) */ ds@661: }; ds@661: dvander@229: /** dvander@229: * @brief Any class deriving from this will be automatically initiated/shutdown by SourceMod dvander@229: */ dvander@229: class SMGlobalClass dvander@229: { ds@675: friend class SourceMod_Core; dvander@229: friend class SourceModBase; ds@661: friend class CoreConfig; dvander@229: public: dvander@229: SMGlobalClass(); dvander@229: public: dvander@229: /** dvander@229: * @brief Called when SourceMod is initially loading dvander@229: */ dvander@229: virtual void OnSourceModStartup(bool late) dvander@229: { dvander@229: } dvander@229: dvander@229: /** dvander@229: * @brief Called after all global classes have initialized dvander@229: */ dvander@229: virtual void OnSourceModAllInitialized() dvander@229: { dvander@229: } dvander@229: dvander@229: /** dvander@229: * @brief Called when SourceMod is shutting down dvander@229: */ dvander@229: virtual void OnSourceModShutdown() dvander@229: { dvander@229: } faluco@281: faluco@281: /** ds@661: * @brief Called after SourceMod is completely shut down ds@661: */ faluco@281: virtual void OnSourceModAllShutdown() faluco@281: { faluco@281: } ds@661: ds@661: /** ds@661: * @brief Called when a core config option is changed. ds@661: * @note This is called once BEFORE OnSourceModStartup() when SourceMod is loading ds@661: * @note It can then be called again when the 'sm config' command is used ds@661: */ dvander@663: virtual ConfigResult OnSourceModConfigChanged(const char *key, dvander@663: const char *value, dvander@663: ConfigSource source, dvander@663: char *error, dvander@663: size_t maxlength) ds@661: { dvander@663: return ConfigResult_Ignore; ds@661: } dvander@673: dvander@673: /** dvander@673: * @brief Called when the level changes. dvander@673: */ dvander@673: virtual void OnSourceModLevelChange(const char *mapName) dvander@673: { dvander@673: } dvander@673: dvander@673: /** dvander@916: * @brief Called when the level ends. dvander@916: */ dvander@916: virtual void OnSourceModLevelEnd() dvander@916: { dvander@916: } dvander@916: dvander@916: /** dvander@673: * @brief Called after plugins are loaded on mapchange. dvander@673: */ dvander@673: virtual void OnSourceModPluginsLoaded() dvander@673: { dvander@673: } ds@675: ds@675: /** ds@675: * @brief Called when SourceMod receives a pointer to IServerPluginCallbacks from SourceMM ds@675: */ ds@675: virtual void OnSourceModVSPReceived(IServerPluginCallbacks *iface) ds@675: { ds@675: } dvander@893: dvander@893: /** dvander@893: * @brief Called once all MM:S plugins are loaded. dvander@893: */ dvander@893: virtual void OnSourceModGameInitialized() dvander@893: { dvander@893: } dvander@229: private: dvander@229: SMGlobalClass *m_pGlobalClassNext; dvander@229: static SMGlobalClass *head; dvander@229: }; dvander@229: dvander@160: extern ISourcePawnEngine *g_pSourcePawn; dvander@160: extern IVirtualMachine *g_pVM; dvander@252: extern IdentityToken_t *g_pCoreIdent; dvander@160: dvander@233: #include "sm_autonatives.h" dvander@233: dvander@160: #endif //_INCLUDE_SOURCEMOD_GLOBALS_H_