Freeciv-3.4
Loading...
Searching...
No Matches
sanitycheck.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/* utility */
19#include "bitvector.h"
20#include "log.h"
21
22/* common */
23#include "ai.h"
24#include "city.h"
25#include "game.h"
26#include "government.h"
27#include "map.h"
28#include "movement.h"
29#include "nation.h"
30#include "player.h"
31#include "research.h"
32#include "specialist.h"
33#include "terrain.h"
34#include "unit.h"
35#include "unitlist.h"
36
37/* server */
38#include "citytools.h"
39#include "cityturn.h" /* city_repair_size() */
40#include "diplhand.h" /* valid_dst_closest() */
41#include "maphand.h"
42#include "plrhand.h"
43#include "srv_main.h"
44#include "unittools.h"
45
46#include "sanitycheck.h"
47
48
49#ifdef SANITY_CHECKING
50
51#define SANITY_FAIL(format, ...) \
52 fc_assert_fail(file, function, line, NULL, format, ## __VA_ARGS__)
53
54#define SANITY_CHECK(check) \
55 fc_assert_full(file, function, line, check, , NOLOGMSG, NOLOGMSG)
56
57#define SANITY_CITY(_city, check) \
58 fc_assert_full(file, function, line, check, , \
59 "(%4d, %4d) in \"%s\"[%d]", TILE_XY((_city)->tile), \
60 city_name_get(_city), city_size_get(_city))
61
62#define SANITY_TERRAIN(_tile, check) \
63 fc_assert_full(file, function, line, check, , \
64 "(%4d, %4d) at \"%s\"", TILE_XY(_tile), \
65 terrain_rule_name(tile_terrain(_tile)))
66
67#define SANITY_TILE(_tile, check) \
68 do { \
69 struct city *_tile##_city = tile_city(_tile); \
70 if (NULL != _tile##_city) { \
71 SANITY_CITY(_tile##_city, check); \
72 } else { \
73 SANITY_TERRAIN(_tile, check); \
74 } \
75 } while (FALSE)
76
77static void check_city_feelings(const struct city *pcity, const char *file,
78 const char *function, int line);
79
80/**********************************************************************/
83static void check_specials(const char *file, const char *function, int line)
84{
85 whole_map_iterate(&(wld.map), ptile) {
86 const struct terrain *pterrain = tile_terrain(ptile);
87
88 extra_type_iterate(pextra) {
89 if (tile_has_extra(ptile, pextra)) {
90 extra_deps_iterate(&(pextra->reqs), pdep) {
91 SANITY_TILE(ptile, tile_has_extra(ptile, pdep));
93 }
95
97 if (tile_has_extra(ptile, pextra)) {
98 SANITY_TILE(ptile, pterrain->mining_time != 0);
99 }
102 if (tile_has_extra(ptile, pextra)) {
103 SANITY_TILE(ptile, pterrain->irrigation_time != 0);
104 }
106
107 SANITY_TILE(ptile, terrain_index(pterrain) >= T_FIRST
108 && terrain_index(pterrain) < terrain_count());
110}
111
112/**********************************************************************/
115static void check_fow(const char *file, const char *function, int line)
116{
117 if (!game_was_started()) {
118 /* The private map of the players is only allocated at game start. */
119 return;
120 }
121
122 whole_map_iterate(&(wld.map), ptile) {
123 players_iterate(pplayer) {
124 struct player_tile *plr_tile = map_get_player_tile(ptile, pplayer);
125
127 /* underflow of unsigned int */
128 SANITY_TILE(ptile, plr_tile->seen_count[v] < 30000);
129 SANITY_TILE(ptile, plr_tile->own_seen[v] < 30000);
130 SANITY_TILE(ptile, plr_tile->own_seen[v] <= plr_tile->seen_count[v]);
132
133 /* Lots of server bits depend on this. */
134 SANITY_TILE(ptile, plr_tile->seen_count[V_INVIS]
135 <= plr_tile->seen_count[V_MAIN]);
136 SANITY_TILE(ptile, plr_tile->own_seen[V_INVIS]
137 <= plr_tile->own_seen[V_MAIN]);
140
144}
145
146/**********************************************************************/
149static void check_misc(const char *file, const char *function, int line)
150{
151 int nplayers = 0, nbarbs = 0;
152
153 /* Do not use player_slots_iterate as we want to check the index! */
154 player_slots_iterate(pslot) {
155 if (player_slot_is_used(pslot)) {
157 nbarbs++;
158 }
159 nplayers++;
160 }
162
163 SANITY_CHECK(nplayers == player_count());
164 SANITY_CHECK(nbarbs == server.nbarbarians);
165
169}
170
171/**********************************************************************/
174static void check_map(const char *file, const char *function, int line)
175{
176 whole_map_iterate(&(wld.map), ptile) {
177 struct city *pcity = tile_city(ptile);
178 int cont = tile_continent(ptile);
179
180 CHECK_INDEX(tile_index(ptile));
181
182 if (NULL != pcity) {
183 SANITY_TILE(ptile, same_pos(pcity->tile, ptile));
184 SANITY_TILE(ptile, tile_owner(ptile) != NULL);
185 }
186
188 /* Only city tiles are claimed when borders are disabled */
189 SANITY_TILE(ptile, tile_owner(ptile) == NULL);
190 }
191
192 if (is_ocean_tile(ptile)) {
193 SANITY_TILE(ptile, cont < 0);
194 adjc_iterate(&(wld.map), ptile, tile1) {
195 if (is_ocean_tile(tile1)) {
196 SANITY_TILE(ptile, tile_continent(tile1) == cont);
197 }
199 } else {
200 SANITY_TILE(ptile, cont > 0);
201 adjc_iterate(&(wld.map), ptile, tile1) {
202 if (!is_ocean_tile(tile1)) {
203 SANITY_TILE(ptile, tile_continent(tile1) == cont);
204 }
206 }
207
208 unit_list_iterate(ptile->units, punit) {
209 SANITY_TILE(ptile, same_pos(unit_tile(punit), ptile));
210
211 /* Check diplomatic status of stacked units. */
212 unit_list_iterate(ptile->units, punit2) {
216 if (pcity) {
218 city_owner(pcity)));
219 }
222}
223
224/**********************************************************************/
227static bool check_city_good(struct city *pcity, const char *file,
228 const char *function, int line)
229{
230 struct player *pplayer = city_owner(pcity);
231 struct tile *pcenter = city_tile(pcity);
232
233 if (NULL == pcenter) {
234 /* Editor! */
235 SANITY_FAIL("(----,----) city has no tile (skipping remaining tests), "
236 "at %s \"%s\"[%d]%s",
239 "{city center}");
240 return FALSE;
241 }
242
244
247
248 if (NULL != tile_owner(pcenter)) {
249 if (tile_owner(pcenter) != pplayer) {
250 SANITY_FAIL("(%4d,%4d) tile owned by %s, at %s \"%s\"[%d]%s",
255 "{city center}");
256 }
257 }
258
259 unit_list_iterate(pcity->units_supported, punit) {
261 SANITY_CITY(pcity, unit_owner(punit) == pplayer);
263
264 city_built_iterate(pcity, pimprove) {
265 if (is_small_wonder(pimprove)) {
266 SANITY_CITY(pcity, city_from_small_wonder(pplayer, pimprove) == pcity);
267 } else if (is_great_wonder(pimprove)) {
269 }
271
273 struct city *partner = game_city_by_number(proute->partner);
274
275 if (partner != NULL) {
276 struct trade_route *back_route = NULL;
277
279 if (pback->partner == pcity->id) {
281 break;
282 }
284
286
287 if (back_route != NULL) {
288 switch (back_route->dir) {
289 case RDIR_TO:
291 break;
292 case RDIR_FROM:
294 break;
297 break;
298 case RDIR_NONE:
300 break;
301 }
302
303 SANITY_CITY(pcity, proute->goods == back_route->goods);
304 }
305 }
307
310 SANITY_FAIL("(%4d,%4d) Bad worker task %d in \"%s\", removing...",
312 ptask->act,
315 free(ptask);
316 ptask = NULL;
317 }
319
320 return TRUE;
321}
322
323/**********************************************************************/
326static void check_city_size(struct city *pcity, const char *file,
327 const char *function, int line)
328{
329 int delta;
330 int citizen_count = 0;
331 struct tile *pcenter = city_tile(pcity);
332 const struct civ_map *nmap = &(wld.map);
333
335
337 ptile, _index, _x, _y) {
338 if (tile_worked(ptile) == pcity) {
340 }
342
345 if (0 != delta) {
346 SANITY_FAIL("(%4d,%4d) %d citizens not equal [size], "
347 "repairing \"%s\"[%d]", TILE_XY(pcity->tile),
349
351 log_debug("[%s (%d)] specialists: %d", city_name_get(pcity), pcity->id,
353
354 city_repair_size(pcity, delta);
356 }
357}
358
359/**********************************************************************/
363static void check_city_feelings(const struct city *pcity, const char *file,
364 const char *function, int line)
365{
366 int feel;
368
369 for (feel = FEELING_BASE; feel < FEELING_LAST; feel++) {
370 int sum = 0;
371 int ccategory;
372
374 sum += pcity->feel[ccategory][feel];
375 }
376
377 /* While loading savegame, we want to check sanity of values read from the
378 * savegame despite the fact that city workers_frozen level of the city
379 * is above zero -> can't limit sanitycheck callpoints by that. Instead
380 * we check even more relevant needs_arrange. */
381 SANITY_CITY(pcity, pcity->server.needs_arrange == CNA_NOT);
382
384 }
385}
386
387/**********************************************************************/
390void real_sanity_check_city(struct city *pcity, const char *file,
391 const char *function, int line)
392{
393 if (check_city_good(pcity, file, function, line)) {
396 }
397}
398
399/**********************************************************************/
402static void check_cities(const char *file, const char *function, int line)
403{
404 players_iterate(pplayer) {
405 city_list_iterate(pplayer->cities, pcity) {
406 SANITY_CITY(pcity, city_owner(pcity) == pplayer);
407
411}
412
413/**********************************************************************/
416static void check_units(const char *file, const char *function, int line)
417{
418 players_iterate(pplayer) {
419 unit_list_iterate(pplayer->units, punit) {
420 struct tile *ptile = unit_tile(punit);
421 struct city *pcity;
422 struct city *phome;
424
425 SANITY_CHECK(unit_owner(punit) == pplayer);
426
429 punit->homecity));
430 if (phome) {
431 SANITY_CHECK(city_owner(phome) == pplayer);
432 }
433 }
434
435 /* Unit in the correct player list? */
437 punit->id) != NULL);
438
440 SANITY_FAIL("(%4d,%4d) %s has activity %s, "
441 "but it can't continue at %s",
444 tile_get_info_text(ptile, TRUE, 0));
445 }
446
449 }
450
451 if (punit->activity == ACTIVITY_GOTO) {
452 /* ACTIVITY_GOTO requires goto_tile always to be set. */
454 }
455
456 pcity = tile_city(ptile);
457 if (pcity) {
459 }
460
462 SANITY_CHECK(punit->hp > 0);
463
464 /* Check for ground units in the ocean. */
466 || ptrans != NULL);
467
468 /* Check for over-full transports. */
471
472 /* Check transporter. This should be last as the pointer ptrans will
473 * be modified. */
474 if (ptrans != NULL) {
475 struct unit *plevel = punit;
476 int level = 0;
477
478 /* Make sure the transporter is on the tile. */
480
481 /* Can punit be cargo for its transporter? */
483
484 /* Check that the unit is listed as transported. */
486 punit) != NULL);
487
488 /* Check the depth of the transportation. */
489 while (ptrans) {
490 struct unit_list *pcargos = unit_transport_cargo(ptrans);
491
494
495 /* Check for next level. */
496 plevel = ptrans;
498 level++;
499 }
500
501 /* Transporter capacity will be checked when transporter itself
502 * is checked */
503 }
504
505 /* Check that cargo is marked as transported with this unit */
511}
512
513/**********************************************************************/
516static void check_players(const char *file, const char *function, int line)
517{
518 players_iterate(pplayer) {
519 int found_primary_capital = 0;
520
521 if (!pplayer->is_alive) {
522 /* Dead players' units and cities are disbanded in kill_player(). */
523 SANITY_CHECK(unit_list_size(pplayer->units) == 0);
524 SANITY_CHECK(city_list_size(pplayer->cities) == 0);
525
526 continue;
527 }
528
529 SANITY_CHECK(pplayer->server.adv != NULL);
530 SANITY_CHECK(!pplayer->nation || pplayer->nation->player == pplayer);
532
534 || city_list_size(pplayer->cities) == 0);
535
536 city_list_iterate(pplayer->cities, pcity) {
537 if (pcity->capital == CAPITAL_PRIMARY) {
539 }
542
545
546 if (pplayer2 == pplayer) {
547 break; /* Do diplomatic sanity check only once per player couple. */
548 }
549
552 SANITY_CHECK(state1->type == state2->type);
553 SANITY_CHECK(state1->max_state == state2->max_state);
555 if (state1->type == DS_CEASEFIRE
556 || state1->type == DS_ARMISTICE) {
557 SANITY_CHECK(state1->turns_left == state2->turns_left);
558 }
559 if (state1->type == DS_TEAM) {
563 if (pplayer->is_alive && pplayer2->is_alive) {
566 }
567 }
568 if (pplayer->is_alive
569 && pplayer2->is_alive
570 && pplayers_allied(pplayer, pplayer2)) {
573
578 }
580
581 if (pplayer->revolution_finishes == -1) {
583 SANITY_FAIL("%s government is anarchy, but does not finish!",
585 }
587 } else if (pplayer->revolution_finishes > game.info.turn) {
589 } else {
590 /* Things may vary in this case depending on when the sanity_check
591 * call is made. No better check is possible. */
592 }
593
594 /* Dying players shouldn't be left around. But they are. */
597
598 nations_iterate(pnation) {
599 SANITY_CHECK(!pnation->player || pnation->player->nation == pnation);
601
604 SANITY_CHECK(pplayer->team == pteam);
607}
608
609/**********************************************************************/
612static void check_teams(const char *file, const char *function, int line)
613{
614 int count[MAX_NUM_TEAM_SLOTS];
615
616 memset(count, 0, sizeof(count));
617 players_iterate(pplayer) {
618 /* For the moment, all players have teams. */
619 SANITY_CHECK(pplayer->team != NULL);
620 if (pplayer->team) {
621 count[team_index(pplayer->team)]++;
622 }
624
630 == count[team_slot_index(tslot)]);
631 }
633}
634
635/**********************************************************************/
638static void
639check_researches(const char *file, const char *function, int line)
640{
643 || A_UNSET == presearch->researching
644 || is_future_tech(presearch->researching)
645 || (A_NONE != presearch->researching
646 && valid_advance_by_number(presearch->researching)));
647 SANITY_CHECK(A_UNSET == presearch->tech_goal
648 || (A_NONE != presearch->tech_goal
649 && valid_advance_by_number(presearch->tech_goal)));
650 SANITY_CHECK(presearch->techs_researched
653}
654
655/**********************************************************************/
658static void check_connections(const char *file, const char *function,
659 int line)
660{
662
663 /* Other lists are subsets of all_connections */
666}
667
668/**********************************************************************/
677void real_sanity_check(const char *file, const char *function, int line)
678{
679 if (!map_is_empty()) {
680 /* Don't sanity-check the map if it hasn't been created yet (this
681 * happens when loading scenarios). */
683 check_map(file, function, line);
684 check_cities(file, function, line);
685 check_units(file, function, line);
686 check_fow(file, function, line);
687 }
688 check_misc(file, function, line);
690 check_teams(file, function, line);
693
694 players_iterate(pplayer) {
695 CALL_PLR_AI_FUNC(check_sanity, pplayer, pplayer);
697}
698
699/**********************************************************************/
703void real_sanity_check_tile(struct tile *ptile, const char *file,
704 const char *function, int line)
705{
706 SANITY_CHECK(ptile != NULL);
707 SANITY_CHECK(ptile->terrain != NULL);
708
709 unit_list_iterate(ptile->units, punit) {
710 /* Check if the units can survive on the tile (terrain). Here only the
711 * 'easy' test if the unit is transported is done. A complete check is
712 * done by check_units() in real_sanity_check(). */
713 if (!can_unit_exist_at_tile(&(wld.map), punit, ptile)
714 && !unit_transported(punit)) {
715 SANITY_FAIL("(%4d,%4d) %s can't survive on %s", TILE_XY(ptile),
717 }
719}
720
721#endif /* SANITY_CHECKING */
#define CALL_PLR_AI_FUNC(_func, _player,...)
Definition ai.h:380
#define BV_ISSET(bv, bit)
Definition bitvector.h:86
const char * city_name_get(const struct city *pcity)
Definition city.c:1141
void city_refresh_from_main_map(const struct civ_map *nmap, struct city *pcity, bool *workers_map)
Definition city.c:3243
int city_map_radius_sq_get(const struct city *pcity)
Definition city.c:137
void citylog_map_workers(enum log_level level, struct city *pcity)
Definition city.c:446
citizens city_specialists(const struct city *pcity)
Definition city.c:3385
@ CNA_NOT
Definition city.h:304
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define city_tile(_pcity_)
Definition city.h:565
static citizens city_size_get(const struct city *pcity)
Definition city.h:570
#define city_tile_iterate_skip_free_worked(_nmap, _radius_sq, _city_tile, _tile, _index, _x, _y)
Definition city.h:212
@ CITIZEN_LAST
Definition city.h:270
@ CITIZEN_HAPPY
Definition city.h:266
#define city_owner(_pcity_)
Definition city.h:564
#define city_tile_iterate_skip_free_worked_end
Definition city.h:220
#define city_list_iterate_end
Definition city.h:510
@ FEELING_LAST
Definition city.h:283
@ FEELING_BASE
Definition city.h:277
#define city_built_iterate(_pcity, _p)
Definition city.h:836
#define city_built_iterate_end
Definition city.h:842
void city_repair_size(struct city *pcity, int change)
Definition cityturn.c:852
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
enum diplstate_type valid_dst_closest(struct player_diplstate *dst)
Definition diplhand.c:108
#define extra_type_iterate(_p)
Definition extras.h:315
#define extra_deps_iterate(_reqs, _dep)
Definition extras.h:372
#define extra_type_iterate_end
Definition extras.h:321
#define extra_deps_iterate_end
Definition extras.h:380
#define extra_type_by_cause_iterate_end
Definition extras.h:339
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:333
@ BORDERS_DISABLED
Definition fc_types.h:732
#define IDENTITY_NUMBER_ZERO
Definition fc_types.h:94
struct civ_game game
Definition game.c:62
struct world wld
Definition game.c:63
struct city * game_city_by_number(int id)
Definition game.c:107
#define GAME_TRANSPORT_MAX_RECURSIVE
Definition game.h:767
struct government * government_by_number(const Government_type_id gov)
Definition government.c:105
struct government * government_of_player(const struct player *pplayer)
Definition government.c:116
bool is_great_wonder(const struct impr_type *pimprove)
struct city * city_from_small_wonder(const struct player *pplayer, const struct impr_type *pimprove)
struct city * city_from_great_wonder(const struct impr_type *pimprove)
bool is_small_wonder(const struct impr_type *pimprove)
#define log_debug(message,...)
Definition log.h:116
@ LOG_DEBUG
Definition log.h:35
#define fc_assert_exit(condition)
Definition log.h:198
bool same_pos(const struct tile *tile1, const struct tile *tile2)
Definition map.c:1076
bool map_is_empty(void)
Definition map.c:148
#define adjc_iterate_end
Definition map.h:439
#define CHECK_INDEX(mindex)
Definition map.h:153
#define adjc_iterate(nmap, center_tile, itr_tile)
Definition map.h:434
#define whole_map_iterate(_map, _tile)
Definition map.h:582
#define whole_map_iterate_end
Definition map.h:591
bool really_gives_vision(struct player *me, struct player *them)
Definition maphand.c:343
struct player_tile * map_get_player_tile(const struct tile *ptile, const struct player *pplayer)
Definition maphand.c:1387
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
Definition movement.c:350
const char * nation_rule_name(const struct nation_type *pnation)
Definition nation.c:138
struct nation_type * nation_of_player(const struct player *pplayer)
Definition nation.c:443
#define nations_iterate_end
Definition nation.h:364
#define nations_iterate(NAME_pnation)
Definition nation.h:361
bool player_slot_is_used(const struct player_slot *pslot)
Definition player.c:441
struct unit * player_unit_by_number(const struct player *pplayer, int unit_id)
Definition player.c:1217
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
Definition player.c:1468
int player_count(void)
Definition player.c:806
int player_slot_count(void)
Definition player.c:415
enum dipl_reason pplayer_can_make_treaty(const struct player *p1, const struct player *p2, enum diplstate_type treaty)
Definition player.c:164
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
Definition player.c:1979
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:245
struct city * player_city_by_number(const struct player *pplayer, int city_id)
Definition player.c:1191
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
Definition player.c:325
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1397
struct player * player_slot_get_player(const struct player_slot *pslot)
Definition player.c:432
#define players_iterate_end
Definition player.h:552
dipl_reason
Definition player.h:192
@ DIPL_ALLIANCE_PROBLEM_THEM
Definition player.h:194
@ DIPL_ALLIANCE_PROBLEM_US
Definition player.h:194
#define players_iterate(_pplayer)
Definition player.h:547
#define player_list_iterate(playerlist, pplayer)
Definition player.h:570
static bool is_barbarian(const struct player *pplayer)
Definition player.h:499
#define player_slots_iterate(_pslot)
Definition player.h:538
#define player_list_iterate_end
Definition player.h:572
#define player_slots_iterate_end
Definition player.h:542
int normal_player_count(void)
Definition plrhand.c:3212
int recalculate_techs_researched(const struct research *presearch)
Definition research.c:1357
#define researches_iterate(_presearch)
Definition research.h:155
#define researches_iterate_end
Definition research.h:158
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
bool game_was_started(void)
Definition srv_main.c:355
enum server_states server_state(void)
Definition srv_main.c:339
Definition city.h:318
struct conn_list * est_connections
Definition game.h:97
struct packet_game_info info
Definition game.h:89
struct conn_list * web_client_connections
Definition game.h:99
struct conn_list * all_connections
Definition game.h:96
struct civ_game::@32::@36 server
int max_players
Definition game.h:163
struct government * government_during_revolution
Definition game.h:94
struct player * player
Definition nation.h:118
enum borders_mode borders
Government_type_id government_during_revolution_id
struct city_list * cities
Definition player.h:281
bv_pstatus status
Definition player.h:322
int revolution_finishes
Definition player.h:273
struct team * team
Definition player.h:261
struct unit_list * units
Definition player.h:282
bool is_alive
Definition player.h:268
struct player::@73::@75 server
struct nation_type * nation
Definition player.h:260
struct adv_data * adv
Definition player.h:334
Definition team.c:40
int mining_time
Definition terrain.h:118
int irrigation_time
Definition terrain.h:115
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
struct terrain * terrain
Definition tile.h:57
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
struct unit::@84::@87 server
struct tile * tile
Definition unit.h:142
struct extra_type * activity_target
Definition unit.h:167
int homecity
Definition unit.h:148
struct tile * goto_tile
Definition unit.h:157
struct civ_map map
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
int team_count(void)
Definition team.c:366
int team_index(const struct team *pteam)
Definition team.c:374
struct team * team_slot_get_team(const struct team_slot *tslot)
Definition team.c:149
int team_slot_index(const struct team_slot *tslot)
Definition team.c:138
const struct player_list * team_members(const struct team *pteam)
Definition team.c:442
bool team_slot_is_used(const struct team_slot *tslot)
Definition team.c:160
#define team_slots_iterate_end
Definition team.h:89
#define team_slots_iterate(_tslot)
Definition team.h:84
#define teams_iterate_end
Definition team.h:99
#define teams_iterate(_pteam)
Definition team.h:94
#define MAX_NUM_TEAM_SLOTS
Definition team.h:27
bool is_future_tech(Tech_type_id tech)
Definition tech.c:286
struct advance * valid_advance_by_number(const Tech_type_id id)
Definition tech.c:181
#define A_NONE
Definition tech.h:43
#define A_UNSET
Definition tech.h:48
Terrain_type_id terrain_count(void)
Definition terrain.c:119
Terrain_type_id terrain_index(const struct terrain *pterrain)
Definition terrain.c:139
#define is_ocean_tile(ptile)
Definition terrain.h:197
#define terrain_has_flag(terr, flag)
Definition terrain.h:177
#define T_FIRST
Definition terrain.h:65
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
Definition tile.c:772
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_index(_pt_)
Definition tile.h:89
#define tile_worked(_tile)
Definition tile.h:119
#define tile_terrain(_tile)
Definition tile.h:115
#define TILE_XY(ptile)
Definition tile.h:43
#define tile_continent(_tile)
Definition tile.h:93
#define tile_has_extra(ptile, pextra)
Definition tile.h:152
#define tile_owner(_tile)
Definition tile.h:97
#define trade_routes_iterate_end
#define trade_routes_iterate(c, proute)
int get_transporter_occupancy(const struct unit *ptrans)
Definition unit.c:1847
bool unit_transport_check(const struct unit *pcargo, const struct unit *ptrans)
Definition unit.c:2583
struct unit * unit_transport_get(const struct unit *pcargo)
Definition unit.c:2545
bool can_unit_continue_current_activity(const struct civ_map *nmap, struct unit *punit)
Definition unit.c:884
const char * get_activity_text(enum unit_activity activity)
Definition unit.c:657
int get_transporter_capacity(const struct unit *punit)
Definition unit.c:316
bool unit_transported(const struct unit *pcargo)
Definition unit.c:2529
struct unit_list * unit_transport_cargo(const struct unit *ptrans)
Definition unit.c:2555
bool activity_requires_target(enum unit_activity activity)
Definition unit.c:609
#define unit_tile(_pu)
Definition unit.h:407
#define unit_owner(_pu)
Definition unit.h:406
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
#define unit_list_iterate_end
Definition unitlist.h:33
const char * unit_rule_name(const struct unit *punit)
Definition unittype.c:1613
#define vision_layer_iterate(v)
Definition vision.h:76
#define vision_layer_iterate_end
Definition vision.h:79
bool worker_task_is_sane(struct worker_task *ptask)
Definition workertask.c:40
#define worker_task_list_iterate(tasklist, ptask)
Definition workertask.h:33
#define worker_task_list_iterate_end
Definition workertask.h:35