core/sourcemod.h
author Borja Ferrer <faluco@alliedmods.net>
Tue Jan 30 18:04:53 2007 +0000 (2007-01-30)
changeset 422 5ef0f5610c2a
parent 370 d3a484f98f6d
child 448 25984ddd0ce0
permissions -rw-r--r--
finalized translation routines and formatting
     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 
    69 public: //ISourceMod
    70 	const char *GetModPath();
    71 	const char *GetSourceModPath();
    72 	size_t BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...);
    73 	void LogMessage(IExtension *pExt, const char *format, ...);
    74 	void LogError(IExtension *pExt, const char *format, ...);
    75 	size_t FormatString(char *buffer, size_t maxlength, IPluginContext *pContext, const cell_t *params, unsigned int param);
    76 private:
    77 	/**
    78 	 * @brief Loading plugins
    79 	 */
    80 	void DoGlobalPluginLoads();
    81 private:
    82 	char m_SMBaseDir[PLATFORM_MAX_PATH+1];
    83 	char m_SMRelDir[PLATFORM_MAX_PATH+1];
    84 	bool m_IsMapLoading;
    85 	bool m_ExecPluginReload;
    86 	unsigned int m_target;
    87 };
    88 
    89 extern SourceModBase g_SourceMod;
    90 
    91 #endif //_INCLUDE_SOURCEMOD_GLOBALHEADER_H_