extensions/tf2/util.h
author Nicholas Hastings <skamonkey@gmail.com>
Thu Aug 29 09:27:35 2013 -0400 (2013-08-29)
changeset 4092 f184c016f489
parent 1987 0534b0a2ffda
permissions -rw-r--r--
Clean up TF2 ext CalcCritical code (bug 5894, r=voided).
pred@1963
     1
/**
pred@1963
     2
 * vim: set ts=4 :
pred@1963
     3
 * =============================================================================
pred@1963
     4
 * SourceMod Team Fortress 2 Extension
pred@1963
     5
 * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
pred@1963
     6
 * =============================================================================
pred@1963
     7
 *
pred@1963
     8
 * This program is free software; you can redistribute it and/or modify it under
pred@1963
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
pred@1963
    10
 * Free Software Foundation.
pred@1963
    11
 * 
pred@1963
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
pred@1963
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
pred@1963
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
pred@1963
    15
 * details.
pred@1963
    16
 *
pred@1963
    17
 * You should have received a copy of the GNU General Public License along with
pred@1963
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
pred@1963
    19
 *
pred@1963
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
pred@1963
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
pred@1963
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
pred@1963
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
pred@1963
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
pred@1963
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
pred@1963
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
pred@1963
    27
 * or <http://www.sourcemod.net/license.php>.
pred@1963
    28
 *
ds@1987
    29
 * Version: $Id$
pred@1963
    30
 */
pred@1963
    31
pred@1963
    32
#ifndef _INCLUDE_TF2TOOLS_UTIL_H_
pred@1963
    33
#define _INCLUDE_TF2TOOLS_UTIL_H_
pred@1963
    34
pred@1963
    35
#define REGISTER_NATIVE_ADDR(name, code) \
pred@1963
    36
	void *addr; \
pred@1963
    37
	if (!g_pGameConf->GetMemSig(name, &addr) || !addr) \
pred@1963
    38
	{ \
pred@1963
    39
		return pContext->ThrowNativeError("Failed to locate function"); \
pred@1963
    40
	} \
pred@1963
    41
	code; \
pred@1963
    42
	g_RegNatives.Register(pWrapper);
pred@1963
    43
pred@1963
    44
pred@1963
    45
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...);
pred@1963
    46
pred@1963
    47
bool UTIL_FindDataTable(SendTable *pTable, 
pred@1963
    48
						  const char *name,
pred@1963
    49
						  sm_sendprop_info_t *info,
pred@1963
    50
						  unsigned int offset);
pred@1963
    51
skamonkey@4092
    52
bool UTIL_ContainsDataTable(SendTable *pTable, const char *name);
skamonkey@4092
    53
pred@1963
    54
ServerClass *UTIL_FindServerClass(const char *classname);
pred@1963
    55
pred@1963
    56
CBaseEntity *UTIL_GetCBaseEntity(int num, bool onlyPlayers);
pred@1963
    57
pred@1963
    58
pred@1963
    59
#endif //_INCLUDE_TF2TOOLS_UTIL_H_