Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
PurchaseSettingsDefClass.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE_PURCHASESETTINGSDEFCLASS_H
13#define TT_INCLUDE_PURCHASESETTINGSDEFCLASS_H
14#include "Definition.h"
15#include "Engine_String.h"
16#ifndef TTLE_EXPORTS
17#include "TranslateDBClass.h"
18#endif
19#include "NetworkObjectClass.h"
20#include "ExtendedNetworkObject.h"
21#include "BuildingGameObjDef.h"
22using namespace BuildingConstants;
23#define PTTEAM(t) (t?0:1) //Convert a normal team into a PT team
24class PurchaseSettingsDefClass abstract : public DefinitionClass, public NetworkObjectClass {
25public:
26 enum TEAM {
27 TEAM_GDI,
28 TEAM_NOD,
29 TEAM_MUTANT_GDI,
30 TEAM_MUTANT_NOD,
31 };
32 enum TYPE {
33 TYPE_CLASSES,
34 TYPE_VEHICLES,
35 TYPE_EQUIPMENT,
36 TYPE_SECRET_CLASSES,
37 TYPE_SECRET_VEHICLES,
38 TYPE_AIR,
39 TYPE_NAVAL,
40 };
41 PurchaseSettingsDefClass();
42 ~PurchaseSettingsDefClass();
43 void setDirtyBitsForClient(const int clientId);
44 const PersistFactoryClass &Get_Factory() const;
45 bool Save(ChunkSaveClass &csave);
46 bool Load(ChunkLoadClass &cload);
47 void Load_Variables(ChunkLoadClass &cload);
48 uint32 Get_Class_ID() const;
49 PersistClass *Create() const;
50 static SCRIPTS_API PurchaseSettingsDefClass *Find_Definition(TYPE type,TEAM team);
51#ifdef DDBEDIT
52 virtual void Dump (FileClass &file);
53#endif
54 DECLARE_EDITABLE(PurchaseSettingsDefClass,DefinitionClass);
55 void Delete(void)
56 {
57 }
58 void Set_Delete_Pending()
59 {
60 }
61 unsigned int Get_Network_Class_ID () const { return 2004; }
62#ifndef TTLE_EXPORTS
63#ifndef DDBEDIT
64#ifndef W3DVIEWER
65 void Export_Occasional(BitStreamClass &packet);
66 void Import_Occasional(BitStreamClass &packet);
67#endif
68#endif
69 int Get_Definition(int index)
70 {
71 return presetids[index];
72 }
73 int Get_Cost(int index)
74 {
75 return costs[index];
76 }
77 const wchar_t *Get_Name(int index)
78 {
79 return TRANSLATE(stringids[index]);
80 }
81 const char *Get_Texture(int index)
82 {
83 return textures[index];
84 }
85 int Get_Alt_Definition(int index,int index2)
86 {
87 return altpresetids[index][index2];
88 }
89 const char *Get_Alt_Texture(int index,int index2)
90 {
91 return alttextures[index][index2];
92 }
93 int Get_String(int index)
94 {
95 return stringids[index];
96 }
97 TEAM Get_Team()
98 {
99 return team;
100 }
101 TYPE Get_Type()
102 {
103 return type;
104 }
105 int Get_Tech_Level(int index)
106 {
107 return TechLevel[index];
108 }
109 bool Get_Factory_Not_Required(int index)
110 {
111 return FactoryNotRequired[index];
112 }
113 BuildingType Get_Factory_Building(int index)
114 {
115 return Factory[index];
116 }
117 BuildingType Get_Tech_Building(int index)
118 {
119 return TechBuilding[index];
120 }
121 void Set_Tech_Level(int index,int level)
122 {
123 TechLevel[index] = level;
124 }
125 void Set_Factory_Building(int index,BuildingType type)
126 {
127 Factory[index] = type;
128 }
129 void Set_Tech_Building(int index,BuildingType type)
130 {
131 TechBuilding[index] = type;
132 }
133 bool Get_Hidden(int index)
134 {
135 return Hidden[index];
136 }
137 bool Get_Disabled(int index)
138 {
139 return Disabled[index];
140 }
141 bool Get_Busy(int index)
142 {
143 return Busy[index];
144 }
145 void Set_Hidden(int index, bool b)
146 {
147 Hidden[index] = b;
148 Set_Object_Dirty_Bit(BIT_OCCASIONAL,true);
149 }
150 void Set_Disabled(int index, bool b)
151 {
152 Disabled[index] = b;
153 Set_Object_Dirty_Bit(BIT_OCCASIONAL,true);
154 }
155 void Set_Busy(int index, bool b)
156 {
157 Busy[index] = b;
158 Set_Object_Dirty_Bit(BIT_OCCASIONAL,true);
159 }
160 bool Get_Page_Hidden()
161 {
162 return PageHidden;
163 }
164 void Set_Page_Hidden(bool b)
165 {
166 PageHidden = b;
167 Set_Object_Dirty_Bit(BIT_OCCASIONAL,true);
168 }
169 bool Get_Page_Disabled()
170 {
171 return PageDisabled;
172 }
173 void Set_Page_Disabled(bool b)
174 {
175 PageDisabled = b;
176 Set_Object_Dirty_Bit(BIT_OCCASIONAL,true);
177 }
178 bool Get_Page_Busy()
179 {
180 return PageBusy;
181 }
182 void Set_Page_Busy(bool b)
183 {
184 PageBusy = b;
185 Set_Object_Dirty_Bit(BIT_OCCASIONAL,true);
186 }
187 void Set_Definition(int index,int preset) {
188 presetids[index] = preset;
189 }
190 void Set_Alt_Definition(int index,int index2,int preset) {
191 altpresetids[index][index2] = preset;
192 }
193 void Set_Cost(int index,int cost) {
194 costs[index] = cost;
195 }
196#endif
197private:
198 TEAM team;
199 TYPE type;
200 int costs[10];
201 int presetids[10];
202 unsigned int stringids[10];
203 StringClass textures[10];
204 bool Hidden[10];
205 bool Disabled[10];
206 bool Busy[10];
207 int TechLevel[10];
208 BuildingType Factory[10];
209 BuildingType TechBuilding[10];
210 bool FactoryNotRequired[10];
211 int altpresetids[10][3];
212 StringClass alttextures[10][3];
213 bool PageHidden;
214 bool PageDisabled;
215 bool PageBusy;
216 static PurchaseSettingsDefClass *DefinitionArray[4][7];
217 friend class PresetDump;
218};
219
220IMPLEMENT_EXTENDED_NETWORK_OBJECT(PurchaseSettingsDefClass);
221
222#endif