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
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. */
143
145
146struct extra_type_list;
147struct unit_class_list;
148
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 */
158
160
161 struct {
166
167 struct {
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
446
447/* Used in the network protocol. */
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
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
485
487 struct name_translation name; /* level/rank name */
488 int power_fact; /* combat/work speed/diplomatic power factor (in %) */
490 int base_raise_chance; /* server only */
491 int work_raise_chance; /* server only */
492};
493
499
500struct unit_type {
503 bool ruledit_disabled; /* Does not really exist - hole in units array */
512 int build_cost; /* Use wrappers to access this. */
513 int pop_cost; /* Number of workers the unit contains
514 * (e.g., settlers, engineers) */
518 int unknown_move_cost; /* See utype_unknown_move_cost(). */
519
521
524 int hp;
527
528#define U_NOT_OBSOLETED (NULL)
529 const struct unit_type *obsoleted_by;
530 const struct unit_type *converted_to;
532 int fuel;
533
536
537 int happy_cost; /* unhappy people in home city */
539
540 /* Only valid for ACTION_PARADROP* */
542
543 /* Additional values for the expanded veteran system */
545
546 /* Values for bombardment */
548
549 /* Values for founding cities */
551
553
555
557
559
560 /* Can attack these classes even if they are otherwise "Unreachable" */
562 /* Can load into these class transports at any location,
563 * even if they are otherwise "Unreachable". */
565 /* Can unload from these class transports at any location,
566 * even if they are otherwise "Unreachable". */
568
570
572
573 struct {
574 bool igwall;
575 bool worker;
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 */
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 */
587
589};
590
591/* General unit and unit type (matched) routines */
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**************************************************************************/
617static 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
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
639 const struct unit_type *ptranstype);
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);
647 enum action_result result);
650bool utype_acts_hostile(const struct unit_type *putype);
651
653 const enum ustate_prop prop,
654 const bool is_there);
656 const action_id act_id,
657 const enum ustate_prop prop,
658 const bool is_there);
660 enum action_result result,
661 const enum ustate_prop prop,
662 const bool is_there);
663
665 const action_id act_id,
666 const enum citytile_type prop,
667 const bool is_there);
668
670 const action_id act_id,
671 const int prop,
672 const bool is_there);
673
674bool
676 const action_id act_id,
677 const int prop,
678 const bool is_there);
679
681 const action_id act_id,
682 const int move_fragments);
683
685 const action_id act_id,
686 const enum citytile_type prop,
687 const bool is_there);
688
690 struct action *paction);
691
693 struct action *paction,
694 const enum ustate_prop prop);
695
697 const struct unit_type *utype);
698
700 const struct unit_type *utype);
701
703 const struct unit_type *utype);
704
705bool utype_is_unmoved_by_action(const struct action *paction,
706 const struct unit_type *utype);
707
709 const struct unit_type *utype);
710
712 const struct unit_type *putype);
713
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. */
722typedef 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);
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 */
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
745#endif /* uclass_index */
746
747struct unit_class *unit_class_get(const struct unit *punit);
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**************************************************************************/
766static 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
774 const char *name,
775 const char *helptxt);
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);
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 *
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);
798
799struct veteran_system *veteran_system_new(int count);
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
811
812/* player related unit functions */
813int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer,
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,
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
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
894
895/* Initialization and iteration */
896void unit_classes_init(void);
897void unit_classes_free(void);
898
901
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 */
#define BV_DEFINE(name, bits)
Definition bitvector.h:132
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
char * incite_cost
Definition comments.c:74
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
int Unit_Class_id
Definition fc_types.h:421
int action_id
Definition fc_types.h:392
#define MAX_LEN_NAME
Definition fc_types.h:66
int Unit_type_id
Definition fc_types.h:385
@ O_LAST
Definition fc_types.h:101
#define UCL_LAST
Definition fc_types.h:420
enum output_type_id Output_type_id
Definition fc_types.h:381
const char * name
Definition inputfile.c:127
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:235
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
Definition ai.h:50
Definition city.h:320
enum unit_type_flag_id flag
Definition unittype.h:467
enum combat_bonus_type type
Definition unittype.h:468
Definition tile.h:50
Unit_Class_id item_number
Definition unittype.h:150
int hp_loss_pct
Definition unittype.h:155
enum unit_move_type move_type
Definition unittype.h:153
int non_native_def_pct
Definition unittype.h:156
enum move_level sea_move
Definition unittype.h:163
struct unit_class::@85 adv
struct unit_class_list * subset_movers
Definition unittype.h:173
struct extra_type_list * refuel_extras
Definition unittype.h:168
struct extra_type_list * native_tile_extras
Definition unittype.h:169
int min_speed
Definition unittype.h:154
struct unit_class::@86 cache
struct extra_type_list * native_bases
Definition unittype.h:170
struct extra_type_list * bonus_roads
Definition unittype.h:171
int ferry_types
Definition unittype.h:164
struct name_translation name
Definition unittype.h:151
struct strvec * helptext
Definition unittype.h:159
bv_unit_class_flags flags
Definition unittype.h:157
bool ruledit_disabled
Definition unittype.h:152
struct extra_type_list * hiding_extras
Definition unittype.h:172
enum move_level land_move
Definition unittype.h:162
int transport_capacity
Definition unittype.h:523
int max_defense_mp_bonus_pct
Definition unittype.h:579
struct unit_type::@87 adv
struct unit_class * uclass
Definition unittype.h:556
int pop_cost
Definition unittype.h:513
void * ais[FREECIV_AI_MOD_LAST]
Definition unittype.h:588
struct requirement_vector build_reqs
Definition unittype.h:520
Unit_type_id item_number
Definition unittype.h:501
int defense_strength
Definition unittype.h:516
bv_unit_classes cargo
Definition unittype.h:558
int firepower
Definition unittype.h:525
int paratroopers_range
Definition unittype.h:541
char graphic_alt[MAX_LEN_NAME]
Definition unittype.h:506
bool worker
Definition unittype.h:575
char sound_move_alt[MAX_LEN_NAME]
Definition unittype.h:509
int build_cost
Definition unittype.h:512
int convert_time
Definition unittype.h:531
int city_size
Definition unittype.h:550
struct veteran_system * veteran
Definition unittype.h:544
const struct unit_type * obsoleted_by
Definition unittype.h:529
int vision_radius_sq
Definition unittype.h:522
int move_rate
Definition unittype.h:517
bv_unit_classes targets
Definition unittype.h:561
enum vision_layer vlayer
Definition unittype.h:569
struct strvec * helptext
Definition unittype.h:571
int bombard_rate
Definition unittype.h:547
char graphic_str[MAX_LEN_NAME]
Definition unittype.h:505
int city_slots
Definition unittype.h:552
int scramble_coeff[U_LAST]
Definition unittype.h:583
char sound_move[MAX_LEN_NAME]
Definition unittype.h:508
struct unit_type::@88 cache
char sound_fight_alt[MAX_LEN_NAME]
Definition unittype.h:511
bool igwall
Definition unittype.h:574
struct name_translation name
Definition unittype.h:502
bv_unit_type_roles roles
Definition unittype.h:535
enum transp_def_type tp_defense
Definition unittype.h:554
int unknown_move_cost
Definition unittype.h:518
int upkeep[O_LAST]
Definition unittype.h:538
char graphic_alt2[MAX_LEN_NAME]
Definition unittype.h:507
bv_unit_classes disembarks
Definition unittype.h:567
const struct unit_type * converted_to
Definition unittype.h:530
bv_unit_type_flags flags
Definition unittype.h:534
bool ruledit_disabled
Definition unittype.h:503
char sound_fight[MAX_LEN_NAME]
Definition unittype.h:510
bv_unit_classes embarks
Definition unittype.h:564
int attack_strength
Definition unittype.h:515
int happy_cost
Definition unittype.h:537
int defense_mp_bonuses_pct[U_LAST]
Definition unittype.h:582
struct combat_bonus_list * bonuses
Definition unittype.h:526
void * ruledit_dlg
Definition unittype.h:504
Definition unit.h:138
int base_raise_chance
Definition unittype.h:490
struct name_translation name
Definition unittype.h:487
int work_raise_chance
Definition unittype.h:491
struct veteran_level * definitions
Definition unittype.h:497
#define bool
Definition support.h:71
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
int utype_buy_gold_cost(const struct city *pcity, const struct unit_type *punittype, int shields_in_stock)
Definition unittype.c:1492
void unit_types_init(void)
Definition unittype.c:2346
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
const char * uclass_name_translation(const struct unit_class *pclass)
Definition unittype.c:1632
void set_unit_class_caches(struct unit_class *pclass)
Definition unittype.c:2742
struct unit_type * best_role_unit(const struct city *pcity, int role)
Definition unittype.c:2271
struct unit_type * role_units_iterate(int role, role_unit_callback cb, void *data)
Definition unittype.c:2217
bool utype_action_takes_all_mp(const struct unit_type *putype, struct action *paction)
Definition unittype.c:1191
const char * utype_veteran_name_translation(const struct unit_type *punittype, int level)
Definition unittype.c:2598
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
bool utype_has_class_flag(const struct unit_type *ptype, enum unit_class_flag_id flag)
Definition unittype.c:1657
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
Definition unittype.h:766
void user_unit_type_flags_init(void)
Definition unittype.c:1864
int utype_pays_mp_for_action_base(const struct action *paction, const struct unit_type *putype)
Definition unittype.c:1381
bool utype_player_already_has_this(const struct player *pplayer, const struct unit_type *putype)
Definition unittype.c:1941
bool utype_can_freely_unload(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
Definition unittype.c:300
const char * unit_class_flag_helptxt(enum unit_class_flag_id id)
Definition unittype.c:1854
bool utype_pays_for_regular_move_to_tgt(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1330
#define utype_class(_t_)
Definition unittype.h:749
struct unit_type * role_units_iterate_backwards(int role, role_unit_callback cb, void *data)
Definition unittype.c:2236
bool utype_can_remove_extra(const struct unit_type *putype, const struct extra_type *pextra)
Definition unittype.c:241
int unit_build_shield_cost(const struct city *pcity, const struct unit *punit)
Definition unittype.c:1476
const char * unit_name_translation(const struct unit *punit)
Definition unittype.c:1569
bool unit_has_class_flag(const struct unit *punit, enum unit_class_flag_id flag)
Definition unittype.c:1649
bool can_player_build_unit_direct(const struct player *p, const struct unit_type *punittype, bool consider_reg_impr_req)
Definition unittype.c:1968
#define L_FIRST
Definition unittype.h:349
bool utype_is_moved_to_tgt_by_action(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1249
bool is_tech_req_for_utype(const struct unit_type *ptype, struct advance *padv)
Definition unittype.c:2710
int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer, Output_type_id otype)
Definition unittype.c:132
enum unit_move_type utype_move_type(const struct unit_type *punittype)
Definition unittype.c:1551
struct unit_type * first_role_unit_for_player(const struct player *pplayer, int role)
Definition unittype.c:2322
Unit_Class_id uclass_count(void)
Definition unittype.c:2445
bool utype_is_cityfounder(const struct unit_type *utype)
Definition unittype.c:2951
const struct unit_class * unit_class_array_last(void)
Definition unittype.c:2434
struct unit_type * unit_type_by_rule_name(const char *name)
Definition unittype.c:1767
struct unit_type * get_role_unit(int role, int role_index)
Definition unittype.c:2253
struct unit_type * unit_type_array_first(void)
Definition unittype.c:58
void unit_class_flags_free(void)
Definition unittype.c:2411
bool uclass_flag_is_in_use(enum unit_class_flag_id ucflag)
Definition unittype.c:2967
const char * unit_rule_name(const struct unit *punit)
Definition unittype.c:1587
bool utype_has_role(const struct unit_type *punittype, int role)
Definition unittype.c:199
void set_unit_move_type(struct unit_class *puclass)
Definition unittype.c:2910
move_level
Definition unittype.h:144
@ MOVE_PARTIAL
Definition unittype.h:144
@ MOVE_FULL
Definition unittype.h:144
@ MOVE_NONE
Definition unittype.h:144
void unit_type_action_cache_init(void)
Definition unittype.c:931
int utype_build_shield_cost_base(const struct unit_type *punittype)
Definition unittype.c:1468
void set_unit_type_caches(struct unit_type *ptype)
Definition unittype.c:2801
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
const struct veteran_system * utype_veteran_system(const struct unit_type *punittype)
Definition unittype.c:2567
bool utype_is_consumed_by_action_result(enum action_result result, const struct unit_type *utype)
Definition unittype.c:1229
int num_role_units(int role)
Definition unittype.c:2203
bool utype_player_already_has_this_unique(const struct player *pplayer, const struct unit_type *putype)
Definition unittype.c:1927
static bool utype_has_flag(const struct unit_type *punittype, int flag)
Definition unittype.h:617
void unit_types_free(void)
Definition unittype.c:2385
bool utype_may_act_at_all(const struct unit_type *putype)
Definition unittype.c:359
int unit_build_shield_cost_base(const struct unit *punit)
Definition unittype.c:1484
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1703
struct unit_type * best_role_unit_for_player(const struct player *pplayer, int role)
Definition unittype.c:2297
void role_unit_precalcs(void)
Definition unittype.c:2175
struct unit_class * uclass_by_number(const Unit_Class_id id)
Definition unittype.c:2476
bool utype_can_create_extra(const struct unit_type *putype, const struct extra_type *pextra)
Definition unittype.c:217
struct advance * utype_primary_tech_req(const struct unit_type *ptype)
Definition unittype.c:2696
bool utype_can_freely_load(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
Definition unittype.c:288
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
#define L_LAST
Definition unittype.h:439
Unit_type_id utype_count(void)
Definition unittype.c:80
bool(* role_unit_callback)(struct unit_type *ptype, void *data)
Definition unittype.h:722
int utype_veteran_levels(const struct unit_type *punittype)
Definition unittype.c:2613
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
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
void veteran_system_destroy(struct veteran_system *vsystem)
Definition unittype.c:2658
const char * utype_rule_name(const struct unit_type *punittype)
Definition unittype.c:1578
struct unit_class * unit_class_get(const struct unit *punit)
Definition unittype.c:2498
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
struct unit_type * utype_by_number(const Unit_type_id id)
Definition unittype.c:112
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
Definition unittype.c:387
bool unit_has_type_role(const struct unit *punit, enum unit_role_id role)
Definition unittype.c:208
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
const struct veteran_level * utype_veteran_level(const struct unit_type *punittype, int level)
Definition unittype.c:2583
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
Definition unittype.c:190
bool unit_can_take_over(const struct unit *punit)
Definition unittype.c:264
void unit_classes_free(void)
Definition unittype.c:2528
void unit_type_action_cache_set(struct unit_type *ptype)
Definition unittype.c:915
const char * uclass_rule_name(const struct unit_class *pclass)
Definition unittype.c:1641
bool utype_is_consumed_by_action(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1219
void unit_type_flags_free(void)
Definition unittype.c:2399
#define U_LAST
Definition unittype.h:40
Unit_type_id utype_number(const struct unit_type *punittype)
Definition unittype.c:100
bool utype_veteran_has_power_bonus(const struct unit_type *punittype)
Definition unittype.c:2626
void user_unit_class_flags_init(void)
Definition unittype.c:1800
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
struct unit_class * unit_class_by_rule_name(const char *s)
Definition unittype.c:1784
struct unit_type * unit_type_by_translated_name(const char *name)
Definition unittype.c:1752
const char * unit_type_flag_helptxt(enum unit_type_flag_id id)
Definition unittype.c:1917
const char * utype_values_string(const struct unit_type *punittype)
Definition unittype.c:1596
#define uclass_index(_c_)
Definition unittype.h:742
void * utype_ai_data(const struct unit_type *ptype, const struct ai_type *ai)
Definition unittype.c:2725
struct unit_class * unit_class_array_first(void)
Definition unittype.c:2423
Unit_type_id utype_index(const struct unit_type *punittype)
Definition unittype.c:91
void unit_classes_init(void)
Definition unittype.c:2506
bool utype_flag_is_in_use(enum unit_type_flag_id uflag)
Definition unittype.c:2986
#define L_MAX
Definition unittype.h:443
int utype_pop_value(const struct unit_type *punittype, const struct city *pcity)
Definition unittype.c:1528
bool utype_can_take_over(const struct unit_type *punittype)
Definition unittype.c:276
void utype_set_ai_data(struct unit_type *ptype, const struct ai_type *ai, void *data)
Definition unittype.c:2733
void set_user_unit_class_flag_name(enum unit_class_flag_id id, const char *name, const char *helptxt)
Definition unittype.c:1812
bool can_player_build_unit_later(const struct player *p, const struct unit_type *punittype)
Definition unittype.c:2099
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1438
int unit_pop_value(const struct unit *punit)
Definition unittype.c:1543
void role_unit_precalcs_free(void)
Definition unittype.c:2160
struct veteran_system * veteran_system_new(int count)
Definition unittype.c:2640
Unit_Class_id uclass_number(const struct unit_class *pclass)
Definition unittype.c:2467
bool can_player_build_unit_now(const struct player *p, const struct unit_type *punittype)
Definition unittype.c:2078
bool utype_can_do_action_sub_result(const struct unit_type *putype, enum action_sub_result sub_result)
Definition unittype.c:408
bool utype_is_unmoved_by_action(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1288
bool utype_acts_hostile(const struct unit_type *putype)
Definition unittype.c:443
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
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1560
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
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:371
void set_user_unit_type_flag_name(enum unit_type_flag_id id, const char *name, const char *helptxt)
Definition unittype.c:1876
int utype_happy_cost(const struct unit_type *ut, const struct player *pplayer)
Definition unittype.c:181
bool role_units_translations(struct astring *astr, int flag, bool alts)
Definition unittype.c:1668
const char * utype_values_translation(const struct unit_type *punittype)
Definition unittype.c:1617
const struct unit_type * unit_type_array_last(void)
Definition unittype.c:69
int unit_upgrade_price(const struct player *pplayer, const struct unit_type *from, const struct unit_type *to)
Definition unittype.c:1731