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
93 struct unit_type_ai *utai = utype_ai_data(ut, ait);
94 int desire;
95
96 if (!allow_gold_upkeep && utype_upkeep_cost(ut, pplayer, O_GOLD) > 0) {
97 continue;
98 }
99
100 if (!can_city_build_unit_now(pcity, ut)
101 || ut->attack_strength < ut->transport_capacity
102 || (tc == TC_OCEAN && utype_class(ut)->adv.sea_move == MOVE_NONE)
103 || (tc == TC_LAND && utype_class(ut)->adv.land_move == MOVE_NONE)) {
104 continue;
105 }
106
107 desire = (ut->hp
108 * ut->attack_strength
109 * ut->firepower
110 * ut->move_rate
111 + ut->defense_strength) / MAX(UNITTYPE_COSTS(ut), 1);
112
113 if (utai->missile_platform) {
114 desire += desire / 6;
115 }
116
118 desire += desire / 2;
119 }
120 if (ut->vlayer == V_INVIS) {
121 desire += desire / 4;
122 }
124 desire -= desire / 4; /* less flexibility */
125 }
126 /* Causes continual unhappiness */
128 desire /= 2;
129 }
130
133 / MAX(pcity->surplus[O_SHIELD], 1)));
134
135 if (desire > best) {
136 best = desire;
137 bestid = ut;
138 }
140
141 return bestid;
142}
143
144/**********************************************************************/
147static void dai_hunter_missile_want(struct player *pplayer,
148 struct city *pcity,
149 struct adv_choice *choice)
150{
151 adv_want best = -1;
152 struct unit_type *best_unit_type = NULL;
153 struct unit *hunter = NULL;
154
156 if (dai_hunter_qualify(pplayer, punit)) {
161 hunter = punit;
162 break;
163 }
165 if (hunter) {
166 break;
167 }
168 }
170
171 if (!hunter) {
172 return;
173 }
174
176 int desire;
177
179 || !can_city_build_unit_now(pcity, ut)) {
180 continue;
181 }
182
184 continue;
185 }
186
187 /* FIXME: We need to store some data that can tell us if
188 * enemy transports are protected by anti-missile technology.
189 * In this case, want nuclear much more! */
190 desire = (ut->hp
191 * MIN(ut->attack_strength, 30) /* nuke fix */
192 * ut->firepower
193 * ut->move_rate) / UNITTYPE_COSTS(ut) + 1;
194
195 /* Causes continual unhappiness */
197 desire /= 2;
198 }
199
202 / MAX(pcity->surplus[O_SHIELD], 1)));
203
204 if (desire > best) {
205 best = desire;
207 }
209
210 if (best > choice->want) {
211 CITY_LOG(LOGLEVEL_HUNT, pcity,
212 "pri missile w/ want " ADV_WANT_PRINTF, best);
213 choice->value.utype = best_unit_type;
214 choice->want = best;
215 choice->type = CT_ATTACKER;
216 choice->need_boat = FALSE;
217 adv_choice_set_use(choice, "missile");
218 } else if (best >= 0) {
219 CITY_LOG(LOGLEVEL_HUNT, pcity, "not pri missile w/ want " ADV_WANT_PRINTF
220 "(old want " ADV_WANT_PRINTF ")", best, choice->want);
221 }
222}
223
224/**********************************************************************/
227static void eval_hunter_want(struct ai_type *ait, struct player *pplayer,
228 struct city *pcity,
229 struct adv_choice *choice,
230 struct unit_type *best_type,
231 int veteran)
232{
233 struct unit *virtualunit;
234 int want = 0;
235
237 want = dai_hunter_manage(ait, pplayer, virtualunit);
239 if (want > choice->want) {
240 CITY_LOG(LOGLEVEL_HUNT, pcity, "pri hunter w/ want %d", want);
241 choice->value.utype = best_type;
242 choice->want = want;
243 choice->type = CT_ATTACKER;
244 choice->need_boat = FALSE;
245 adv_choice_set_use(choice, "hunter");
246 }
247}
248
249/**********************************************************************/
252void dai_hunter_choice(struct ai_type *ait, struct player *pplayer,
253 struct city *pcity, struct adv_choice *choice,
255{
260 struct unit *hunter = dai_hunter_find(pplayer, pcity);
261
263 || is_barbarian(pplayer) || !pplayer->is_alive
264 || has_handicap(pplayer, H_TARGETS)) {
265 return; /* None available */
266 }
267 if (hunter) {
268 /* Maybe want missiles to go with a hunter instead? */
269 dai_hunter_missile_want(pplayer, pcity, choice);
270 return;
271 }
272
273 if (best_sea_hunter) {
275 ait, pplayer, pcity, choice, best_sea_hunter,
277 }
278 if (best_land_hunter) {
280 ait, pplayer, pcity, choice, best_land_hunter,
282 }
283}
284
285/**********************************************************************/
288bool dai_hunter_qualify(struct player *pplayer, struct unit *punit)
289{
290 if (is_barbarian(pplayer) || unit_owner(punit) != pplayer) {
291 return FALSE;
292 }
294 return TRUE;
295 }
296 return FALSE;
297}
298
299/**********************************************************************/
304static void dai_hunter_try_launch(struct ai_type *ait,
305 struct player *pplayer,
306 struct unit *punit,
307 struct unit *target)
308{
309 int target_sanity = target->id;
310 struct pf_parameter parameter;
311 struct pf_map *pfm;
312 const struct civ_map *nmap = &(wld.map);
313
314 /* Only directly transported units. Not launching cargo of cargo */
316 struct unit *sucker = NULL;
317
318 if (unit_owner(missile) == pplayer
321 UNIT_LOG(LOGLEVEL_HUNT, missile, "checking for hunt targets");
322 pft_fill_unit_parameter(&parameter, nmap, punit);
323 parameter.omniscience = !has_handicap(pplayer, H_MAP);
324 pfm = pf_map_new(&parameter);
325
326 pf_map_move_costs_iterate(pfm, ptile, move_cost, FALSE) {
327 if (move_cost > missile->moves_left / SINGLE_MOVE) {
328 break;
329 }
330 if (tile_city(ptile)
331 || !can_unit_attack_tile(punit, NULL, ptile)) {
332 continue;
333 }
334 unit_list_iterate(ptile->units, victim) {
335 enum diplstate_type ds =
337 const struct unit_type *ptype;
338 const struct unit_type *victim_type;
339
340 if (ds != DS_WAR) {
341 continue;
342 }
343 if (victim == target) {
344 sucker = victim;
345 UNIT_LOG(LOGLEVEL_HUNT, missile, "found primary target %d(%d, %d)"
346 " dist %d", victim->id, TILE_XY(unit_tile(victim)),
347 move_cost);
348 break; /* Our target! Get it!!! */
349 }
350
353
356 sucker = victim;
357 UNIT_LOG(LOGLEVEL_HUNT, missile, "found aux target %d(%d, %d)",
359 break;
360 }
362 if (sucker) {
363 break; /* Found something - kill it! */
364 }
367
368 if (sucker) {
371
373 missile, ptrans)) {
376 }
377 }
378
379 missile->goto_tile = unit_tile(sucker);
381 /* We survived; did they? */
384 unit_tile(missile))) {
386 }
387 }
389 return; /* Target killed */
390 }
391 }
392 } /* if */
394}
395
396/**********************************************************************/
399static void dai_hunter_juiciness(struct player *pplayer, struct unit *punit,
400 struct unit *target, unsigned *stackthreat,
401 unsigned *stackcost)
402{
403 *stackthreat = 0;
404 *stackcost = 0;
405
406 unit_list_iterate(unit_tile(target)->units, sucker) {
407 const struct unit_type *suck_type = unit_type_get(sucker);
408
411 *stackcost += 1000;
412 *stackthreat += 5000;
413 }
415 *stackthreat += 500; /* Extra threatening */
416 }
419
420 *stackthreat *= 9; /* WAG - reduced by distance later */
422}
423
424/**********************************************************************/
436int dai_hunter_manage(struct ai_type *ait, struct player *pplayer,
437 struct unit *punit)
438{
439 bool is_virtual = (punit->id == 0);
440 struct pf_parameter parameter;
441 struct pf_map *pfm;
442 int limit = unit_move_rate(punit) * 6;
443 struct unit_ai *unit_data = def_ai_unit_data(punit, ait);
445 unsigned original_threat = 0, original_cost = 0;
446 struct civ_map *nmap = &(wld.map);
447
448 fc_assert_ret_val(!is_barbarian(pplayer), 0);
449 fc_assert_ret_val(pplayer->is_alive, 0);
450
451 pft_fill_unit_parameter(&parameter, nmap, punit);
452 parameter.omniscience = !has_handicap(pplayer, H_MAP);
453 pfm = pf_map_new(&parameter);
454
455 if (original_target) {
458 }
459
460 pf_map_move_costs_iterate(pfm, ptile, move_cost, FALSE) {
461 /* End faster if we have a target */
462 if (move_cost > limit) {
463 UNIT_LOG(LOGLEVEL_HUNT, punit, "gave up finding hunt target");
465 return 0;
466 }
467
468 if (tile_city(ptile)
469 || !can_unit_attack_tile(punit, NULL, ptile)) {
470 continue;
471 }
472
473 unit_list_iterate_safe(ptile->units, target) {
474 struct player *aplayer = unit_owner(target);
475 int dist1, dist2;
476 unsigned stackthreat = 0, stackcost = 0;
477 int sanity_target = target->id;
478 struct pf_path *path;
479 struct unit_ai *target_data;
480 struct tile *target_tile;
481 struct unit *defender;
482
483 /* Note that we need not (yet) be at war with aplayer */
484 if (!adv_is_player_dangerous(pplayer, aplayer)) {
485 continue;
486 }
487
488 target_data = def_ai_unit_data(target, ait);
489 if (BV_ISSET(target_data->hunted, player_index(pplayer))) {
490 /* Can't hunt this one. The bit is cleared in the beginning
491 * of each turn. */
492 continue;
493 }
495 && get_transporter_capacity(target) == 0
496 && !unit_has_type_flag(target, UTYF_GAMELOSS)) {
497 /* Won't hunt this one. */
498 continue;
499 }
500
501 target_tile = unit_tile(target);
503 /* We can't attack the target */
504 continue;
505 }
506
507 /* Figure out whether unit is coming closer */
508 if (target_data->cur_pos && target_data->prev_pos) {
511 } else {
512 dist1 = dist2 = 0;
513 }
514 UNIT_LOG(LOGLEVEL_HUNT, punit, "considering chasing %s[%d](%d, %d) "
515 "dist1 %d dist2 %d",
516 unit_rule_name(target), target->id, TILE_XY(target_tile),
517 dist1, dist2);
518
519 /* We can't chase if we aren't faster or on intercept vector */
520 if (unit_type_get(punit)->move_rate < unit_type_get(target)->move_rate
521 && dist1 >= dist2) {
523 "giving up racing %s (%d, %d)->(%d, %d)",
524 unit_rule_name(target),
525 target_data->prev_pos
527 : -1,
528 target_data->prev_pos
530 : -1,
532 continue;
533 }
534
535 /* Calculate juiciness of target, compare with existing target,
536 * if any. */
537 dai_hunter_juiciness(pplayer, punit, target, &stackthreat, &stackcost);
538 defender = get_defender(nmap, punit, target_tile, NULL);
539 if (defender != NULL) {
540 stackcost *= unit_win_chance(nmap, punit, defender, NULL);
541 }
543 UNIT_LOG(LOGLEVEL_HUNT, punit, "%d is too expensive (it %d vs us %d)",
544 target->id, stackcost,
546 continue; /* Too expensive */
547 }
548 stackthreat /= move_cost + 1;
549 if (!is_virtual
550 && original_target != target
552 UNIT_LOG(LOGLEVEL_HUNT, punit, "Unit %d is not worse than %d",
553 target->id, original_target->id);
554 continue; /* The threat we found originally was worse than this! */
555 }
557 UNIT_LOG(LOGLEVEL_HUNT, punit, "%d is not worth it", target->id);
558 continue; /* Not worth it */
559 }
560
561 UNIT_LOG(LOGLEVEL_HUNT, punit, "hunting %s %s[%d](%d,%d) "
562 "with want %d, dist1 %d, dist2 %d",
564 unit_rule_name(target),
565 target->id,
568 dist1,
569 dist2);
570 /* Ok, now we FINALLY have a target worth destroying! */
571 unit_data->target = target->id;
572 if (is_virtual) {
574 return stackthreat;
575 }
576
577 /* This assigns missiles to us */
579
580 /* Check if we can nuke it */
581 dai_hunter_try_launch(ait, pplayer, punit, target);
582
583 /* Check if we have nuked it */
584 if (target != game_unit_by_number(sanity_target)) {
585 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished by cargo (pre)");
588 return -1; /* try again */
589 }
590
591 /* Go towards it. */
592 path = pf_map_path(pfm, target_tile);
593 if (!adv_unit_execute_path(punit, path)) {
594 pf_path_destroy(path);
596 return 0;
597 }
598 pf_path_destroy(path);
599
600 if (target != game_unit_by_number(sanity_target)) {
601 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished");
604 return -1; /* try again */
605 }
606
607 /* Check if we can nuke it now */
608 dai_hunter_try_launch(ait, pplayer, punit, target);
609 if (target != game_unit_by_number(sanity_target)) {
610 UNIT_LOG(LOGLEVEL_HUNT, punit, "mission accomplished by cargo (post)");
613 return -1; /* try again */
614 }
615
617 unit_data->done = TRUE;
618 return stackthreat; /* still have work to do */
621
622 UNIT_LOG(LOGLEVEL_HUNT, punit, "ran out of map finding hunt target");
624 return 0; /* found nothing */
625}
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:3909
#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:399
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:227
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:288
static void dai_hunter_missile_want(struct player *pplayer, struct city *pcity, struct adv_choice *choice)
Definition aihunt.c:147
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:252
int dai_hunter_manage(struct ai_type *ait, struct player *pplayer, struct unit *punit)
Definition aihunt.c:436
static void dai_hunter_try_launch(struct ai_type *ait, struct player *pplayer, struct unit *punit, struct unit *target)
Definition aihunt.c:304
bool dai_unit_attack(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Definition aitools.c:816
bool dai_unit_goto(struct ai_type *ait, struct unit *punit, struct tile *ptile)
Definition aitools.c:604
void dai_unit_new_task(struct ai_type *ait, struct unit *punit, enum ai_unit_task task, struct tile *ptile)
Definition aitools.c:642
#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:803
bool can_city_build_unit_now(const struct city *pcity, const struct unit_type *punittype)
Definition city.c:945
#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:834
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:74
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:3438
@ 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:1355
#define ADV_WANT_PRINTF
Definition fc_types.h:1356
@ 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:724
struct unit * unit_transport_get(const struct unit *pcargo)
Definition unit.c:2437
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
Definition unit.c:1620
int get_transporter_capacity(const struct unit *punit)
Definition unit.c:299
void unit_virtual_destroy(struct unit *punit)
Definition unit.c:1725
bool unit_transported(const struct unit *pcargo)
Definition unit.c:2421
#define unit_tile(_pu)
Definition unit.h:390
#define unit_owner(_pu)
Definition unit.h:389
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:3291
#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: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:852
#define unit_type_iterate_end
Definition unittype.h:859