Freeciv-3.3
Loading...
Searching...
No Matches
daihunter.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 "srv_log.h"
38#include "unithand.h"
39#include "unittools.h"
40
41/* server/advisors */
42#include "advdata.h"
43#include "advgoto.h"
44
45/* ai */
46#include "handicaps.h"
47
48/* ai/default */
49#include "daiplayer.h"
50#include "daitools.h"
51#include "daiunit.h"
52
53#include "daihunter.h"
54
55
56/**********************************************************************/
60static struct unit *dai_hunter_find(struct player *pplayer,
61 struct city *pcity)
62{
64 if (dai_hunter_qualify(pplayer, punit)) {
65 return punit;
66 }
69 if (dai_hunter_qualify(pplayer, punit)) {
70 return punit;
71 }
73
74 return NULL;
75}
76
77/**********************************************************************/
80static struct unit_type *dai_hunter_guess_best(struct city *pcity,
81 enum terrain_class tc,
82 struct ai_type *ait,
84{
85 struct unit_type *bestid = NULL;
86 int best = 0;
87 struct player *pplayer = city_owner(pcity);
88
90 struct unit_type_ai *utai = utype_ai_data(ut, ait);
91 int desire;
92
93 if (!allow_gold_upkeep && utype_upkeep_cost(ut, pplayer, O_GOLD) > 0) {
94 continue;
95 }
96
97 if (!can_city_build_unit_now(pcity, ut)
98 || ut->attack_strength < ut->transport_capacity
99 || (tc == TC_OCEAN && utype_class(ut)->adv.sea_move == MOVE_NONE)
100 || (tc == TC_LAND && utype_class(ut)->adv.land_move == MOVE_NONE)) {
101 continue;
102 }
103
104 desire = (ut->hp
105 * ut->attack_strength
106 * ut->firepower
107 * ut->move_rate
108 + ut->defense_strength) / MAX(UNITTYPE_COSTS(ut), 1);
109
110 if (utai->missile_platform) {
111 desire += desire / 6;
112 }
113
115 desire += desire / 2;
116 }
117 if (ut->vlayer == V_INVIS) {
118 desire += desire / 4;
119 }
121 desire -= desire / 4; /* less flexibility */
122 }
123 /* Causes continual unhappiness */
125 desire /= 2;
126 }
127
130 / MAX(pcity->surplus[O_SHIELD], 1)));
131
132 if (desire > best) {
133 best = desire;
134 bestid = ut;
135 }
137
138 return bestid;
139}
140
141/**********************************************************************/
144static void dai_hunter_missile_want(struct player *pplayer,
145 struct city *pcity,
146 struct adv_choice *choice)
147{
148 adv_want best = -1;
149 struct unit_type *best_unit_type = NULL;
150 struct unit *hunter = NULL;
151
153 if (dai_hunter_qualify(pplayer, punit)) {
158 hunter = punit;
159 break;
160 }
162 if (hunter) {
163 break;
164 }
165 }
167
168 if (!hunter) {
169 return;
170 }
171
173 int desire;
174
176 || !can_city_build_unit_now(pcity, ut)) {
177 continue;
178 }
179
181 continue;
182 }
183
184 /* FIXME: We need to store some data that can tell us if
185 * enemy transports are protected by anti-missile technology.
186 * In this case, want nuclear much more! */
187 desire = (ut->hp
188 * MIN(ut->attack_strength, 30) /* nuke fix */
189 * ut->firepower
190 * ut->move_rate) / UNITTYPE_COSTS(ut) + 1;
191
192 /* Causes continual unhappiness */
194 desire /= 2;
195 }
196
199 / MAX(pcity->surplus[O_SHIELD], 1)));
200
201 if (desire > best) {
202 best = desire;
204 }
206
207 if (best > choice->want) {
208 CITY_LOG(LOGLEVEL_HUNT, pcity,
209 "pri missile w/ want " ADV_WANT_PRINTF, best);
210 choice->value.utype = best_unit_type;
211 choice->want = best;
212 choice->type = CT_ATTACKER;
213 choice->need_boat = FALSE;
214 adv_choice_set_use(choice, "missile");
215 } else if (best >= 0) {
216 CITY_LOG(LOGLEVEL_HUNT, pcity, "not pri missile w/ want " ADV_WANT_PRINTF
217 "(old want " ADV_WANT_PRINTF ")", best, choice->want);
218 }
219}
220
221/**********************************************************************/
224static void eval_hunter_want(struct ai_type *ait, struct player *pplayer,
225 struct city *pcity,
226 struct adv_choice *choice,
227 struct unit_type *best_type,
228 int veteran)
229{
230 struct unit *virtualunit;
231 int want = 0;
232
234 want = dai_hunter_manage(ait, pplayer, virtualunit);
236 if (want > choice->want) {
237 CITY_LOG(LOGLEVEL_HUNT, pcity, "pri hunter w/ want %d", want);
238 choice->value.utype = best_type;
239 choice->want = want;
240 choice->type = CT_ATTACKER;
241 choice->need_boat = FALSE;
242 adv_choice_set_use(choice, "hunter");
243 }
244}
245
246/**********************************************************************/
249void dai_hunter_choice(struct ai_type *ait, struct player *pplayer,
250 struct city *pcity, struct adv_choice *choice,
252{
257 struct unit *hunter = dai_hunter_find(pplayer, pcity);
258
260 || is_barbarian(pplayer) || !pplayer->is_alive
261 || has_handicap(pplayer, H_TARGETS)) {
262 return; /* None available */
263 }
264 if (hunter) {
265 /* Maybe want missiles to go with a hunter instead? */
266 dai_hunter_missile_want(pplayer, pcity, choice);
267 return;
268 }
269
270 if (best_sea_hunter) {
272 ait, pplayer, pcity, choice, best_sea_hunter,
274 }
275 if (best_land_hunter) {
277 ait, pplayer, pcity, choice, best_land_hunter,
279 }
280}
281
282/**********************************************************************/
285bool dai_hunter_qualify(struct player *pplayer, struct unit *punit)
286{
287 if (is_barbarian(pplayer) || unit_owner(punit) != pplayer) {
288 return FALSE;
289 }
291 return TRUE;
292 }
293 return FALSE;
294}
295
296/**********************************************************************/
301static void dai_hunter_try_launch(struct ai_type *ait,
302 struct player *pplayer,
303 struct unit *punit,
304 struct unit *target)
305{
306 int target_sanity = target->id;
307 struct pf_parameter parameter;
308 struct pf_map *pfm;
309 const struct civ_map *nmap = &(wld.map);
310
311 /* Only directly transported units. Not launching cargo of cargo */
313 struct unit *sucker = NULL;
314
315 if (unit_owner(missile) == pplayer
318 UNIT_LOG(LOGLEVEL_HUNT, missile, "checking for hunt targets");
319 pft_fill_unit_parameter(&parameter, nmap, punit);
320 parameter.omniscience = !has_handicap(pplayer, H_MAP);
321 pfm = pf_map_new(&parameter);
322
323 pf_map_move_costs_iterate(pfm, ptile, move_cost, FALSE) {
324 if (move_cost > missile->moves_left / SINGLE_MOVE) {
325 break;
326 }
327 if (tile_city(ptile)
328 || !can_unit_attack_tile(punit, NULL, ptile)) {
329 continue;
330 }
331 unit_list_iterate(ptile->units, victim) {
332 enum diplstate_type ds
334 const struct unit_type *ptype;
335 const struct unit_type *victim_type;
336
337 if (ds != DS_WAR) {
338 continue;
339 }
340 if (victim == target) {
341 sucker = victim;
342 UNIT_LOG(LOGLEVEL_HUNT, missile, "found primary target %d(%d, %d)"
343 " dist %d", victim->id, TILE_XY(unit_tile(victim)),
344 move_cost);
345 break; /* Our target! Get it!!! */
346 }
347
350
353 sucker = victim;
354 UNIT_LOG(LOGLEVEL_HUNT, missile, "found aux target %d(%d, %d)",
356 break;
357 }
359 if (sucker) {
360 break; /* Found something - kill it! */
361 }
364
365 if (sucker) {
368
370 missile, ptrans)) {
373 }
374 }
375
376 missile->goto_tile = unit_tile(sucker);
378 /* We survived; did they? */
381 unit_tile(missile))) {
383 }
384 }
386 return; /* Target killed */
387 }
388 }
389 } /* if */
391}
392
393/**********************************************************************/
396static void dai_hunter_juiciness(struct player *pplayer, struct unit *punit,
397 struct unit *target, unsigned *stackthreat,
398 unsigned *stackcost)
399{
400 *stackthreat = 0;
401 *stackcost = 0;
402
403 unit_list_iterate(unit_tile(target)->units, sucker) {
404 const struct unit_type *suck_type = unit_type_get(sucker);
405
408 *stackcost += 1000;
409 *stackthreat += 5000;
410 }
412 *stackthreat += 500; /* Extra threatening */
413 }
416
417 *stackthreat *= 9; /* WAG - reduced by distance later */
419}
420
421/**********************************************************************/
433int dai_hunter_manage(struct ai_type *ait, struct player *pplayer,
434 struct unit *punit)
435{
436 bool is_virtual = (punit->id == 0);
437 struct pf_parameter parameter;
438 struct pf_map *pfm;
439 int limit = unit_move_rate(punit) * 6;
440 struct unit_ai *unit_data = def_ai_unit_data(punit, ait);
442 unsigned original_threat = 0, original_cost = 0;
443 struct civ_map *nmap = &(wld.map);
444
445 fc_assert_ret_val(!is_barbarian(pplayer), 0);
446 fc_assert_ret_val(pplayer->is_alive, 0);
447
448 pft_fill_unit_parameter(&parameter, nmap, punit);
449 parameter.omniscience = !has_handicap(pplayer, H_MAP);
450 pfm = pf_map_new(&parameter);
451
452 if (original_target) {
455 }
456
457 pf_map_move_costs_iterate(pfm, ptile, move_cost, FALSE) {
458 /* End faster if we have a target */
459 if (move_cost > limit) {
460 UNIT_LOG(LOGLEVEL_HUNT, punit, "gave up finding hunt target");
462 return 0;
463 }
464
465 if (tile_city(ptile)
466 || !can_unit_attack_tile(punit, NULL, ptile)) {
467 continue;
468 }
469
470 unit_list_iterate_safe(ptile->units, target) {
471 struct player *aplayer = unit_owner(target);
472 int dist1, dist2;
473 unsigned stackthreat = 0, stackcost = 0;
474 int sanity_target = target->id;
475 struct pf_path *path;
476 struct unit_ai *target_data;
477 struct tile *target_tile;
478 struct unit *defender;
479
480 /* Note that we need not (yet) be at war with aplayer */
481 if (!adv_is_player_dangerous(pplayer, aplayer)) {
482 continue;
483 }
484
485 target_data = def_ai_unit_data(target, ait);
486 if (BV_ISSET(target_data->hunted, player_index(pplayer))) {
487 /* Can't hunt this one. The bit is cleared in the beginning
488 * of each turn. */
489 continue;
490 }
492 && get_transporter_capacity(target) == 0
493 && !unit_has_type_flag(target, UTYF_GAMELOSS)) {
494 /* Won't hunt this one. */
495 continue;
496 }
497
498 target_tile = unit_tile(target);
500 /* We can't attack the target */
501 continue;
502 }
503
504 /* Figure out whether unit is coming closer */
505 if (target_data->cur_pos && target_data->prev_pos) {
508 } else {
509 dist1 = dist2 = 0;
510 }
511 UNIT_LOG(LOGLEVEL_HUNT, punit, "considering chasing %s[%d](%d, %d) "
512 "dist1 %d dist2 %d",
513 unit_rule_name(target), target->id, TILE_XY(target_tile),
514 dist1, dist2);
515
516 /* We can't chase if we aren't faster or on intercept vector */
517 if (unit_type_get(punit)->move_rate < unit_type_get(target)->move_rate
518 && dist1 >= dist2) {
520 "giving up racing %s (%d, %d)->(%d, %d)",
521 unit_rule_name(target),
522 target_data->prev_pos
524 : -1,
525 target_data->prev_pos
527 : -1,
529 continue;
530 }
531
532 /* Calculate juiciness of target, compare with existing target,
533 * if any. */
534 dai_hunter_juiciness(pplayer, punit, target, &stackthreat, &stackcost);
535 defender = get_defender(nmap, punit, target_tile, NULL);
536 if (defender != NULL) {
537 stackcost *= unit_win_chance(nmap, punit, defender, NULL);
538 }
540 UNIT_LOG(LOGLEVEL_HUNT, punit, "%d is too expensive (it %d vs us %d)",
541 target->id, stackcost,
543 continue; /* Too expensive */
544 }
545 stackthreat /= move_cost + 1;
546 if (!is_virtual
547 && original_target != target
549 UNIT_LOG(LOGLEVEL_HUNT, punit, "Unit %d is not worse than %d",
550 target->id, original_target->id);
551 continue; /* The threat we found originally was worse than this! */
552 }
554 UNIT_LOG(LOGLEVEL_HUNT, punit, "%d is not worth it", target->id);
555 continue; /* Not worth it */
556 }
557
558 UNIT_LOG(LOGLEVEL_HUNT, punit, "hunting %s %s[%d](%d,%d) "
559 "with want %d, dist1 %d, dist2 %d",
561 unit_rule_name(target),
562 target->id,
565 dist1,
566 dist2);
567 /* Ok, now we FINALLY have a target worth destroying! */
568 unit_data->target = target->id;
569 if (is_virtual) {
571 return stackthreat;
572 }
573
574 /* This assigns missiles to us */
576
577 /* Check if we can nuke it */
578 dai_hunter_try_launch(ait, pplayer, punit, target);
579
580 /* Check if we have nuked it */
581 if (target != game_unit_by_number(sanity_target)) {
582 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished by cargo (pre)");
585 return -1; /* try again */
586 }
587
588 /* Go towards it. */
589 path = pf_map_path(pfm, target_tile);
590 if (!adv_unit_execute_path(punit, path)) {
591 pf_path_destroy(path);
593 return 0;
594 }
595 pf_path_destroy(path);
596
597 if (target != game_unit_by_number(sanity_target)) {
598 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished");
601 return -1; /* try again */
602 }
603
604 /* Check if we can nuke it now */
605 dai_hunter_try_launch(ait, pplayer, punit, target);
606 if (target != game_unit_by_number(sanity_target)) {
607 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished by cargo (post)");
610 return -1; /* try again */
611 }
612
614 unit_data->done = TRUE;
615 return stackthreat; /* still have work to do */
618
619 UNIT_LOG(LOGLEVEL_HUNT, punit, "ran out of map finding hunt target");
621 return 0; /* found nothing */
622}
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:3129
#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:1106
bool adv_unit_execute_path(struct unit *punit, struct pf_path *path)
Definition advgoto.c:86
adv_want amortize(adv_want benefit, int delay)
Definition advtools.c:29
#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 city *pcity, const struct unit_type *punittype)
Definition city.c:948
#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:480
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:123
struct unit * get_defender(const struct civ_map *nmap, const struct unit *attacker, const struct tile *ptile, const struct action *paction)
Definition combat.c:839
bool can_unit_attack_tile(const struct unit *punit, const struct action *paction, const struct tile *dest_tile)
Definition combat.c:312
char * incite_cost
Definition comments.c:74
static void dai_hunter_juiciness(struct player *pplayer, struct unit *punit, struct unit *target, unsigned *stackthreat, unsigned *stackcost)
Definition daihunter.c:396
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 daihunter.c:224
static struct unit * dai_hunter_find(struct player *pplayer, struct city *pcity)
Definition daihunter.c:60
bool dai_hunter_qualify(struct player *pplayer, struct unit *punit)
Definition daihunter.c:285
static void dai_hunter_missile_want(struct player *pplayer, struct city *pcity, struct adv_choice *choice)
Definition daihunter.c:144
static struct unit_type * dai_hunter_guess_best(struct city *pcity, enum terrain_class tc, struct ai_type *ait, bool allow_gold_upkeep)
Definition daihunter.c:80
void dai_hunter_choice(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, bool allow_gold_upkeep)
Definition daihunter.c:249
int dai_hunter_manage(struct ai_type *ait, struct player *pplayer, struct unit *punit)
Definition daihunter.c:433
static void dai_hunter_try_launch(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct unit *target)
Definition daihunter.c:301
static struct unit_ai * def_ai_unit_data(const struct unit *punit, struct ai_type *deftype)
Definition daiplayer.h:48
bool dai_unit_attack(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Definition daitools.c:815
bool dai_unit_goto(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Definition daitools.c:603
void dai_unit_new_task(struct ai_type *ait, struct unit *punit, enum ai_unit_task task, struct tile *ptile)
Definition daitools.c:641
bool dai_unit_can_strike_my_unit(const struct unit *attacker, const struct unit *defender)
Definition daiunit.c:3448
@ 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:1335
#define ADV_WANT_PRINTF
Definition fc_types.h:1336
@ O_SHIELD
Definition fc_types.h:101
@ O_GOLD
Definition fc_types.h:101
struct world wld
Definition game.c:62
struct unit * game_unit_by_number(int id)
Definition game.c:115
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:941
int real_map_distance(const struct tile *tile0, const struct tile *tile1)
Definition map.c:636
static int index_to_map_pos_y(int mindex)
Definition map.h:710
static int index_to_map_pos_x(int mindex)
Definition map.h:701
int unit_move_rate(const struct unit *punit)
Definition movement.c:89
bool can_unit_type_transport(const struct unit_type *transporter, const struct unit_class *transported)
Definition movement.c:869
bool can_attack_non_native(const struct unit_type *utype)
Definition movement.c:213
#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:843
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:491
#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:199
bool is_alive
Definition player.h:268
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
Definition unit.h:140
int id
Definition unit.h:147
struct unit_list * transporting
Definition unit.h:187
int veteran
Definition unit.h:154
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:89
#define TILE_XY(ptile)
Definition tile.h:43
const struct unit_type * utype
Definition fc_types.h:698
struct unit * unit_transport_get(const struct unit *pcargo)
Definition unit.c:2499
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
Definition unit.c:1662
int get_transporter_capacity(const struct unit *punit)
Definition unit.c:300
void unit_virtual_destroy(struct unit *punit)
Definition unit.c:1767
bool unit_transported(const struct unit *pcargo)
Definition unit.c:2483
#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:3317
#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:2725
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:756
@ MOVE_NONE
Definition unittype.h:144
static bool utype_has_flag(const struct unit_type *punittype, int flag)
Definition unittype.h:624
#define unit_type_iterate(_p)
Definition unittype.h:859
#define unit_type_iterate_end
Definition unittype.h:866