|
skamonkey@3767
|
1 |
/** |
|
skamonkey@3767
|
2 |
* vim: set ts=4 : |
|
skamonkey@3767
|
3 |
* ============================================================================= |
|
skamonkey@3767
|
4 |
* SourceMod Team Fortress 2 Extension |
|
skamonkey@3767
|
5 |
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. |
|
skamonkey@3767
|
6 |
* ============================================================================= |
|
skamonkey@3767
|
7 |
* |
|
skamonkey@3767
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
skamonkey@3767
|
9 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
skamonkey@3767
|
10 |
* Free Software Foundation. |
|
skamonkey@3767
|
11 |
* |
|
skamonkey@3767
|
12 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
skamonkey@3767
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
skamonkey@3767
|
14 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
skamonkey@3767
|
15 |
* details. |
|
skamonkey@3767
|
16 |
* |
|
skamonkey@3767
|
17 |
* You should have received a copy of the GNU General Public License along with |
|
skamonkey@3767
|
18 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
skamonkey@3767
|
19 |
* |
|
skamonkey@3767
|
20 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
skamonkey@3767
|
21 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
skamonkey@3767
|
22 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
skamonkey@3767
|
23 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
skamonkey@3767
|
24 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
skamonkey@3767
|
25 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
skamonkey@3767
|
26 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
skamonkey@3767
|
27 |
* or <http://www.sourcemod.net/license.php>. |
|
skamonkey@3767
|
28 |
* |
|
skamonkey@3767
|
29 |
* Version: $Id$ |
|
skamonkey@3767
|
30 |
*/ |
|
skamonkey@3767
|
31 |
|
|
skamonkey@3767
|
32 |
// ^ ripped from SM's TF2 Extension |
|
skamonkey@3767
|
33 |
|
|
skamonkey@3767
|
34 |
#include "extension.h" |
|
skamonkey@3767
|
35 |
#include "util.h" |
|
skamonkey@3767
|
36 |
|
|
skamonkey@4054
|
37 |
bool UTIL_ContainsDataTable(SendTable *pTable, const char *name) |
|
skamonkey@3767
|
38 |
{ |
|
skamonkey@4054
|
39 |
const char *pname = pTable->GetName(); |
|
skamonkey@3767
|
40 |
int props = pTable->GetNumProps(); |
|
skamonkey@3767
|
41 |
SendProp *prop; |
|
skamonkey@3767
|
42 |
SendTable *table; |
|
skamonkey@3767
|
43 |
|
|
skamonkey@4054
|
44 |
if (pname && strcmp(name, pname) == 0) |
|
skamonkey@4054
|
45 |
return true; |
|
skamonkey@4054
|
46 |
|
|
skamonkey@3767
|
47 |
for (int i=0; i<props; i++) |
|
skamonkey@3767
|
48 |
{ |
|
skamonkey@3767
|
49 |
prop = pTable->GetProp(i); |
|
skamonkey@3767
|
50 |
|
|
skamonkey@3767
|
51 |
if ((table = prop->GetDataTable()) != NULL) |
|
skamonkey@3767
|
52 |
{ |
|
skamonkey@3767
|
53 |
pname = table->GetName(); |
|
skamonkey@3767
|
54 |
if (pname && strcmp(name, pname) == 0) |
|
skamonkey@3767
|
55 |
{ |
|
skamonkey@3767
|
56 |
return true; |
|
skamonkey@3767
|
57 |
} |
|
skamonkey@3767
|
58 |
|
|
skamonkey@4054
|
59 |
if (UTIL_ContainsDataTable(table, name)) |
|
skamonkey@3767
|
60 |
{ |
|
skamonkey@3767
|
61 |
return true; |
|
skamonkey@3767
|
62 |
} |
|
skamonkey@3767
|
63 |
} |
|
skamonkey@3767
|
64 |
} |
|
skamonkey@3767
|
65 |
|
|
skamonkey@3767
|
66 |
return false; |
|
skamonkey@3767
|
67 |
} |