31 #define U_LAST MAX_NUM_UNIT_TYPES
45 #define UNIT_MAX_PARADROP_RANGE (65535 - 1)
48 #define SPECENUM_NAME unit_class_flag_id
49 #define SPECENUM_VALUE0 UCF_TERRAIN_SPEED
50 #define SPECENUM_VALUE0NAME N_("?uclassflag:TerrainSpeed")
51 #define SPECENUM_VALUE1 UCF_TERRAIN_DEFENSE
52 #define SPECENUM_VALUE1NAME N_("?uclassflag:TerrainDefense")
53 #define SPECENUM_VALUE2 UCF_DAMAGE_SLOWS
54 #define SPECENUM_VALUE2NAME N_("?uclassflag:DamageSlows")
56 #define SPECENUM_VALUE3 UCF_CAN_OCCUPY_CITY
57 #define SPECENUM_VALUE3NAME N_("?uclassflag:CanOccupyCity")
58 #define SPECENUM_VALUE4 UCF_BUILD_ANYWHERE
59 #define SPECENUM_VALUE4NAME N_("?uclassflag:BuildAnywhere")
60 #define SPECENUM_VALUE5 UCF_UNREACHABLE
61 #define SPECENUM_VALUE5NAME N_("?uclassflag:Unreachable")
63 #define SPECENUM_VALUE6 UCF_COLLECT_RANSOM
64 #define SPECENUM_VALUE6NAME N_("?uclassflag:CollectRansom")
66 #define SPECENUM_VALUE7 UCF_ZOC
67 #define SPECENUM_VALUE7NAME N_("?uclassflag:ZOC")
69 #define SPECENUM_VALUE8 UCF_DOESNT_OCCUPY_TILE
70 #define SPECENUM_VALUE8NAME N_("?uclassflag:DoesntOccupyTile")
72 #define SPECENUM_VALUE9 UCF_ATTACK_NON_NATIVE
73 #define SPECENUM_VALUE9NAME N_("?uclassflag:AttackNonNative")
75 #define SPECENUM_VALUE10 UCF_KILLCITIZEN
76 #define SPECENUM_VALUE10NAME N_("?uclassflag:KillCitizen")
78 #define SPECENUM_VALUE11 UCF_USER_FLAG_1
79 #define SPECENUM_VALUE12 UCF_USER_FLAG_2
80 #define SPECENUM_VALUE13 UCF_USER_FLAG_3
81 #define SPECENUM_VALUE14 UCF_USER_FLAG_4
82 #define SPECENUM_VALUE15 UCF_USER_FLAG_5
83 #define SPECENUM_VALUE16 UCF_USER_FLAG_6
84 #define SPECENUM_VALUE17 UCF_USER_FLAG_7
85 #define SPECENUM_VALUE18 UCF_USER_FLAG_8
86 #define SPECENUM_VALUE19 UCF_USER_FLAG_9
87 #define SPECENUM_VALUE20 UCF_USER_FLAG_10
88 #define SPECENUM_VALUE21 UCF_USER_FLAG_11
89 #define SPECENUM_VALUE22 UCF_USER_FLAG_12
92 #define SPECENUM_COUNT UCF_COUNT
93 #define SPECENUM_NAMEOVERRIDE
94 #define SPECENUM_BITVECTOR bv_unit_class_flags
95 #include "specenum_gen.h"
97 #define UCF_LAST_USER_FLAG UCF_USER_FLAG_12
98 #define MAX_NUM_USER_UCLASS_FLAGS (UCF_LAST_USER_FLAG - UCF_USER_FLAG_1 + 1)
101 #define SPECENUM_NAME unit_move_type
102 #define SPECENUM_VALUE0 UMT_LAND
103 #define SPECENUM_VALUE0NAME "Land"
104 #define SPECENUM_VALUE1 UMT_SEA
105 #define SPECENUM_VALUE1NAME "Sea"
106 #define SPECENUM_VALUE2 UMT_BOTH
107 #define SPECENUM_VALUE2NAME "Both"
108 #include "specenum_gen.h"
117 struct extra_type_list;
118 struct unit_class_list;
156 #define SPECENUM_NAME unit_type_flag_id
158 #define SPECENUM_VALUE0 UTYF_RESERVED_2
159 #define SPECENUM_VALUE0NAME N_("Reserved 2")
161 #define SPECENUM_VALUE1 UTYF_NOZOC
162 #define SPECENUM_VALUE1NAME N_("?unitflag:HasNoZOC")
163 #define SPECENUM_VALUE2 UTYF_IGZOC
165 #define SPECENUM_VALUE2NAME N_("?unitflag:IgZOC")
166 #define SPECENUM_VALUE3 UTYF_CIVILIAN
167 #define SPECENUM_VALUE3NAME N_("?unitflag:NonMil")
168 #define SPECENUM_VALUE4 UTYF_IGTER
170 #define SPECENUM_VALUE4NAME N_("?unitflag:IgTer")
171 #define SPECENUM_VALUE5 UTYF_ONEATTACK
172 #define SPECENUM_VALUE5NAME N_("?unitflag:OneAttack")
173 #define SPECENUM_VALUE6 UTYF_FIELDUNIT
174 #define SPECENUM_VALUE6NAME N_("?unitflag:FieldUnit")
177 #define SPECENUM_VALUE7 UTYF_PROVOKING
178 #define SPECENUM_VALUE7NAME N_("?unitflag:Provoking")
180 #define SPECENUM_VALUE8 UTYF_NEVER_PROTECTS
181 #define SPECENUM_VALUE8NAME N_("?unitflag:NeverProtects")
183 #define SPECENUM_VALUE9 UTYF_SETTLERS
184 #define SPECENUM_VALUE9NAME N_("?unitflag:Settlers")
185 #define SPECENUM_VALUE10 UTYF_DIPLOMAT
186 #define SPECENUM_VALUE10NAME N_("?unitflag:Diplomat")
188 #define SPECENUM_VALUE11 UTYF_COAST_STRICT
189 #define SPECENUM_VALUE11NAME N_("?unitflag:CoastStrict")
191 #define SPECENUM_VALUE12 UTYF_COAST
192 #define SPECENUM_VALUE12NAME N_("?unitflag:Coast")
194 #define SPECENUM_VALUE13 UTYF_SHIELD2GOLD
195 #define SPECENUM_VALUE13NAME N_("?unitflag:Shield2Gold")
197 #define SPECENUM_VALUE14 UTYF_SPY
198 #define SPECENUM_VALUE14NAME N_("?unitflag:Spy")
200 #define SPECENUM_VALUE15 UTYF_ONLY_NATIVE_ATTACK
201 #define SPECENUM_VALUE15NAME N_("?unitflag:Only_Native_Attack")
203 #define SPECENUM_VALUE16 UTYF_FANATIC
204 #define SPECENUM_VALUE16NAME N_("?unitflag:Fanatic")
206 #define SPECENUM_VALUE17 UTYF_GAMELOSS
207 #define SPECENUM_VALUE17NAME N_("?unitflag:GameLoss")
209 #define SPECENUM_VALUE18 UTYF_UNIQUE
210 #define SPECENUM_VALUE18NAME N_("?unitflag:Unique")
214 #define SPECENUM_VALUE19 UTYF_EVAC_FIRST
215 #define SPECENUM_VALUE19NAME N_("?unitflag:EvacuateFirst")
217 #define SPECENUM_VALUE20 UTYF_SUPERSPY
218 #define SPECENUM_VALUE20NAME N_("?unitflag:SuperSpy")
220 #define SPECENUM_VALUE21 UTYF_NOHOME
221 #define SPECENUM_VALUE21NAME N_("?unitflag:NoHome")
223 #define SPECENUM_VALUE22 UTYF_NO_VETERAN
224 #define SPECENUM_VALUE22NAME N_("?unitflag:NoVeteran")
226 #define SPECENUM_VALUE23 UTYF_CITYBUSTER
227 #define SPECENUM_VALUE23NAME N_("?unitflag:CityBuster")
229 #define SPECENUM_VALUE24 UTYF_NOBUILD
230 #define SPECENUM_VALUE24NAME N_("?unitflag:NoBuild")
233 #define SPECENUM_VALUE25 UTYF_BADWALLATTACKER
234 #define SPECENUM_VALUE25NAME N_("?unitflag:BadWallAttacker")
236 #define SPECENUM_VALUE26 UTYF_BADCITYDEFENDER
237 #define SPECENUM_VALUE26NAME N_("?unitflag:BadCityDefender")
239 #define SPECENUM_VALUE27 UTYF_BARBARIAN_ONLY
240 #define SPECENUM_VALUE27NAME N_("?unitflag:BarbarianOnly")
242 #define SPECENUM_VALUE28 UTYF_RESERVED_1
243 #define SPECENUM_VALUE28NAME N_("Reserved 1")
246 #define SPECENUM_VALUE29 UTYF_NEWCITY_GAMES_ONLY
247 #define SPECENUM_VALUE29NAME N_("?unitflag:NewCityGamesOnly")
249 #define SPECENUM_VALUE30 UTYF_CANESCAPE
250 #define SPECENUM_VALUE30NAME N_("?unitflag:CanEscape")
252 #define SPECENUM_VALUE31 UTYF_CANKILLESCAPING
253 #define SPECENUM_VALUE31NAME N_("?unitflag:CanKillEscaping")
255 #define SPECENUM_VALUE32 UTYF_USER_FLAG_1
256 #define SPECENUM_VALUE33 UTYF_USER_FLAG_2
257 #define SPECENUM_VALUE34 UTYF_USER_FLAG_3
258 #define SPECENUM_VALUE35 UTYF_USER_FLAG_4
259 #define SPECENUM_VALUE36 UTYF_USER_FLAG_5
260 #define SPECENUM_VALUE37 UTYF_USER_FLAG_6
261 #define SPECENUM_VALUE38 UTYF_USER_FLAG_7
262 #define SPECENUM_VALUE39 UTYF_USER_FLAG_8
263 #define SPECENUM_VALUE40 UTYF_USER_FLAG_9
264 #define SPECENUM_VALUE41 UTYF_USER_FLAG_10
265 #define SPECENUM_VALUE42 UTYF_USER_FLAG_11
266 #define SPECENUM_VALUE43 UTYF_USER_FLAG_12
267 #define SPECENUM_VALUE44 UTYF_USER_FLAG_13
268 #define SPECENUM_VALUE45 UTYF_USER_FLAG_14
269 #define SPECENUM_VALUE46 UTYF_USER_FLAG_15
270 #define SPECENUM_VALUE47 UTYF_USER_FLAG_16
271 #define SPECENUM_VALUE48 UTYF_USER_FLAG_17
272 #define SPECENUM_VALUE49 UTYF_USER_FLAG_18
273 #define SPECENUM_VALUE50 UTYF_USER_FLAG_19
274 #define SPECENUM_VALUE51 UTYF_USER_FLAG_20
275 #define SPECENUM_VALUE52 UTYF_USER_FLAG_21
276 #define SPECENUM_VALUE53 UTYF_USER_FLAG_22
277 #define SPECENUM_VALUE54 UTYF_USER_FLAG_23
278 #define SPECENUM_VALUE55 UTYF_USER_FLAG_24
279 #define SPECENUM_VALUE56 UTYF_USER_FLAG_25
280 #define SPECENUM_VALUE57 UTYF_USER_FLAG_26
281 #define SPECENUM_VALUE58 UTYF_USER_FLAG_27
282 #define SPECENUM_VALUE59 UTYF_USER_FLAG_28
283 #define SPECENUM_VALUE60 UTYF_USER_FLAG_29
284 #define SPECENUM_VALUE61 UTYF_USER_FLAG_30
285 #define SPECENUM_VALUE62 UTYF_USER_FLAG_31
286 #define SPECENUM_VALUE63 UTYF_USER_FLAG_32
287 #define SPECENUM_VALUE64 UTYF_USER_FLAG_33
288 #define SPECENUM_VALUE65 UTYF_USER_FLAG_34
289 #define SPECENUM_VALUE66 UTYF_USER_FLAG_35
290 #define SPECENUM_VALUE67 UTYF_USER_FLAG_36
291 #define SPECENUM_VALUE68 UTYF_USER_FLAG_37
292 #define SPECENUM_VALUE69 UTYF_USER_FLAG_38
293 #define SPECENUM_VALUE70 UTYF_USER_FLAG_39
294 #define SPECENUM_VALUE71 UTYF_USER_FLAG_40
295 #define SPECENUM_VALUE72 UTYF_USER_FLAG_41
296 #define SPECENUM_VALUE73 UTYF_USER_FLAG_42
297 #define SPECENUM_VALUE74 UTYF_USER_FLAG_43
298 #define SPECENUM_VALUE75 UTYF_USER_FLAG_44
299 #define SPECENUM_VALUE76 UTYF_USER_FLAG_45
302 #define UTYF_LAST_USER_FLAG UTYF_USER_FLAG_45
303 #define MAX_NUM_USER_UNIT_FLAGS (UTYF_LAST_USER_FLAG - UTYF_USER_FLAG_1 + 1)
304 #define SPECENUM_NAMEOVERRIDE
305 #define SPECENUM_BITVECTOR bv_unit_type_flags
306 #include "specenum_gen.h"
319 #define L_FIRST (UTYF_LAST_USER_FLAG + 1)
321 #define SPECENUM_NAME unit_role_id
323 #define SPECENUM_VALUE77 L_FIRSTBUILD
324 #define SPECENUM_VALUE77NAME N_("?unitflag:FirstBuild")
326 #define SPECENUM_VALUE78 L_EXPLORER
327 #define SPECENUM_VALUE78NAME N_("?unitflag:Explorer")
329 #define SPECENUM_VALUE79 L_HUT
330 #define SPECENUM_VALUE79NAME N_("?unitflag:Hut")
332 #define SPECENUM_VALUE80 L_HUT_TECH
333 #define SPECENUM_VALUE80NAME N_("?unitflag:HutTech")
335 #define SPECENUM_VALUE81 L_PARTISAN
336 #define SPECENUM_VALUE81NAME N_("?unitflag:Partisan")
338 #define SPECENUM_VALUE82 L_DEFEND_OK
339 #define SPECENUM_VALUE82NAME N_("?unitflag:DefendOk")
341 #define SPECENUM_VALUE83 L_DEFEND_GOOD
342 #define SPECENUM_VALUE83NAME N_("?unitflag:DefendGood")
344 #define SPECENUM_VALUE84 L_FERRYBOAT
345 #define SPECENUM_VALUE84NAME N_("?unitflag:FerryBoat")
347 #define SPECENUM_VALUE85 L_BARBARIAN
348 #define SPECENUM_VALUE85NAME N_("?unitflag:Barbarian")
350 #define SPECENUM_VALUE86 L_BARBARIAN_TECH
351 #define SPECENUM_VALUE86NAME N_("?unitflag:BarbarianTech")
353 #define SPECENUM_VALUE87 L_BARBARIAN_BOAT
354 #define SPECENUM_VALUE87NAME N_("?unitflag:BarbarianBoat")
356 #define SPECENUM_VALUE88 L_BARBARIAN_BUILD
357 #define SPECENUM_VALUE88NAME N_("BarbarianBuild")
359 #define SPECENUM_VALUE89 L_BARBARIAN_BUILD_TECH
360 #define SPECENUM_VALUE89NAME N_("?unitflag:BarbarianBuildTech")
362 #define SPECENUM_VALUE90 L_BARBARIAN_LEADER
363 #define SPECENUM_VALUE90NAME N_("?unitflag:BarbarianLeader")
365 #define SPECENUM_VALUE91 L_BARBARIAN_SEA
366 #define SPECENUM_VALUE91NAME N_("?unitflag:BarbarianSea")
368 #define SPECENUM_VALUE92 L_BARBARIAN_SEA_TECH
369 #define SPECENUM_VALUE92NAME N_("?unitflag:BarbarianSeaTech")
371 #define SPECENUM_VALUE93 L_START_CITIES
372 #define SPECENUM_VALUE93NAME N_("?unitflag:CitiesStartunit")
374 #define SPECENUM_VALUE94 L_START_WORKER
375 #define SPECENUM_VALUE94NAME N_("?unitflag:WorkerStartunit")
377 #define SPECENUM_VALUE95 L_START_EXPLORER
378 #define SPECENUM_VALUE95NAME N_("?unitflag:ExplorerStartunit")
380 #define SPECENUM_VALUE96 L_START_KING
381 #define SPECENUM_VALUE96NAME N_("?unitflag:KingStartunit")
383 #define SPECENUM_VALUE97 L_START_DIPLOMAT
384 #define SPECENUM_VALUE97NAME N_("?unitflag:DiplomatStartunit")
386 #define SPECENUM_VALUE98 L_START_FERRY
387 #define SPECENUM_VALUE98NAME N_("?unitflag:FerryStartunit")
389 #define SPECENUM_VALUE99 L_START_DEFEND_OK
390 #define SPECENUM_VALUE99NAME N_("?unitflag:DefendOkStartunit")
392 #define SPECENUM_VALUE100 L_START_DEFEND_GOOD
393 #define SPECENUM_VALUE100NAME N_("?unitflag:DefendGoodStartunit")
395 #define SPECENUM_VALUE101 L_START_ATTACK_FAST
396 #define SPECENUM_VALUE101NAME N_("?unitflag:AttackFastStartunit")
398 #define SPECENUM_VALUE102 L_START_ATTACK_STRONG
399 #define SPECENUM_VALUE102NAME N_("?unitflag:AttackStrongStartunit")
401 #define SPECENUM_VALUE103 L_HUNTER
402 #define SPECENUM_VALUE103NAME N_("?unitflag:Hunter")
404 #define SPECENUM_VALUE104 L_SETTLERS
405 #define SPECENUM_VALUE104NAME N_("?unitflag:Settlers")
406 #define L_LAST (L_SETTLERS + 1)
408 #include "specenum_gen.h"
418 #define SPECENUM_NAME combat_bonus_type
419 #define SPECENUM_VALUE0 CBONUS_DEFENSE_MULTIPLIER
420 #define SPECENUM_VALUE0NAME "DefenseMultiplier"
421 #define SPECENUM_VALUE1 CBONUS_DEFENSE_DIVIDER
422 #define SPECENUM_VALUE1NAME "DefenseDivider"
423 #define SPECENUM_VALUE2 CBONUS_FIREPOWER1
424 #define SPECENUM_VALUE2NAME "Firepower1"
425 #define SPECENUM_VALUE3 CBONUS_DEFENSE_MULTIPLIER_PCT
426 #define SPECENUM_VALUE3NAME "DefenseMultiplierPct"
427 #define SPECENUM_VALUE4 CBONUS_DEFENSE_DIVIDER_PCT
428 #define SPECENUM_VALUE4NAME "DefenseDividerPct"
429 #include "specenum_gen.h"
432 enum unit_type_flag_id
flag;
433 enum combat_bonus_type
type;
441 #define SPECLIST_TAG combat_bonus
442 #define SPECLIST_TYPE struct combat_bonus
445 #define combat_bonus_list_iterate(bonuslist, pbonus) \
446 TYPED_LIST_ITERATE(struct combat_bonus, bonuslist, pbonus)
447 #define combat_bonus_list_iterate_end LIST_ITERATE_END
493 #define U_NOT_OBSOLETED (nullptr)
554 void *
ais[FREECIV_AI_MOD_LAST];
579 enum unit_type_flag_id flag);
595 const char *
name,
const char *helptxt);
610 enum action_result result);
614 const enum ustate_prop prop,
615 const bool is_there);
618 const enum ustate_prop prop,
619 const bool is_there);
623 const enum citytile_type prop,
624 const bool is_there);
628 const bool is_there);
632 const int move_fragments);
636 const enum citytile_type prop,
637 const bool is_there);
659 const struct player *act_player,
660 const struct tile *act_tile,
661 const struct tile *tgt_tile);
684 #define uclass_index(_c_) (_c_)->item_number
691 #define utype_class(_t_) (_t_)->uclass
705 enum unit_class_flag_id flag)
712 const char *
name,
const char *helptxt);
717 const struct unit *punit);
725 int shields_in_stock);
739 const char *vlist_name,
int vlist_power,
740 int vlist_move,
int vlist_raise,
753 const struct player *pplayer);
772 #define utype_fuel(ptype) (ptype)->fuel
785 #define unit_type_iterate(_p) \
787 struct unit_type *_p = unit_type_array_first(); \
788 if (nullptr != _p) { \
789 for (; _p <= unit_type_array_last(); _p++) {
791 #define unit_type_iterate_end \
796 #define unit_type_re_active_iterate(_p) \
797 unit_type_iterate(_p) \
799 if (!_p->ruledit_disabled) {
801 #define unit_type_re_active_iterate_end \
804 unit_type_iterate_end;
823 #define unit_class_iterate(_p) \
825 struct unit_class *_p = unit_class_array_first(); \
826 if (nullptr != _p) { \
827 for (; _p <= unit_class_array_last(); _p++) {
829 #define unit_class_iterate_end \
834 #define unit_class_re_active_iterate(_p) \
835 unit_class_iterate(_p) \
837 if (!_p->ruledit_disabled) {
839 #define unit_class_re_active_iterate_end \
842 unit_class_iterate_end;
844 #define SPECLIST_TAG unit_class
845 #define SPECLIST_TYPE struct unit_class
848 #define unit_class_list_iterate(uclass_list, pclass) \
849 TYPED_LIST_ITERATE(struct unit_class, uclass_list, pclass)
850 #define unit_class_list_iterate_end LIST_ITERATE_END
852 #define SPECLIST_TAG unit_type
853 #define SPECLIST_TYPE struct unit_type
856 #define unit_type_list_iterate(utype_list, ptype) \
857 TYPED_LIST_ITERATE(struct unit_type, utype_list, ptype)
858 #define unit_type_list_iterate_end LIST_ITERATE_END
bool BV_ISSET(const BV &bv, int bit)
enum output_type_id Output_type_id
struct setting_list * level[OLEVELS_NUM]
enum unit_type_flag_id flag
enum combat_bonus_type type
struct unit_class::@81 cache
Unit_Class_id item_number
enum unit_move_type move_type
struct unit_class::@80 adv
struct unit_class_list * subset_movers
struct extra_type_list * native_tile_extras
enum hut_behavior hut_behavior
struct extra_type_list * bonus_roads
QVector< QString > * helptext
struct extra_type_list * refuel_bases
struct name_translation name
bv_unit_class_flags flags
enum move_level land_move
struct unit_class * uclass
struct unit_type::@82 adv
void * ais[FREECIV_AI_MOD_LAST]
struct requirement_vector build_reqs
struct unit_type::@84 rscompat_cache
QVector< QString > * helptext
char graphic_alt[MAX_LEN_NAME]
char sound_move_alt[MAX_LEN_NAME]
struct veteran_system * veteran
const struct unit_type * obsoleted_by
struct advance * require_advance
struct unit_type::@83 cache
char graphic_str[MAX_LEN_NAME]
char sound_move[MAX_LEN_NAME]
char sound_fight_alt[MAX_LEN_NAME]
struct name_translation name
bv_unit_classes disembarks
const struct unit_type * converted_to
char sound_fight[MAX_LEN_NAME]
int defense_mp_bonuses_pct[U_LAST]
struct combat_bonus_list * bonuses
struct name_translation name
struct veteran_level * definitions
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)
Return TRUE iff the given (action enabler controlled) action may be performed by a unit of the given ...
int utype_buy_gold_cost(const struct city *pcity, const struct unit_type *punittype, int shields_in_stock)
Returns the amount of gold it takes to rush this unit.
bool can_unit_act_when_ustate_is(const struct unit_type *punit_type, const enum ustate_prop prop, const bool is_there)
Return TRUE iff there exists an (action enabler controlled) action that a unit of the type punit_type...
const struct unit_class * unit_class_array_last()
Return the last item of unit_classes.
const char * unit_rule_name(const struct unit *punit)
Return the (untranslated) rule name of the unit.
void set_unit_class_caches(struct unit_class *pclass)
Set caches for unit class.
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
struct unit_type * best_role_unit(const struct city *pcity, int role)
Return "best" unit this city can build, with given role/flag.
int utype_pop_value(const struct unit_type *punittype)
How much city shrinks when it builds unit of this type.
BV_DEFINE(bv_unit_classes, UCL_LAST)
const char * uclass_name_translation(const struct unit_class *pclass)
Return the (translated) name of the unit class.
static bool uclass_has_flag(const struct unit_class *punitclass, enum unit_class_flag_id flag)
int utype_pays_mp_for_action_base(const struct action *paction, const struct unit_type *putype)
Returns the amount of movement points successfully performing the specified action will consume in th...
struct unit_type * utype_by_number(const Unit_type_id id)
Return a pointer for the unit type struct for the given unit type id.
bool utype_can_freely_unload(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
Return TRUE iff the given cargo type has no restrictions on when it can unload from the given transpo...
bool utype_pays_for_regular_move_to_tgt(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff successfully performing the specified action always will cost the actor unit of the ...
const char * utype_values_translation(const struct unit_type *punittype)
Return string with translated unit name and list of its values.
int unit_build_shield_cost(const struct city *pcity, const struct unit *punit)
Returns the number of shields it takes to build this unit.
const char * unit_class_flag_helptxt(enum unit_class_flag_id id)
Return the (untranslated) help text of the user unit class flag.
struct unit_type * unit_type_array_first()
Return the first item of unit_types.
bool utype_is_moved_to_tgt_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff successfully performing the specified action always will move the actor unit of the ...
const struct unit_type * unit_type_array_last()
Return the last item of unit_types.
int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer, Output_type_id otype)
Returns the upkeep of a unit of this type under the given government.
enum unit_move_type utype_move_type(const struct unit_type *punittype)
Return move type of the unit type.
const char * utype_rule_name(const struct unit_type *punittype)
Return the (untranslated) rule name of the unit type.
struct unit_type * best_role_unit_for_player(const struct player *pplayer, int role)
Return "best" unit the player can build, with given role/flag.
bool utype_is_cityfounder(const struct unit_type *utype)
Is cityfounder type.
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
Return whether this player can upgrade this unit type (to any other unit type).
void unit_classes_init()
Initialize unit_class structures.
void unit_class_flags_free()
Frees the memory associated with all unit class flags.
bool utype_has_role(const struct unit_type *punittype, int role)
Return whether the given unit type has the role.
void set_unit_move_type(struct unit_class *puclass)
Set move_type for unit class.
int utype_build_shield_cost(const struct city *pcity, const struct unit_type *punittype)
Returns the number of shields it takes to build this unit type.
Unit_type_id utype_count()
Return the number of unit types.
int utype_build_shield_cost_base(const struct unit_type *punittype)
Returns the number of shields this unit type represents.
void set_unit_type_caches(struct unit_type *ptype)
Set caches for unit types.
const char * unit_type_flag_helptxt(enum unit_type_flag_id id)
Return the (untranslated) helptxt of the user unit flag.
bool utype_may_act_move_frags(const struct unit_type *punit_type, const action_id act_id, const int move_fragments)
Return TRUE iff the given (action enabler controlled) action may be performed by a unit of the given ...
bool utype_is_consumed_by_action_result(enum action_result result, const struct unit_type *utype)
Returns TRUE iff performing an action with the specified action result will consume an actor unit of ...
void user_unit_class_flags_init()
Initialize user unit class flags.
int num_role_units(int role)
How many unit types have specified role/flag.
bool utype_player_already_has_this_unique(const struct player *pplayer, const struct unit_type *putype)
Returns TRUE iff the unit type is unique and the player already has one.
static bool utype_has_flag(const struct unit_type *punittype, int flag)
bool utype_may_act_at_all(const struct unit_type *putype)
Return TRUE iff units of this type can do actions controlled by generalized (ruleset defined) action ...
int unit_build_shield_cost_base(const struct unit *punit)
Returns the number of shields this unit represents.
struct unit_class * unit_class_by_rule_name(const char *s)
Returns the unit class that has the given (untranslated) rule name.
struct veteran_system * veteran_system_new(int count)
Allocate new veteran system structure with given veteran level count.
bool utype_can_freely_load(const struct unit_type *pcargotype, const struct unit_type *ptranstype)
Return TRUE iff the given cargo type has no restrictions on when it can load onto the given transport...
void unit_classes_free()
Free resources allocated for unit classes.
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)
Fill veteran level in given veteran system with given information.
Unit_Class_id uclass_count()
Return the unit_class count.
struct unit_class * unit_class_get(const struct unit *punit)
Returns unit class pointer for a unit.
void unit_type_flags_free()
Frees the memory associated with all unit type flags.
const char * utype_values_string(const struct unit_type *punittype)
Return string describing unit type values.
bool(* role_unit_callback)(struct unit_type *ptype, void *data)
bool can_player_build_unit_direct(const struct player *p, const struct unit_type *punittype)
Whether player can build given unit somewhere, ignoring whether unit is obsolete and assuming the pla...
void role_unit_precalcs_free()
Free memory allocated by role_unit_precalcs().
int utype_veteran_levels(const struct unit_type *punittype)
Return veteran levels of the given unit type.
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)
Return TRUE iff the unit type can do the specified (action enabler controlled) action while its unit ...
void veteran_system_destroy(struct veteran_system *vsystem)
Free veteran system.
bool utype_can_do_action_result(const struct unit_type *putype, enum action_result result)
Return TRUE iff units of the given type can do any enabler controlled action with the specified actio...
bool unit_has_type_role(const struct unit *punit, enum unit_role_id role)
Return whether the unit has the given role.
bool role_units_translations(QString &astr, int flag, bool alts)
Return a string with all the names of units with this flag.
FC_STATIC_ASSERT(L_LAST - L_FIRST<=L_MAX, too_many_unit_roles)
const struct veteran_system * utype_veteran_system(const struct unit_type *punittype)
Return veteran system used for this unit type.
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
Return whether the unit has the given flag.
bool unit_can_take_over(const struct unit *punit)
Return whether the unit can take over enemy cities.
struct unit_type * unit_type_by_translated_name(const char *name)
Returns the unit type that has the given (translated) name.
void role_unit_precalcs()
Initialize; it is safe to call this multiple times (e.g., if units have changed due to rulesets in cl...
void unit_type_action_cache_set(struct unit_type *ptype)
Cache if any action may be possible for a unit of the type putype given the property tested for.
const char * utype_name_translation(const struct unit_type *punittype)
Return the (translated) name of the unit type.
void unit_types_init()
Inialize unit-type structures.
void user_unit_type_flags_init()
Initialize user unit type flags.
struct unit_class * uclass_by_number(const Unit_Class_id id)
Returns unit class pointer for an ID value.
int utype_pays_mp_for_action_estimate(const struct action *paction, const struct unit_type *putype, const struct player *act_player, const struct tile *act_tile, const struct tile *tgt_tile)
Returns an estimate of the amount of movement points successfully performing the specified action wil...
bool utype_is_consumed_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff performing the specified action will consume an actor unit of the specified type.
struct unit_type * unit_type_by_rule_name(const char *name)
Returns the unit type that has the given (untranslated) rule name.
Unit_type_id utype_number(const struct unit_type *punittype)
Return the unit type index.
bool utype_veteran_has_power_bonus(const struct unit_type *punittype)
Return whether this unit type's veteran system, if any, confers a power factor bonus at any level (it...
#define uclass_index(_c_)
struct unit_type * get_role_unit(int role, int role_index)
Return index-th unit with specified role/flag.
Unit_type_id utype_index(const struct unit_type *punittype)
Return the unit type index.
bool utype_can_take_over(const struct unit_type *punittype)
Return whether the unit type can take over enemy cities.
void utype_set_ai_data(struct unit_type *ptype, const struct ai_type *ai, void *data)
Attach ai data to unit type.
struct unit_class * unit_class_array_first()
Return the first item of unit_classes.
void set_user_unit_class_flag_name(enum unit_class_flag_id id, const char *name, const char *helptxt)
Sets user defined name for unit class flag.
const char * uclass_rule_name(const struct unit_class *pclass)
Return the (untranslated) rule name of the unit class.
const char * unit_name_translation(const struct unit *punit)
Return the (translated) name of the unit.
bool can_player_build_unit_later(const struct player *p, const struct unit_type *punittype)
Whether player can eventually build given unit somewhere – ie, returns TRUE if unit is available with...
int unit_pop_value(const struct unit *punit)
How much population is put to building this unit.
const char * utype_veteran_name_translation(const struct unit_type *punittype, int level)
Return translated name of the given veteran level.
Unit_Class_id uclass_number(const struct unit_class *pclass)
Return the unit_class index.
bool can_player_build_unit_now(const struct player *p, const struct unit_type *punittype)
Whether player can build given unit somewhere; returns FALSE if unit is obsolete.
void unit_types_free()
Frees the memory associated with all unit types.
bool utype_is_unmoved_by_action(const struct action *paction, const struct unit_type *utype)
Returns TRUE iff successfully performing the specified action never will move the actor unit from its...
bool utype_acts_hostile(const struct unit_type *putype)
Return TRUE iff units of this type can do hostile actions controlled by generalized (ruleset defined)...
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)
Returns TRUE iff the unit type can do the specified (action enabler controlled) action while its targ...
struct unit_type * first_role_unit_for_player(const struct player *pplayer, int role)
Return first unit the player can build, with given role/flag.
void unit_type_action_cache_init()
Cache what unit types may be allowed do what actions, both at all and when certain properties are tru...
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)
Return TRUE iff the given (action enabler controlled) action can be performed by a unit of the given ...
struct unit_type * role_units_iterate_backwards(int role, role_unit_callback cb, void *data)
Iterate over all the role units and feed them to callback, starting from the last one.
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Return TRUE iff units of the given type can do the specified generalized (ruleset defined) action ena...
void set_user_unit_type_flag_name(enum unit_type_flag_id id, const char *name, const char *helptxt)
Sets user defined name for unit flag.
const struct veteran_level * utype_veteran_level(const struct unit_type *punittype, int level)
Return veteran level properties of given unit in given veterancy level.
int utype_happy_cost(const struct unit_type *ut, const struct player *pplayer)
Return the "happy cost" (the number of citizens who are discontented) for this unit.
void * utype_ai_data(const struct unit_type *ptype, const struct ai_type *ai)
Return pointer to ai data of given unit type and ai type.
int unit_upgrade_price(const struct player *pplayer, const struct unit_type *from, const struct unit_type *to)
Return the cost (gold) of upgrading a single unit of the specified type to the new type.