sourcemod/core/sm_globals.h

102 lines
2.6 KiB
C
Raw Normal View History

/**
* vim: set ts=4 :
* ===============================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* ===============================================================
*
* This file is not open source and may not be copied without explicit
* written permission of AlliedModders LLC. This file may not be redistributed
* in whole or significant part.
* For information, see LICENSE.txt or http://www.sourcemod.net/license.php
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_GLOBALS_H_
#define _INCLUDE_SOURCEMOD_GLOBALS_H_
/**
* @file Contains global headers that most files in SourceMod will need.
*/
#include <sp_vm_types.h>
#include <sp_vm_api.h>
#include "sm_platform.h"
#include <IShareSys.h>
using namespace SourcePawn;
using namespace SourceMod;
/**
* @brief Lists error codes possible from attempting to set a core configuration option.
*/
enum CoreConfigErr
{
CoreConfig_Okay = 0, /**< No error */
CoreConfig_NoRuntime = 1, /**< Cannot set config option while SourceMod is running */
CoreConfig_InvalidValue = 2, /**< Invalid value specified for config option */
CoreConfig_InvalidOption = 3, /**< Invalid config option specified */
/* -------------------- */
CoreConfig_TOTAL /**< Total number of core config error codes */
};
/**
* @brief Any class deriving from this will be automatically initiated/shutdown by SourceMod
*/
class SMGlobalClass
{
friend class SourceModBase;
friend class CoreConfig;
public:
SMGlobalClass();
public:
/**
* @brief Called when SourceMod is initially loading
*/
virtual void OnSourceModStartup(bool late)
{
}
/**
* @brief Called after all global classes have initialized
*/
virtual void OnSourceModAllInitialized()
{
}
/**
* @brief Called when SourceMod is shutting down
*/
virtual void OnSourceModShutdown()
{
}
/**
* @brief Called after SourceMod is completely shut down
*/
virtual void OnSourceModAllShutdown()
{
}
/**
* @brief Called when a core config option is changed.
* @note This is called once BEFORE OnSourceModStartup() when SourceMod is loading
* @note It can then be called again when the 'sm config' command is used
*/
virtual CoreConfigErr OnSourceModConfigChanged(const char *option, const char *value)
{
return CoreConfig_InvalidOption;
}
private:
SMGlobalClass *m_pGlobalClassNext;
static SMGlobalClass *head;
};
extern ISourcePawnEngine *g_pSourcePawn;
extern IVirtualMachine *g_pVM;
extern IdentityToken_t *g_pCoreIdent;
#include "sm_autonatives.h"
#endif //_INCLUDE_SOURCEMOD_GLOBALS_H_