Freeciv-3.3
Loading...
Searching...
No Matches
daidomestic.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#include <string.h>
19#include <math.h> /* pow, ceil */
20
21/* utility */
22#include "log.h"
23#include "mem.h"
24
25/* common */
26#include "city.h"
27#include "game.h"
28#include "government.h"
29#include "map.h"
30#include "movement.h"
31#include "traderoutes.h"
32#include "unit.h"
33#include "unitlist.h"
34#include "unittype.h"
35
36/* common/aicore */
37#include "pf_tools.h"
38
39/* server */
40#include "citytools.h"
41#include "unittools.h"
42#include "srv_log.h"
43
44/* server/advisors */
45#include "advbuilding.h"
46#include "advchoice.h"
47#include "advdata.h"
48#include "infracache.h"
49
50/* ai */
51#include "aitraits.h"
52#include "handicaps.h"
53
54/* ai/default */
55#include "daicity.h"
56#include "daidata.h"
57#include "daimilitary.h"
58#include "daiplayer.h"
59#include "daitech.h"
60#include "daitools.h"
61
62#include "daidomestic.h"
63
64
65/***********************************************************************/
71static void dai_choose_help_wonder(struct ai_type *ait,
72 struct city *pcity,
73 struct adv_choice *choice,
74 struct adv_data *ai)
75{
76 struct player *pplayer = city_owner(pcity);
79 /* Total count of caravans available or already being built
80 * on this continent */
81 int caravans = 0;
82 /* The type of the caravan */
83 struct unit_type *unit_type;
84 struct city *wonder_city = game_city_by_number(ai->wonder_city);
85
87 /* No such units available in the ruleset */
88 return;
89 }
90
91 if (pcity == wonder_city
92 || wonder_city == NULL
93 || city_data->distance_to_wonder_city <= 0
95 /* TODO: Should helping to build a unit be considered when legal? */
96 || VUT_UTYPE == wonder_city->production.kind
97 /* TODO: Should helping to build an improvement be considered when
98 * legal? */
99 || !is_wonder(wonder_city->production.value.building)) {
100 /* A distance of zero indicates we are very far away, possibly
101 * on another continent. */
102 return;
103 }
104
105 /* Count existing caravans */
106 unit_list_iterate(pplayer->units, punit) {
108 && tile_continent(unit_tile(punit)) == continent)
109 caravans++;
111
112 /* Count caravans being built */
113 city_list_iterate(pplayer->cities, acity) {
114 if (VUT_UTYPE == acity->production.kind
115 && utype_can_do_action(acity->production.value.utype,
117 && tile_continent(acity->tile) == continent) {
118 caravans++;
119 }
121
123
124 if (!unit_type) {
125 /* We cannot build such units yet
126 * but we will consider it to stimulate science */
128 }
129
131 "Non existence of wonder helper unit not caught");
132
133 /* Check if wonder needs a little help. */
134 if (build_points_left(wonder_city)
136 const struct impr_type *wonder = wonder_city->production.value.building;
138 int dist = city_data->distance_to_wonder_city /
140
142
143 want /= MAX(dist, 1);
144 CITY_LOG(LOG_DEBUG, pcity, "want %s to help wonder in %s with " ADV_WANT_PRINTF,
146 city_name_get(wonder_city),
147 want);
148 if (want > choice->want) {
149 /* This sets our tech want in cases where we cannot actually build
150 * the unit. */
151 unit_type = dai_wants_role_unit(ait, pplayer, pcity,
153 want);
154 if (unit_type != NULL) {
155 choice->want = want;
156 choice->type = CT_CIVILIAN;
157 choice->value.utype = unit_type;
158 } else {
160 "would but could not build ACTION_HELP_WONDER unit, "
161 "bumped reqs");
162 }
163 }
164 }
165}
166
167/***********************************************************************/
172static void dai_choose_trade_route(struct ai_type *ait, struct city *pcity,
173 struct adv_choice *choice,
174 struct adv_data *ai)
175{
176 struct player *pplayer = city_owner(pcity);
177 struct unit_type *unit_type;
178 adv_want want;
179 int income, bonus;
180 int trade_routes;
181 int caravan_units;
183 int max_routes;
185 bool dest_city_found = FALSE;
191 int pct = 0;
192 int trader_trait;
194 bool need_boat = FALSE;
195 int trade_action;
196
197 if (city_list_size(pplayer->cities) < 5) {
198 /* Consider trade routes only if enough destination cities.
199 * This is just a quick check. We make more detailed check below. */
200 return;
201 }
202
205 /* No such units available in the ruleset */
206 return;
207 }
208
211
212 if (!unit_type) {
213 /* Can't establish trade route yet. What about entering a marketplace? */
214 /* TODO: Should a future unit capable of establishing trade routes be
215 * prioritized above a present unit capable of entering a market place?
216 * In that case this should be below the check for a future unit
217 * capable of establishing a trade route. */
220 }
221
222 if (!unit_type) {
223 /* We cannot build such units yet
224 * but we will consider it to stimulate science */
226 }
227
228 if (!unit_type) {
229 /* We'll never be able to establish a trade route. Consider a unit that
230 * can enter the marketplace instead, to stimulate science. */
232 }
233
235 "Non-existence of trade unit not caught");
236
237 if (unit_type) {
239
240 /* Hope there is no "water cities in lakes" ruleset? */
241 can_move_ic = pclass->adv.sea_move != MOVE_NONE;
242 has_boats = pclass->adv.ferry_types > 0;
243 }
244
247 && (can_move_ic || has_boats)) {
249 } else {
251 }
252
253 /* Look for proper destination city for trade. */
256 /* National trade routes have value */
257 city_list_iterate(pplayer->cities, acity) {
259 if (tile_continent(acity->tile) != continent) {
260 if (!(can_move_ic || has_boats)) {
261 /* FIXME: get by roads/rivers? */
262 continue;
263 }
267 break;
268 }
269 } else {
273 break;
274 }
275 }
276 }
278 }
279
280 /* FIXME: This check should consider more about relative
281 * income from different trade route types. This works just
282 * with more typical ruleset setups. */
287 } else {
289 }
290
292 if (aplayer == pplayer || !aplayer->is_alive) {
293 continue;
294 }
295 if (pplayers_allied(pplayer, aplayer)) {
298 if (tile_continent(acity->tile) != continent) {
299 if (!(can_move_ic || has_boats)) {
300 /* FIXME: get by roads/rivers? */
301 continue;
302 }
306 break;
307 }
308 } else {
312 break;
313 }
314 }
315 }
317 }
320 break;
321 }
323 }
324
325 if (!dest_city_found) {
326 /* No proper destination city. */
327 return;
328 }
329
331 /* Count also caravans enroute to establish trade routes */
332 caravan_units = 0;
333 unit_list_iterate(pcity->units_supported, punit) {
336 }
338
342
343 /* We consider only initial benefit from establishing trade route.
344 * We may actually get only initial benefit if both cities already
345 * have four trade routes, if there already is route between them
346 * or if the Establish Trade Route action is illegal. */
347
348 /* The calculations of get_caravan_enter_city_trade_bonus() have to be
349 * duplicated here because the city traded with is imaginary. */
350
351 /* We assume that we are creating trade route to city with 75% of
352 * pcitys trade 10 squares away (FIXME: another estimation?). */
354 int wd = ((100 - game.info.trade_world_rel_pct) * 10
356 * (10 * 40 / MAX(MAP_NATIVE_WIDTH, MAP_NATIVE_HEIGHT))) / 100;
357
358 income = pow(log(wd + 20 + 1.75 * max_trade_prod(pcity)) * 2, 2);
359 } else /* assume CBS_CLASSIC */ {
360 income = (10 + 10) * (1.75 * pcity->surplus[O_TRADE]) / 24;
361 }
362
363 /* A ruleset may use the Trade_Revenue_Bonus effect to reduce the one
364 * time bonus if no trade route is established. Make sure it gets the
365 * correct action. */
369 &(const struct req_context) {
370 .player = pplayer,
371 .city = pcity,
372 .tile = city_tile(pcity),
373 .unittype = unit_type,
374 .action =
376 },
377 NULL,
379
380 /* Be mercy full to players with small amounts. Round up. */
381 income = ceil((float)income * pow(2.0, (double)bonus / 1000.0));
382
385 }
388
389 pct = MAX(pct, typepct);
390 }
393
394 if (typepct > pct) {
395 pct = typepct;
396 need_boat = TRUE;
397 }
398 }
401
402 if (typepct > pct) {
403 pct = typepct;
404 need_boat = TRUE;
405 }
406 }
407
408 need_boat = need_boat && !can_move_ic;
409 income = pct * income / 100;
410
411 want = income * ai->gold_priority + income * ai->science_priority;
412
413 /* We get this income only once after all.
414 * This value is adjusted for most interesting gameplay.
415 * For optimal performance AI should build more caravans, but
416 * we want it to build less valued buildings too. */
418 want /= (130 * TRAIT_DEFAULT_VALUE / trader_trait);
419
420 /* Increase want for trade routes if our economy is very weak.
421 * We may have enough gold, but only because we have already set
422 * tax rate to 100%. So don't check gold directly, but tax rate.
423 * This method helps us out of deadlocks of completely stalled
424 * scientific progress.
425 */
426 if (pplayer->economic.science < 50 && trade_routes < max_routes
428 want *=
429 (6 - pplayer->economic.science / 10) * (6 - pplayer->economic.science / 10);
430 }
431
432 if (trade_routes == 0 && max_routes > 0
434 /* If we have no trade routes at all, we are certainly creating a new one. */
435 want += trader_trait;
436 } else if (trade_routes < max_routes
438 /* Possibly creating a new trade route */
439 want += trader_trait / 4;
440 }
441
443
444 /* Don't pile too many of them */
445 if (unassigned_caravans * 10 > want && want > 0.0) {
446 want = 0.1;
447 } else {
448 want -= unassigned_caravans * 10; /* Don't pile too many of them */
449 }
450
452 "want for trade route unit is " ADV_WANT_PRINTF " (expected initial income %d)",
453 want,
454 income);
455
456 if (want > choice->want) {
457 /* This sets our tech want in cases where we cannot actually build
458 * the unit. */
459 unit_type = dai_wants_role_unit(ait, pplayer, pcity,
461 want);
462
463 if (unit_type == NULL) {
464 unit_type = dai_wants_role_unit(ait, pplayer, pcity,
466 want);
467 }
468
469 /* We don't want to build caravan that wouldn't be able to reach the
470 * destination by any means. It would be useless. */
471 if (unit_type != NULL && (!need_boat || has_boats)) {
472 choice->want = want;
473 choice->type = CT_CIVILIAN;
474 choice->value.utype = unit_type;
475 choice->need_boat = need_boat;
476 } else {
478 "would but could not build trade route unit, bumped reqs");
479 }
480 }
481}
482
483/***********************************************************************/
489 struct player *pplayer,
490 struct city *pcity)
491{
492 struct adv_data *adv = adv_data_get(pplayer, NULL);
493 /* Unit type with certain role */
494 struct unit_type *worker_type;
495 struct unit_type *founder_type;
496 adv_want worker_want, founder_want;
497 struct ai_city *city_data = def_ai_city_data(pcity, ait);
498 struct adv_choice *choice = adv_new_choice();
499
500 /* Find out desire for workers (terrain improvers) */
501 worker_type = city_data->worker_type;
502
503 /* The worker want is calculated in daicity.c called from
504 * dai_manage_cities(). The expand value is the % that the AI should
505 * value expansion (basically to handicap easier difficulty levels)
506 * and is set when the difficulty level is changed (difficulty.c). */
507 worker_want = city_data->worker_want * pplayer->ai_common.expand / 100;
508
509 if (adv->wonder_city == pcity->id) {
510 if (worker_type == NULL || worker_type->pop_cost > 0) {
511 worker_want /= 5;
512 } else {
513 worker_want /= 2;
514 }
515 }
516
517 if (worker_type != NULL
518 && pcity->surplus[O_FOOD] > utype_upkeep_cost(worker_type,
519 pplayer, O_FOOD)) {
520 if (worker_want > 0) {
522 "desires terrain improvers with passion " ADV_WANT_PRINTF,
523 worker_want);
524 dai_choose_role_unit(ait, pplayer, pcity, choice, CT_CIVILIAN,
525 UTYF_WORKERS, worker_want, FALSE);
526 adv_choice_set_use(choice, "worker");
527 }
528 /* Terrain improvers don't use boats (yet) */
529
530 } else if (worker_type == NULL && worker_want > 0) {
531 /* Can't build workers. Lets stimulate science */
532 dai_wants_role_unit(ait, pplayer, pcity, UTYF_WORKERS, worker_want);
533 }
534
535 /* Find out desire for city founders */
536 /* Basically, copied from above and adjusted. -- jjm */
540
541 /* founder_want calculated in daisettlers.c */
542 founder_want = city_data->founder_want;
543
544 if (adv->wonder_city == pcity->id) {
545 if (founder_type == NULL || founder_type->pop_cost > 0) {
546 founder_want /= 5;
547 } else {
548 founder_want /= 2;
549 }
550 }
551
552 if (adv->max_num_cities <= city_list_size(pplayer->cities)
554 founder_want /= 100;
555 }
556
557 /* Adjust founder want by traits */
558 founder_want *= (double)ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer)
560
561 if (founder_type
563 pplayer, O_FOOD)) {
564
565 if (founder_want > choice->want) {
567 "desires founders with passion " ADV_WANT_PRINTF,
568 founder_want);
569 dai_choose_role_unit(ait, pplayer, pcity, choice, CT_CIVILIAN,
571 founder_want,
572 city_data->founder_boat);
573 adv_choice_set_use(choice, "founder");
574
575 } else if (founder_want < -choice->want) {
576 /* We need boats to colonize! */
577 /* We might need boats even if there are boats free,
578 * if they are blockaded or in inland seas. */
579 struct ai_plr *ai = dai_plr_data_get(ait, pplayer, NULL);
580
582 "desires founders with passion " ADV_WANT_PRINTF
583 " and asks for a new boat (%d of %d free)",
584 -founder_want, ai->stats.available_boats, ai->stats.boats);
585
586 /* First fill choice with founder information */
587 choice->want = 0 - founder_want;
588 choice->type = CT_CIVILIAN;
589 choice->value.utype = founder_type; /* Default */
590 choice->need_boat = TRUE;
591
592 /* Then try to overwrite it with ferryboat information
593 * If no ferryboat is found, above founder choice stays. */
594 dai_choose_role_unit(ait, pplayer, pcity, choice, CT_CIVILIAN,
595 L_FERRYBOAT, -founder_want, TRUE);
596 adv_choice_set_use(choice, "founder's boat");
597 }
598 } else if (!founder_type
599 && (founder_want > choice->want || founder_want < -choice->want)) {
600 /* Can't build founders. Lets stimulate science */
601 dai_wants_role_unit(ait, pplayer, pcity,
603 founder_want);
604 }
605 }
606
607 {
608 struct adv_choice *cur;
609
610 /* Consider building caravan-type units to aid wonder construction */
612 adv_choice_set_use(cur, "wonder");
613 dai_choose_help_wonder(ait, pcity, cur, adv);
614 choice = adv_better_choice_free(choice, cur);
615
616 /* Consider city improvements */
618 adv_choice_set_use(cur, "improvement");
620 cur->want = cur->want * (0.5 + (ai_trait_get_value(TRAIT_BUILDER, pplayer)
621 / TRAIT_DEFAULT_VALUE / 2));
622 choice = adv_better_choice_free(choice, cur);
623
624 /* Consider building caravan-type units for trade route */
626 adv_choice_set_use(cur, "trade route");
627 dai_choose_trade_route(ait, pcity, cur, adv);
628 choice = adv_better_choice_free(choice, cur);
629 }
630
631 if (choice->want > DAI_WANT_DOMESTIC_MAX) {
632 /* If we don't do following, we buy caravans in city X when we should be
633 * saving money to buy defenses for city Y. -- Syela */
634 choice->want = DAI_WANT_DOMESTIC_MAX;
635 }
636
637 return choice;
638}
639
640/***********************************************************************/
643void dai_wonder_city_distance(struct ai_type *ait, struct player *pplayer,
644 struct adv_data *adv)
645{
646 struct pf_map *pfm;
647 struct pf_parameter parameter;
648 struct unit_type *punittype;
649 struct unit *ghost;
650 int maxrange;
651 struct city *wonder_city = game_city_by_number(adv->wonder_city);
652 const struct civ_map *nmap = &(wld.map);
653
654 city_list_iterate(pplayer->cities, acity) {
655 /* Mark unavailable */
658
659 if (wonder_city == NULL) {
660 return;
661 }
662
665
666 if (!punittype) {
667 return;
668 }
669
671 "Non existence of wonder helper unit not caught");
672
673 ghost = unit_virtual_create(pplayer, wonder_city, punittype, 0);
675
676 pft_fill_unit_parameter(&parameter, nmap, ghost);
677 parameter.omniscience = !has_handicap(pplayer, H_MAP);
678 pfm = pf_map_new(&parameter);
679
680 pf_map_move_costs_iterate(pfm, ptile, move_cost, FALSE) {
681 struct city *acity = tile_city(ptile);
682
683 if (move_cost > maxrange) {
684 break;
685 }
686 if (!acity) {
687 continue;
688 }
689 if (city_owner(acity) == pplayer) {
691 }
693
696}
static struct action * action_by_number(action_id act_id)
Definition actions.h:396
#define action_id_get_role(act_id)
Definition actions.h:457
void building_advisor_choose(struct city *pcity, struct adv_choice *choice)
#define SHIELD_WEIGHTING
Definition advbuilding.h:20
struct adv_choice * adv_better_choice_free(struct adv_choice *first, struct adv_choice *second)
Definition advchoice.c:98
struct adv_choice * adv_new_choice(void)
Definition advchoice.c:59
#define adv_choice_set_use(_choice, _use)
Definition advchoice.h:85
@ CT_CIVILIAN
Definition advchoice.h:39
struct adv_data * adv_data_get(struct player *pplayer, bool *caller_closes)
Definition advdata.c:606
int ai_trait_get_value(enum trait tr, struct player *pplayer)
Definition aitraits.c:68
bool city_production_gets_caravan_shields(const struct universal *tgt)
Definition city.c:1860
const char * city_name_get(const struct city *pcity)
Definition city.c:1137
#define city_list_iterate(citylist, pcity)
Definition city.h:505
#define city_tile(_pcity_)
Definition city.h:561
#define city_owner(_pcity_)
Definition city.h:560
#define city_list_iterate_end
Definition city.h:507
int build_points_left(struct city *pcity)
Definition citytools.c:576
char * incite_cost
Definition comments.c:76
struct ai_plr * dai_plr_data_get(struct ai_type *ait, struct player *pplayer, bool *caller_closes)
Definition daidata.c:308
void dai_wonder_city_distance(struct ai_type *ait, struct player *pplayer, struct adv_data *adv)
struct adv_choice * domestic_advisor_choose_build(struct ai_type *ait, struct player *pplayer, struct city *pcity)
static void dai_choose_trade_route(struct ai_type *ait, struct city *pcity, struct adv_choice *choice, struct adv_data *ai)
static void dai_choose_help_wonder(struct ai_type *ait, struct city *pcity, struct adv_choice *choice, struct adv_data *ai)
Definition daidomestic.c:71
static struct ai_city * def_ai_city_data(const struct city *pcity, struct ai_type *deftype)
Definition daiplayer.h:42
struct unit_type * dai_wants_role_unit(struct ai_type *ait, struct player *pplayer, struct city *pcity, int role, int want)
Definition daitech.c:522
bool dai_choose_role_unit(struct ai_type *ait, struct player *pplayer, struct city *pcity, struct adv_choice *choice, enum choice_type type, int role, int want, bool need_boat)
Definition daitools.c:1345
#define DAI_WANT_DOMESTIC_MAX
Definition daitools.h:33
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
int get_target_bonus_effects(struct effect_list *plist, const struct req_context *context, const struct req_context *other_context, enum effect_type effect_type)
Definition effects.c:744
float adv_want
Definition fc_types.h:1063
#define ADV_WANT_PRINTF
Definition fc_types.h:1064
@ O_FOOD
Definition fc_types.h:101
@ O_TRADE
Definition fc_types.h:101
signed short Continent_id
Definition fc_types.h:231
struct civ_game game
Definition game.c:61
struct world wld
Definition game.c:62
struct city * game_city_by_number(int id)
Definition game.c:106
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
Definition handicaps.c:66
@ H_MAP
Definition handicaps.h:28
Impr_type_id improvement_index(const struct impr_type *pimprove)
bool is_wonder(const struct impr_type *pimprove)
#define fc_assert_msg(condition, message,...)
Definition log.h:182
#define fc_assert_ret(condition)
Definition log.h:192
@ LOG_DEBUG
Definition log.h:35
int unit_move_rate(const struct unit *punit)
Definition movement.c:89
struct pf_map * pf_map_new(const struct pf_parameter *parameter)
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
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1409
bool player_can_do_action_result(struct player *pplayer, enum action_result result)
Definition player.c:2028
#define players_iterate_end
Definition player.h:542
#define players_iterate(_pplayer)
Definition player.h:537
#define MAX(x, y)
Definition shared.h:54
#define CITY_LOG(loglevel, pcity, msg,...)
Definition srv_log.h:83
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
adv_want building_want[B_LAST]
Definition infracache.h:32
int max_num_cities
Definition advdata.h:145
int wonder_city
Definition advdata.h:55
int science_priority
Definition advdata.h:117
int gold_priority
Definition advdata.h:116
int distance_to_wonder_city
Definition daicity.h:54
struct ai_plr::@282 stats
int boats
Definition daidata.h:79
int available_boats
Definition daidata.h:80
Definition ai.h:50
Definition city.h:317
struct universal production
Definition city.h:393
struct city::@18::@20 server
struct adv_city * adv
Definition city.h:449
struct packet_game_info info
Definition game.h:89
struct packet_scenario_info scenario
Definition game.h:87
enum caravan_bonus_style caravan_bonus_style
int expand
Definition player.h:118
struct city_list * cities
Definition player.h:281
struct player_ai ai_common
Definition player.h:288
struct unit_list * units
Definition player.h:282
bool is_alive
Definition player.h:268
struct player_economic economic
Definition player.h:284
int pop_cost
Definition unittype.h:520
int move_rate
Definition unittype.h:524
Definition unit.h:140
int id
Definition unit.h:147
struct tile * tile
Definition unit.h:142
enum universals_n kind
Definition fc_types.h:608
universals_u value
Definition fc_types.h:607
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_continent(_tile)
Definition tile.h:93
int max_trade_prod(const struct city *pcity)
bool can_cities_trade(const struct city *pc1, const struct city *pc2)
int trade_route_type_trade_pct(enum trade_route_type type)
int city_num_trade_routes(const struct city *pcity)
unsigned max_trade_routes(const struct city *pcity)
Definition traderoutes.c:48
@ TRT_NATIONAL_IC
Definition traderoutes.h:39
@ TRT_IN_IC
Definition traderoutes.h:41
@ TRT_NATIONAL
Definition traderoutes.h:38
@ TRT_IN
Definition traderoutes.h:40
#define TRAIT_DEFAULT_VALUE
Definition traits.h:32
const struct unit_type * utype
Definition fc_types.h:553
const struct impr_type * building
Definition fc_types.h:546
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
Definition unit.c:383
struct unit * unit_virtual_create(struct player *pplayer, struct city *pcity, const struct unit_type *punittype, int veteran_level)
Definition unit.c:1661
void unit_virtual_destroy(struct unit *punit)
Definition unit.c:1766
#define unit_tile(_pu)
Definition unit.h:404
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
#define unit_list_iterate_end
Definition unitlist.h:33
struct unit_type * best_role_unit(const struct city *pcity, int role)
Definition unittype.c:2277
int utype_upkeep_cost(const struct unit_type *ut, struct player *pplayer, Output_type_id otype)
Definition unittype.c:132
struct unit_type * get_role_unit(int role, int role_index)
Definition unittype.c:2259
int utype_build_shield_cost_base(const struct unit_type *punittype)
Definition unittype.c:1474
int num_role_units(int role)
Definition unittype.c:2209
struct unit_type * best_role_unit_for_player(const struct player *pplayer, int role)
Definition unittype.c:2304
const char * utype_rule_name(const struct unit_type *punittype)
Definition unittype.c:1584
int utype_build_shield_cost(const struct city *pcity, const struct player *pplayer, const struct unit_type *punittype)
Definition unittype.c:1444
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:377
#define utype_class(_t_)
Definition unittype.h:756
@ MOVE_NONE
Definition unittype.h:144
#define MAP_NATIVE_WIDTH
#define MAP_NATIVE_HEIGHT