Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
w3dexclusionlist.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/* $Header: /Commando/Code/ww3d2/w3dexclusionlist.cpp 1 12/12/02 3:36p Greg_h $ */
20/***********************************************************************************************
21 *** Confidential - Westwood Studios ***
22 ***********************************************************************************************
23 * *
24 * Project Name : Commando / G 3D Library *
25 * *
26 * $Archive:: /Commando/Code/ww3d2/w3dexclusionlist.cpp $*
27 * *
28 * Author:: Greg_h *
29 * *
30 * $Modtime:: 12/12/02 10:04a $*
31 * *
32 * $Revision:: 1 $*
33 * *
34 *---------------------------------------------------------------------------------------------*
35 * Functions: *
36 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
37
38
39#include "w3dexclusionlist.h"
40#include "proto.h"
41#include "htree.h"
42#include "hanim.h"
43
44
46 Names(names)
47{
48 for (int i=0; i<Names.Count(); i++) {
49 NameHash.Insert(Names[i],i);
50 }
51}
52
57
59{
60 StringClass copy = proto->Get_Name();
61 char * root_name = copy.Peek_Buffer();
62
63 // don't preserve munged prototypes
64 if (strchr(root_name,'#') != NULL) {
65 return false;
66 }
67
68 // chop off the sub-object name if present (
69 char * tmp = strchr(root_name,'.');
70 if (tmp != NULL) {
71 *tmp = 0;
72 }
73
74 return Is_Excluded(root_name);
75}
76
77
79{
80 // plain old name...
81 return Is_Excluded(htree->Get_Name());
82}
83
84
86{
87 // For HAnims, the name to check is the one trailing the '.'
88 StringClass copy = hanim->Get_Name();
89 char * root_name = copy.Peek_Buffer();
90
91 char * tmp = strchr(root_name,'.');
92 if (tmp) {
93 return Is_Excluded(tmp + 1);
94 } else {
95 return false; // should never happen...
96 }
97}
98
99
100bool W3DExclusionListClass::Is_Excluded(const char * root_name) const
101{
102 return NameHash.Exists(StringClass(root_name));
103}
104
105
#define NULL
Definition BaseType.h:92
virtual const char * Get_Name(void) const =0
WWINLINE const char * Get_Name(void) const
Definition htree.h:92
virtual const char * Get_Name(void) const =0
TCHAR * Peek_Buffer(void)
Definition wwstring.h:560
HashTemplateClass< StringClass, int > NameHash
const DynamicVectorClass< StringClass > & Names
bool Is_Excluded(PrototypeClass *proto) const
W3DExclusionListClass(const DynamicVectorClass< StringClass > &names)