Freeciv-3.2
Loading...
Searching...
No Matches
aihunt.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2003 - The Freeciv Team
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
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "bitvector.h"
20#include "log.h"
21
22/* common */
23#include "city.h"
24#include "combat.h"
25#include "game.h"
26#include "map.h"
27#include "movement.h"
28#include "nation.h"
29#include "player.h"
30#include "unit.h"
31#include "unitlist.h"
32
33/* aicore */
34#include "pf_tools.h"
35
36/* server */
37#include "citytools.h"
38#include "srv_log.h"
39#include "unithand.h"
40#include "unittools.h"
41
42/* server/advisors */
43#include "advdata.h"
44#include "advgoto.h"
45#include "advtools.h"
46#include "autosettlers.h"
47
48/* ai */
49#include "handicaps.h"
50
51/* ai/default */
52#include "aitools.h"
53#include "daicity.h"
54#include "daiplayer.h"
55
56#include "aihunt.h"
57
58
59/**********************************************************************/
63static struct unit *dai_hunter_find(struct player *pplayer,
64 struct city *pcity)
65{
67 if (dai_hunter_qualify(pplayer, punit)) {
68 return punit;
69 }
72 if (dai_hunter_qualify(pplayer, punit)) {
73 return punit;
74 }
76
77 return NULL;
78}
79
80/**********************************************************************/
83static struct unit_type *dai_hunter_guess_best(struct city *pcity,
84 enum terrain_class tc,
85 struct ai_type *ait,
87{
88 struct unit_type *bestid = NULL;
89 int best = 0;
90 struct player *pplayer = city_owner(pcity);
91 const struct civ_map *nmap = &(wld.map);
92
94 struct unit_type_ai *utai = utype_ai_data(ut, ait);
95 int desire;
96
97 if (!allow_gold_upkeep && utype_upkeep_cost(ut, pplayer, O_GOLD) > 0) {
98 continue;
99 }
100
101 if (!can_city_build_unit_now(nmap, pcity, ut)
102 || ut->attack_strength < ut->transport_capacity
103 || (tc == TC_OCEAN && utype_class(ut)->adv.sea_move == MOVE_NONE)
104 || (tc == TC_LAND && utype_class(ut)->adv.land_move == MOVE_NONE)) {
105 continue;
106 }
107
108 desire = (ut->hp
109 * ut->attack_strength
110 * ut->firepower
111 * ut->move_rate
112 + ut->defense_strength) / MAX(UNITTYPE_COSTS(ut), 1);
113
114 if (utai->missile_platform) {
115 desire += desire / 6;
116 }
117
119 desire += desire / 2;
120 }
121 if (ut->vlayer == V_INVIS) {
122 desire += desire / 4;
123 }
125 desire -= desire / 4; /* less flexibility */
126 }
127 /* Causes continual unhappiness */
129 desire /= 2;
130 }
131
134 / MAX(pcity->surplus[O_SHIELD], 1)));
135
136 if (desire > best) {
137 best = desire;
138 bestid = ut;
139 }
141
142 return bestid;
143}
144
145/**********************************************************************/
148static void dai_hunter_missile_want(struct player *pplayer,
149 struct city *pcity,
150 struct adv_choice *choice)
151{
152 adv_want best = -1;
153 struct unit_type *best_unit_type = NULL;
154 struct unit *hunter = NULL;
155 const struct civ_map *nmap = &(wld.map);
156
158 if (dai_hunter_qualify(pplayer, punit)) {
163 hunter = punit;
164 break;
165 }
167 if (hunter) {
168 break;
169 }
170 }
172
173 if (!hunter) {
174 return;
175 }
176
178 int desire;
179
181 || !can_city_build_unit_now(nmap, pcity, ut)) {
182 continue;
183 }
184
186 continue;
187 }
188
189 /* FIXME: We need to store some data that can tell us if
190 * enemy transports are protected by anti-missile technology.
191 * In this case, want nuclear much more! */
192 desire = (ut->hp
193 * MIN(ut->attack_strength, 30) /* nuke fix */
194 * ut->firepower
195 * ut->move_rate) / UNITTYPE_COSTS(ut) + 1;
196
197 /* Causes continual unhappiness */
199 desire /= 2;
200 }
201
204 / MAX(pcity->surplus[O_SHIELD], 1)));
205
206 if (desire > best) {
207 best = desire;
209 }
211
212 if (best > choice->want) {
213 CITY_LOG(LOGLEVEL_HUNT, pcity,
214 "pri missile w/ want " ADV_WANT_PRINTF, best);
215 choice->value.utype = best_unit_type;
216 choice->want = best;
217 choice->type = CT_ATTACKER;
218 choice->need_boat = FALSE;
219 adv_choice_set_use(choice, "missile");
220 } else if (best >= 0) {
221 CITY_LOG(LOGLEVEL_HUNT, pcity, "not pri missile w/ want " ADV_WANT_PRINTF
222 "(old want " ADV_WANT_PRINTF ")", best, choice->want);
223 }
224}
225
226/**********************************************************************/
229static void eval_hunter_want(struct ai_type *ait, struct player *pplayer,
230 struct city *pcity,
231 struct adv_choice *choice,
232 struct unit_type *best_type,
233 int veteran)
234{
235 struct unit *virtualunit;
236 int want = 0;
237
239 want = dai_hunter_manage(ait, pplayer, virtualunit);
241 if (want > choice->want) {
242 CITY_LOG(LOGLEVEL_HUNT, pcity, "pri hunter w/ want %d", want);
243 choice->value.utype = best_type;
244 choice->want = want;
245 choice->type = CT_ATTACKER;
246 choice->need_boat = FALSE;
247 adv_choice_set_use(choice, "hunter");
248 }
249}
250
251/**********************************************************************/
254void dai_hunter_choice(struct ai_type *ait, struct player *pplayer,
255 struct city *pcity, struct adv_choice *choice,
257{
262 struct unit *hunter = dai_hunter_find(pplayer, pcity);
263
265 || is_barbarian(pplayer) || !pplayer->is_alive
266 || has_handicap(pplayer, H_TARGETS)) {
267 return; /* None available */
268 }
269 if (hunter) {
270 /* Maybe want missiles to go with a hunter instead? */
271 dai_hunter_missile_want(pplayer, pcity, choice);
272 return;
273 }
274
275 if (best_sea_hunter) {
277 ait, pplayer, pcity, choice, best_sea_hunter,
279 }
280 if (best_land_hunter) {
282 ait, pplayer, pcity, choice, best_land_hunter,
284 }
285}
286
287/**********************************************************************/
290bool dai_hunter_qualify(struct player *pplayer, struct unit *punit)
291{
292 if (is_barbarian(pplayer) || unit_owner(punit) != pplayer) {
293 return FALSE;
294 }
296 return TRUE;
297 }
298 return FALSE;
299}
300
301/**********************************************************************/
306static void dai_hunter_try_launch(struct ai_type *ait,
307 struct player *pplayer,
308 struct unit *punit,
309 struct unit *target)
310{
311 int target_sanity = target->id;
312 struct pf_parameter parameter;
313 struct pf_map *pfm;
314 const struct civ_map *nmap = &(wld.map);
315
316 /* Only directly transported units. Not launching cargo of cargo */
318 struct unit *sucker = NULL;
319
320 if (unit_owner(missile) == pplayer
323 UNIT_LOG(LOGLEVEL_HUNT, missile, "checking for hunt targets");
324 pft_fill_unit_parameter(&parameter, nmap, punit);
325 parameter.omniscience = !has_handicap(pplayer, H_MAP);
326 pfm = pf_map_new(&parameter);
327
328 pf_map_move_costs_iterate(pfm, ptile, move_cost, FALSE) {
329 if (move_cost > missile->moves_left / SINGLE_MOVE) {
330 break;
331 }
332 if (tile_city(ptile)
333 || !can_unit_attack_tile(punit, NULL, ptile)) {
334 continue;
335 }
336 unit_list_iterate(ptile->units, victim) {
337 enum diplstate_type ds =
339 const struct unit_type *ptype;
340 const struct unit_type *victim_type;
341
342 if (ds != DS_WAR) {
343 continue;
344 }
345 if (victim == target) {
346 sucker = victim;
347 UNIT_LOG(LOGLEVEL_HUNT, missile, "found primary target %d(%d, %d)"
348 " dist %d", victim->id, TILE_XY(unit_tile(victim)),
349 move_cost);
350 break; /* Our target! Get it!!! */
351 }
352
355
358 sucker = victim;
359 UNIT_LOG(LOGLEVEL_HUNT, missile, "found aux target %d(%d, %d)",
361 break;
362 }
364 if (sucker) {
365 break; /* Found something - kill it! */
366 }
369
370 if (sucker) {
373
375 missile, ptrans)) {
378 }
379 }
380
381 missile->goto_tile = unit_tile(sucker);
383 /* We survived; did they? */
386 unit_tile(missile))) {
388 }
389 }
391 return; /* Target killed */
392 }
393 }
394 } /* if */
396}
397
398/**********************************************************************/
401static void dai_hunter_juiciness(struct player *pplayer, struct unit *punit,
402 struct unit *target, unsigned *stackthreat,
403 unsigned *stackcost)
404{
405 *stackthreat = 0;
406 *stackcost = 0;
407
408 unit_list_iterate(unit_tile(target)->units, sucker) {
409 const struct unit_type *suck_type = unit_type_get(sucker);
410
413 *stackcost += 1000;
414 *stackthreat += 5000;
415 }
417 *stackthreat += 500; /* Extra threatening */
418 }
421
422 *stackthreat *= 9; /* WAG - reduced by distance later */
424}
425
426/**********************************************************************/
438int dai_hunter_manage(struct ai_type *ait, struct player *pplayer,
439 struct unit *punit)
440{
441 bool is_virtual = (punit->id == 0);
442 struct pf_parameter parameter;
443 struct pf_map *pfm;
444 int limit = unit_move_rate(punit) * 6;
445 struct unit_ai *unit_data = def_ai_unit_data(punit, ait);
447 unsigned original_threat = 0, original_cost = 0;
448 struct civ_map *nmap = &(wld.map);
449
450 fc_assert_ret_val(!is_barbarian(pplayer), 0);
451 fc_assert_ret_val(pplayer->is_alive, 0);
452
453 pft_fill_unit_parameter(&parameter, nmap, punit);
454 parameter.omniscience = !has_handicap(pplayer, H_MAP);
455 pfm = pf_map_new(&parameter);
456
457 if (original_target) {
460 }
461
462 pf_map_move_costs_iterate(pfm, ptile, move_cost, FALSE) {
463 /* End faster if we have a target */
464 if (move_cost > limit) {
465 UNIT_LOG(LOGLEVEL_HUNT, punit, "gave up finding hunt target");
467 return 0;
468 }
469
470 if (tile_city(ptile)
471 || !can_unit_attack_tile(punit, NULL, ptile)) {
472 continue;
473 }
474
475 unit_list_iterate_safe(ptile->units, target) {
476 struct player *aplayer = unit_owner(target);
477 int dist1, dist2;
478 unsigned stackthreat = 0, stackcost = 0;
479 int sanity_target = target->id;
480 struct pf_path *path;
481 struct unit_ai *target_data;
482 struct tile *target_tile;
483 struct unit *defender;
484
485 /* Note that we need not (yet) be at war with aplayer */
486 if (!adv_is_player_dangerous(pplayer, aplayer)) {
487 continue;
488 }
489
490 target_data = def_ai_unit_data(target, ait);
491 if (BV_ISSET(target_data->hunted, player_index(pplayer))) {
492 /* Can't hunt this one. The bit is cleared in the beginning
493 * of each turn. */
494 continue;
495 }
497 && get_transporter_capacity(target) == 0
498 && !unit_has_type_flag(target, UTYF_GAMELOSS)) {
499 /* Won't hunt this one. */
500 continue;
501 }
502
503 target_tile = unit_tile(target);
505 /* We can't attack the target */
506 continue;
507 }
508
509 /* Figure out whether unit is coming closer */
510 if (target_data->cur_pos && target_data->prev_pos) {
513 } else {
514 dist1 = dist2 = 0;
515 }
516 UNIT_LOG(LOGLEVEL_HUNT, punit, "considering chasing %s[%d](%d, %d) "
517 "dist1 %d dist2 %d",
518 unit_rule_name(target), target->id, TILE_XY(target_tile),
519 dist1, dist2);
520
521 /* We can't chase if we aren't faster or on intercept vector */
522 if (unit_type_get(punit)->move_rate < unit_type_get(target)->move_rate
523 && dist1 >= dist2) {
525 "giving up racing %s (%d, %d)->(%d, %d)",
526 unit_rule_name(target),
527 target_data->prev_pos
529 : -1,
530 target_data->prev_pos
532 : -1,
534 continue;
535 }
536
537 /* Calculate juiciness of target, compare with existing target,
538 * if any. */
539 dai_hunter_juiciness(pplayer, punit, target, &stackthreat, &stackcost);
540 defender = get_defender(nmap, punit, target_tile, NULL);
541 if (defender != NULL) {
542 stackcost *= unit_win_chance(nmap, punit, defender, NULL);
543 }
545 UNIT_LOG(LOGLEVEL_HUNT, punit, "%d is too expensive (it %d vs us %d)",
546 target->id, stackcost,
548 continue; /* Too expensive */
549 }
550 stackthreat /= move_cost + 1;
551 if (!is_virtual
552 && original_target != target
554 UNIT_LOG(LOGLEVEL_HUNT, punit, "Unit %d is not worse than %d",
555 target->id, original_target->id);
556 continue; /* The threat we found originally was worse than this! */
557 }
559 UNIT_LOG(LOGLEVEL_HUNT, punit, "%d is not worth it", target->id);
560 continue; /* Not worth it */
561 }
562
563 UNIT_LOG(LOGLEVEL_HUNT, punit, "hunting %s %s[%d](%d,%d) "
564 "with want %d, dist1 %d, dist2 %d",
566 unit_rule_name(target),
567 target->id,
570 dist1,
571 dist2);
572 /* Ok, now we FINALLY have a target worth destroying! */
573 unit_data->target = target->id;
574 if (is_virtual) {
576 return stackthreat;
577 }
578
579 /* This assigns missiles to us */
581
582 /* Check if we can nuke it */
583 dai_hunter_try_launch(ait, pplayer, punit, target);
584
585 /* Check if we have nuked it */
586 if (target != game_unit_by_number(sanity_target)) {
587 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished by cargo (pre)");
590 return -1; /* try again */
591 }
592
593 /* Go towards it. */
594 path = pf_map_path(pfm, target_tile);
595 if (!adv_unit_execute_path(punit, path)) {
596 pf_path_destroy(path);
598 return 0;
599 }
600 pf_path_destroy(path);
601
602 if (target != game_unit_by_number(sanity_target)) {
603 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished");
606 return -1; /* try again */
607 }
608
609 /* Check if we can nuke it now */
610 dai_hunter_try_launch(ait, pplayer, punit, target);
611 if (target != game_unit_by_number(sanity_target)) {
612 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished by cargo (post)");
615 return -1; /* try again */
616 }
617
619 unit_data->done = TRUE;
620 return stackthreat; /* still have work to do */
623
624 UNIT_LOG(LOGLEVEL_HUNT, punit, "ran out of map finding hunt target");
626 return 0; /* found nothing */
627}
bool is_action_enabled_unit_on_unit(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct unit *target_unit)
Definition actions.c:3918
#define adv_choice_set_use(_choice, _use)
Definition advchoice.h:85
@ CT_ATTACKER
Definition advchoice.h:40
bool adv_is_player_dangerous(struct player *pplayer, struct player *aplayer)
Definition advdata.c:1107
bool adv_unit_execute_path(struct unit *punit, struct pf_path *path)
Definition advgoto.c:82
adv_want amortize(adv_want benefit, int delay)
Definition advtools.c:29
static void dai_hunter_juiciness(struct player *pplayer, struct unit *punit, struct unit *target, unsigned *stackthreat, unsigned *stackcost)
Definition aihunt.c:401
static void eval_hunter_want(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, struct unit_type *best_type, int veteran)
Definition aihunt.c:229
static struct unit * dai_hunter_find(struct player *pplayer, struct city *pcity)
Definition aihunt.c:63
bool dai_hunter_qualify(struct player *pplayer, struct unit *punit)
Definition aihunt.c:290
static void dai_hunter_missile_want(struct player *pplayer, struct city *pcity, struct adv_choice *choice)
Definition aihunt.c:148
static struct unit_type * dai_hunter_guess_best(struct city *pcity, enum terrain_class tc, struct ai_type *ait, bool allow_gold_upkeep)
Definition aihunt.c:83
void dai_hunter_choice(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, bool allow_gold_upkeep)
Definition aihunt.c:254
int dai_hunter_manage(struct ai_type *ait, struct player *pplayer, struct unit *punit)
Definition aihunt.c:438
static void dai_hunter_try_launch(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct unit *target)
Definition aihunt.c:306
bool dai_unit_attack(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Definition aitools.c:818
bool dai_unit_goto(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Definition aitools.c:606
void dai_unit_new_task(struct ai_type *ait, struct unit *punit, enum ai_unit_task task, struct tile *ptile)
Definition aitools.c:644
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
int city_production_unit_veteran_level(struct city *pcity, const struct unit_type *punittype)
Definition city.c:804
bool can_city_build_unit_now(const struct civ_map *nmap, const struct city *pcity, const struct unit_type *punittype)
Definition city.c:947
#define city_owner(_pcity_)
Definition city.h:563
double unit_win_chance(const struct civ_map *nmap, const struct unit *attacker, const struct unit *defender, const struct action *paction)
Definition combat.c:478
enum unit_attack_result unit_attack_unit_at_tile_result(const struct unit *punit, const struct action *paction, const struct unit *pdefender, const struct tile *dest_tile)
Definition combat.c:122
struct unit * get_defender(const struct civ_map *nmap, const struct unit *attacker, const struct tile *ptile, const struct action *paction)
Definition combat.c:836
bool can_unit_attack_tile(const struct unit *punit, const struct action *paction, const struct tile *dest_tile)
Definition combat.c:311
char * incite_cost
Definition comments.c:75
static struct unit_ai * def_ai_unit_data(const struct unit *punit, struct ai_type *deftype)
Definition daiplayer.h:48
bool dai_unit_can_strike_my_unit(const struct unit *attacker, const struct unit *defender)
Definition daiunit.c:3443
@ AIUNIT_NONE
Definition daiunit.h:27
@ AIUNIT_HUNTER
Definition daiunit.h:29
#define DEFENSE_POWER(ptype)
Definition daiunit.h:66
#define ATTACK_POWER(ptype)
Definition daiunit.h:68
#define UNITTYPE_COSTS(ut)
Definition daiunit.h:75
struct unit struct city struct unit struct tile * target_tile
Definition dialogs_g.h:57
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
float adv_want
Definition fc_types.h:1354
#define ADV_WANT_PRINTF
Definition fc_types.h:1355
@ O_SHIELD
Definition fc_types.h:101
@ O_GOLD
Definition fc_types.h:101
struct world wld
Definition game.c:63
struct unit * game_unit_by_number(int id)
Definition game.c:116
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
Definition handicaps.c:66
@ H_MAP
Definition handicaps.h:28
@ H_TARGETS
Definition handicaps.h:24
#define fc_assert_ret_val(condition, val)
Definition log.h:194
bool is_tiles_adjacent(const struct tile *tile0, const struct tile *tile1)
Definition map.c:931
int real_map_distance(const struct tile *tile0, const struct tile *tile1)
Definition map.c:630
static int index_to_map_pos_y(int mindex)
Definition map.h:724
static int index_to_map_pos_x(int mindex)
Definition map.h:715
int unit_move_rate(const struct unit *punit)
Definition movement.c:90
bool can_unit_type_transport(const struct unit_type *transporter, const struct unit_class *transported)
Definition movement.c:868
bool can_attack_non_native(const struct unit_type *utype)
Definition movement.c:214
#define SINGLE_MOVE
Definition movement.h:26
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:138
struct nation_type * nation_of_unit(const struct unit *punit)
Definition nation.c:463
void pf_path_destroy(struct pf_path *path)
struct pf_map * pf_map_new(const struct pf_parameter *parameter)
struct pf_path * pf_map_path(struct pf_map *pfm, struct tile *ptile)
void pf_map_destroy(struct pf_map *pfm)
#define pf_map_move_costs_iterate_end
#define pf_map_move_costs_iterate(ARG_pfm, NAME_tile, NAME_cost, COND_from_start)
void pft_fill_unit_parameter(struct pf_parameter *parameter, const struct civ_map *nmap, const struct unit *punit)
Definition pf_tools.c:840
int player_index(const struct player *pplayer)
Definition player.c:829
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:324
static bool is_barbarian(const struct player *pplayer)
Definition player.h:489
#define MIN(x, y)
Definition shared.h:55
#define MAX(x, y)
Definition shared.h:54
#define CITY_LOG(loglevel, pcity, msg,...)
Definition srv_log.h:83
#define LOGLEVEL_HUNT
Definition srv_log.h:35
#define UNIT_LOG(loglevel, punit, msg,...)
Definition srv_log.h:98
enum choice_type type
Definition advchoice.h:46
adv_want want
Definition advchoice.h:48
universals_u value
Definition advchoice.h:47
bool need_boat
Definition advchoice.h:49
Definition ai.h:50
Definition city.h:320
int surplus[O_LAST]
Definition city.h:355
struct tile * tile
Definition city.h:322
struct unit_list * units_supported
Definition city.h:406
enum diplstate_type type
Definition player.h:197
bool is_alive
Definition player.h:266
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
Definition unit.h:138
int id
Definition unit.h:145
struct unit_list * transporting
Definition unit.h:184
int veteran
Definition unit.h:152
struct civ_map map
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_index(_pt_)
Definition tile.h:88
#define TILE_XY(ptile)
Definition tile.h:43
const struct unit_type * utype
Definition fc_types.h:721
struct unit * unit_transport_get(const struct unit *pcargo)
Definition unit.c:2441
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
Definition unit.c:1624
int get_transporter_capacity(const struct unit *punit)
Definition unit.c:297
void unit_virtual_destroy(struct unit *punit)
Definition unit.c:1729
bool unit_transported(const struct unit *pcargo)
Definition unit.c:2425
#define unit_tile(_pu)
Definition unit.h:397
#define unit_owner(_pu)
Definition unit.h:396
void unit_do_action(struct player *pplayer, const int actor_id, const int target_id, const int sub_tgt_id, const char *name, const action_id action_type)
Definition unithand.c:3293
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
#define unit_list_iterate_safe(unitlist, _unit)
Definition unitlist.h:39
#define unit_list_iterate_end
Definition unitlist.h:33
#define unit_list_iterate_safe_end
Definition unitlist.h:61
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer, Output_type_id otype)
Definition unittype.c:132
const char * unit_rule_name(const struct unit *punit)
Definition unittype.c:1587
int unit_build_shield_cost_base(const struct unit *punit)
Definition unittype.c:1484
bool unit_has_type_role(const struct unit *punit, enum unit_role_id role)
Definition unittype.c:208
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
Definition unittype.c:190
void * utype_ai_data(const struct unit_type *ptype, const struct ai_type *ai)
Definition unittype.c:2739
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1438
bool utype_acts_hostile(const struct unit_type *putype)
Definition unittype.c:443
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:371
#define utype_class(_t_)
Definition unittype.h:749
@ MOVE_NONE
Definition unittype.h:144
static bool utype_has_flag(const struct unit_type *punittype, int flag)
Definition unittype.h:617
#define unit_type_iterate(_p)
Definition unittype.h:855
#define unit_type_iterate_end
Definition unittype.h:862