public/IGameHelpers.h
author David Anderson <dvander@alliedmods.net>
Sun Jun 17 05:08:26 2007 +0000 (2007-06-17)
changeset 966 7152bf978703
parent 965 327edbb1357a
child 1132 e8d4e82e9541
permissions -rw-r--r--
gcc is a pus packed pusillanimous pond of pickled plop
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC. 
     5  * All rights reserved.
     6  * ===============================================================
     7  *
     8  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be 
     9  * used or modified under the Terms and Conditions of its License Agreement, 
    10  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative 
    11  * works must be licensed under the GNU General Public License (version 2 or 
    12  * greater).  A copy of the GPL is included under public/licenses/GPL.txt.
    13  * 
    14  * To view the latest information, see: http://www.sourcemod.net/license.php
    15  *
    16  * Version: $Id$
    17  */
    18 
    19 #ifndef _INCLUDE_SOURCEMOD_GAMEHELPERS_H_
    20 #define _INCLUDE_SOURCEMOD_GAMEHELPERS_H_
    21 
    22 #include <IShareSys.h>
    23 #include <dt_send.h>
    24 #include <server_class.h>
    25 #include <datamap.h>
    26 #include <edict.h>
    27 
    28 #define SMINTERFACE_GAMEHELPERS_NAME		"IGameHelpers"
    29 #define SMINTERFACE_GAMEHELPERS_VERSION		1
    30 
    31 /**
    32  * @file IGameHelpers.h
    33  * @brief Provides Source helper functions.
    34  */
    35 
    36 namespace SourceMod
    37 {
    38 	class IGameHelpers : public SMInterface
    39 	{
    40 	public:
    41 		virtual const char *GetInterfaceName()
    42 		{
    43 			return SMINTERFACE_GAMEHELPERS_NAME;
    44 		}
    45 		virtual unsigned int GetInterfaceVersion()
    46 		{
    47 			return SMINTERFACE_GAMEHELPERS_VERSION;
    48 		}
    49 	public:
    50 		/**
    51 		 * @brief Finds a send property in a named send table.
    52 		 *
    53 		 * @param classname		Top-level sendtable name.
    54 		 * @param offset		Property name.
    55 		 * @return				SendProp pointer on success, NULL on failure.
    56 		 */
    57 		virtual SendProp *FindInSendTable(const char *classname, const char *offset) =0;
    58 
    59 		/**
    60 		 * @brief Finds a named server class.
    61 		 *
    62 		 * @return				ServerClass pointer on success, NULL on failure.
    63 		 */
    64 		virtual ServerClass *FindServerClass(const char *classname) =0;
    65 
    66 		/**
    67 		 * @brief Finds a datamap_t definition.
    68 		 *
    69 		 * @param pMap			datamap_t pointer.
    70 		 * @param offset		Property name.
    71 		 * @return				typedescription_t pointer on success, NULL 
    72 		 *						on failure.
    73 		 */
    74 		virtual typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset) =0;
    75 
    76 		/**
    77 		 * @brief Retrieves an entity's datamap_t pointer.
    78 		 *
    79 		 * @param pEntity		CBaseEntity entity.
    80 		 * @return				datamap_t pointer, or NULL on failure.
    81 		 */
    82 		virtual datamap_t *GetDataMap(CBaseEntity *pEntity) =0;
    83 
    84 		/**
    85 		 * @brief Marks an edict as state changed for an offset.
    86 		 *
    87 		 * @param pEdict		Edict pointer.
    88 		 * @param offset		Offset index.
    89 		 */
    90 		virtual void SetEdictStateChanged(edict_t *pEdict, unsigned short offset) =0;
    91 
    92 		/**
    93 		 * @brief Sends a text message to a client.
    94 		 *
    95 		 * @param client		Client index.
    96 		 * @param dest			Destination on the HUD.
    97 		 * @param msg			Message to send.
    98 		 */
    99 		virtual void TextMsg(int client, int dest, const char *msg) =0;
   100 	};
   101 }
   102 
   103 #endif //_INCLUDE_SOURCEMOD_GAMEHELPERS_H_