1 /***************************************************************************
2  *      Mechanized Assault and Exploration Reloaded Projectfile            *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18  ***************************************************************************/
19 
20 #ifndef game_data_units_unitdataH
21 #define game_data_units_unitdataH
22 
23 #include <string>
24 #include <utility>
25 #include <vector>
26 
27 #include "main.h" // sID
28 #include "utility/signal/signal.h"
29 
30 // struct for vehicle properties
31 struct sUnitData
32 {
33 	sUnitData();
34 	sUnitData (const sUnitData& other);
35 
36 	sUnitData& operator= (const sUnitData& other);
37 
38 	// Main
39 	sID ID;
40 	std::string name;
41 	std::string description;
42 
43 	// Attack
44 	enum eMuzzleType
45 	{
46 		MUZZLE_TYPE_NONE,
47 		MUZZLE_TYPE_BIG,
48 		MUZZLE_TYPE_ROCKET,
49 		MUZZLE_TYPE_SMALL,
50 		MUZZLE_TYPE_MED,
51 		MUZZLE_TYPE_MED_LONG,
52 		MUZZLE_TYPE_ROCKET_CLUSTER,
53 		MUZZLE_TYPE_TORPEDO,
54 		MUZZLE_TYPE_SNIPER
55 	};
56 	eMuzzleType muzzleType;
57 
58 	char canAttack;
59 
60 	bool canDriveAndFire;
61 
62 	// Production
63 	int buildCosts;
64 	std::string canBuild;
65 	std::string buildAs;
66 
67 	int maxBuildFactor;
68 
69 	bool canBuildPath;
70 	bool canBuildRepeat;
71 
72 	float factorGround;
73 	float factorSea;
74 	float factorAir;
75 	float factorCoast;
76 
77 	// Abilities
78 	bool isBig;
79 	bool connectsToBase;
80 	float modifiesSpeed;
81 	bool canClearArea;
82 	bool canBeCaptured;
83 	bool canBeDisabled;
84 	bool canCapture;
85 	bool canDisable;
86 	bool canRepair;
87 	bool canRearm;
88 	bool canResearch;
89 	bool canPlaceMines;
90 	bool canSurvey;
91 	bool doesSelfRepair;
92 	int convertsGold;
93 	bool canSelfDestroy;
94 	bool canScore;
95 
96 	int canMineMaxRes;
97 
98 	int needsMetal;
99 	int needsOil;
100 	int needsEnergy;
101 	int needsHumans;
102 	int produceEnergy;
103 	int produceHumans;
104 
105 	char isStealthOn;
106 	char canDetectStealthOn;
107 
108 	enum eSurfacePosition
109 	{
110 		SURFACE_POS_BENEATH_SEA,
111 		SURFACE_POS_ABOVE_SEA,
112 		SURFACE_POS_BASE,
113 		SURFACE_POS_ABOVE_BASE,
114 		SURFACE_POS_GROUND,
115 		SURFACE_POS_ABOVE
116 	};
117 	eSurfacePosition surfacePosition;
118 
119 	enum eOverbuildType
120 	{
121 		OVERBUILD_TYPE_NO,
122 		OVERBUILD_TYPE_YES,
123 		OVERBUILD_TYPE_YESNREMOVE
124 	};
125 	eOverbuildType canBeOverbuild;
126 
127 	bool canBeLandedOn;
128 	bool canWork;
129 	bool explodesOnContact;
130 	bool isHuman;
131 
132 	// Storage
133 	int storageResMax;
134 	enum eStorageResType
135 	{
136 		STORE_RES_NONE,
137 		STORE_RES_METAL,
138 		STORE_RES_OIL,
139 		STORE_RES_GOLD
140 	};
141 	eStorageResType storeResType;
142 
143 	int storageUnitsMax;
144 	enum eStorageUnitsImageType
145 	{
146 		STORE_UNIT_IMG_NONE,
147 		STORE_UNIT_IMG_TANK,
148 		STORE_UNIT_IMG_PLANE,
149 		STORE_UNIT_IMG_SHIP,
150 		STORE_UNIT_IMG_HUMAN
151 	};
152 	eStorageUnitsImageType storeUnitsImageType;
153 	std::vector<std::string> storeUnitsTypes;
154 	std::string isStorageType;
155 
156 	// Graphic
157 	bool hasClanLogos;
158 	bool hasCorpse;
159 	bool hasDamageEffect;
160 	bool hasBetonUnderground;
161 	bool hasPlayerColor;
162 	bool hasOverlay;
163 
164 	bool buildUpGraphic;
165 	bool animationMovement;
166 	bool powerOnGraphic;
167 	bool isAnimated;
168 	bool makeTracks;
169 
170 	bool isConnectorGraphic;
171 	int hasFrames;
172 
173 	int getVersion() const;
174 	void setVersion (int value);
175 
176 	int getSpeed() const;
177 	void setSpeed (int value);
178 
179 	int getSpeedMax() const;
180 	void setSpeedMax (int value);
181 
182 	int getHitpoints() const;
183 	void setHitpoints (int value);
184 
185 	int getHitpointsMax() const;
186 	void setHitpointsMax (int value);
187 
188 	int getScan() const;
189 	void setScan (int value);
190 
191 	int getRange() const;
192 	void setRange (int value);
193 
194 	int getShots() const;
195 	void setShots (int value);
196 
197 	int getShotsMax() const;
198 	void setShotsMax (int value);
199 
200 	int getAmmo() const;
201 	void setAmmo (int value);
202 
203 	int getAmmoMax() const;
204 	void setAmmoMax (int value);
205 
206 	int getDamage() const;
207 	void setDamage (int value);
208 
209 	int getArmor() const;
210 	void setArmor (int value);
211 
212 	int getStoredResources() const;
213 	void setStoredResources (int value);
214 
215 	int getStoredUnits() const;
216 	void setStoredUnits (int value);
217 
218 	mutable cSignal<void ()> versionChanged;
219 	mutable cSignal<void ()> speedChanged;
220 	mutable cSignal<void ()> speedMaxChanged;
221 	mutable cSignal<void ()> hitpointsChanged;
222 	mutable cSignal<void ()> hitpointsMaxChanged;
223 	mutable cSignal<void ()> shotsChanged;
224 	mutable cSignal<void ()> shotsMaxChanged;
225 	mutable cSignal<void ()> ammoChanged;
226 	mutable cSignal<void ()> ammoMaxChanged;
227 	mutable cSignal<void ()> scanChanged;
228 	mutable cSignal<void ()> rangeChanged;
229 	mutable cSignal<void ()> damageChanged;
230 	mutable cSignal<void ()> armorChanged;
231 	mutable cSignal<void ()> storedResourcesChanged;
232 	mutable cSignal<void ()> storedUnitsChanged;
233 private:
234 	int version;
235 
236 	int speedCur;
237 	int speedMax;
238 
239 	int hitpointsCur;
240 	int hitpointsMax;
241 	int shotsCur;
242 	int shotsMax;
243 	int ammoCur;
244 	int ammoMax;
245 
246 	int range;
247 	int scan;
248 
249 	int damage;
250 	int armor;
251 
252 	int storageResCur;
253 	int storageUnitsCur;
254 };
255 
256 #endif // game_data_units_unitdataH
257