dvander@370: /**
ds@653: * vim: set ts=4 :
dvander@1231: * ================================================================
dvander@1231: * SourceMod
dvander@1231: * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
dvander@1231: * ================================================================
dvander@370: *
dvander@1231: * This program is free software; you can redistribute it and/or
dvander@1231: * modify it under the terms of the GNU General Public License,
dvander@1231: * version 3.0, as published by the Free Software Foundation.
dvander@1231: *
dvander@1231: * This program is distributed in the hope that it will be useful,
dvander@1231: * but WITHOUT ANY WARRANTY; without even the implied warranty of
dvander@1231: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dvander@1231: * GNU General Public License for more details.
dvander@1231: *
dvander@1231: * You should have received a copy of the GNU General Public License
dvander@1231: * along with this program. If not, see .
dvander@1231: *
dvander@1231: * As a special exception, AlliedModders LLC gives you permission to
dvander@1231: * link the code of this program (as well as its derivative works) to
dvander@1231: * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any
dvander@1231: * Game MODs that run on software by the Valve Corporation. You must
dvander@1231: * obey the GNU General Public License in all respects for all other
dvander@1231: * code used. Additionally, AlliedModders LLC grants this exception
dvander@1231: * to all derivative works. AlliedModders LLC defines further
dvander@1231: * exceptions, found in LICENSE.txt (as of this writing, version
dvander@1231: * JULY-31-2007), or .
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@1157: friend class CExtensionManager;
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@1157:
dvander@1157: /**
dvander@1157: * @brief Called when an identity is dropped (right now, extensions only)
dvander@1157: */
dvander@1157: virtual void OnSourceModIdentityDropped(IdentityToken_t *pToken)
dvander@1157: {
dvander@1157: }
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_