55 #define MAXIMUM_CLAIMED_OCEAN_SIZE (20)
68 bool can_reveal_tiles);
70 const v_radius_t change,
bool can_reveal_tiles);
74 const struct tile *ptile,
75 enum vision_layer vlayer);
77 const struct tile *ptile,
78 enum vision_layer vlayer);
100 _(
"Global warming has occurred!"));
102 _(
"Coastlines have been flooded and vast "
103 "ranges of grassland have become deserts."));
113 _(
"Nuclear winter has occurred!"));
115 _(
"Wetlands have dried up and vast "
116 "ranges of grassland have become tundra."));
127 memset(used, 0,
sizeof(used));
129 qDebug(
"Climate change: %s (%d)",
130 warming ?
"Global warming" :
"Nuclear winter",
effect);
132 while (
effect > 0 && (k--) > 0) {
133 struct terrain *old, *candidates[2], *tnew;
147 struct terrain *wetter, *drier;
152 candidates[0] = wetter;
153 candidates[1] = drier;
155 candidates[0] = drier;
156 candidates[1] = wetter;
163 for (i = 0; i < 2; i++) {
164 tnew = candidates[i];
193 if (tnew !=
T_NONE && old != tnew) {
203 }
else if (old == tnew) {
218 bool upgradet =
false;
228 if (gained !=
nullptr) {
253 int cities_upgradet = 0;
255 bool multiple_types =
false;
256 int cities_total = city_list_size(pplayer->
cities);
268 if (new_upgrade ==
nullptr) {
270 multiple_types =
true;
271 }
else if (upgradet ==
nullptr) {
273 upgradet = new_upgrade;
274 }
else if (upgradet != new_upgrade) {
276 multiple_types =
true;
282 if (cities_total > 0) {
283 percent = cities_upgradet * 100 / cities_total;
288 if (cities_upgradet > 0) {
293 _(
"New hope sweeps like fire through the country as "
294 "the discovery of new infrastructure building technology "
301 _(
"The people are pleased to hear that your "
302 "scientists finally know about new infrastructure building "
307 if (multiple_types) {
309 _(
"Workers spontaneously gather and upgrade all "
310 "possible cities with better infrastructure."));
313 _(
"Workers spontaneously gather and upgrade all "
314 "possible cities with %s."),
488 struct packet_tile_info info;
489 const struct player *owner;
490 const struct player *eowner;
492 if (dest ==
nullptr) {
509 info.spec_sprite[0] =
'\0';
514 struct player *pplayer = pconn->playing;
516 if (
nullptr == pplayer && !pconn->observer) {
539 info.place_turn = (
nullptr != ptile->
placing)
543 if (pplayer !=
nullptr) {
546 info.extras = ptile->
extras;
549 if (ptile->
label !=
nullptr) {
552 qstrncpy(info.label, ptile->
label,
sizeof(info.label) - 1);
554 info.label[0] =
'\0';
557 send_packet_tile_info(pconn, &info);
573 info.terrain = (
nullptr != plrtile->
terrain)
576 info.resource = (
nullptr != plrtile->
resource)
582 info.extras = plrtile->
extras;
585 if (ptile->
label !=
nullptr) {
588 info.label[0] =
'\0';
591 send_packet_tile_info(pconn, &info);
592 }
else if (send_unknown) {
606 info.label[0] =
'\0';
608 send_packet_tile_info(pconn, &info);
619 struct packet_map_info minfo;
625 lsend_packet_map_info(dest, &minfo);
635 bool can_reveal_tiles)
654 const v_radius_t new_radius_sq,
bool can_reveal_tiles)
659 if (old_radius_sq[V_MAIN] == new_radius_sq[V_MAIN]
660 && old_radius_sq[V_INVIS] == new_radius_sq[V_INVIS]
661 && old_radius_sq[V_SUBSURFACE] == new_radius_sq[V_SUBSURFACE]) {
669 if (max_radius < old_radius_sq[v]) {
670 max_radius = old_radius_sq[v];
672 if (max_radius < new_radius_sq[v]) {
673 max_radius = new_radius_sq[v];
683 log_debug(
" vision layer %d is changing from %d to %d.", v,
684 old_radius_sq[v], new_radius_sq[v]);
694 if (dr > old_radius_sq[v] && dr <= new_radius_sq[v]) {
696 }
else if (dr > new_radius_sq[v] && dr <= old_radius_sq[v]) {
718 if (pplayer->
server.border_vision == is_enabled) {
725 pplayer->
server.border_vision = is_enabled;
729 if (pplayer == ptile->owner) {
745 static int recurse = 0;
804 static int recurse = 0;
895 const struct player *pplayer,
896 enum vision_layer vlayer)
910 const struct tile *ptile,
911 enum vision_layer vlayer)
923 const v_radius_t change,
bool can_reveal_tiles)
926 bool revealing_tile =
false;
929 log_debug(
"%s() for player %s (nb %d) at (%d, %d).", __FUNCTION__,
933 log_debug(
" vision layer %d is changing from %d to %d.", v,
942 if (0 > change[V_INVIS]
943 && plrtile->
seen_count[V_INVIS] == -change[V_INVIS]) {
944 log_debug(
"(%d, %d): hiding invisible units to player %s (nb %d).",
956 if (0 > change[V_SUBSURFACE]
957 && plrtile->
seen_count[V_SUBSURFACE] == -change[V_SUBSURFACE]) {
958 log_debug(
"(%d, %d): hiding subsurface units to player %s (nb %d).",
971 if (0 > change[V_MAIN] && plrtile->
seen_count[V_MAIN] == -change[V_MAIN]) {
972 log_debug(
"(%d, %d): hiding visible units to player %s (nb %d).",
1004 if (0 < plrtile->
seen_count[V_MAIN] && can_reveal_tiles) {
1005 log_debug(
"(%d, %d): revealing tile to player %s (nb %d).",
1010 revealing_tile =
true;
1017 if (0 > change[V_MAIN] && 0 == plrtile->
seen_count[V_MAIN]) {
1018 log_debug(
"(%d, %d): fogging tile for player %s (nb %d).",
1029 if ((revealing_tile && 0 < plrtile->
seen_count[V_MAIN])
1030 || (0 < change[V_MAIN]
1033 && (change[V_MAIN] + !
game.
info.fogofwar
1037 log_debug(
"(%d, %d): unfogging tile for player %s (nb %d).",
1059 if (
nullptr != (pcity =
tile_city(ptile))) {
1064 if ((revealing_tile && 0 < plrtile->
seen_count[V_INVIS])
1065 || (0 < change[V_INVIS]
1066 && change[V_INVIS] == plrtile->
seen_count[V_INVIS])) {
1067 log_debug(
"(%d, %d): revealing invisible units to player %s (nb %d).",
1078 if ((revealing_tile && 0 < plrtile->
seen_count[V_SUBSURFACE])
1079 || (0 < change[V_SUBSURFACE]
1080 && change[V_SUBSURFACE] == plrtile->
seen_count[V_SUBSURFACE])) {
1081 log_debug(
"(%d, %d): revealing subsurface units to player %s (nb %d).",
1101 const struct tile *ptile,
1102 enum vision_layer vlayer)
1125 if (ptile->
site.get() != new_site) {
1126 ptile->
site.reset(new_site);
1179 delete[] pplayer->
server.private_map;
1193 if (!pplayer->
server.private_map) {
1200 delete[] pplayer->
server.private_map;
1201 pplayer->
server.private_map =
nullptr;
1218 bool reality_changed =
false;
1223 bool changed =
false;
1225 if (!aplayer->server.private_map) {
1231 if (aplrtile && aplrtile->
site
1238 if (aplrtile->
owner == pplayer) {
1239 aplrtile->
owner =
nullptr;
1264 reality_changed =
true;
1267 ptile->extras_owner =
nullptr;
1268 reality_changed =
true;
1271 if (reality_changed) {
1290 plrtile->
owner =
nullptr;
1292 plrtile->
site =
nullptr;
1318 const struct player *pplayer)
1331 const struct player *pplayer)
1342 const struct player *pplayer)
1415 struct player *pplayer = pconn->playing;
1417 if (
nullptr == pplayer && pconn->observer) {
1467 dest_tile->terrain = from_tile->terrain;
1468 dest_tile->extras = from_tile->extras;
1469 dest_tile->resource = from_tile->resource;
1470 dest_tile->owner = from_tile->owner;
1471 dest_tile->extras_owner = from_tile->extras_owner;
1472 dest_tile->last_updated = from_tile->last_updated;
1476 if (from_tile->site) {
1532 pplayer->server.really_gives_vision = pplayer->gives_shared_vision;
1550 && pplayer != pplayer3) {
1551 BV_SET(pplayer->server.really_gives_vision,
1562 }
while (added > 0);
1575 qCritical(
"Trying to give shared vision from %s to %s, "
1576 "but that vision is already given!",
1583 save_vision[
player_index(pplayer)] = pplayer->server.really_gives_vision;
1600 log_debug(
"really giving shared vision from %s to %s",
1609 if (0 < change[V_MAIN] || 0 < change[V_INVIS]) {
1640 qCritical(
"Tried removing the shared vision from %s to %s, "
1641 "but it did not exist in the first place!",
1648 save_vision[
player_index(pplayer)] = pplayer->server.really_gives_vision;
1666 log_debug(
"really removing shared vision from %s to %s",
1675 if (0 > change[V_MAIN] || 0 > change[V_INVIS]) {
1755 bool ocean_near =
false;
1822 bool old_is_ocean, new_is_ocean;
1824 if (!oldter || !newter) {
1831 return (old_is_ocean && !new_is_ocean) || (!old_is_ocean && new_is_ocean);
1841 if (pcity !=
nullptr) {
1860 if (extend_rivers) {
1883 bool nonfresh =
false;
1960 bool other_continent;
1967 if (ptile == source) {
1980 other_continent =
false;
1984 if (tile2 == source) {
1988 if (cont2 == cont) {
1990 }
else if (cont1 <= 0) {
1993 }
else if (cont2 != cont1) {
1996 other_continent =
true;
2000 return !other_continent && ocean_tiles <= 2;
2012 if (
nullptr == phome) {
2026 struct tile *psource)
2030 if ((ploser != powner && ploser !=
nullptr)
2033 || ploser->
server.border_vision)) {
2039 if (powner !=
nullptr
2042 || powner->
server.border_vision)) {
2055 if (ploser != powner) {
2071 struct tile *psource,
bool claim_bases)
2122 int old_radius_sq,
int new_radius_sq)
2124 if (old_radius_sq == new_radius_sq) {
2133 if (old_radius_sq < new_radius_sq) {
2138 if (dr > new_radius_sq) {
2162 if (
owner ==
nullptr) {
2170 if (radius_sq < 0) {
2178 if (dclaimer == ptile) {
2197 if (dr != 0 &&
nullptr != dclaimer && dclaimer != ptile) {
2199 int strength_old, strength_new;
2201 if (ccity !=
nullptr) {
2209 +
game.
info.border_city_permanent_radius_sq) {
2218 if (strength_new <= strength_old) {
2255 qDebug(
"map_calculate_borders()");
2265 qDebug(
"map_calculate_borders() workers");
2284 units_num = unit_list_size(ptile->
units);
2285 auto could_see_unit =
2286 (units_num > 0 ? std::make_unique<bv_player[]>(units_num) :
nullptr);
2289 if (pextra->
eus != EUS_NORMAL) {
2310 if (powner !=
nullptr) {
2320 if (ploser !=
nullptr) {
2331 && powner != ploser) {
2335 if (ploser !=
nullptr) {
2346 if (powner !=
nullptr) {
2355 if (pextra->
eus != EUS_NORMAL) {
2408 bool extras_removed =
false;
2415 extras_removed =
true;
2420 if (pextra->
eus != EUS_NORMAL) {
2442 if (pextra->
data.
base !=
nullptr) {
2450 if (old_owner != pplayer) {
2454 if (oldbase != pextra) {
2468 if (extras_removed) {
2480 bv_player base_seen;
2503 if (
nullptr != owner
2530 if (pextra->
eus != EUS_NORMAL) {
2567 }
else if (reveal_cities &&
nullptr !=
tile_city(ptile)) {
#define CALL_FUNC_EACH_AI(_func,...)
bool territory_claiming_base(const struct base_type *pbase)
Does this base type claim territory?
bool BV_ISSET(const BV &bv, int bit)
#define BV_ARE_EQUAL(vec1, vec2)
int tile_border_source_radius_sq(struct tile *ptile)
Border radius sq from given border source tile.
bool is_border_source(struct tile *ptile)
Is given tile source to borders.
int tile_border_strength(struct tile *ptile, struct tile *source)
Border source strength at tile.
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
struct tile * city_tile(const struct city *pcity)
Return the tile location of the city.
int city_map_radius_sq_get(const struct city *pcity)
Returns the current squared radius of the city.
#define city_list_iterate(citylist, pcity)
#define city_tile_iterate(_radius_sq, _city_tile, _tile)
#define city_list_iterate_end
#define city_tile_iterate_end
void city_refresh_queue_add(struct city *pcity)
Queue pending city_refresh() for later.
void city_refresh_queue_processing()
Refresh the listed cities.
void conn_list_do_unbuffer(struct conn_list *dest)
Convenience functions to unbuffer a list of connections.
void conn_list_compression_thaw(const struct conn_list *pconn_list)
Thaw a connection list.
void conn_list_do_buffer(struct conn_list *dest)
Convenience functions to buffer a list of connections.
void conn_list_compression_freeze(const struct conn_list *pconn_list)
Freeze a connection list.
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
#define MAX_NUM_PLAYER_SLOTS
signed short Continent_id
#define IDENTITY_NUMBER_ZERO
const struct ft_color ftc_server
struct city * game_city_by_number(int id)
Often used function to get a city pointer from a city ID.
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
bool terrain_surroundings_allow_change(const struct tile *ptile, const struct terrain *pterrain)
Returns FALSE if a terrain change to 'pterrain' would be prevented by not having enough similar terra...
struct tile * rand_map_pos(const struct civ_map *nmap)
Random square anywhere on the map.
int map_num_tiles()
Returns the total number of (real) positions (or tiles) on the map.
int map_vector_to_sq_distance(int dx, int dy)
Return the sq_distance for a given vector.
void map_distance_vector(int *dx, int *dy, const struct tile *tile0, const struct tile *tile1)
Topology function to find the vector which has the minimum "real" distance between the map positions ...
#define circle_dxyr_iterate(nmap, center_tile, sq_radius, _tile, dx, dy, dr)
#define cardinal_adjc_iterate_end
#define adjc_iterate(nmap, center_tile, itr_tile)
#define circle_dxyr_iterate_end
#define cardinal_adjc_iterate(nmap, center_tile, itr_tile)
#define circle_iterate(nmap, center_tile, sq_radius, tile_itr)
#define whole_map_iterate(_map, _tile)
#define MAP_TILE_OWNER_NULL
#define whole_map_iterate_end
#define circle_iterate_end
struct terrain * most_shallow_ocean(bool frozen)
Return most shallow ocean terrain type.
int get_ocean_size(Continent_id id)
Return size in tiles of the given ocean.
void assign_continent_numbers()
Assigns continent and ocean numbers to all tiles, and set map.num_continents and map....
int get_lake_surrounders(Continent_id cont)
Get continent surrounding lake, or -1 if there is multiple continents.
void disable_fog_of_war()
Turns FoW off for everyone.
void player_map_init(struct player *pplayer)
Allocate space for map, and initialise the tiles.
void update_player_tile_last_seen(struct player *pplayer, struct tile *ptile)
Remember that tile was last seen this year.
static void shared_vision_change_seen(struct player *pplayer, struct tile *ptile, const v_radius_t change, bool can_reveal_tiles)
Change the seen count of a tile for a pplayer.
void vision_clear_sight(struct vision *vision)
Clear all sight points from this vision source.
void map_calculate_borders()
Update borders for all sources.
void map_set_border_vision(struct player *pplayer, const bool is_enabled)
Turn a players ability to see inside his borders on or off.
void map_claim_ownership(struct tile *ptile, struct player *powner, struct tile *psource, bool claim_bases)
Claim ownership of a single tile.
bool map_is_known(const struct tile *ptile, const struct player *pplayer)
Return whether the player knows the tile.
void send_map_info(struct conn_list *dest)
Send basic map information: map size, topology, and is_earth.
bool send_tile_suppression(bool now)
Suppress send_tile_info() during game_load()
void destroy_extra(struct tile *ptile, struct extra_type *pextra)
Remove extra from tile.
void map_claim_base(struct tile *ptile, const extra_type *pextra, struct player *powner, struct player *ploser)
Claim base to player's ownership.
static void check_units_single_tile(struct tile *ptile)
Helper function for bounce_units_on_terrain_change() that checks units on a single tile.
static void really_give_map_from_player_to_player(struct player *pfrom, struct player *pdest)
Give information about whole map (all tiles) from player to player.
bool really_gives_vision(struct player *me, struct player *them)
Return TRUE iff the player me really gives shared vision to player them.
void map_know_and_see_all(struct player *pplayer)
Call this function to unfog all tiles.
static int map_get_own_seen(const struct player *pplayer, const struct tile *ptile, enum vision_layer vlayer)
Returns the own seen count of a tile for a player.
static void map_change_own_seen(struct player *pplayer, struct tile *ptile, const v_radius_t change)
Changes the own seen count of a tile for a player.
void send_tile_info(struct conn_list *dest, struct tile *ptile, bool send_unknown)
Send tile information to all the clients in dest which know and see the tile.
bool update_player_tile_knowledge(struct player *pplayer, struct tile *ptile)
Give pplayer the correct knowledge about tile; return TRUE iff knowledge changed.
static int map_get_seen(const struct player *pplayer, const struct tile *ptile, enum vision_layer vlayer)
Return whether the player can see the tile.
static void ocean_to_land_fix_rivers(struct tile *ptile)
Set the tile to be a river if required.
void give_map_from_player_to_player(struct player *pfrom, struct player *pdest)
Give information about whole map (all tiles) from player to player.
void send_all_known_tiles(struct conn_list *dest)
Send all tiles known to specified clients.
void bounce_units_on_terrain_change(struct tile *ptile)
Check ptile and nearby tiles to see if all units can remain at their current locations,...
void give_seamap_from_player_to_player(struct player *pfrom, struct player *pdest)
Give information about all oceanic tiles from player to player.
void remove_shared_vision(struct player *pfrom, struct player *pto)
Removes shared vision from between two players.
bool need_to_reassign_continents(const struct terrain *oldter, const struct terrain *newter)
Returns TRUE if the terrain change from 'oldter' to 'newter' may require expensive reassignment of co...
void give_distorted_map(struct player *pfrom, struct player *pto, int prob, bool reveal_cities)
Transfer (random parts of) player pfrom's world map to pto.
static bool is_claimable_ocean(struct tile *ptile, struct tile *source, struct player *pplayer)
Ocean tile can be claimed iff one of the following conditions stands: a) it is an inland lake not lar...
void show_map_to_all()
Unfogs all tiles for all players.
static bool is_terrain_ecologically_wet(struct tile *ptile)
Used only in global_warming() and nuclear_winter() below.
void tile_claim_bases(struct tile *ptile, struct player *powner)
Claim ownership of bases on single tile.
void disable_fog_of_war_player(struct player *pplayer)
Turns FoW off for player.
void climate_change(bool warming, int effect)
Do a climate change.
static bool send_tile_suppressed
void upgrade_all_city_extras(struct player *pplayer, bool discovery)
To be called when a player gains some better extra building tech for the first time.
void map_update_border(struct tile *ptile, struct player *owner, int old_radius_sq, int new_radius_sq)
Update borders for this source.
void map_set_known(struct tile *ptile, struct player *pplayer)
Set known status of the tile.
void enable_fog_of_war()
Turns FoW on for everyone.
void map_show_all(struct player *pplayer)
Shows the area to the player.
static void map_unit_homecity_enqueue(struct tile *ptile)
For each unit at the tile, queue any unique home city.
static void map_change_seen(struct player *pplayer, struct tile *ptile, const v_radius_t change, bool can_reveal_tiles)
This function changes the seen state of one player for all vision layers of a tile.
void map_show_tile(struct player *src_player, struct tile *ptile)
Shows the area to the player.
void give_citymap_from_player_to_player(struct city *pcity, struct player *pfrom, struct player *pdest)
Give information about tiles within city radius from player to player.
void nuclear_winter(int effect)
Wrapper for climate_change().
void create_extra(struct tile *ptile, const extra_type *pextra, struct player *pplayer)
Create extra to tile.
static void player_tile_init(struct tile *ptile, struct player *pplayer)
We need to use fogofwar_old here, so the player's tiles get in the same state as the other players' t...
static void really_give_tile_info_from_player_to_player(struct player *pfrom, struct player *pdest, struct tile *ptile)
Give tile information from one player to one player.
void terrain_changed(struct tile *ptile)
Handle local side effects for a terrain change.
void player_map_free(struct player *pplayer)
Free a player's private map.
static void unbuffer_shared_vision(struct player *pplayer)
Stop buffering shared vision.
static void map_claim_border_ownership(struct tile *ptile, struct player *powner, struct tile *psource)
Claim ownership of a single tile.
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
Returns whether the layer 'vlayer' of the tile 'ptile' is known and seen by the player 'pplayer'.
void change_playertile_site(struct player_tile *ptile, struct vision_site *new_site)
Changes site information for player tile.
void fix_tile_on_terrain_change(struct tile *ptile, struct terrain *oldter, bool extend_rivers)
Handles local side effects for a terrain change (tile and its surroundings).
void enable_fog_of_war_player(struct player *pplayer)
Turns FoW on for player.
void map_show_circle(struct player *pplayer, struct tile *ptile, int radius_sq)
Shows the area to the player.
void map_vision_update(struct player *pplayer, struct tile *ptile, const v_radius_t old_radius_sq, const v_radius_t new_radius_sq, bool can_reveal_tiles)
There doesn't have to be a city.
void map_claim_border(struct tile *ptile, struct player *owner, int radius_sq)
Update borders for this source.
void update_tile_knowledge(struct tile *ptile)
Update playermap knowledge for everybody who sees the tile, and send a packet to everyone whose info ...
void remove_player_from_maps(struct player *pplayer)
Remove all knowledge of a player from main map and other players' private maps, and send updates to c...
void give_shared_vision(struct player *pfrom, struct player *pto)
Starts shared vision between two players.
void check_terrain_change(struct tile *ptile, struct terrain *oldter)
Handles local and global side effects for a terrain change for a single tile.
static void give_tile_info_from_player_to_player(struct player *pfrom, struct player *pdest, struct tile *ptile)
Give tile information from player to player.
struct player_tile * map_get_player_tile(const struct tile *ptile, const struct player *pplayer)
Players' information of tiles is tracked so that fogged area can be kept consistent even when the cli...
void map_hide_tile(struct player *src_player, struct tile *ptile)
Hides the area to the player.
struct vision_site * map_get_player_site(const struct tile *ptile, const struct player *pplayer)
Returns site located at given tile from player map.
struct vision_site * map_get_player_city(const struct tile *ptile, const struct player *pplayer)
Returns city located at given tile from player map.
static void buffer_shared_vision(struct player *pplayer)
Start buffering shared vision.
void global_warming(int effect)
Wrapper for climate_change().
bool upgrade_city_extras(struct city *pcity, struct extra_type **gained)
Check city for extra upgrade.
static void create_vision_dependencies()
This updates all players' really_gives_vision field.
void map_clear_border(struct tile *ptile)
Remove border for this source.
void map_clear_known(struct tile *ptile, struct player *pplayer)
Clear known status of the tile.
static void player_tile_free(struct tile *ptile, struct player *pplayer)
Free the memory stored into the player tile.
#define MAXIMUM_CLAIMED_OCEAN_SIZE
void vision_change_sight(struct vision *vision, const v_radius_t radius_sq)
Change the sight points for the vision source, fogging or unfogging tiles as needed.
bool can_unit_exist_at_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *ptile)
Return TRUE iff the unit can "exist" at this location.
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
Similar to notify_conn_packet (see also), but takes player as "destination".
int num_known_tech_with_flag(const struct player *pplayer, enum tech_flag_id flag)
Returns the number of techs the player has researched which has this flag.
int player_number(const struct player *pplayer)
Return the player index/number/id.
bool can_player_see_unit(const struct player *pplayer, const struct unit *punit)
Checks if a unit can be seen by pplayer at its current location.
int player_index(const struct player *pplayer)
Return the player index.
const char * player_name(const struct player *pplayer)
Return the leader name of the player.
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
Returns true iff players are allied.
bool gives_shared_vision(const struct player *me, const struct player *them)
Return TRUE iff the player me gives shared vision to player them.
#define players_iterate_end
#define players_iterate(_pplayer)
void send_player_info_c(struct player *src, struct conn_list *dest)
Send information about player slot 'src', or all valid (i.e.
bool road_has_flag(const struct road_type *proad, enum road_flag_id flag)
Check if road provides effect.
int count_river_near_tile(const struct tile *ptile, const struct extra_type *priver)
Count tiles with any river near the tile.
#define sanity_check_tile(x)
void flush_packets()
Attempt to flush all information in the send buffers for upto 'netwait' seconds.
enum server_states server_state()
Return current server state.
struct civ_game::@28::@32 server
struct conn_list * est_connections
struct packet_game_info info
struct packet_scenario_info scenario
struct player * extras_owner
std::unique_ptr< vision_site > site
struct extra_type * resource
struct city_list * cities
struct player::@65::@67 server
struct conn_list * connections
bv_player gives_shared_vision
struct terrain * cooler_wetter_result
struct terrain * cooler_drier_result
struct terrain * warmer_wetter_result
struct terrain * warmer_drier_result
struct extra_type * resource
struct player * extras_owner
struct extra_type * placing
#define sz_strlcpy(dest, src)
Terrain_type_id terrain_count()
Return the number of terrains.
bool is_terrain_class_near_tile(const struct tile *ptile, enum terrain_class tclass)
Is there terrain of the given class near tile? (Does not check ptile itself.)
Terrain_type_id terrain_number(const struct terrain *pterrain)
Return the terrain index.
#define is_ocean(pterrain)
#define is_ocean_tile(ptile)
#define terrain_has_flag(terr, flag)
void tile_add_extra(struct tile *ptile, const struct extra_type *pextra)
Adds extra to tile.
bool tile_has_river(const struct tile *ptile)
Tile has any river type.
void tile_remove_extra(struct tile *ptile, const struct extra_type *pextra)
Removes extra from tile if such exist.
void tile_change_terrain(struct tile *ptile, struct terrain *pterrain)
Change the terrain to the given type.
bool tile_virtual_check(const tile *vtile)
Check if the given tile is a virtual one or not.
bool tile_has_conflicting_extra(const struct tile *ptile, const struct extra_type *pextra)
Returns TRUE if the given tile has a extra conflicting with the given one.
void tile_set_owner(struct tile *ptile, struct player *pplayer, struct tile *claimer)
Set the owner of a tile (may be nullptr).
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
#define tile_claimer(_tile)
#define tile_worked(_tile)
#define tile_resource(_tile)
#define tile_terrain(_tile)
#define tile_continent(_tile)
#define tile_has_extra(ptile, pextra)
#define tile_owner(_tile)
bool unit_transported(const struct unit *pcargo)
Returns TRUE iff the unit is transported.
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_safe(unitlist, _unit)
#define unit_list_iterate_end
#define unit_list_iterate_safe_end
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
#define V_RADIUS(main_sq, invis_sq, subs_sq)
#define vision_layer_iterate(v)
#define vision_site_owner(v)
short int v_radius_t[V_COUNT]
#define vision_layer_iterate_end