Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/unittype.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
unittype.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__UNITTYPE_H
14#define FC__UNITTYPE_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "bitvector.h"
22#include "shared.h"
23
24/* common */
25#include "fc_types.h"
26#include "name_translation.h"
27#include "requirements.h"
28
29struct astring; /* Actually defined in "utility/astring.h". */
30struct strvec; /* Actually defined in "utility/string_vector.h". */
31
32struct ai_type;
33struct civ_map;
34
35/* U_LAST is a value which is guaranteed to be larger than all
36 * actual Unit_type_id values. It is used as a flag value;
37 * it can also be used for fixed allocations to ensure able
38 * to hold full number of unit types.
39 * Used in the network protocol. */
40#define U_LAST MAX_NUM_UNITS
41
42 BV_DEFINE(bv_utypes, U_LAST);
43
44/* The largest distance a ruleset can allow a unit to paradrop.
45 *
46 * Remember to make sure that the field type of PACKET_RULESET_UNIT's
47 * paratroopers_range field can transfer the new maximum if you increase
48 * it.
49 *
50 * The top value is reserved in case a future Freeciv version wants to
51 * implement "no maximum range". It could be used to signal that the unit
52 * can paradrop anywhere. Note that the value below it is high enough to
53 * give the same effect on all maps inside the current size limits.
54 * (No map side can be larger than MAP_MAX_LINEAR_SIZE)
55 */
56#define UNIT_MAX_PARADROP_RANGE (65535 - 1)
57
58/* Used in the network protocol. */
59#define SPECENUM_NAME unit_class_flag_id
60#define SPECENUM_VALUE0 UCF_TERRAIN_SPEED
61#define SPECENUM_VALUE0NAME N_("?uclassflag:TerrainSpeed")
62#define SPECENUM_VALUE1 UCF_TERRAIN_DEFENSE
63#define SPECENUM_VALUE1NAME N_("?uclassflag:TerrainDefense")
64#define SPECENUM_VALUE2 UCF_DAMAGE_SLOWS
65#define SPECENUM_VALUE2NAME N_("?uclassflag:DamageSlows")
66/* Can occupy enemy cities */
67#define SPECENUM_VALUE3 UCF_CAN_OCCUPY_CITY
68#define SPECENUM_VALUE3NAME N_("?uclassflag:CanOccupyCity")
69#define SPECENUM_VALUE4 UCF_BUILD_ANYWHERE
70#define SPECENUM_VALUE4NAME N_("?uclassflag:BuildAnywhere")
71#define SPECENUM_VALUE5 UCF_UNREACHABLE
72#define SPECENUM_VALUE5NAME N_("?uclassflag:Unreachable")
73/* Can collect ransom from barbarian leader */
74#define SPECENUM_VALUE6 UCF_COLLECT_RANSOM
75#define SPECENUM_VALUE6NAME N_("?uclassflag:CollectRansom")
76/* Is subject to ZOC */
77#define SPECENUM_VALUE7 UCF_ZOC
78#define SPECENUM_VALUE7NAME N_("?uclassflag:ZOC")
79/* Cities can still work tile when enemy unit on it */
80#define SPECENUM_VALUE8 UCF_DOESNT_OCCUPY_TILE
81#define SPECENUM_VALUE8NAME N_("?uclassflag:DoesntOccupyTile")
82/* Can attack against units on non-native tiles */
83#define SPECENUM_VALUE9 UCF_ATTACK_NON_NATIVE
84#define SPECENUM_VALUE9NAME N_("?uclassflag:AttackNonNative")
85/* Kills citizens upon successful attack against a city */
86#define SPECENUM_VALUE10 UCF_KILLCITIZEN
87#define SPECENUM_VALUE10NAME N_("?uclassflag:KillCitizen")
88/* Frightens the huts it pops. */
89#define SPECENUM_VALUE11 UCF_HUT_FRIGHTEN
90#define SPECENUM_VALUE11NAME N_("?uclassflag:HutFrighten")
91/* Is a target for "Land Bombardment" attacks */
92#define SPECENUM_VALUE12 UCF_NONNAT_BOMBARD_TGT
93#define SPECENUM_VALUE12NAME N_("?uclassflag:NonNatBombardTgt")
94
95#define SPECENUM_VALUE13 UCF_USER_FLAG_1
96#define SPECENUM_VALUE14 UCF_USER_FLAG_2
97#define SPECENUM_VALUE15 UCF_USER_FLAG_3
98#define SPECENUM_VALUE16 UCF_USER_FLAG_4
99#define SPECENUM_VALUE17 UCF_USER_FLAG_5
100#define SPECENUM_VALUE18 UCF_USER_FLAG_6
101#define SPECENUM_VALUE19 UCF_USER_FLAG_7
102#define SPECENUM_VALUE20 UCF_USER_FLAG_8
103#define SPECENUM_VALUE21 UCF_USER_FLAG_9
104#define SPECENUM_VALUE22 UCF_USER_FLAG_10
105#define SPECENUM_VALUE23 UCF_USER_FLAG_11
106#define SPECENUM_VALUE24 UCF_USER_FLAG_12
107#define SPECENUM_VALUE25 UCF_USER_FLAG_13
108#define SPECENUM_VALUE26 UCF_USER_FLAG_14
109#define SPECENUM_VALUE27 UCF_USER_FLAG_15
110#define SPECENUM_VALUE28 UCF_USER_FLAG_16
111#define SPECENUM_VALUE29 UCF_USER_FLAG_17
112#define SPECENUM_VALUE30 UCF_USER_FLAG_18
113#define SPECENUM_VALUE31 UCF_USER_FLAG_19
114#define SPECENUM_VALUE32 UCF_USER_FLAG_20
115#define SPECENUM_VALUE33 UCF_USER_FLAG_21
116#define SPECENUM_VALUE34 UCF_USER_FLAG_22
117#define SPECENUM_VALUE35 UCF_USER_FLAG_23
118#define SPECENUM_VALUE36 UCF_USER_FLAG_24
119#define SPECENUM_VALUE37 UCF_USER_FLAG_25
120
121/* Keep this last */
122#define SPECENUM_COUNT UCF_COUNT
123#define SPECENUM_NAMEOVERRIDE
124#define SPECENUM_BITVECTOR bv_unit_class_flags
125#include "specenum_gen.h"
126
127#define UCF_LAST_USER_FLAG UCF_USER_FLAG_25
128#define MAX_NUM_USER_UCLASS_FLAGS (UCF_LAST_USER_FLAG \
129 - UCF_USER_FLAG_1 + 1)
130
131/* Used in savegame processing and clients. */
132#define SPECENUM_NAME unit_move_type
133#define SPECENUM_VALUE0 UMT_LAND
134#define SPECENUM_VALUE0NAME "Land"
135#define SPECENUM_VALUE1 UMT_SEA
136#define SPECENUM_VALUE1NAME "Sea"
137#define SPECENUM_VALUE2 UMT_BOTH
138#define SPECENUM_VALUE2NAME "Both"
139#include "specenum_gen.h"
140
141/* Used in the network protocol. */
142 BV_DEFINE(bv_unit_classes, UCL_LAST);
143
144 enum move_level { MOVE_NONE, MOVE_PARTIAL, MOVE_FULL };
145
146struct extra_type_list;
147struct unit_class_list;
148
149 struct unit_class {
150 Unit_Class_id item_number;
151 struct name_translation name;
152 bool ruledit_disabled;
153 enum unit_move_type move_type;
154 int min_speed; /* Minimum speed after damage and effects */
155 int hp_loss_pct; /* Percentage of hitpoints lost each turn not in city or airbase */
156 int non_native_def_pct;
157 bv_unit_class_flags flags;
158
159 struct strvec *helptext;
160
161 struct {
162 enum move_level land_move;
163 enum move_level sea_move;
164 int ferry_types;
165 } adv;
166
167 struct {
168 struct extra_type_list *refuel_extras;
169 struct extra_type_list *native_tile_extras;
170 struct extra_type_list *native_bases;
171 struct extra_type_list *bonus_roads;
172 struct extra_type_list *hiding_extras;
173 struct unit_class_list *subset_movers;
174 } cache;
175};
176
177/* Unit "special effects" flags:
178 * Note this is now an enumerated type, and not power-of-two integers
179 * for bits, though unit_type.flags is still a bitfield, and code
180 * which uses unit_has_type_flag() without twiddling bits is unchanged.
181 * (It is easier to go from i to (1<<i) than the reverse.)
182 * See data/classic/units.ruleset for documentation of their effects.
183 * Change the array *flag_names[] in unittype.c accordingly.
184 * Used in the network protocol.
185 */
186#define SPECENUM_NAME unit_type_flag_id
187/* Unit has no ZOC */
188#define SPECENUM_VALUE0 UTYF_NOZOC
189#define SPECENUM_VALUE0NAME N_("?unitflag:HasNoZOC")
190#define SPECENUM_VALUE1 UTYF_IGZOC
191/* TRANS: unit type flag (rarely shown): "ignore zones of control" */
192#define SPECENUM_VALUE1NAME N_("?unitflag:IgZOC")
193#define SPECENUM_VALUE2 UTYF_CIVILIAN
194#define SPECENUM_VALUE2NAME N_("?unitflag:NonMil")
195#define SPECENUM_VALUE3 UTYF_IGTER
196/* TRANS: unit type flag (rarely shown): "ignore terrain" */
197#define SPECENUM_VALUE3NAME N_("?unitflag:IgTer")
198#define SPECENUM_VALUE4 UTYF_FIELDUNIT
199#define SPECENUM_VALUE4NAME N_("?unitflag:FieldUnit")
200/* autoattack: a unit will choose to attack this unit even if defending
201 * against it has better odds. */
202#define SPECENUM_VALUE5 UTYF_PROVOKING
203#define SPECENUM_VALUE5NAME N_("?unitflag:Provoking")
204/* Overrides unreachable_protects server setting */
205#define SPECENUM_VALUE6 UTYF_NEVER_PROTECTS
206#define SPECENUM_VALUE6NAME N_("?unitflag:NeverProtects")
207/* Does not include ability to found cities */
208#define SPECENUM_VALUE7 UTYF_SETTLERS
209#define SPECENUM_VALUE7NAME N_("?unitflag:Settlers")
210#define SPECENUM_VALUE8 UTYF_DIPLOMAT
211#define SPECENUM_VALUE8NAME N_("?unitflag:Diplomat")
212/* Can't leave the coast */
213#define SPECENUM_VALUE9 UTYF_COAST_STRICT
214#define SPECENUM_VALUE9NAME N_("?unitflag:CoastStrict")
215/* Can 'refuel' at coast - meaningless if fuel value not set */
216#define SPECENUM_VALUE10 UTYF_COAST
217#define SPECENUM_VALUE10NAME N_("?unitflag:Coast")
218/* upkeep can switch from shield to gold */
219#define SPECENUM_VALUE11 UTYF_SHIELD2GOLD
220#define SPECENUM_VALUE11NAME N_("?unitflag:Shield2Gold")
221/* Strong in diplomatic battles. */
222#define SPECENUM_VALUE12 UTYF_SPY
223#define SPECENUM_VALUE12NAME N_("?unitflag:Spy")
224/* Cannot attack vs non-native tiles even if class can */
225#define SPECENUM_VALUE13 UTYF_ONLY_NATIVE_ATTACK
226#define SPECENUM_VALUE13NAME N_("?unitflag:Only_Native_Attack")
227/* Only Fundamentalist government can build these units */
228#define SPECENUM_VALUE14 UTYF_FANATIC
229#define SPECENUM_VALUE14NAME N_("?unitflag:Fanatic")
230/* Losing this unit means losing the game */
231#define SPECENUM_VALUE15 UTYF_GAMELOSS
232#define SPECENUM_VALUE15NAME N_("?unitflag:GameLoss")
233/* A player can only have one unit of this type */
234#define SPECENUM_VALUE16 UTYF_UNIQUE
235#define SPECENUM_VALUE16NAME N_("?unitflag:Unique")
236/* When a transport containing this unit disappears the game will try to
237 * rescue units with this flag before it tries to rescue units without
238 * it. */
239#define SPECENUM_VALUE17 UTYF_EVAC_FIRST
240#define SPECENUM_VALUE17NAME N_("?unitflag:EvacuateFirst")
241/* Always wins diplomatic contests */
242#define SPECENUM_VALUE18 UTYF_SUPERSPY
243#define SPECENUM_VALUE18NAME N_("?unitflag:SuperSpy")
244/* Has no homecity */
245#define SPECENUM_VALUE19 UTYF_NOHOME
246#define SPECENUM_VALUE19NAME N_("?unitflag:NoHome")
247/* Cannot increase veteran level */
248#define SPECENUM_VALUE20 UTYF_NO_VETERAN
249#define SPECENUM_VALUE20NAME N_("?unitflag:NoVeteran")
250/* Gets double firepower against cities */
251#define SPECENUM_VALUE21 UTYF_CITYBUSTER
252#define SPECENUM_VALUE21NAME N_("?unitflag:CityBuster")
253/* Unit cannot be built (barb leader etc) */
254#define SPECENUM_VALUE22 UTYF_NOBUILD
255#define SPECENUM_VALUE22NAME N_("?unitflag:NoBuild")
256/* Firepower set to 1 when EFT_DEFEND_BONUS applies
257 * (for example, land unit attacking city with walls) */
258#define SPECENUM_VALUE23 UTYF_BADWALLATTACKER
259#define SPECENUM_VALUE23NAME N_("?unitflag:BadWallAttacker")
260/* Firepower set to 1 and attackers x2 when in city */
261#define SPECENUM_VALUE24 UTYF_BADCITYDEFENDER
262#define SPECENUM_VALUE24NAME N_("?unitflag:BadCityDefender")
263/* Only barbarians can build this unit */
264#define SPECENUM_VALUE25 UTYF_BARBARIAN_ONLY
265#define SPECENUM_VALUE25NAME N_("?unitflag:BarbarianOnly")
266/* Unit can't be built in scenarios where founding new cities is prevented. */
267#define SPECENUM_VALUE26 UTYF_NEWCITY_GAMES_ONLY
268#define SPECENUM_VALUE26NAME N_("?unitflag:NewCityGamesOnly")
269/* Can escape when killstack occours */
270#define SPECENUM_VALUE27 UTYF_CANESCAPE
271#define SPECENUM_VALUE27NAME N_("?unitflag:CanEscape")
272/* Can kill escaping units */
273#define SPECENUM_VALUE28 UTYF_CANKILLESCAPING
274#define SPECENUM_VALUE28NAME N_("?unitflag:CanKillEscaping")
275/* Makes random movement, not under player control */
276#define SPECENUM_VALUE29 UTYF_RANDOM_MOVEMENT
277#define SPECENUM_VALUE29NAME N_("?unitflag:RandomMovement")
278
279#define SPECENUM_VALUE30 UTYF_USER_FLAG_1
280#define SPECENUM_VALUE31 UTYF_USER_FLAG_2
281#define SPECENUM_VALUE32 UTYF_USER_FLAG_3
282#define SPECENUM_VALUE33 UTYF_USER_FLAG_4
283#define SPECENUM_VALUE34 UTYF_USER_FLAG_5
284#define SPECENUM_VALUE35 UTYF_USER_FLAG_6
285#define SPECENUM_VALUE36 UTYF_USER_FLAG_7
286#define SPECENUM_VALUE37 UTYF_USER_FLAG_8
287#define SPECENUM_VALUE38 UTYF_USER_FLAG_9
288#define SPECENUM_VALUE39 UTYF_USER_FLAG_10
289#define SPECENUM_VALUE40 UTYF_USER_FLAG_11
290#define SPECENUM_VALUE41 UTYF_USER_FLAG_12
291#define SPECENUM_VALUE42 UTYF_USER_FLAG_13
292#define SPECENUM_VALUE43 UTYF_USER_FLAG_14
293#define SPECENUM_VALUE44 UTYF_USER_FLAG_15
294#define SPECENUM_VALUE45 UTYF_USER_FLAG_16
295#define SPECENUM_VALUE46 UTYF_USER_FLAG_17
296#define SPECENUM_VALUE47 UTYF_USER_FLAG_18
297#define SPECENUM_VALUE48 UTYF_USER_FLAG_19
298#define SPECENUM_VALUE49 UTYF_USER_FLAG_20
299#define SPECENUM_VALUE50 UTYF_USER_FLAG_21
300#define SPECENUM_VALUE51 UTYF_USER_FLAG_22
301#define SPECENUM_VALUE52 UTYF_USER_FLAG_23
302#define SPECENUM_VALUE53 UTYF_USER_FLAG_24
303#define SPECENUM_VALUE54 UTYF_USER_FLAG_25
304#define SPECENUM_VALUE55 UTYF_USER_FLAG_26
305#define SPECENUM_VALUE56 UTYF_USER_FLAG_27
306#define SPECENUM_VALUE57 UTYF_USER_FLAG_28
307#define SPECENUM_VALUE58 UTYF_USER_FLAG_29
308#define SPECENUM_VALUE59 UTYF_USER_FLAG_30
309#define SPECENUM_VALUE60 UTYF_USER_FLAG_31
310#define SPECENUM_VALUE61 UTYF_USER_FLAG_32
311#define SPECENUM_VALUE62 UTYF_USER_FLAG_33
312#define SPECENUM_VALUE63 UTYF_USER_FLAG_34
313#define SPECENUM_VALUE64 UTYF_USER_FLAG_35
314#define SPECENUM_VALUE65 UTYF_USER_FLAG_36
315#define SPECENUM_VALUE66 UTYF_USER_FLAG_37
316#define SPECENUM_VALUE67 UTYF_USER_FLAG_38
317#define SPECENUM_VALUE68 UTYF_USER_FLAG_39
318#define SPECENUM_VALUE69 UTYF_USER_FLAG_40
319#define SPECENUM_VALUE70 UTYF_USER_FLAG_41
320#define SPECENUM_VALUE71 UTYF_USER_FLAG_42
321#define SPECENUM_VALUE72 UTYF_USER_FLAG_43
322#define SPECENUM_VALUE73 UTYF_USER_FLAG_44
323#define SPECENUM_VALUE74 UTYF_USER_FLAG_45
324#define SPECENUM_VALUE75 UTYF_USER_FLAG_46
325#define SPECENUM_VALUE76 UTYF_USER_FLAG_47
326#define SPECENUM_VALUE77 UTYF_USER_FLAG_48
327#define SPECENUM_VALUE78 UTYF_USER_FLAG_49
328#define SPECENUM_VALUE79 UTYF_USER_FLAG_50
329/* Note that first role must have value next to last flag */
330
331#define UTYF_LAST_USER_FLAG UTYF_USER_FLAG_50
332#define MAX_NUM_USER_UNIT_FLAGS (UTYF_LAST_USER_FLAG - UTYF_USER_FLAG_1 + 1)
333#define SPECENUM_NAMEOVERRIDE
334#define SPECENUM_BITVECTOR bv_unit_type_flags
335#include "specenum_gen.h"
336
337
338/* Unit "roles": these are similar to unit flags but differ in that
339 they don't represent intrinsic properties or abilities of units,
340 but determine which units are used (mainly by the server or AI)
341 in various circumstances, or "roles".
342 Note that in some cases flags can act as roles, eg, we don't need
343 a role for "settlers", because we can just use UTYF_SETTLERS.
344 (Now have to consider ACTION_FOUND_CITY too)
345 So we make sure flag values and role values are distinct,
346 so some functions can use them interchangably.
347 See data/classic/units.ruleset for documentation of their effects.
348*/
349#define L_FIRST (UTYF_LAST_USER_FLAG + 1)
350
351#define SPECENUM_NAME unit_role_id
352/* Built first when city established */
353#define SPECENUM_VALUE80 L_FIRSTBUILD
354#define SPECENUM_VALUE80NAME N_("?unitflag:FirstBuild")
355/* Explorer unit */
356#define SPECENUM_VALUE81 L_EXPLORER
357#define SPECENUM_VALUE81NAME N_("?unitflag:Explorer")
358/* Can be found in hut */
359#define SPECENUM_VALUE82 L_HUT
360#define SPECENUM_VALUE82NAME N_("?unitflag:Hut")
361/* Can be found in hut, tech required */
362#define SPECENUM_VALUE83 L_HUT_TECH
363#define SPECENUM_VALUE83NAME N_("?unitflag:HutTech")
364/* Created in Partisan circumstances */
365#define SPECENUM_VALUE84 L_PARTISAN
366#define SPECENUM_VALUE84NAME N_("?unitflag:Partisan")
367/* Ok on defense (AI) */
368#define SPECENUM_VALUE85 L_DEFEND_OK
369#define SPECENUM_VALUE85NAME N_("?unitflag:DefendOk")
370/* Primary purpose is defense (AI) */
371#define SPECENUM_VALUE86 L_DEFEND_GOOD
372#define SPECENUM_VALUE86NAME N_("?unitflag:DefendGood")
373/* Useful for ferrying (AI) */
374#define SPECENUM_VALUE87 L_FERRYBOAT
375#define SPECENUM_VALUE87NAME N_("?unitflag:FerryBoat")
376/* Barbarians unit, land only */
377#define SPECENUM_VALUE88 L_BARBARIAN
378#define SPECENUM_VALUE88NAME N_("?unitflag:Barbarian")
379/* Barbarians unit, global tech required */
380#define SPECENUM_VALUE89 L_BARBARIAN_TECH
381#define SPECENUM_VALUE89NAME N_("?unitflag:BarbarianTech")
382/* Barbarian boat */
383#define SPECENUM_VALUE90 L_BARBARIAN_BOAT
384#define SPECENUM_VALUE90NAME N_("?unitflag:BarbarianBoat")
385/* Barbarians boat, global tech required */
386#define SPECENUM_VALUE91 L_BARBARIAN_BOAT_TECH
387#define SPECENUM_VALUE91NAME N_("?unitflag:BarbarianBoatTech")
388/* What barbarians should build */
389#define SPECENUM_VALUE92 L_BARBARIAN_BUILD
390#define SPECENUM_VALUE92NAME N_("?unitflag:BarbarianBuild")
391/* Barbarians build when global tech */
392#define SPECENUM_VALUE93 L_BARBARIAN_BUILD_TECH
393#define SPECENUM_VALUE93NAME N_("?unitflag:BarbarianBuildTech")
394/* Barbarian leader */
395#define SPECENUM_VALUE94 L_BARBARIAN_LEADER
396#define SPECENUM_VALUE94NAME N_("?unitflag:BarbarianLeader")
397/* Sea raider unit */
398#define SPECENUM_VALUE95 L_BARBARIAN_SEA
399#define SPECENUM_VALUE95NAME N_("?unitflag:BarbarianSea")
400/* Sea raider unit, global tech required */
401#define SPECENUM_VALUE96 L_BARBARIAN_SEA_TECH
402#define SPECENUM_VALUE96NAME N_("?unitflag:BarbarianSeaTech")
403/* StartUnit: Cities */
404#define SPECENUM_VALUE97 L_START_CITIES
405#define SPECENUM_VALUE97NAME N_("?unitflag:CitiesStartUnit")
406/* StartUnit: Worker */
407#define SPECENUM_VALUE98 L_START_WORKER
408#define SPECENUM_VALUE98NAME N_("?unitflag:WorkerStartUnit")
409/* StartUnit: Explorer */
410#define SPECENUM_VALUE99 L_START_EXPLORER
411#define SPECENUM_VALUE99NAME N_("?unitflag:ExplorerStartUnit")
412/* StartUnit: King */
413#define SPECENUM_VALUE100 L_START_KING
414#define SPECENUM_VALUE100NAME N_("?unitflag:KingStartUnit")
415/* StartUnit: Diplomat */
416#define SPECENUM_VALUE101 L_START_DIPLOMAT
417#define SPECENUM_VALUE101NAME N_("?unitflag:DiplomatStartUnit")
418/* StartUnit: Ferryboat */
419#define SPECENUM_VALUE102 L_START_FERRY
420#define SPECENUM_VALUE102NAME N_("?unitflag:FerryStartUnit")
421/* StartUnit: DefendOk */
422#define SPECENUM_VALUE103 L_START_DEFEND_OK
423#define SPECENUM_VALUE103NAME N_("?unitflag:DefendOkStartUnit")
424/* StartUnit: DefendGood */
425#define SPECENUM_VALUE104 L_START_DEFEND_GOOD
426#define SPECENUM_VALUE104NAME N_("?unitflag:DefendGoodStartUnit")
427/* StartUnit: AttackFast */
428#define SPECENUM_VALUE105 L_START_ATTACK_FAST
429#define SPECENUM_VALUE105NAME N_("?unitflag:AttackFastStartUnit")
430/* StartUnit: AttackStrong */
431#define SPECENUM_VALUE106 L_START_ATTACK_STRONG
432#define SPECENUM_VALUE106NAME N_("?unitflag:AttackStrongStartUnit")
433/* AI hunter type unit */
434#define SPECENUM_VALUE107 L_HUNTER
435#define SPECENUM_VALUE107NAME N_("?unitflag:Hunter")
436/* Can improve terrain */
437#define SPECENUM_VALUE108 L_SETTLERS
438#define SPECENUM_VALUE108NAME N_("?unitflag:Settlers")
439#define L_LAST (L_SETTLERS + 1)
440
441#include "specenum_gen.h"
442
443#define L_MAX 64 /* Used in the network protocol. */
444
445 FC_STATIC_ASSERT(L_LAST - L_FIRST <= L_MAX, too_many_unit_roles);
446
447/* Used in the network protocol. */
448 BV_DEFINE(bv_unit_type_roles, L_MAX);
449
450/* Used in the network protocol. */
451#define SPECENUM_NAME combat_bonus_type
452#define SPECENUM_VALUE0 CBONUS_DEFENSE_MULTIPLIER
453#define SPECENUM_VALUE0NAME "DefenseMultiplier"
454#define SPECENUM_VALUE1 CBONUS_DEFENSE_DIVIDER
455#define SPECENUM_VALUE1NAME "DefenseDivider"
456#define SPECENUM_VALUE2 CBONUS_LOW_FIREPOWER
457#define SPECENUM_VALUE2NAME "LowFirepower"
458#define SPECENUM_VALUE3 CBONUS_DEFENSE_MULTIPLIER_PCT
459#define SPECENUM_VALUE3NAME "DefenseMultiplierPct"
460#define SPECENUM_VALUE4 CBONUS_DEFENSE_DIVIDER_PCT
461#define SPECENUM_VALUE4NAME "DefenseDividerPct"
462#define SPECENUM_VALUE5 CBONUS_SCRAMBLES_PCT
463#define SPECENUM_VALUE5NAME "CityDefensePct"
464#include "specenum_gen.h"
465
466 struct combat_bonus {
467 enum unit_type_flag_id flag;
468 enum combat_bonus_type type;
469 int value;
470
471 /* Not listed in the help text. */
472 bool quiet;
473};
474
475/* get 'struct combat_bonus_list' and related functions: */
476#define SPECLIST_TAG combat_bonus
477#define SPECLIST_TYPE struct combat_bonus
478#include "speclist.h"
479
480#define combat_bonus_list_iterate(bonuslist, pbonus) \
481 TYPED_LIST_ITERATE(struct combat_bonus, bonuslist, pbonus)
482#define combat_bonus_list_iterate_end LIST_ITERATE_END
483
484 BV_DEFINE(bv_unit_types, U_LAST);
485
486 struct veteran_level {
487 struct name_translation name; /* level/rank name */
488 int power_fact; /* combat/work speed/diplomatic power factor (in %) */
489 int move_bonus;
490 int base_raise_chance; /* server only */
491 int work_raise_chance; /* server only */
492};
493
494 struct veteran_system {
495 int levels;
496
497 struct veteran_level *definitions;
498};
499
500 struct unit_type {
501 Unit_type_id item_number;
502 struct name_translation name;
503 bool ruledit_disabled; /* Does not really exist - hole in units array */
504 void *ruledit_dlg;
505 char graphic_str[MAX_LEN_NAME];
506 char graphic_alt[MAX_LEN_NAME];
507 char graphic_alt2[MAX_LEN_NAME];
508 char sound_move[MAX_LEN_NAME];
509 char sound_move_alt[MAX_LEN_NAME];
510 char sound_fight[MAX_LEN_NAME];
511 char sound_fight_alt[MAX_LEN_NAME];
512 int build_cost; /* Use wrappers to access this. */
513 int pop_cost; /* Number of workers the unit contains
514 * (e.g., settlers, engineers) */
515 int attack_strength;
516 int defense_strength;
517 int move_rate;
518 int unknown_move_cost; /* See utype_unknown_move_cost(). */
519
520 struct requirement_vector build_reqs;
521
522 int vision_radius_sq;
523 int transport_capacity;
524 int hp;
525 int firepower;
526 struct combat_bonus_list *bonuses;
527
528#define U_NOT_OBSOLETED (NULL)
529 const struct unit_type *obsoleted_by;
530 const struct unit_type *converted_to;
531 int convert_time;
532 int fuel;
533
534 bv_unit_type_flags flags;
535 bv_unit_type_roles roles;
536
537 int happy_cost; /* unhappy people in home city */
538 int upkeep[O_LAST];
539
540 /* Only valid for ACTION_PARADROP* */
541 int paratroopers_range;
542
543 /* Additional values for the expanded veteran system */
544 struct veteran_system *veteran;
545
546 /* Values for bombardment */
547 int bombard_rate;
548
549 /* Values for founding cities */
550 int city_size;
551
552 int city_slots;
553
554 enum transp_def_type tp_defense;
555
556 struct unit_class *uclass;
557
558 bv_unit_classes cargo;
559
560 /* Can attack these classes even if they are otherwise "Unreachable" */
561 bv_unit_classes targets;
562 /* Can load into these class transports at any location,
563 * even if they are otherwise "Unreachable". */
564 bv_unit_classes embarks;
565 /* Can unload from these class transports at any location,
566 * even if they are otherwise "Unreachable". */
567 bv_unit_classes disembarks;
568
569 enum vision_layer vlayer;
570
571 struct strvec *helptext;
572
573 struct {
574 bool igwall;
575 bool worker;
576 } adv;
577
578 struct {
579 int max_defense_mp_bonus_pct; /* Value 0 here does not guarantee that unit
580 * never has CBONUS_DEFENSE_MULTIPLIER, it
581 * merely means that there's no POSITIVE one */
582 int defense_mp_bonuses_pct[U_LAST];
583 int scramble_coeff[U_LAST]; /* for scrambling units, 10000 x defense factor
584 * in cities (includes common type defense
585 * bonus multiplier), for other 0 */
586 } cache;
587
588 void *ais[FREECIV_AI_MOD_LAST];
589};
590
591/* General unit and unit type (matched) routines */
592 Unit_type_id utype_count(void);
593 Unit_type_id utype_index(const struct unit_type *punittype);
594 Unit_type_id utype_number(const struct unit_type *punittype);
595
596const struct unit_type *unit_type_get(const struct unit *punit);
597struct unit_type *utype_by_number(const Unit_type_id id);
598
599struct unit_type *unit_type_by_rule_name(const char *name);
600struct unit_type *unit_type_by_translated_name(const char *name);
601
602const char *unit_rule_name(const struct unit *punit);
603const char *utype_rule_name(const struct unit_type *punittype);
604
605const char *unit_name_translation(const struct unit *punit);
606const char *utype_name_translation(const struct unit_type *punittype);
607
608const char *utype_values_string(const struct unit_type *punittype);
609const char *utype_values_translation(const struct unit_type *punittype);
610
611/* General unit type flag and role routines */
612bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag);
613
614/**************************************************************************
615 Return whether the given unit type has the flag.
616**************************************************************************/
617 static inline bool utype_has_flag(const struct unit_type *punittype, int flag)
618{
619 return BV_ISSET(punittype->flags, flag);
620}
621
622bool unit_has_type_role(const struct unit *punit, enum unit_role_id role);
623bool utype_has_role(const struct unit_type *punittype, int role);
624
625void user_unit_type_flags_init(void);
626void set_user_unit_type_flag_name(enum unit_type_flag_id id, const char *name,
627 const char *helptxt);
628const char *unit_type_flag_helptxt(enum unit_type_flag_id id);
629
630bool utype_can_create_extra(const struct unit_type *putype,
631 const struct extra_type *pextra);
632bool utype_can_remove_extra(const struct unit_type *putype,
633 const struct extra_type *pextra);
634
635bool unit_can_take_over(const struct unit *punit);
636bool utype_can_take_over(const struct unit_type *punittype);
637
638bool utype_can_freely_load(const struct unit_type *pcargotype,
639 const struct unit_type *ptranstype);
640bool utype_can_freely_unload(const struct unit_type *pcargotype,
641 const struct unit_type *ptranstype);
642
643bool utype_may_act_at_all(const struct unit_type *putype);
644bool utype_can_do_action(const struct unit_type *putype,
645 const action_id act_id);
646bool utype_can_do_action_result(const struct unit_type *putype,
647 enum action_result result);
648bool utype_can_do_action_sub_result(const struct unit_type *putype,
649 enum action_sub_result sub_result);
650bool utype_acts_hostile(const struct unit_type *putype);
651
652bool can_unit_act_when_ustate_is(const struct unit_type *punit_type,
653 const enum ustate_prop prop,
654 const bool is_there);
655bool utype_can_do_act_when_ustate(const struct unit_type *punit_type,
656 const action_id act_id,
657 const enum ustate_prop prop,
658 const bool is_there);
659bool utype_can_do_action_result_when_ustate(const struct unit_type *putype,
660 enum action_result result,
661 const enum ustate_prop prop,
662 const bool is_there);
663
664bool utype_can_do_act_if_tgt_citytile(const struct unit_type *punit_type,
665 const action_id act_id,
666 const enum citytile_type prop,
667 const bool is_there);
668
669bool can_utype_do_act_if_tgt_diplrel(const struct unit_type *punit_type,
670 const action_id act_id,
671 const int prop,
672 const bool is_there);
673
674bool
675 utype_can_act_if_tgt_diplrel_tile_other(const struct unit_type *punit_type,
676 const action_id act_id,
677 const int prop,
678 const bool is_there);
679
680bool utype_may_act_move_frags(const struct unit_type *punit_type,
681 const action_id act_id,
682 const int move_fragments);
683
684bool utype_may_act_tgt_city_tile(const struct unit_type *punit_type,
685 const action_id act_id,
686 const enum citytile_type prop,
687 const bool is_there);
688
689bool utype_action_takes_all_mp(const struct unit_type *putype,
690 struct action *paction);
691
692bool utype_action_takes_all_mp_if_ustate_is(const struct unit_type *putype,
693 struct action *paction,
694 const enum ustate_prop prop);
695
696bool utype_is_consumed_by_action(const struct action *paction,
697 const struct unit_type *utype);
698
699bool utype_is_consumed_by_action_result(enum action_result result,
700 const struct unit_type *utype);
701
702bool utype_is_moved_to_tgt_by_action(const struct action *paction,
703 const struct unit_type *utype);
704
705bool utype_is_unmoved_by_action(const struct action *paction,
706 const struct unit_type *utype);
707
708bool utype_pays_for_regular_move_to_tgt(const struct action *paction,
709 const struct unit_type *utype);
710
711int utype_pays_mp_for_action_base(const struct action *paction,
712 const struct unit_type *putype);
713
714int utype_pays_mp_for_action_estimate(const struct civ_map *nmap,
715 const struct action *paction,
716 const struct unit_type *putype,
717 const struct player *act_player,
718 const struct tile *act_tile,
719 const struct tile *tgt_tile);
720
721/* Functions to operate on various flag and roles. */
722 typedef bool (*role_unit_callback)(struct unit_type *ptype, void *data);
723
724void role_unit_precalcs(void);
725void role_unit_precalcs_free(void);
726int num_role_units(int role);
727struct unit_type *role_units_iterate(int role, role_unit_callback cb, void *data);
728struct unit_type *role_units_iterate_backwards(int role, role_unit_callback cb, void *data);
729struct unit_type *get_role_unit(int role, int role_index);
730struct unit_type *best_role_unit(const struct city *pcity, int role);
731struct unit_type *best_role_unit_for_player(const struct player *pplayer,
732 int role);
733struct unit_type *first_role_unit_for_player(const struct player *pplayer,
734 int role);
735bool role_units_translations(struct astring *astr, int flag, bool alts);
736
737/* General unit class routines */
738 Unit_Class_id uclass_count(void);
739 Unit_Class_id uclass_number(const struct unit_class *pclass);
740/* Optimised to be identical to uclass_number: the implementation
741 * unittype.c is also semantically correct. */
742#define uclass_index(_c_) (_c_)->item_number
743#ifndef uclass_index
744 Unit_Class_id uclass_index(const struct unit_class *pclass);
745#endif /* uclass_index */
746
747struct unit_class *unit_class_get(const struct unit *punit);
748struct unit_class *uclass_by_number(const Unit_Class_id id);
749#define utype_class(_t_) (_t_)->uclass
750#ifndef utype_class
751struct unit_class *utype_class(const struct unit_type *punittype);
752#endif /* utype_class */
753
754struct unit_class *unit_class_by_rule_name(const char *s);
755
756const char *uclass_rule_name(const struct unit_class *pclass);
757const char *uclass_name_translation(const struct unit_class *pclass);
758
759bool unit_has_class_flag(const struct unit *punit, enum unit_class_flag_id flag);
760bool utype_has_class_flag(const struct unit_type *ptype,
761 enum unit_class_flag_id flag);
762
763/**************************************************************************
764 Return whether the given unit class has the flag.
765**************************************************************************/
766 static inline bool uclass_has_flag(const struct unit_class *punitclass,
767 enum unit_class_flag_id flag)
768{
769 return BV_ISSET(punitclass->flags, flag);
770}
771
772void user_unit_class_flags_init(void);
773void set_user_unit_class_flag_name(enum unit_class_flag_id id,
774 const char *name,
775 const char *helptxt);
776const char *unit_class_flag_helptxt(enum unit_class_flag_id id);
777
778/* Ancillary routines */
779int unit_build_shield_cost(const struct city *pcity, const struct unit *punit);
780int utype_build_shield_cost(const struct city *pcity,
781 const struct player *pplayer,
782 const struct unit_type *punittype);
783int utype_build_shield_cost_base(const struct unit_type *punittype);
784int unit_build_shield_cost_base(const struct unit *punit);
785
786int utype_buy_gold_cost(const struct city *pcity,
787 const struct unit_type *punittype,
788 int shields_in_stock);
789
790const struct veteran_system *
791 utype_veteran_system(const struct unit_type *punittype);
792int utype_veteran_levels(const struct unit_type *punittype);
793const struct veteran_level *
794 utype_veteran_level(const struct unit_type *punittype, int level);
795const char *utype_veteran_name_translation(const struct unit_type *punittype,
796 int level);
797bool utype_veteran_has_power_bonus(const struct unit_type *punittype);
798
799struct veteran_system *veteran_system_new(int count);
800void veteran_system_destroy(struct veteran_system *vsystem);
801void veteran_system_definition(struct veteran_system *vsystem, int level,
802 const char *vlist_name, int vlist_power,
803 int vlist_move, int vlist_raise,
804 int vlist_wraise);
805
806int unit_pop_value(const struct unit *punit);
807int utype_pop_value(const struct unit_type *punittype, const struct city *pcity);
808
809enum unit_move_type utype_move_type(const struct unit_type *punittype);
810void set_unit_move_type(struct unit_class *puclass);
811
812/* player related unit functions */
813int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer,
814 Output_type_id otype);
815int utype_happy_cost(const struct unit_type *ut, const struct player *pplayer);
816
817const struct unit_type *can_upgrade_unittype(const struct player *pplayer,
818 const struct unit_type *punittype);
819int unit_upgrade_price(const struct player *pplayer,
820 const struct unit_type *from,
821 const struct unit_type *to);
822
823bool utype_player_already_has_this(const struct player *pplayer,
824 const struct unit_type *putype);
825bool utype_player_already_has_this_unique(const struct player *pplayer,
826 const struct unit_type *putype);
827
828bool can_player_build_unit_direct(const struct player *p,
829 const struct unit_type *punittype,
830 bool consider_reg_impr_req);
831bool can_player_build_unit_later(const struct player *p,
832 const struct unit_type *punittype);
833bool can_player_build_unit_now(const struct player *p,
834 const struct unit_type *punittype);
835
836#define utype_fuel(ptype) (ptype)->fuel
837
838bool utype_is_cityfounder(const struct unit_type *utype);
839
840bool uclass_flag_is_in_use(enum unit_class_flag_id ucflag);
841bool utype_flag_is_in_use(enum unit_type_flag_id uflag);
842
843/* Initialization and iteration */
844void unit_types_init(void);
845void unit_types_free(void);
846void unit_type_flags_free(void);
847void unit_class_flags_free(void);
848
849struct unit_type *unit_type_array_first(void);
850const struct unit_type *unit_type_array_last(void);
851
852#define unit_type_iterate(_p) \
853{ \
854 struct unit_type *_p = unit_type_array_first(); \
855 if (NULL != _p) { \
856 const struct unit_type *_end_##_p = unit_type_array_last(); \
857 for (; _p <= _end_##_p; _p++) {
858
859#define unit_type_iterate_end \
860 } \
861 } \
862}
863
864#define unit_type_re_active_iterate(_p) \
865 unit_type_iterate(_p) { \
866 if (!_p->ruledit_disabled) {
867
868#define unit_type_re_active_iterate_end \
869 } \
870 } unit_type_iterate_end;
871
872#define unit_tech_reqs_iterate(_utype_, _p) \
873do { \
874 requirement_vector_iterate(&(_utype_)->build_reqs, preq_##_p) { \
875 if (preq_##_p->source.kind == VUT_ADVANCE) { \
876 struct advance *_p = preq_##_p->source.value.advance;
877
878#define unit_tech_reqs_iterate_end \
879 } \
880 } requirement_vector_iterate_end; \
881} while (FALSE);
882
883/* Used on client to show just one req */
884struct advance *utype_primary_tech_req(const struct unit_type *ptype);
885bool is_tech_req_for_utype(const struct unit_type *ptype,
886 struct advance *padv);
887
888void *utype_ai_data(const struct unit_type *ptype, const struct ai_type *ai);
889void utype_set_ai_data(struct unit_type *ptype, const struct ai_type *ai,
890 void *data);
891
892void unit_type_action_cache_set(struct unit_type *ptype);
893void unit_type_action_cache_init(void);
894
895/* Initialization and iteration */
896void unit_classes_init(void);
897void unit_classes_free(void);
898
899void set_unit_class_caches(struct unit_class *pclass);
900void set_unit_type_caches(struct unit_type *ptype);
901
902struct unit_class *unit_class_array_first(void);
903const struct unit_class *unit_class_array_last(void);
904
905#define unit_class_iterate(_p) \
906{ \
907 struct unit_class *_p = unit_class_array_first(); \
908 if (NULL != _p) { \
909 const struct unit_class *_end_##_p = unit_class_array_last(); \
910 for (; _p <= _end_##_p; _p++) {
911
912#define unit_class_iterate_end \
913 } \
914 } \
915}
916
917#define unit_class_re_active_iterate(_p) \
918 unit_class_iterate(_p) { \
919 if (!_p->ruledit_disabled) {
920
921#define unit_class_re_active_iterate_end \
922 } \
923 } unit_class_iterate_end;
924
925#define SPECLIST_TAG unit_class
926#define SPECLIST_TYPE struct unit_class
927#include "speclist.h"
928
929#define unit_class_list_iterate(uclass_list, pclass) \
930 TYPED_LIST_ITERATE(struct unit_class, uclass_list, pclass)
931#define unit_class_list_iterate_end LIST_ITERATE_END
932
933#define SPECLIST_TAG unit_type
934#define SPECLIST_TYPE struct unit_type
935#include "speclist.h"
936
937#define unit_type_list_iterate(utype_list, ptype) \
938 TYPED_LIST_ITERATE(struct unit_type, utype_list, ptype)
939#define unit_type_list_iterate_end LIST_ITERATE_END
940
941#ifdef __cplusplus
942}
943#endif /* __cplusplus */
944
945#endif /* FC__UNITTYPE_H */
bitvector.h
BV_DEFINE
#define BV_DEFINE(name, bits)
Definition bitvector.h:132
BV_ISSET
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
incite_cost
char * incite_cost
Definition comments.c:74
punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
fc_types.h
Unit_Class_id
int Unit_Class_id
Definition fc_types.h:421
action_id
int action_id
Definition fc_types.h:392
MAX_LEN_NAME
#define MAX_LEN_NAME
Definition fc_types.h:66
Unit_type_id
int Unit_type_id
Definition fc_types.h:385
O_LAST
@ O_LAST
Definition fc_types.h:101
UCL_LAST
#define UCL_LAST
Definition fc_types.h:420
Output_type_id
enum output_type_id Output_type_id
Definition fc_types.h:381
name
const char * name
Definition inputfile.c:127
FC_STATIC_ASSERT
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:235
name_translation.h
requirements.h
level
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
shared.h
specenum_gen.h
speclist.h
action
Definition actions.h:360
advance
Definition tech.h:124
ai_type
Definition ai.h:50
astring
Definition astring.h:36
city
Definition city.h:320
civ_map
Definition map_types.h:71
combat_bonus
Definition unittype.h:466
combat_bonus::value
int value
Definition unittype.h:469
combat_bonus::flag
enum unit_type_flag_id flag
Definition unittype.h:467
combat_bonus::quiet
bool quiet
Definition unittype.h:472
combat_bonus::type
enum combat_bonus_type type
Definition unittype.h:468
extra_type
Definition extras.h:88
name_translation
Definition name_translation.h:35
player
Definition player.h:247
strvec
Definition string_vector.c:29
tile
Definition tile.h:50
unit_class
Definition unittype.h:149
unit_class::item_number
Unit_Class_id item_number
Definition unittype.h:150
unit_class::hp_loss_pct
int hp_loss_pct
Definition unittype.h:155
unit_class::move_type
enum unit_move_type move_type
Definition unittype.h:153
unit_class::non_native_def_pct
int non_native_def_pct
Definition unittype.h:156
unit_class::sea_move
enum move_level sea_move
Definition unittype.h:163
unit_class::adv
struct unit_class::@85 adv
unit_class::subset_movers
struct unit_class_list * subset_movers
Definition unittype.h:173
unit_class::refuel_extras
struct extra_type_list * refuel_extras
Definition unittype.h:168
unit_class::native_tile_extras
struct extra_type_list * native_tile_extras
Definition unittype.h:169
unit_class::min_speed
int min_speed
Definition unittype.h:154
unit_class::cache
struct unit_class::@86 cache
unit_class::native_bases
struct extra_type_list * native_bases
Definition unittype.h:170
unit_class::bonus_roads
struct extra_type_list * bonus_roads
Definition unittype.h:171
unit_class::ferry_types
int ferry_types
Definition unittype.h:164
unit_class::name
struct name_translation name
Definition unittype.h:151
unit_class::helptext
struct strvec * helptext
Definition unittype.h:159
unit_class::flags
bv_unit_class_flags flags
Definition unittype.h:157
unit_class::ruledit_disabled
bool ruledit_disabled
Definition unittype.h:152
unit_class::hiding_extras
struct extra_type_list * hiding_extras
Definition unittype.h:172
unit_class::land_move
enum move_level land_move
Definition unittype.h:162
unit_type
Definition unittype.h:500
unit_type::transport_capacity
int transport_capacity
Definition unittype.h:523
unit_type::max_defense_mp_bonus_pct
int max_defense_mp_bonus_pct
Definition unittype.h:579
unit_type::adv
struct unit_type::@87 adv
unit_type::uclass
struct unit_class * uclass
Definition unittype.h:556
unit_type::pop_cost
int pop_cost
Definition unittype.h:513
unit_type::ais
void * ais[FREECIV_AI_MOD_LAST]
Definition unittype.h:588
unit_type::build_reqs
struct requirement_vector build_reqs
Definition unittype.h:520
unit_type::item_number
Unit_type_id item_number
Definition unittype.h:501
unit_type::defense_strength
int defense_strength
Definition unittype.h:516
unit_type::cargo
bv_unit_classes cargo
Definition unittype.h:558
unit_type::firepower
int firepower
Definition unittype.h:525
unit_type::paratroopers_range
int paratroopers_range
Definition unittype.h:541
unit_type::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition unittype.h:506
unit_type::worker
bool worker
Definition unittype.h:575
unit_type::sound_move_alt
char sound_move_alt[MAX_LEN_NAME]
Definition unittype.h:509
unit_type::build_cost
int build_cost
Definition unittype.h:512
unit_type::convert_time
int convert_time
Definition unittype.h:531
unit_type::city_size
int city_size
Definition unittype.h:550
unit_type::veteran
struct veteran_system * veteran
Definition unittype.h:544
unit_type::obsoleted_by
const struct unit_type * obsoleted_by
Definition unittype.h:529
unit_type::vision_radius_sq
int vision_radius_sq
Definition unittype.h:522
unit_type::move_rate
int move_rate
Definition unittype.h:517
unit_type::targets
bv_unit_classes targets
Definition unittype.h:561
unit_type::vlayer
enum vision_layer vlayer
Definition unittype.h:569
unit_type::helptext
struct strvec * helptext
Definition unittype.h:571
unit_type::bombard_rate
int bombard_rate
Definition unittype.h:547
unit_type::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition unittype.h:505
unit_type::city_slots
int city_slots
Definition unittype.h:552
unit_type::scramble_coeff
int scramble_coeff[U_LAST]
Definition unittype.h:583
unit_type::sound_move
char sound_move[MAX_LEN_NAME]
Definition unittype.h:508
unit_type::cache
struct unit_type::@88 cache
unit_type::hp
int hp
Definition unittype.h:524
unit_type::sound_fight_alt
char sound_fight_alt[MAX_LEN_NAME]
Definition unittype.h:511
unit_type::igwall
bool igwall
Definition unittype.h:574
unit_type::name
struct name_translation name
Definition unittype.h:502
unit_type::fuel
int fuel
Definition unittype.h:532
unit_type::roles
bv_unit_type_roles roles
Definition unittype.h:535
unit_type::tp_defense
enum transp_def_type tp_defense
Definition unittype.h:554
unit_type::unknown_move_cost
int unknown_move_cost
Definition unittype.h:518
unit_type::upkeep
int upkeep[O_LAST]
Definition unittype.h:538
unit_type::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition unittype.h:507
unit_type::disembarks
bv_unit_classes disembarks
Definition unittype.h:567
unit_type::converted_to
const struct unit_type * converted_to
Definition unittype.h:530
unit_type::flags
bv_unit_type_flags flags
Definition unittype.h:534
unit_type::ruledit_disabled
bool ruledit_disabled
Definition unittype.h:503
unit_type::sound_fight
char sound_fight[MAX_LEN_NAME]
Definition unittype.h:510
unit_type::embarks
bv_unit_classes embarks
Definition unittype.h:564
unit_type::attack_strength
int attack_strength
Definition unittype.h:515
unit_type::happy_cost
int happy_cost
Definition unittype.h:537
unit_type::defense_mp_bonuses_pct
int defense_mp_bonuses_pct[U_LAST]
Definition unittype.h:582
unit_type::bonuses
struct combat_bonus_list * bonuses
Definition unittype.h:526
unit_type::ruledit_dlg
void * ruledit_dlg
Definition unittype.h:504
unit
Definition unit.h:138
veteran_level
Definition unittype.h:486
veteran_level::power_fact
int power_fact
Definition unittype.h:488
veteran_level::base_raise_chance
int base_raise_chance
Definition unittype.h:490
veteran_level::name
struct name_translation name
Definition unittype.h:487
veteran_level::move_bonus
int move_bonus
Definition unittype.h:489
veteran_level::work_raise_chance
int work_raise_chance
Definition unittype.h:491
veteran_system
Definition unittype.h:494
veteran_system::definitions
struct veteran_level * definitions
Definition unittype.h:497
veteran_system::levels
int levels
Definition unittype.h:495
bool
#define bool
Definition support.h:71
utype_may_act_tgt_city_tile
bool utype_may_act_tgt_city_tile(const struct unit_type *punit_type, const action_id act_id, const enum citytile_type prop, const bool is_there)
Definition unittype.c:1124
utype_buy_gold_cost
int utype_buy_gold_cost(const struct city *pcity, const struct unit_type *punittype, int shields_in_stock)
Definition unittype.c:1492
unit_types_init
void unit_types_init(void)
Definition unittype.c:2346
can_unit_act_when_ustate_is
bool can_unit_act_when_ustate_is(const struct unit_type *punit_type, const enum ustate_prop prop, const bool is_there)
Definition unittype.c:943
uclass_name_translation
const char * uclass_name_translation(const struct unit_class *pclass)
Definition unittype.c:1632
set_unit_class_caches
void set_unit_class_caches(struct unit_class *pclass)
Definition unittype.c:2742
best_role_unit
struct unit_type * best_role_unit(const struct city *pcity, int role)
Definition unittype.c:2271
role_units_iterate
struct unit_type * role_units_iterate(int role, role_unit_callback cb, void *data)
Definition unittype.c:2217
utype_action_takes_all_mp
bool utype_action_takes_all_mp(const struct unit_type *putype, struct action *paction)
Definition unittype.c:1191
utype_veteran_name_translation
const char * utype_veteran_name_translation(const struct unit_type *punittype, int level)
Definition unittype.c:2598
unit_type_get
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
utype_has_class_flag
bool utype_has_class_flag(const struct unit_type *ptype, enum unit_class_flag_id flag)
Definition unittype.c:1657
uclass_has_flag
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
Definition unittype.h:766
user_unit_type_flags_init
void user_unit_type_flags_init(void)
Definition unittype.c:1864
utype_pays_mp_for_action_base
int utype_pays_mp_for_action_base(const struct action *paction, const struct unit_type *putype)
Definition unittype.c:1381
utype_player_already_has_this
bool utype_player_already_has_this(const struct player *pplayer, const struct unit_type *putype)
Definition unittype.c:1941
utype_can_freely_unload
bool utype_can_freely_unload(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
Definition unittype.c:300
unit_class_flag_helptxt
const char * unit_class_flag_helptxt(enum unit_class_flag_id id)
Definition unittype.c:1854
utype_pays_for_regular_move_to_tgt
bool utype_pays_for_regular_move_to_tgt(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1330
utype_class
#define utype_class(_t_)
Definition unittype.h:749
role_units_iterate_backwards
struct unit_type * role_units_iterate_backwards(int role, role_unit_callback cb, void *data)
Definition unittype.c:2236
utype_can_remove_extra
bool utype_can_remove_extra(const struct unit_type *putype, const struct extra_type *pextra)
Definition unittype.c:241
unit_build_shield_cost
int unit_build_shield_cost(const struct city *pcity, const struct unit *punit)
Definition unittype.c:1476
unit_name_translation
const char * unit_name_translation(const struct unit *punit)
Definition unittype.c:1569
unit_has_class_flag
bool unit_has_class_flag(const struct unit *punit, enum unit_class_flag_id flag)
Definition unittype.c:1649
can_player_build_unit_direct
bool can_player_build_unit_direct(const struct player *p, const struct unit_type *punittype, bool consider_reg_impr_req)
Definition unittype.c:1968
L_FIRST
#define L_FIRST
Definition unittype.h:349
utype_is_moved_to_tgt_by_action
bool utype_is_moved_to_tgt_by_action(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1249
is_tech_req_for_utype
bool is_tech_req_for_utype(const struct unit_type *ptype, struct advance *padv)
Definition unittype.c:2710
utype_upkeep_cost
int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer, Output_type_id otype)
Definition unittype.c:132
utype_move_type
enum unit_move_type utype_move_type(const struct unit_type *punittype)
Definition unittype.c:1551
first_role_unit_for_player
struct unit_type * first_role_unit_for_player(const struct player *pplayer, int role)
Definition unittype.c:2322
uclass_count
Unit_Class_id uclass_count(void)
Definition unittype.c:2445
utype_is_cityfounder
bool utype_is_cityfounder(const struct unit_type *utype)
Definition unittype.c:2951
unit_class_array_last
const struct unit_class * unit_class_array_last(void)
Definition unittype.c:2434
unit_type_by_rule_name
struct unit_type * unit_type_by_rule_name(const char *name)
Definition unittype.c:1767
get_role_unit
struct unit_type * get_role_unit(int role, int role_index)
Definition unittype.c:2253
unit_type_array_first
struct unit_type * unit_type_array_first(void)
Definition unittype.c:58
unit_class_flags_free
void unit_class_flags_free(void)
Definition unittype.c:2411
uclass_flag_is_in_use
bool uclass_flag_is_in_use(enum unit_class_flag_id ucflag)
Definition unittype.c:2967
unit_rule_name
const char * unit_rule_name(const struct unit *punit)
Definition unittype.c:1587
utype_has_role
bool utype_has_role(const struct unit_type *punittype, int role)
Definition unittype.c:199
set_unit_move_type
void set_unit_move_type(struct unit_class *puclass)
Definition unittype.c:2910
move_level
move_level
Definition unittype.h:144
MOVE_PARTIAL
@ MOVE_PARTIAL
Definition unittype.h:144
MOVE_FULL
@ MOVE_FULL
Definition unittype.h:144
MOVE_NONE
@ MOVE_NONE
Definition unittype.h:144
unit_type_action_cache_init
void unit_type_action_cache_init(void)
Definition unittype.c:931
utype_build_shield_cost_base
int utype_build_shield_cost_base(const struct unit_type *punittype)
Definition unittype.c:1468
set_unit_type_caches
void set_unit_type_caches(struct unit_type *ptype)
Definition unittype.c:2801
utype_may_act_move_frags
bool utype_may_act_move_frags(const struct unit_type *punit_type, const action_id act_id, const int move_fragments)
Definition unittype.c:1058
utype_veteran_system
const struct veteran_system * utype_veteran_system(const struct unit_type *punittype)
Definition unittype.c:2567
utype_is_consumed_by_action_result
bool utype_is_consumed_by_action_result(enum action_result result, const struct unit_type *utype)
Definition unittype.c:1229
num_role_units
int num_role_units(int role)
Definition unittype.c:2203
utype_player_already_has_this_unique
bool utype_player_already_has_this_unique(const struct player *pplayer, const struct unit_type *putype)
Definition unittype.c:1927
utype_has_flag
static bool utype_has_flag(const struct unit_type *punittype, int flag)
Definition unittype.h:617
unit_types_free
void unit_types_free(void)
Definition unittype.c:2385
utype_may_act_at_all
bool utype_may_act_at_all(const struct unit_type *putype)
Definition unittype.c:359
unit_build_shield_cost_base
int unit_build_shield_cost_base(const struct unit *punit)
Definition unittype.c:1484
can_upgrade_unittype
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1703
best_role_unit_for_player
struct unit_type * best_role_unit_for_player(const struct player *pplayer, int role)
Definition unittype.c:2297
role_unit_precalcs
void role_unit_precalcs(void)
Definition unittype.c:2175
uclass_by_number
struct unit_class * uclass_by_number(const Unit_Class_id id)
Definition unittype.c:2476
utype_can_create_extra
bool utype_can_create_extra(const struct unit_type *putype, const struct extra_type *pextra)
Definition unittype.c:217
utype_primary_tech_req
struct advance * utype_primary_tech_req(const struct unit_type *ptype)
Definition unittype.c:2696
utype_can_freely_load
bool utype_can_freely_load(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
Definition unittype.c:288
veteran_system_definition
void veteran_system_definition(struct veteran_system *vsystem, int level, const char *vlist_name, int vlist_power, int vlist_move, int vlist_raise, int vlist_wraise)
Definition unittype.c:2671
L_LAST
#define L_LAST
Definition unittype.h:439
utype_count
Unit_type_id utype_count(void)
Definition unittype.c:80
role_unit_callback
bool(* role_unit_callback)(struct unit_type *ptype, void *data)
Definition unittype.h:722
utype_veteran_levels
int utype_veteran_levels(const struct unit_type *punittype)
Definition unittype.c:2613
utype_pays_mp_for_action_estimate
int utype_pays_mp_for_action_estimate(const struct civ_map *nmap, const struct action *paction, const struct unit_type *putype, const struct player *act_player, const struct tile *act_tile, const struct tile *tgt_tile)
Definition unittype.c:1393
utype_can_do_act_when_ustate
bool utype_can_do_act_when_ustate(const struct unit_type *punit_type, const action_id act_id, const enum ustate_prop prop, const bool is_there)
Definition unittype.c:955
veteran_system_destroy
void veteran_system_destroy(struct veteran_system *vsystem)
Definition unittype.c:2658
utype_rule_name
const char * utype_rule_name(const struct unit_type *punittype)
Definition unittype.c:1578
unit_class_get
struct unit_class * unit_class_get(const struct unit *punit)
Definition unittype.c:2498
utype_can_do_action_result_when_ustate
bool utype_can_do_action_result_when_ustate(const struct unit_type *putype, enum action_result result, const enum ustate_prop prop, const bool is_there)
Definition unittype.c:975
utype_by_number
struct unit_type * utype_by_number(const Unit_type_id id)
Definition unittype.c:112
utype_can_do_action_result
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
Definition unittype.c:387
unit_has_type_role
bool unit_has_type_role(const struct unit *punit, enum unit_role_id role)
Definition unittype.c:208
utype_action_takes_all_mp_if_ustate_is
bool utype_action_takes_all_mp_if_ustate_is(const struct unit_type *putype, struct action *paction, const enum ustate_prop prop)
Definition unittype.c:1207
utype_veteran_level
const struct veteran_level * utype_veteran_level(const struct unit_type *punittype, int level)
Definition unittype.c:2583
unit_has_type_flag
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
Definition unittype.c:190
unit_can_take_over
bool unit_can_take_over(const struct unit *punit)
Definition unittype.c:264
unit_classes_free
void unit_classes_free(void)
Definition unittype.c:2528
unit_type_action_cache_set
void unit_type_action_cache_set(struct unit_type *ptype)
Definition unittype.c:915
uclass_rule_name
const char * uclass_rule_name(const struct unit_class *pclass)
Definition unittype.c:1641
utype_is_consumed_by_action
bool utype_is_consumed_by_action(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1219
unit_type_flags_free
void unit_type_flags_free(void)
Definition unittype.c:2399
U_LAST
#define U_LAST
Definition unittype.h:40
utype_number
Unit_type_id utype_number(const struct unit_type *punittype)
Definition unittype.c:100
utype_veteran_has_power_bonus
bool utype_veteran_has_power_bonus(const struct unit_type *punittype)
Definition unittype.c:2626
user_unit_class_flags_init
void user_unit_class_flags_init(void)
Definition unittype.c:1800
utype_can_act_if_tgt_diplrel_tile_other
bool utype_can_act_if_tgt_diplrel_tile_other(const struct unit_type *punit_type, const action_id act_id, const int prop, const bool is_there)
Definition unittype.c:1036
unit_class_by_rule_name
struct unit_class * unit_class_by_rule_name(const char *s)
Definition unittype.c:1784
unit_type_by_translated_name
struct unit_type * unit_type_by_translated_name(const char *name)
Definition unittype.c:1752
unit_type_flag_helptxt
const char * unit_type_flag_helptxt(enum unit_type_flag_id id)
Definition unittype.c:1917
utype_values_string
const char * utype_values_string(const struct unit_type *punittype)
Definition unittype.c:1596
uclass_index
#define uclass_index(_c_)
Definition unittype.h:742
utype_ai_data
void * utype_ai_data(const struct unit_type *ptype, const struct ai_type *ai)
Definition unittype.c:2725
unit_class_array_first
struct unit_class * unit_class_array_first(void)
Definition unittype.c:2423
utype_index
Unit_type_id utype_index(const struct unit_type *punittype)
Definition unittype.c:91
unit_classes_init
void unit_classes_init(void)
Definition unittype.c:2506
utype_flag_is_in_use
bool utype_flag_is_in_use(enum unit_type_flag_id uflag)
Definition unittype.c:2986
L_MAX
#define L_MAX
Definition unittype.h:443
utype_pop_value
int utype_pop_value(const struct unit_type *punittype, const struct city *pcity)
Definition unittype.c:1528
utype_can_take_over
bool utype_can_take_over(const struct unit_type *punittype)
Definition unittype.c:276
utype_set_ai_data
void utype_set_ai_data(struct unit_type *ptype, const struct ai_type *ai, void *data)
Definition unittype.c:2733
set_user_unit_class_flag_name
void set_user_unit_class_flag_name(enum unit_class_flag_id id, const char *name, const char *helptxt)
Definition unittype.c:1812
can_player_build_unit_later
bool can_player_build_unit_later(const struct player *p, const struct unit_type *punittype)
Definition unittype.c:2099
utype_build_shield_cost
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1438
unit_pop_value
int unit_pop_value(const struct unit *punit)
Definition unittype.c:1543
role_unit_precalcs_free
void role_unit_precalcs_free(void)
Definition unittype.c:2160
veteran_system_new
struct veteran_system * veteran_system_new(int count)
Definition unittype.c:2640
uclass_number
Unit_Class_id uclass_number(const struct unit_class *pclass)
Definition unittype.c:2467
can_player_build_unit_now
bool can_player_build_unit_now(const struct player *p, const struct unit_type *punittype)
Definition unittype.c:2078
utype_can_do_action_sub_result
bool utype_can_do_action_sub_result(const struct unit_type *putype, enum action_sub_result sub_result)
Definition unittype.c:408
utype_is_unmoved_by_action
bool utype_is_unmoved_by_action(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1288
utype_acts_hostile
bool utype_acts_hostile(const struct unit_type *putype)
Definition unittype.c:443
utype_can_do_act_if_tgt_citytile
bool utype_can_do_act_if_tgt_citytile(const struct unit_type *punit_type, const action_id act_id, const enum citytile_type prop, const bool is_there)
Definition unittype.c:996
utype_name_translation
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1560
can_utype_do_act_if_tgt_diplrel
bool can_utype_do_act_if_tgt_diplrel(const struct unit_type *punit_type, const action_id act_id, const int prop, const bool is_there)
Definition unittype.c:1017
utype_can_do_action
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:371
set_user_unit_type_flag_name
void set_user_unit_type_flag_name(enum unit_type_flag_id id, const char *name, const char *helptxt)
Definition unittype.c:1876
utype_happy_cost
int utype_happy_cost(const struct unit_type *ut, const struct player *pplayer)
Definition unittype.c:181
role_units_translations
bool role_units_translations(struct astring *astr, int flag, bool alts)
Definition unittype.c:1668
utype_values_translation
const char * utype_values_translation(const struct unit_type *punittype)
Definition unittype.c:1617
unit_type_array_last
const struct unit_type * unit_type_array_last(void)
Definition unittype.c:69
unit_upgrade_price
int unit_upgrade_price(const struct player *pplayer, const struct unit_type *from, const struct unit_type *to)
Definition unittype.c:1731