Freeciv-3.3
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
177const char *unit_type_flag_id_name_update_cb(const char *old_name);
178
179/* Unit "special effects" flags:
180 * Note this is now an enumerated type, and not power-of-two integers
181 * for bits, though unit_type.flags is still a bitfield, and code
182 * which uses unit_has_type_flag() without twiddling bits is unchanged.
183 * (It is easier to go from i to (1<<i) than the reverse.)
184 * See data/classic/units.ruleset for documentation of their effects.
185 * Change the array *flag_names[] in unittype.c accordingly.
186 * Used in the network protocol.
187 */
188#define SPECENUM_NAME unit_type_flag_id
189/* Unit has no ZOC */
190#define SPECENUM_VALUE0 UTYF_NOZOC
191#define SPECENUM_VALUE0NAME N_("?unitflag:HasNoZOC")
192#define SPECENUM_VALUE1 UTYF_IGZOC
193/* TRANS: unit type flag (rarely shown): "ignore zones of control" */
194#define SPECENUM_VALUE1NAME N_("?unitflag:IgZOC")
195#define SPECENUM_VALUE2 UTYF_CIVILIAN
196#define SPECENUM_VALUE2NAME N_("?unitflag:NonMil")
197#define SPECENUM_VALUE3 UTYF_IGTER
198/* TRANS: unit type flag (rarely shown): "ignore terrain" */
199#define SPECENUM_VALUE3NAME N_("?unitflag:IgTer")
200#define SPECENUM_VALUE4 UTYF_FIELDUNIT
201#define SPECENUM_VALUE4NAME N_("?unitflag:FieldUnit")
202/* autoattack: a unit will choose to attack this unit even if defending
203 * against it has better odds. */
204#define SPECENUM_VALUE5 UTYF_PROVOKING
205#define SPECENUM_VALUE5NAME N_("?unitflag:Provoking")
206/* Overrides unreachable_protects server setting */
207#define SPECENUM_VALUE6 UTYF_NEVER_PROTECTS
208#define SPECENUM_VALUE6NAME N_("?unitflag:NeverProtects")
209/* Does not include ability to found cities */
210#define SPECENUM_VALUE7 UTYF_WORKERS
211#define SPECENUM_VALUE7NAME N_("?unitflag:Workers")
212#define SPECENUM_VALUE8 UTYF_DIPLOMAT
213#define SPECENUM_VALUE8NAME N_("?unitflag:Diplomat")
214/* Can't leave the coast */
215#define SPECENUM_VALUE9 UTYF_COAST_STRICT
216#define SPECENUM_VALUE9NAME N_("?unitflag:CoastStrict")
217/* Can 'refuel' at coast - meaningless if fuel value not set */
218#define SPECENUM_VALUE10 UTYF_COAST
219#define SPECENUM_VALUE10NAME N_("?unitflag:Coast")
220/* upkeep can switch from shield to gold */
221#define SPECENUM_VALUE11 UTYF_SHIELD2GOLD
222#define SPECENUM_VALUE11NAME N_("?unitflag:Shield2Gold")
223/* Strong in diplomatic battles. */
224#define SPECENUM_VALUE12 UTYF_SPY
225#define SPECENUM_VALUE12NAME N_("?unitflag:Spy")
226/* Cannot attack vs non-native tiles even if class can */
227#define SPECENUM_VALUE13 UTYF_ONLY_NATIVE_ATTACK
228#define SPECENUM_VALUE13NAME N_("?unitflag:Only_Native_Attack")
229/* Only Fundamentalist government can build these units */
230#define SPECENUM_VALUE14 UTYF_FANATIC
231#define SPECENUM_VALUE14NAME N_("?unitflag:Fanatic")
232/* Losing this unit means losing the game */
233#define SPECENUM_VALUE15 UTYF_GAMELOSS
234#define SPECENUM_VALUE15NAME N_("?unitflag:GameLoss")
235/* A player can only have one unit of this type */
236#define SPECENUM_VALUE16 UTYF_UNIQUE
237#define SPECENUM_VALUE16NAME N_("?unitflag:Unique")
238/* When a transport containing this unit disappears the game will try to
239 * rescue units with this flag before it tries to rescue units without
240 * it. */
241#define SPECENUM_VALUE17 UTYF_EVAC_FIRST
242#define SPECENUM_VALUE17NAME N_("?unitflag:EvacuateFirst")
243/* Always wins diplomatic contests */
244#define SPECENUM_VALUE18 UTYF_SUPERSPY
245#define SPECENUM_VALUE18NAME N_("?unitflag:SuperSpy")
246/* Has no homecity */
247#define SPECENUM_VALUE19 UTYF_NOHOME
248#define SPECENUM_VALUE19NAME N_("?unitflag:NoHome")
249/* Unreserved - clean out */
250#define SPECENUM_VALUE20 UTYF_UNRESERVED
251#define SPECENUM_VALUE20NAME "Unreserved"
252/* Gets double firepower against cities */
253#define SPECENUM_VALUE21 UTYF_CITYBUSTER
254#define SPECENUM_VALUE21NAME N_("?unitflag:CityBuster")
255/* Unit cannot be built (barb leader etc) */
256#define SPECENUM_VALUE22 UTYF_NOBUILD
257#define SPECENUM_VALUE22NAME N_("?unitflag:NoBuild")
258/* Firepower set to 1 when EFT_DEFEND_BONUS applies
259 * (for example, land unit attacking city with walls) */
260#define SPECENUM_VALUE23 UTYF_BADWALLATTACKER
261#define SPECENUM_VALUE23NAME N_("?unitflag:BadWallAttacker")
262/* Firepower set to 1 and attackers x2 when in city */
263#define SPECENUM_VALUE24 UTYF_BADCITYDEFENDER
264#define SPECENUM_VALUE24NAME N_("?unitflag:BadCityDefender")
265/* Only barbarians can build this unit */
266#define SPECENUM_VALUE25 UTYF_BARBARIAN_ONLY
267#define SPECENUM_VALUE25NAME N_("?unitflag:BarbarianOnly")
268/* Unit can't be built in scenarios where founding new cities is prevented. */
269#define SPECENUM_VALUE26 UTYF_NEWCITY_GAMES_ONLY
270#define SPECENUM_VALUE26NAME N_("?unitflag:NewCityGamesOnly")
271/* Can kill escaping units */
272#define SPECENUM_VALUE27 UTYF_CANKILLESCAPING
273#define SPECENUM_VALUE27NAME N_("?unitflag:CanKillEscaping")
274/* Makes random movement, not under player control */
275#define SPECENUM_VALUE28 UTYF_RANDOM_MOVEMENT
276#define SPECENUM_VALUE28NAME N_("?unitflag:RandomMovement")
277/* Do not show flag for the unit */
278#define SPECENUM_VALUE29 UTYF_FLAGLESS
279#define SPECENUM_VALUE29NAME N_("?unitflag:Flagless")
280#define SPECENUM_VALUE30 UTYF_PROVIDES_RANSOM
281#define SPECENUM_VALUE30NAME N_("?unitflag:ProvidesRansom")
282
283#define SPECENUM_VALUE31 UTYF_USER_FLAG_1
284#define SPECENUM_VALUE32 UTYF_USER_FLAG_2
285#define SPECENUM_VALUE33 UTYF_USER_FLAG_3
286#define SPECENUM_VALUE34 UTYF_USER_FLAG_4
287#define SPECENUM_VALUE35 UTYF_USER_FLAG_5
288#define SPECENUM_VALUE36 UTYF_USER_FLAG_6
289#define SPECENUM_VALUE37 UTYF_USER_FLAG_7
290#define SPECENUM_VALUE38 UTYF_USER_FLAG_8
291#define SPECENUM_VALUE39 UTYF_USER_FLAG_9
292#define SPECENUM_VALUE40 UTYF_USER_FLAG_10
293#define SPECENUM_VALUE41 UTYF_USER_FLAG_11
294#define SPECENUM_VALUE42 UTYF_USER_FLAG_12
295#define SPECENUM_VALUE43 UTYF_USER_FLAG_13
296#define SPECENUM_VALUE44 UTYF_USER_FLAG_14
297#define SPECENUM_VALUE45 UTYF_USER_FLAG_15
298#define SPECENUM_VALUE46 UTYF_USER_FLAG_16
299#define SPECENUM_VALUE47 UTYF_USER_FLAG_17
300#define SPECENUM_VALUE48 UTYF_USER_FLAG_18
301#define SPECENUM_VALUE49 UTYF_USER_FLAG_19
302#define SPECENUM_VALUE50 UTYF_USER_FLAG_20
303#define SPECENUM_VALUE51 UTYF_USER_FLAG_21
304#define SPECENUM_VALUE52 UTYF_USER_FLAG_22
305#define SPECENUM_VALUE53 UTYF_USER_FLAG_23
306#define SPECENUM_VALUE54 UTYF_USER_FLAG_24
307#define SPECENUM_VALUE55 UTYF_USER_FLAG_25
308#define SPECENUM_VALUE56 UTYF_USER_FLAG_26
309#define SPECENUM_VALUE57 UTYF_USER_FLAG_27
310#define SPECENUM_VALUE58 UTYF_USER_FLAG_28
311#define SPECENUM_VALUE59 UTYF_USER_FLAG_29
312#define SPECENUM_VALUE60 UTYF_USER_FLAG_30
313#define SPECENUM_VALUE61 UTYF_USER_FLAG_31
314#define SPECENUM_VALUE62 UTYF_USER_FLAG_32
315#define SPECENUM_VALUE63 UTYF_USER_FLAG_33
316#define SPECENUM_VALUE64 UTYF_USER_FLAG_34
317#define SPECENUM_VALUE65 UTYF_USER_FLAG_35
318#define SPECENUM_VALUE66 UTYF_USER_FLAG_36
319#define SPECENUM_VALUE67 UTYF_USER_FLAG_37
320#define SPECENUM_VALUE68 UTYF_USER_FLAG_38
321#define SPECENUM_VALUE69 UTYF_USER_FLAG_39
322#define SPECENUM_VALUE70 UTYF_USER_FLAG_40
323#define SPECENUM_VALUE71 UTYF_USER_FLAG_41
324#define SPECENUM_VALUE72 UTYF_USER_FLAG_42
325#define SPECENUM_VALUE73 UTYF_USER_FLAG_43
326#define SPECENUM_VALUE74 UTYF_USER_FLAG_44
327#define SPECENUM_VALUE75 UTYF_USER_FLAG_45
328#define SPECENUM_VALUE76 UTYF_USER_FLAG_46
329#define SPECENUM_VALUE77 UTYF_USER_FLAG_47
330#define SPECENUM_VALUE78 UTYF_USER_FLAG_48
331#define SPECENUM_VALUE79 UTYF_USER_FLAG_49
332#define SPECENUM_VALUE80 UTYF_USER_FLAG_50
333#define SPECENUM_VALUE81 UTYF_USER_FLAG_51
334#define SPECENUM_VALUE82 UTYF_USER_FLAG_52
335/* Note that first role must have value next to last flag */
336
337#define UTYF_LAST_USER_FLAG UTYF_USER_FLAG_52
338#define MAX_NUM_USER_UNIT_FLAGS (UTYF_LAST_USER_FLAG - UTYF_USER_FLAG_1 + 1)
339#define SPECENUM_NAMEOVERRIDE
340#define SPECENUM_NAME_UPDATER
341#define SPECENUM_BITVECTOR bv_unit_type_flags
342#include "specenum_gen.h"
343
344
345/* Unit "roles": these are similar to unit flags but differ in that
346 they don't represent intrinsic properties or abilities of units,
347 but determine which units are used (mainly by the server or AI)
348 in various circumstances, or "roles".
349 Note that in some cases flags can act as roles, eg, we don't need
350 a role for "workers", because we can just use UTYF_WORKERS.
351 (Now have to consider ACTION_FOUND_CITY too)
352 So we make sure flag values and role values are distinct,
353 so some functions can use them interchangably.
354 See data/classic/units.ruleset for documentation of their effects.
355*/
356#define L_FIRST (UTYF_LAST_USER_FLAG + 1)
357
358#define SPECENUM_NAME unit_role_id
359/* Built first when city established */
360#define SPECENUM_VALUE83 L_FIRSTBUILD
361#define SPECENUM_VALUE83NAME N_("?unitflag:FirstBuild")
362/* Explorer unit */
363#define SPECENUM_VALUE84 L_EXPLORER
364#define SPECENUM_VALUE84NAME N_("?unitflag:Explorer")
365/* Can be found in hut */
366#define SPECENUM_VALUE85 L_HUT
367#define SPECENUM_VALUE85NAME N_("?unitflag:Hut")
368/* Can be found in hut, tech required */
369#define SPECENUM_VALUE86 L_HUT_TECH
370#define SPECENUM_VALUE86NAME N_("?unitflag:HutTech")
371/* Created in Partisan circumstances */
372#define SPECENUM_VALUE87 L_PARTISAN
373#define SPECENUM_VALUE87NAME N_("?unitflag:Partisan")
374/* Ok on defense (AI) */
375#define SPECENUM_VALUE88 L_DEFEND_OK
376#define SPECENUM_VALUE88NAME N_("?unitflag:DefendOk")
377/* Primary purpose is defense (AI) */
378#define SPECENUM_VALUE89 L_DEFEND_GOOD
379#define SPECENUM_VALUE89NAME N_("?unitflag:DefendGood")
380/* Useful for ferrying (AI) */
381#define SPECENUM_VALUE90 L_FERRYBOAT
382#define SPECENUM_VALUE90NAME N_("?unitflag:FerryBoat")
383/* Barbarians unit, land only */
384#define SPECENUM_VALUE91 L_BARBARIAN
385#define SPECENUM_VALUE91NAME N_("?unitflag:Barbarian")
386/* Barbarians unit, global tech required */
387#define SPECENUM_VALUE92 L_BARBARIAN_TECH
388#define SPECENUM_VALUE92NAME N_("?unitflag:BarbarianTech")
389/* Barbarian boat */
390#define SPECENUM_VALUE93 L_BARBARIAN_BOAT
391#define SPECENUM_VALUE93NAME N_("?unitflag:BarbarianBoat")
392/* Barbarians boat, global tech required */
393#define SPECENUM_VALUE94 L_BARBARIAN_BOAT_TECH
394#define SPECENUM_VALUE94NAME N_("?unitflag:BarbarianBoatTech")
395/* What barbarians should build */
396#define SPECENUM_VALUE95 L_BARBARIAN_BUILD
397#define SPECENUM_VALUE95NAME N_("?unitflag:BarbarianBuild")
398/* Barbarians build when global tech */
399#define SPECENUM_VALUE96 L_BARBARIAN_BUILD_TECH
400#define SPECENUM_VALUE96NAME N_("?unitflag:BarbarianBuildTech")
401/* Barbarian leader */
402#define SPECENUM_VALUE97 L_BARBARIAN_LEADER
403#define SPECENUM_VALUE97NAME N_("?unitflag:BarbarianLeader")
404/* Sea raider unit */
405#define SPECENUM_VALUE98 L_BARBARIAN_SEA
406#define SPECENUM_VALUE98NAME N_("?unitflag:BarbarianSea")
407/* Sea raider unit, global tech required */
408#define SPECENUM_VALUE99 L_BARBARIAN_SEA_TECH
409#define SPECENUM_VALUE99NAME N_("?unitflag:BarbarianSeaTech")
410/* StartUnit: Cities */
411#define SPECENUM_VALUE100 L_START_CITIES
412#define SPECENUM_VALUE100NAME N_("?unitflag:CitiesStartUnit")
413/* StartUnit: Worker */
414#define SPECENUM_VALUE101 L_START_WORKER
415#define SPECENUM_VALUE101NAME N_("?unitflag:WorkerStartUnit")
416/* StartUnit: Explorer */
417#define SPECENUM_VALUE102 L_START_EXPLORER
418#define SPECENUM_VALUE102NAME N_("?unitflag:ExplorerStartUnit")
419/* StartUnit: King */
420#define SPECENUM_VALUE103 L_START_KING
421#define SPECENUM_VALUE103NAME N_("?unitflag:KingStartUnit")
422/* StartUnit: Diplomat */
423#define SPECENUM_VALUE104 L_START_DIPLOMAT
424#define SPECENUM_VALUE104NAME N_("?unitflag:DiplomatStartUnit")
425/* StartUnit: Ferryboat */
426#define SPECENUM_VALUE105 L_START_FERRY
427#define SPECENUM_VALUE105NAME N_("?unitflag:FerryStartUnit")
428/* StartUnit: DefendOk */
429#define SPECENUM_VALUE106 L_START_DEFEND_OK
430#define SPECENUM_VALUE106NAME N_("?unitflag:DefendOkStartUnit")
431/* StartUnit: DefendGood */
432#define SPECENUM_VALUE107 L_START_DEFEND_GOOD
433#define SPECENUM_VALUE107NAME N_("?unitflag:DefendGoodStartUnit")
434/* StartUnit: AttackFast */
435#define SPECENUM_VALUE108 L_START_ATTACK_FAST
436#define SPECENUM_VALUE108NAME N_("?unitflag:AttackFastStartUnit")
437/* StartUnit: AttackStrong */
438#define SPECENUM_VALUE109 L_START_ATTACK_STRONG
439#define SPECENUM_VALUE109NAME N_("?unitflag:AttackStrongStartUnit")
440/* AI hunter type unit */
441#define SPECENUM_VALUE110 L_HUNTER
442#define SPECENUM_VALUE110NAME N_("?unitflag:Hunter")
443/* Can improve terrain */
444#define SPECENUM_VALUE111 L_SETTLERS
445#define SPECENUM_VALUE111NAME N_("?unitflag:Settlers")
446#define L_LAST (L_SETTLERS + 1)
447
448#include "specenum_gen.h"
449
450#define L_MAX 64 /* Used in the network protocol. */
451
453
454/* Used in the network protocol. */
456
457/* Used in the network protocol. */
458#define SPECENUM_NAME combat_bonus_type
459#define SPECENUM_VALUE0 CBONUS_DEFENSE_MULTIPLIER
460#define SPECENUM_VALUE0NAME "DefenseMultiplier"
461#define SPECENUM_VALUE1 CBONUS_DEFENSE_DIVIDER
462#define SPECENUM_VALUE1NAME "DefenseDivider"
463#define SPECENUM_VALUE2 CBONUS_LOW_FIREPOWER
464#define SPECENUM_VALUE2NAME "LowFirepower"
465#define SPECENUM_VALUE3 CBONUS_DEFENSE_MULTIPLIER_PCT
466#define SPECENUM_VALUE3NAME "DefenseMultiplierPct"
467#define SPECENUM_VALUE4 CBONUS_DEFENSE_DIVIDER_PCT
468#define SPECENUM_VALUE4NAME "DefenseDividerPct"
469#define SPECENUM_VALUE5 CBONUS_SCRAMBLES_PCT
470#define SPECENUM_VALUE5NAME "CityDefensePct"
471#include "specenum_gen.h"
472
476 int value;
477
478 /* Not listed in the help text. */
479 bool quiet;
480};
481
482/* get 'struct combat_bonus_list' and related functions: */
483#define SPECLIST_TAG combat_bonus
484#define SPECLIST_TYPE struct combat_bonus
485#include "speclist.h"
486
487#define combat_bonus_list_iterate(bonuslist, pbonus) \
488 TYPED_LIST_ITERATE(struct combat_bonus, bonuslist, pbonus)
489#define combat_bonus_list_iterate_end LIST_ITERATE_END
490
492
494 struct name_translation name; /* level/rank name */
495 int power_fact; /* combat/work speed/diplomatic power factor (in %) */
497 int base_raise_chance; /* server only */
498 int work_raise_chance; /* server only */
499};
500
506
507struct unit_type {
510 bool ruledit_disabled; /* Does not really exist - hole in units array */
519 int build_cost; /* Use wrappers to access this. */
520 int pop_cost; /* Number of workers the unit contains
521 * (e.g., settlers, engineers) */
525 int unknown_move_cost; /* See utype_unknown_move_cost(). */
526
528
531 int hp;
534
535#define U_NOT_OBSOLETED (NULL)
536 const struct unit_type *obsoleted_by;
537 const struct unit_type *converted_to;
539 int fuel;
540
543
544 int happy_cost; /* unhappy people in home city */
546
547 /* Only valid for ACTION_PARADROP* */
549
550 /* Additional values for the expanded veteran system */
552
553 /* Values for bombardment */
555
556 /* Values for founding cities */
558
560
562
564
566
567 /* Can attack these classes even if they are otherwise "Unreachable" */
569 /* Can load into these class transports at any location,
570 * even if they are otherwise "Unreachable". */
572 /* Can unload from these class transports at any location,
573 * even if they are otherwise "Unreachable". */
575
577
579
580 struct {
581 bool igwall;
582 bool worker;
584
585 struct {
586 int max_defense_mp_bonus_pct; /* Value 0 here does not guarantee that unit
587 * never has CBONUS_DEFENSE_MULTIPLIER, it
588 * merely means that there's no POSITIVE one */
590 int scramble_coeff[U_LAST]; /* for scrambling units, 10000 x defense factor
591 * in cities (includes common type defense
592 * bonus multiplier), for other 0 */
594
596};
597
598/* General unit and unit type (matched) routines */
602
603const struct unit_type *unit_type_get(const struct unit *punit);
604struct unit_type *utype_by_number(const Unit_type_id id);
605
606struct unit_type *unit_type_by_rule_name(const char *name);
607struct unit_type *unit_type_by_translated_name(const char *name);
608
609const char *unit_rule_name(const struct unit *punit);
610const char *utype_rule_name(const struct unit_type *punittype);
611
612const char *unit_name_translation(const struct unit *punit);
613const char *utype_name_translation(const struct unit_type *punittype);
614
615const char *utype_values_string(const struct unit_type *punittype);
616const char *utype_values_translation(const struct unit_type *punittype);
617
618/* General unit type flag and role routines */
619bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag);
620
621/**************************************************************************
622 Return whether the given unit type has the flag.
623**************************************************************************/
624static inline bool utype_has_flag(const struct unit_type *punittype, int flag)
625{
626 return BV_ISSET(punittype->flags, flag);
627}
628
629bool unit_has_type_role(const struct unit *punit, enum unit_role_id role);
630bool utype_has_role(const struct unit_type *punittype, int role);
631
633void set_user_unit_type_flag_name(enum unit_type_flag_id id, const char *name,
634 const char *helptxt);
635const char *unit_type_flag_helptxt(enum unit_type_flag_id id);
636
637bool utype_can_create_extra(const struct unit_type *putype,
638 const struct extra_type *pextra);
639bool utype_can_remove_extra(const struct unit_type *putype,
640 const struct extra_type *pextra);
641
642bool unit_can_take_over(const struct unit *punit);
643bool utype_can_take_over(const struct unit_type *punittype);
644
646 const struct unit_type *ptranstype);
648 const struct unit_type *ptranstype);
649
650bool utype_may_act_at_all(const struct unit_type *putype);
651bool utype_can_do_action(const struct unit_type *putype,
652 const action_id act_id);
654 enum action_result result);
657bool utype_acts_hostile(const struct unit_type *putype);
658
660 const enum ustate_prop prop,
661 const bool is_there);
663 const action_id act_id,
664 const enum ustate_prop prop,
665 const bool is_there);
667 enum action_result result,
668 const enum ustate_prop prop,
669 const bool is_there);
670
672 const action_id act_id,
673 const enum citytile_type prop,
674 const bool is_there);
675
677 const action_id act_id,
678 const int prop,
679 const bool is_there);
680
681bool
683 const action_id act_id,
684 const int prop,
685 const bool is_there);
686
688 const action_id act_id,
689 const int move_fragments);
690
692 const action_id act_id,
693 const enum citytile_type prop,
694 const bool is_there);
695
697 struct action *paction);
698
700 struct action *paction,
701 const enum ustate_prop prop);
702
704 const struct unit_type *utype);
705
707 const struct unit_type *utype);
708
710 const struct unit_type *utype);
711
712bool utype_is_unmoved_by_action(const struct action *paction,
713 const struct unit_type *utype);
714
716 const struct unit_type *utype);
717
719 const struct unit_type *putype);
720
722 const struct action *paction,
723 const struct unit_type *putype,
724 const struct player *act_player,
725 const struct tile *act_tile,
726 const struct tile *tgt_tile);
727
728/* Functions to operate on various flag and roles. */
729typedef bool (*role_unit_callback)(struct unit_type *ptype, void *data);
730
731void role_unit_precalcs(void);
732void role_unit_precalcs_free(void);
733int num_role_units(int role);
734struct unit_type *role_units_iterate(int role, role_unit_callback cb, void *data);
736struct unit_type *get_role_unit(int role, int role_index);
737struct unit_type *best_role_unit(const struct city *pcity, int role);
738struct unit_type *best_role_unit_for_player(const struct player *pplayer,
739 int role);
740struct unit_type *first_role_unit_for_player(const struct player *pplayer,
741 int role);
742bool role_units_translations(struct astring *astr, int flag, bool alts);
743
744/* General unit class routines */
747/* Optimised to be identical to uclass_number: the implementation
748 * unittype.c is also semantically correct. */
749#define uclass_index(_c_) (_c_)->item_number
750#ifndef uclass_index
752#endif /* uclass_index */
753
754struct unit_class *unit_class_get(const struct unit *punit);
756#define utype_class(_t_) (_t_)->uclass
757#ifndef utype_class
758struct unit_class *utype_class(const struct unit_type *punittype);
759#endif /* utype_class */
760
761struct unit_class *unit_class_by_rule_name(const char *s);
762
763const char *uclass_rule_name(const struct unit_class *pclass);
764const char *uclass_name_translation(const struct unit_class *pclass);
765
766bool unit_has_class_flag(const struct unit *punit, enum unit_class_flag_id flag);
767bool utype_has_class_flag(const struct unit_type *ptype,
768 enum unit_class_flag_id flag);
769
770/**************************************************************************
771 Return whether the given unit class has the flag.
772**************************************************************************/
773static inline bool uclass_has_flag(const struct unit_class *punitclass,
774 enum unit_class_flag_id flag)
775{
776 return BV_ISSET(punitclass->flags, flag);
777}
778
781 const char *name,
782 const char *helptxt);
784
785/* Ancillary routines */
786int unit_build_shield_cost(const struct city *pcity, const struct unit *punit);
787int utype_build_shield_cost(const struct city *pcity,
788 const struct player *pplayer,
789 const struct unit_type *punittype);
791int unit_build_shield_cost_base(const struct unit *punit);
792
793int utype_buy_gold_cost(const struct city *pcity,
794 const struct unit_type *punittype,
795 int shields_in_stock);
796
797const struct veteran_system *
799int utype_veteran_levels(const struct unit_type *punittype);
800const struct veteran_level *
801 utype_veteran_level(const struct unit_type *punittype, int level);
802const char *utype_veteran_name_translation(const struct unit_type *punittype,
803 int level);
805
806struct veteran_system *veteran_system_new(int count);
809 const char *vlist_name, int vlist_power,
810 int vlist_move, int vlist_raise,
811 int vlist_wraise);
812
813int unit_pop_value(const struct unit *punit);
814int utype_pop_value(const struct unit_type *punittype, const struct city *pcity);
815
818
819/* player related unit functions */
820int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer,
822int utype_happy_cost(const struct unit_type *ut, const struct player *pplayer);
823
824const struct unit_type *can_upgrade_unittype(const struct player *pplayer,
825 const struct unit_type *punittype);
826int unit_upgrade_price(const struct player *pplayer,
827 const struct unit_type *from,
828 const struct unit_type *to);
829
830bool utype_player_already_has_this(const struct player *pplayer,
831 const struct unit_type *putype);
832bool utype_player_already_has_this_unique(const struct player *pplayer,
833 const struct unit_type *putype);
834
835bool can_player_build_unit_direct(const struct player *p,
836 const struct unit_type *punittype,
838bool can_player_build_unit_later(const struct player *p,
839 const struct unit_type *punittype);
840bool can_player_build_unit_now(const struct player *p,
841 const struct unit_type *punittype);
842
843#define utype_fuel(ptype) (ptype)->fuel
844
845bool utype_is_cityfounder(const struct unit_type *utype);
846
849
850/* Initialization and iteration */
851void unit_types_init(void);
852void unit_types_free(void);
853void unit_type_flags_free(void);
854void unit_class_flags_free(void);
855
856struct unit_type *unit_type_array_first(void);
857const struct unit_type *unit_type_array_last(void);
858
859#define unit_type_iterate(_p) \
860{ \
861 struct unit_type *_p = unit_type_array_first(); \
862 if (NULL != _p) { \
863 const struct unit_type *_end_##_p = unit_type_array_last(); \
864 for (; _p <= _end_##_p; _p++) {
865
866#define unit_type_iterate_end \
867 } \
868 } \
869}
870
871#define unit_type_re_active_iterate(_p) \
872 unit_type_iterate(_p) { \
873 if (!_p->ruledit_disabled) {
874
875#define unit_type_re_active_iterate_end \
876 } \
877 } unit_type_iterate_end;
878
879#define unit_tech_reqs_iterate(_utype_, _p) \
880do { \
881 requirement_vector_iterate(&(_utype_)->build_reqs, preq_##_p) { \
882 if (preq_##_p->source.kind == VUT_ADVANCE) { \
883 struct advance *_p = preq_##_p->source.value.advance;
884
885#define unit_tech_reqs_iterate_end \
886 } \
887 } requirement_vector_iterate_end; \
888} while (FALSE);
889
890/* Used on client to show just one req */
891struct advance *utype_primary_tech_req(const struct unit_type *ptype);
892bool is_tech_req_for_utype(const struct unit_type *ptype,
893 struct advance *padv);
894
895void *utype_ai_data(const struct unit_type *ptype, const struct ai_type *ai);
896void utype_set_ai_data(struct unit_type *ptype, const struct ai_type *ai,
897 void *data);
898
901
902/* Initialization and iteration */
903void unit_classes_init(void);
904void unit_classes_free(void);
905
908
910const struct unit_class *unit_class_array_last(void);
911
912#define unit_class_iterate(_p) \
913{ \
914 struct unit_class *_p = unit_class_array_first(); \
915 if (NULL != _p) { \
916 const struct unit_class *_end_##_p = unit_class_array_last(); \
917 for (; _p <= _end_##_p; _p++) {
918
919#define unit_class_iterate_end \
920 } \
921 } \
922}
923
924#define unit_class_re_active_iterate(_p) \
925 unit_class_iterate(_p) { \
926 if (!_p->ruledit_disabled) {
927
928#define unit_class_re_active_iterate_end \
929 } \
930 } unit_class_iterate_end;
931
932#define SPECLIST_TAG unit_class
933#define SPECLIST_TYPE struct unit_class
934#include "speclist.h"
935
936#define unit_class_list_iterate(uclass_list, pclass) \
937 TYPED_LIST_ITERATE(struct unit_class, uclass_list, pclass)
938#define unit_class_list_iterate_end LIST_ITERATE_END
939
940#define SPECLIST_TAG unit_type
941#define SPECLIST_TYPE struct unit_type
942#include "speclist.h"
943
944#define unit_type_list_iterate(utype_list, ptype) \
945 TYPED_LIST_ITERATE(struct unit_type, utype_list, ptype)
946#define unit_type_list_iterate_end LIST_ITERATE_END
947
948#ifdef __cplusplus
949}
950#endif /* __cplusplus */
951
952#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:420
int action_id
Definition fc_types.h:393
#define MAX_LEN_NAME
Definition fc_types.h:66
int Unit_type_id
Definition fc_types.h:386
@ O_LAST
Definition fc_types.h:101
#define UCL_LAST
Definition fc_types.h:419
enum output_type_id Output_type_id
Definition fc_types.h:382
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:474
enum combat_bonus_type type
Definition unittype.h:475
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:530
int max_defense_mp_bonus_pct
Definition unittype.h:586
struct unit_type::@87 adv
struct unit_class * uclass
Definition unittype.h:563
int pop_cost
Definition unittype.h:520
void * ais[FREECIV_AI_MOD_LAST]
Definition unittype.h:595
struct requirement_vector build_reqs
Definition unittype.h:527
Unit_type_id item_number
Definition unittype.h:508
int defense_strength
Definition unittype.h:523
bv_unit_classes cargo
Definition unittype.h:565
int firepower
Definition unittype.h:532
int paratroopers_range
Definition unittype.h:548
char graphic_alt[MAX_LEN_NAME]
Definition unittype.h:513
bool worker
Definition unittype.h:582
char sound_move_alt[MAX_LEN_NAME]
Definition unittype.h:516
int build_cost
Definition unittype.h:519
int convert_time
Definition unittype.h:538
int city_size
Definition unittype.h:557
struct veteran_system * veteran
Definition unittype.h:551
const struct unit_type * obsoleted_by
Definition unittype.h:536
int vision_radius_sq
Definition unittype.h:529
int move_rate
Definition unittype.h:524
bv_unit_classes targets
Definition unittype.h:568
enum vision_layer vlayer
Definition unittype.h:576
struct strvec * helptext
Definition unittype.h:578
int bombard_rate
Definition unittype.h:554
char graphic_str[MAX_LEN_NAME]
Definition unittype.h:512
int city_slots
Definition unittype.h:559
int scramble_coeff[U_LAST]
Definition unittype.h:590
char sound_move[MAX_LEN_NAME]
Definition unittype.h:515
struct unit_type::@88 cache
char sound_fight_alt[MAX_LEN_NAME]
Definition unittype.h:518
bool igwall
Definition unittype.h:581
struct name_translation name
Definition unittype.h:509
bv_unit_type_roles roles
Definition unittype.h:542
enum transp_def_type tp_defense
Definition unittype.h:561
int unknown_move_cost
Definition unittype.h:525
int upkeep[O_LAST]
Definition unittype.h:545
char graphic_alt2[MAX_LEN_NAME]
Definition unittype.h:514
bv_unit_classes disembarks
Definition unittype.h:574
const struct unit_type * converted_to
Definition unittype.h:537
bv_unit_type_flags flags
Definition unittype.h:541
bool ruledit_disabled
Definition unittype.h:510
char sound_fight[MAX_LEN_NAME]
Definition unittype.h:517
bv_unit_classes embarks
Definition unittype.h:571
int attack_strength
Definition unittype.h:522
int happy_cost
Definition unittype.h:544
int defense_mp_bonuses_pct[U_LAST]
Definition unittype.h:589
struct combat_bonus_list * bonuses
Definition unittype.h:533
void * ruledit_dlg
Definition unittype.h:511
Definition unit.h:140
int base_raise_chance
Definition unittype.h:497
struct name_translation name
Definition unittype.h:494
int work_raise_chance
Definition unittype.h:498
struct veteran_level * definitions
Definition unittype.h:504
#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:773
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:756
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:356
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
const char * unit_type_flag_id_name_update_cb(const char *old_name)
Definition unittype.c:3002
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:624
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:446
Unit_type_id utype_count(void)
Definition unittype.c:80
bool(* role_unit_callback)(struct unit_type *ptype, void *data)
Definition unittype.h:729
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:749
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:450
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