core/sourcemod.h
author Scott Ehlert <ds@alliedmods.net>
Thu Feb 08 21:41:28 2007 +0000 (2007-02-08)
changeset 457 9b8a85bf4175
parent 448 25984ddd0ce0
child 484 d254e257cac2
permissions -rw-r--r--
Initial import of convar stuff
1) Natives to create, find, set, and get convars
2) "cvars" option added to sm menu
3) Some internal additions to CPlugin to store a convar list
Still some things left to do...
     1 /**
     2  * ===============================================================
     3  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     4  * ===============================================================
     5  *
     6  * This file is not open source and may not be copied without explicit
     7  * written permission of AlliedModders LLC.  This file may not be redistributed 
     8  * in whole or significant part.
     9  * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
    10  *
    11  * Version: $Id$
    12  */
    13 
    14 #ifndef _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
    15 #define _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
    16 
    17 #include "sm_globals.h"
    18 #include <ISourceMod.h>
    19 
    20 /**
    21  * @brief Implements SourceMod's global overall management, API, and logic
    22  */
    23 
    24 class SourceModBase : public ISourceMod
    25 {
    26 public:
    27 	SourceModBase();
    28 public:
    29 	/**
    30 	 * @brief Initializes SourceMod, or returns an error on failure.
    31 	 */
    32 	bool InitializeSourceMod(char *error, size_t err_max, bool late);
    33 
    34 	/** 
    35 	 * @brief Starts everything SourceMod needs to run
    36 	 */
    37 	void StartSourceMod(bool late);
    38 
    39 	/** 
    40 	 * @brief Shuts down all SourceMod components
    41 	 */
    42 	void CloseSourceMod();
    43 
    44 	/**
    45 	 * @brief Map change hook
    46 	 */
    47 	bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
    48 
    49 	/**
    50 	 * @brief Level shutdown hook
    51 	 */
    52 	void LevelShutdown();
    53 
    54 	/** 
    55 	 * @brief Returns whether or not a mapload is in progress
    56 	 */
    57 	bool IsMapLoading();
    58 
    59 	/** 
    60 	 * @brief Stores the global target index.
    61 	 */
    62 	void SetGlobalTarget(unsigned int index);
    63 
    64 	/** 
    65 	 * @brief Returns the global target index.
    66 	 */
    67 	unsigned int GetGlobalTarget() const;
    68 public: //ISourceMod
    69 	const char *GetModPath();
    70 	const char *GetSourceModPath();
    71 	size_t BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...);
    72 	void LogMessage(IExtension *pExt, const char *format, ...);
    73 	void LogError(IExtension *pExt, const char *format, ...);
    74 	size_t FormatString(char *buffer, size_t maxlength, IPluginContext *pContext, const cell_t *params, unsigned int param);
    75 	void SetAuthChecking(bool set);
    76 private:
    77 	/**
    78 	 * @brief Loading plugins
    79 	 */
    80 	void DoGlobalPluginLoads();
    81 	void GameFrame(bool simulating);
    82 private:
    83 	char m_SMBaseDir[PLATFORM_MAX_PATH+1];
    84 	char m_SMRelDir[PLATFORM_MAX_PATH+1];
    85 	bool m_IsMapLoading;
    86 	bool m_ExecPluginReload;
    87 	unsigned int m_target;
    88 	bool m_CheckingAuth;
    89 };
    90 
    91 extern SourceModBase g_SourceMod;
    92 
    93 #endif //_INCLUDE_SOURCEMOD_GLOBALHEADER_H_