Freeciv-3.4
Loading...
Searching...
No Matches
advgoto.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* common */
19#include "ai.h"
20#include "combat.h"
21#include "game.h"
22#include "movement.h"
23#include "unit.h"
24#include "tile.h"
25
26/* aicore */
27#include "path_finding.h"
28#include "pf_tools.h"
29
30/* server */
31#include "maphand.h"
32#include "srv_log.h"
33#include "unithand.h"
34#include "unittools.h"
35
36/* server/advisors */
37#include "advtools.h"
38#include "autoworkers.h"
39
40#include "advgoto.h"
41
42static bool adv_unit_move(struct unit *punit, struct tile *ptile);
43
44/**********************************************************************/
49bool adv_follow_path(struct unit *punit, struct pf_path *path,
50 struct tile *ptile)
51{
52 struct tile *old_tile = punit->goto_tile;
53 enum unit_activity activity = punit->activity;
54 struct extra_type *tgt = punit->activity_target;
55 bool alive;
56
57 if (punit->moves_left <= 0) {
58 return TRUE;
59 }
60
61 punit->goto_tile = ptile;
64
65 if (alive) {
66 if (activity != ACTIVITY_GOTO) {
67 /* Only go via ACTIVITY_IDLE if we are actually changing the activity */
69 send_unit_info(NULL, punit); /* FIXME: probably duplicate */
71 activity_default_action(activity));
72 }
73 punit->goto_tile = old_tile; /* May be NULL. */
75 }
76
77 return alive;
78}
79
80
81/**********************************************************************/
88bool adv_unit_execute_path(struct unit *punit, struct pf_path *path)
89{
90 const bool is_plr_ai = is_ai(unit_owner(punit));
91 int i;
92
93 /* We start with i = 1 for i = 0 is our present position */
94 for (i = 1; i < path->length; i++) {
95 struct tile *ptile = path->positions[i].tile;
96 int id = punit->id;
97
98 if (same_pos(unit_tile(punit), ptile)) {
99#ifdef PF_WAIT_DEBUG
101#if PF_WAIT_DEBUG & 1
103#if PF_WAIT_DEBUG & (2 | 4)
104 ||
105#endif
106#endif
107#if PF_WAIT_DEBUG & 2
109#if PF_WAIT_DEBUG & 4
110 ||
111#endif
112#endif
113#if PF_WAIT_DEBUG & 4
115#endif
116 , "%s waits at %d,%d for no visible profit",
117 unit_rule_name(punit), TILE_XY(ptile));
118#endif
119 UNIT_LOG(LOG_DEBUG, punit, "execute_path: waiting this turn");
120 return TRUE;
121 }
122
123 /* We use ai_unit_move() for everything but the last step
124 * of the way so that we abort if unexpected opposition
125 * shows up. Any enemy on the target tile is expected to
126 * be our target and any attack there intentional.
127 * However, do not annoy human players by automatically attacking
128 * using units temporarily under AI control (such as auto-explorers)
129 */
130
131 if (is_plr_ai) {
133 } else {
134 (void) adv_unit_move(punit, ptile);
135 }
136 if (!game_unit_by_number(id)) {
137 /* Died... */
138 return FALSE;
139 }
140
141 if (!same_pos(unit_tile(punit), ptile) || punit->moves_left <= 0) {
142 /* Stopped (or maybe fought) or ran out of moves */
143 return TRUE;
144 }
145 }
146
147 return TRUE;
148}
149
150/**********************************************************************/
158static bool adv_unit_move(struct unit *punit, struct tile *ptile)
159{
160 struct action *paction;
161 struct player *pplayer = unit_owner(punit);
162 struct unit *ptrans = NULL;
163 const struct civ_map *nmap = &(wld.map);
164
165 /* If enemy, stop and give a chance for the human player to
166 handle this case */
167 if (is_enemy_unit_tile(ptile, pplayer)
168 || is_enemy_city_tile(ptile, pplayer)) {
169 UNIT_LOG(LOG_DEBUG, punit, "movement halted due to enemy presence");
170 return FALSE;
171 }
172
173 /* Select move kind. */
175 && ((ptrans = transporter_for_unit_at(punit, ptile)))
177 punit, ptrans)) {
178 /* "Transport Embark". */
180 } else if (!can_unit_survive_at_tile(nmap, punit, ptile)
181 && ptrans != NULL
183 punit, ptrans)) {
184 /* "Transport Embark 2". */
186 } else if (!can_unit_survive_at_tile(nmap, punit, ptile)
187 && ptrans != NULL
189 punit, ptrans)) {
190 /* "Transport Embark 3". */
192 } else if (!can_unit_survive_at_tile(nmap, punit, ptile)
193 && ptrans != NULL
195 punit, ptrans)) {
196 /* "Transport Embark 4". */
199 punit, ptile, NULL)) {
200 /* "Transport Disembark". */
203 punit, ptile, NULL)) {
204 /* "Transport Disembark 2". */
207 punit, ptile, NULL)) {
208 /* "Transport Disembark 3". */
211 punit, ptile, NULL)) {
212 /* "Transport Disembark 4". */
215 punit, ptile, NULL)) {
216 /* "Enter Hut". */
219 punit, ptile, NULL)) {
220 /* "Enter Hut 2". */
223 punit, ptile, NULL)) {
224 /* "Enter Hut 3". */
227 punit, ptile, NULL)) {
228 /* "Enter Hut 4". */
231 punit, ptile, NULL)) {
232 /* "Frighten Hut". */
235 punit, ptile, NULL)) {
236 /* "Frighten Hut 2". */
239 punit, ptile, NULL)) {
240 /* "Frighten Hut 3". */
243 punit, ptile, NULL)) {
244 /* "Frighten Hut 4". */
247 punit, ptile, NULL)) {
248 /* "Unit Move". */
251 punit, ptile, NULL)) {
252 /* "Unit Move 2". */
254 } else {
255 /* "Unit Move 3". */
257 }
258
259 /* Try not to end move next to an enemy if we can avoid it by waiting */
262 /* The unit will have to move it self rather than being moved. */
263 int mcost = map_move_cost_unit(nmap, punit, ptile);
264
265 if (paction) {
266 struct tile *from_tile;
267
268 /* Ugly hack to understand the OnNativeTile unit state requirements
269 * used in the Action_Success_Actor_Move_Cost effect. */
273 punit->tile = ptile;
274
276
278 }
279
280 if (punit->moves_left <= mcost
281 && unit_move_rate(punit) > mcost
282 && adv_danger_at(punit, ptile)
285 "ending move early to stay out of trouble");
286 return FALSE;
287 }
288 }
289
290 /* Go */
292 /* Move */
293 /* TODO: Differentiate (server side AI) player from server side agent
294 * working for (possibly AI) player by using ACT_REQ_PLAYER and
295 * ACT_REQ_SS_AGENT */
296 if (paction != nullptr && ptrans != nullptr
298 /* "Transport Embark". */
300 0, "", action_number(paction));
301 } else if (paction
310 /* "Transport Disembark", "Transport Disembark 2", "Enter Hut",
311 * "Frighten Hut" or "Unit Move". */
313 0, "", action_number(paction));
314 }
315
316 return TRUE;
317}
318
319/**********************************************************************/
326static bool adv_could_be_my_zoc(struct unit *punit, struct tile *ptile)
327{
328 struct tile *utile = unit_tile(punit);
329 struct player *owner;
330 struct civ_map *cmap = &(wld.map);
332
333 if (same_pos(ptile, utile)) {
334 return FALSE; /* Can't be my zoc */
335 }
336
338 if (is_tiles_adjacent(ptile, utile)
340 return FALSE;
341 }
342
343 adjc_iterate(cmap, ptile, atile) {
346 return FALSE;
347 }
349
350 return TRUE;
351}
352
353/**********************************************************************/
361int adv_could_unit_move_to_tile(struct unit *punit, struct tile *dest_tile)
362{
366 TRUE, NULL, FALSE);
367
368 switch (reason) {
369 case MR_OK:
370 return 1;
371
372 case MR_ZOC:
374 return -1;
375 }
376 break;
377
378 default:
379 break;
380 };
381 return 0;
382}
383
384/**********************************************************************/
387int adv_unittype_att_rating(const struct unit_type *punittype, int veteran,
388 int moves_left, int hp)
389{
390 return base_get_attack_power(punittype, veteran, moves_left) * hp
391 * punittype->firepower / POWER_DIVIDER;
392}
393
394/**********************************************************************/
403
404/**********************************************************************/
413
414/**********************************************************************/
418{
420
421 return v * v;
422}
423
424/**********************************************************************/
427bool adv_danger_at(struct unit *punit, struct tile *ptile)
428{
429 int a = 0, d, db;
430 struct player *pplayer = unit_owner(punit);
431 struct city *pcity = tile_city(ptile);
433 int extras_bonus = 0;
434 struct player *owner = unit_owner(punit);
435
436 /* Give AI code possibility to decide itself */
437 CALL_PLR_AI_FUNC(consider_tile_dangerous, owner, ptile, punit, &dc);
438 if (dc == OVERRIDE_TRUE) {
439 return TRUE;
440 } else if (dc == OVERRIDE_FALSE) {
441 return FALSE;
442 }
443
445 && !is_non_allied_unit_tile(ptile, pplayer,
447 /* We will be safe in a friendly city */
448 return FALSE;
449 }
450
451 /* Calculate how well we can defend at (x,y) */
452 db = 10 + tile_terrain(ptile)->defense_bonus / 10;
454 db += (db * extras_bonus) / 100;
456
457 adjc_iterate(&(wld.map), ptile, ptile1) {
459 /* We cannot see danger at (ptile1) => assume there is none */
460 continue;
461 }
465 == ATT_OK)
467 == ATT_OK)) {
469 if ((a * a * 10) >= d) {
470 /* The enemies combined strength is too big! */
471 return TRUE;
472 }
473 }
476
477 return FALSE; /* As good a quick'n'dirty should be -- Syela */
478}
479
480/**********************************************************************/
483static int stack_value(const struct tile *ptile,
484 const struct player *pplayer)
485{
486 int cost = 0;
487
488 if (is_stack_vulnerable(ptile)) {
489 unit_list_iterate(ptile->units, punit) {
490 if (unit_owner(punit) == pplayer) {
492 }
494 }
495
496 return cost;
497}
498
499/**********************************************************************/
509static double chance_killed_at(const struct tile *ptile,
510 struct adv_risk_cost *risk_cost,
511 const struct pf_parameter *param)
512{
513 double db;
514 int extras_bonus = 0;
515 /* Compute the basic probability */
516 /* WAG */
517 /* In the early stages of a typical game, ferries
518 * are effectively invulnerable (not until Frigates set sail),
519 * so we make seas appear safer.
520 * If we don't do this, the amphibious movement code has too strong a
521 * desire to minimise the length of the path,
522 * leading to poor choice for landing beaches */
523 double p = is_ocean_tile(ptile)? 0.05: 0.15;
524
525 /* If we are on defensive terrain, we are more likely to survive */
526 db = 10 + tile_terrain(ptile)->defense_bonus / 10;
528 utype_class(param->utype));
529 db += (extras_bonus) / 100;
530 p *= 10.0 / db;
531
532 return p;
533}
534
535/**********************************************************************/
550static unsigned stack_risk(const struct tile *ptile,
551 struct adv_risk_cost *risk_cost,
552 const struct pf_parameter *param)
553{
554 double risk = 0;
555 /* Compute the risk of destruction, assuming we will stop at this tile */
556 const double value = risk_cost->base_value
557 + stack_value(ptile, param->owner);
558 const double p_killed = chance_killed_at(ptile, risk_cost, param);
559 double danger = value * p_killed;
560
561 /* Adjust for the fact that we might not stop at this tile,
562 * and for our fearfulness */
563 risk += danger * risk_cost->fearfulness;
564
565 /* Adjust for the risk that we might become stuck (for an indefinite period)
566 * if we enter or try to enter the tile. */
567 if (risk_cost->enemy_zoc_cost != 0
568 && (is_non_allied_city_tile(ptile, param->owner)
569 || !is_plr_zoc_srv(param->owner, ptile, param->map)
570 || is_non_allied_unit_tile(ptile, param->owner,
572 /* We could become stuck. */
573 risk += risk_cost->enemy_zoc_cost;
574 }
575
576 return risk;
577}
578
579/**********************************************************************/
586static unsigned prefer_short_stacks(const struct tile *ptile,
587 enum known_type known,
588 const struct pf_parameter *param)
589{
590 return stack_risk(ptile, (struct adv_risk_cost *)param->data, param);
591}
592
593/**********************************************************************/
597void adv_avoid_risks(struct pf_parameter *parameter,
598 struct adv_risk_cost *risk_cost,
599 struct unit *punit,
600 const double fearfulness)
601{
602 /* If we stay a short time on each tile, the danger of each individual tile
603 * is reduced. If we do not do this,
604 * we will not favour longer but faster routs. */
605 const double linger_fraction = (double)SINGLE_MOVE / parameter->move_rate;
606
607 parameter->data = risk_cost;
608 parameter->get_EC = prefer_short_stacks;
610 risk_cost->fearfulness = fearfulness * linger_fraction;
611
612 risk_cost->enemy_zoc_cost = PF_TURN_FACTOR * 20;
613}
614
615/**********************************************************************/
619bool adv_seek_shelter(const struct civ_map *nmap, struct unit *punit,
620 enum adv_unit_task task)
621{
622 struct pf_parameter parameter;
623 struct pf_map *shelter_map;
624 struct tile *shelter_tile = nullptr;
625 bool alive = TRUE;
626 struct player *owner = unit_owner(punit);
627
628 pft_fill_unit_parameter(&parameter, nmap, punit);
629 shelter_map = pf_map_new(&parameter);
630
632 struct city *pcity = tile_city(ptile);
633
634 if (pcity != nullptr) {
636 shelter_tile = ptile;
637 break;
638 }
639 }
641
642 if (shelter_tile != nullptr && shelter_tile != unit_tile(punit)) {
643 struct pf_path *shelter_path;
644
646
649
652 "arrives to shelter city at (%d, %d)",
654 }
655
657 }
658
660
661 return alive;
662}
int action_number(const struct action *action)
Definition actions.c:1229
bool is_action_enabled_unit_on_tile(const struct civ_map *nmap, const action_id wanted_action, const struct unit *actor_unit, const struct tile *target_tile, const struct extra_type *target_extra)
Definition actions.c:3344
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:3180
static struct action * action_by_number(action_id act_id)
Definition actions.h:400
#define action_has_result(_act_, _res_)
Definition actions.h:184
#define ACTION_NONE
Definition actions.h:59
bool adv_follow_path(struct unit *punit, struct pf_path *path, struct tile *ptile)
Definition advgoto.c:49
int adv_unit_def_rating_basic_squared(const struct unit *punit)
Definition advgoto.c:417
static int stack_value(const struct tile *ptile, const struct player *pplayer)
Definition advgoto.c:483
int adv_unit_def_rating_basic(const struct unit *punit)
Definition advgoto.c:408
static unsigned prefer_short_stacks(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
Definition advgoto.c:586
static unsigned stack_risk(const struct tile *ptile, struct adv_risk_cost *risk_cost, const struct pf_parameter *param)
Definition advgoto.c:550
bool adv_danger_at(struct unit *punit, struct tile *ptile)
Definition advgoto.c:427
static bool adv_unit_move(struct unit *punit, struct tile *ptile)
Definition advgoto.c:158
bool adv_seek_shelter(const struct civ_map *nmap, struct unit *punit, enum adv_unit_task task)
Definition advgoto.c:619
static double chance_killed_at(const struct tile *ptile, struct adv_risk_cost *risk_cost, const struct pf_parameter *param)
Definition advgoto.c:509
int adv_unittype_att_rating(const struct unit_type *punittype, int veteran, int moves_left, int hp)
Definition advgoto.c:387
int adv_unit_att_rating(const struct unit *punit)
Definition advgoto.c:398
static bool adv_could_be_my_zoc(struct unit *punit, struct tile *ptile)
Definition advgoto.c:326
int adv_could_unit_move_to_tile(struct unit *punit, struct tile *dest_tile)
Definition advgoto.c:361
void adv_avoid_risks(struct pf_parameter *parameter, struct adv_risk_cost *risk_cost, struct unit *punit, const double fearfulness)
Definition advgoto.c:597
bool adv_unit_execute_path(struct unit *punit, struct pf_path *path)
Definition advgoto.c:88
#define POWER_DIVIDER
Definition advtools.h:32
#define CALL_PLR_AI_FUNC(_func, _player,...)
Definition ai.h:380
void adv_unit_new_task(struct unit *punit, enum adv_unit_task task, struct tile *ptile)
static bool is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:776
static bool is_enemy_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:740
#define city_owner(_pcity_)
Definition city.h:564
bool is_stack_vulnerable(const struct tile *ptile)
Definition combat.c:994
enum unit_attack_result unit_attack_units_at_tile_result(const struct unit *punit, const struct action *paction, const struct tile *ptile)
Definition combat.c:257
int base_get_attack_power(const struct unit_type *punittype, int veteran, int moves_left)
Definition combat.c:550
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
int base_get_defense_power(const struct unit *punit)
Definition combat.c:574
@ ATT_OK
Definition combat.h:35
char * incite_cost
Definition comments.c:77
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
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 int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
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 int cost
Definition dialogs_g.h:74
adv_unit_task
Definition fc_types.h:231
override_bool
Definition fc_types.h:96
@ OVERRIDE_TRUE
Definition fc_types.h:96
@ NO_OVERRIDE
Definition fc_types.h:96
@ OVERRIDE_FALSE
Definition fc_types.h:96
struct world wld
Definition game.c:63
struct unit * game_unit_by_number(int id)
Definition game.c:115
struct city * owner
Definition citydlg.c:226
#define fc_assert_msg(condition, message,...)
Definition log.h:182
#define fc_assert(condition)
Definition log.h:177
@ LOG_DEBUG
Definition log.h:35
bool is_tiles_adjacent(const struct tile *tile0, const struct tile *tile1)
Definition map.c:1076
bool same_pos(const struct tile *tile1, const struct tile *tile2)
Definition map.c:1085
#define adjc_iterate_end
Definition map.h:439
#define adjc_iterate(nmap, center_tile, itr_tile)
Definition map.h:434
static int map_move_cost_unit(const struct civ_map *nmap, struct unit *punit, const struct tile *ptile)
Definition map.h:299
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
Definition maphand.c:925
enum unit_move_result unit_move_to_tile_test(const struct civ_map *nmap, const struct unit *punit, enum unit_activity activity, const struct tile *src_tile, const struct tile *dst_tile, bool igzoc, bool enter_transport, struct unit *embark_to, bool enter_enemy_city)
Definition movement.c:661
int unit_move_rate(const struct unit *punit)
Definition movement.c:89
bool can_unit_survive_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
Definition movement.c:522
#define SINGLE_MOVE
Definition movement.h:26
unit_move_result
Definition movement.h:34
@ MR_OK
Definition movement.h:35
@ MR_ZOC
Definition movement.h:40
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_TURN_FACTOR
#define pf_map_tiles_iterate(ARG_pfm, NAME_tile, COND_from_start)
#define pf_map_tiles_iterate_end
void pft_fill_unit_parameter(struct pf_parameter *parameter, const struct civ_map *nmap, const struct unit *punit)
Definition pf_tools.c:843
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1376
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1397
#define is_ai(plr)
Definition player.h:232
#define UNIT_LOG(loglevel, punit, msg,...)
Definition srv_log.h:98
Definition city.h:318
const struct civ_map * map
const struct player * owner
unsigned(* get_EC)(const struct tile *ptile, enum known_type known, const struct pf_parameter *param)
const struct unit_type * utype
unsigned length
struct pf_position * positions
struct tile * tile
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
int firepower
Definition unittype.h:532
Definition unit.h:140
enum unit_activity activity
Definition unit.h:159
int moves_left
Definition unit.h:152
int id
Definition unit.h:147
int hp
Definition unit.h:153
int fuel
Definition unit.h:155
struct tile * tile
Definition unit.h:142
struct extra_type * activity_target
Definition unit.h:167
struct tile * goto_tile
Definition unit.h:157
int veteran
Definition unit.h:154
struct civ_map map
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define is_ocean_tile(ptile)
Definition terrain.h:197
#define terrain_has_flag(terr, flag)
Definition terrain.h:177
int tile_extras_class_defense_bonus(const struct tile *ptile, const struct unit_class *pclass)
Definition tile.c:243
int tile_extras_defense_bonus(const struct tile *ptile, const struct unit_type *punittype)
Definition tile.c:234
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_index(_pt_)
Definition tile.h:89
known_type
Definition tile.h:35
#define tile_terrain(_tile)
Definition tile.h:115
#define TILE_XY(ptile)
Definition tile.h:43
int unit_pays_mp_for_action(const struct action *paction, const struct unit *punit)
Definition unit.c:2188
struct unit * transporter_for_unit_at(const struct unit *pcargo, const struct tile *ptile)
Definition unit.c:1977
enum gen_action activity_default_action(enum unit_activity act)
Definition unit.c:2942
bool is_plr_zoc_srv(const struct player *pplayer, const struct tile *ptile0, const struct civ_map *zmap)
Definition unit.c:1445
#define unit_tile(_pu)
Definition unit.h:408
static bool is_enemy_unit_tile(const struct tile *ptile, const struct player *pplayer)
Definition unit.h:433
#define unit_owner(_pu)
Definition unit.h:407
static bool is_non_allied_unit_tile(const struct tile *ptile, const struct player *pplayer, bool everyone_non_allied)
Definition unit.h:446
bool unit_activity_handling_targeted(struct unit *punit, enum unit_activity new_activity, struct extra_type **new_target, enum gen_action trigger_action)
Definition unithand.c:6784
bool unit_activity_handling(struct unit *punit, enum unit_activity new_activity, enum gen_action trigger_action)
Definition unithand.c:6708
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:3350
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
#define unit_list_iterate_end
Definition unitlist.h:33
void send_unit_info(struct conn_list *dest, struct unit *punit)
Definition unittools.c:2883
bool unit_move(struct unit *punit, struct tile *pdesttile, int move_cost, struct unit *embark_to, bool find_embark_target, bool conquer_city_allowed, bool conquer_extras_allowed, bool enter_hut, bool frighten_hut)
Definition unittools.c:4084
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:126
bool utype_is_moved_to_tgt_by_action(const struct action *paction, const struct unit_type *utype)
Definition unittype.c:1274
const char * unit_rule_name(const struct unit *punit)
Definition unittype.c:1613
int unit_build_shield_cost_base(const struct unit *punit)
Definition unittype.c:1509
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
Definition unittype.c:215
#define utype_class(_t_)
Definition unittype.h:756
#define utype_fuel(ptype)
Definition unittype.h:849
static bool utype_has_flag(const struct unit_type *punittype, int flag)
Definition unittype.h:624