dvander@370: /**
ds@653: * vim: set ts=4 :
ds@1330: * =============================================================================
dvander@1231: * SourceMod
ds@1947: * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
ds@1330: * =============================================================================
dvander@370: *
ds@1330: * This program is free software; you can redistribute it and/or modify it under
ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330: * Free Software Foundation.
dvander@1231: *
ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
ds@1330: * details.
dvander@1231: *
ds@1330: * You should have received a copy of the GNU General Public License along with
ds@1330: * this program. If not, see .
dvander@1231: *
ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in
ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants
ds@1330: * this exception to all derivative works. AlliedModders LLC defines further
ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330: * 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@1915: * @brief Called after all global classes have been started up
dvander@1915: */
dvander@1915: virtual void OnSourceModAllInitialized()
dvander@1915: {
dvander@1915: }
dvander@1915:
dvander@1915: /**
dvander@229: * @brief Called after all global classes have initialized
dvander@229: */
dvander@1915: virtual void OnSourceModAllInitialized_Post()
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: */
dvander@1581: virtual void OnSourceModVSPReceived()
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@2193: extern ISourcePawnEngine2 *g_pSourcePawn2;
dvander@252: extern IdentityToken_t *g_pCoreIdent;
dvander@160:
dvander@233: #include "sm_autonatives.h"
dvander@233:
dvander@160: #endif //_INCLUDE_SOURCEMOD_GLOBALS_H_