74 modified_tile_table->clear();
96 struct packet_edit_startpos
startpos;
97 struct packet_edit_startpos_full startpos_full;
99 if (
nullptr == dest) {
117 send_packet_edit_startpos(pconn, &
startpos);
118 send_packet_edit_startpos_full(pconn, &startpos_full);
137 #ifdef SANITY_CHECKING
138 for (
const auto *ptile : *modified_tile_table) {
142 modified_tile_table->clear();
157 if (unfogged &&
game.
info.fogofwar) {
159 }
else if (!unfogged && !
game.
info.fogofwar) {
181 if (!
game.
info.is_edit_mode && is_edit_mode) {
184 _(
" *** Server set to edit mode by %s! *** "),
188 if (
game.
info.is_edit_mode && !is_edit_mode) {
190 _(
" *** Edit mode canceled by %s. *** "),
196 if (
game.
info.is_edit_mode != is_edit_mode) {
197 game.
info.is_edit_mode = is_edit_mode;
214 if (old_terrain == pterrain
222 modified_tile_table->insert(ptile);
240 bool remove_mode,
bool send_info)
280 struct tile *ptile_center;
285 _(
"Cannot edit the tile because %d is not a valid "
286 "tile index on this map!"),
295 _(
"Cannot modify terrain for the tile %s because "
296 "%d is not a valid terrain id."),
317 bool removal,
int eowner,
int size)
319 struct tile *ptile_center;
320 struct player *plr_eowner;
325 _(
"Cannot edit the tile because %d is not a valid "
326 "tile index on this map!"),
331 if (id < 0 || id >=
game.
control.num_extra_types) {
334 _(
"Cannot modify extras for the tile %s because "
335 "%d is not a valid extra id."),
343 plr_eowner =
nullptr;
349 ptile->extras_owner = plr_eowner;
360 const struct packet_edit_tile *packet)
364 bool changed =
false;
369 _(
"Cannot edit the tile because %d is not a valid "
370 "tile index on this map!"),
423 struct city *homecity;
430 _(
"Cannot create units because %d is not a valid "
431 "tile index on this map!"),
440 _(
"Cannot create a unit at %s because the "
441 "given unit type id %d is invalid."),
450 _(
"Cannot create a unit of type %s at %s "
451 "because the given owner's player id %d is "
463 _(
"Cannot create unit of type %s on enemy tile "
473 _(
"Cannot create a unit of type %s on the terrain "
479 if (count > 0 && !pplayer->
is_alive) {
490 for (i = 0; i < count; i++) {
493 punit =
create_unit(pplayer, ptile, punittype, 0,
id, -1);
495 dsend_packet_edit_object_created(pc, tag, punit->
id);
516 _(
"Cannot remove units because %d is not a valid "
517 "tile index on this map!"),
526 _(
"Cannot remove a unit at %s because the "
527 "given unit type id %d is invalid."),
537 _(
"Cannot remove a unit of type %s at %s "
538 "because the given owner's player id %d is "
569 _(
"No such unit (ID %d)."),
id);
580 const struct packet_edit_unit *packet)
585 bool changed =
false;
592 _(
"No such unit (ID %d)."),
id);
598 if (packet->moves_left != punit->
moves_left) {
609 if (packet->moved != punit->
moved) {
610 punit->
moved = packet->moved;
619 hp =
CLIP(1, packet->hp, putype->
hp);
620 if (
hp != punit->
hp) {
625 if (packet->veteran != punit->
veteran) {
626 int v = packet->veteran;
629 _(
"Invalid veteran level %d for unit %d (%s)."), v,
id,
637 if (packet->stay != punit->
stay) {
638 punit->
stay = packet->stay;
664 _(
"Cannot create a city because %d is not a valid "
665 "tile index on this map!"),
674 _(
"Cannot create a city at %s because the "
675 "given owner's player id %d is invalid"),
684 _(
"A city may not be built at %s."),
tile_link(ptile));
706 dsend_packet_edit_object_created(pc, tag, pcity->
id);
716 const struct packet_edit_city *packet)
719 struct city *pcity, *oldcity;
723 bool changed =
false;
724 bool need_game_info =
false;
725 bv_player need_player_info;
730 _(
"Cannot edit city with invalid city ID %d."), packet->id);
739 if (0 != strcmp(pcity->
name, packet->name)) {
742 _(
"Cannot edit city name: %s"), buf);
753 _(
"Invalid city size %d for city %s."), packet->size,
762 if (packet->history != pcity->
history) {
763 pcity->
history = packet->history;
774 if (packet->built[
id] >= 0) {
776 _(
"It is impossible for a city to have %s!"),
790 && packet->built[
id] >= 0) {
793 if (oldcity != pcity) {
796 if (
nullptr != oldcity &&
city_owner(oldcity) != pplayer) {
798 need_game_info =
true;
803 if (oldcity != pcity) {
820 if (packet->food_stock != pcity->
food_stock) {
822 if (!(0 <= packet->food_stock && packet->food_stock <= max)) {
824 _(
"Invalid city food stock amount %d for city %s "
825 "(allowed range is %d to %d)."),
826 packet->food_stock,
city_link(pcity), 0, max);
836 if (!(0 <= packet->shield_stock && packet->shield_stock <= max)) {
838 _(
"Invalid city shield stock amount %d for city %s "
839 "(allowed range is %d to %d)."),
840 packet->shield_stock,
city_link(pcity), 0, max);
861 if (need_game_info) {
887 _(
"No more players can be added because the maximum "
888 "number of players (%d) has been reached."),
895 _(
"No more players can be added because there are "
896 "no available nations (%d used)."),
901 pnation =
pick_a_nation(
nullptr,
true,
true, NOT_A_BARBARIAN);
904 _(
"Player cannot be created because random nation "
905 "selection failed."));
912 _(
"Player creation failed."));
926 pplayer->
server.got_first_city =
false;
940 dsend_packet_edit_object_created(pc, tag,
player_number(pplayer));
952 if (pplayer ==
nullptr) {
954 _(
"No such player (ID %d)."),
id);
972 const struct packet_edit_player *packet)
975 bool changed =
false, update_research =
false;
978 enum tech_state known;
984 _(
"Cannot edit player with invalid player ID %d."),
992 if (0 != strcmp(packet->name,
player_name(pplayer))) {
996 error_buf,
sizeof(error_buf))) {
1000 _(
"Cannot change name of player (%d) '%s' to '%s': %s"),
1009 if (pnation ==
nullptr) {
1011 _(
"Cannot change nation for player %d (%s) "
1012 "because the given nation ID %d is invalid."),
1015 }
else if (pnation->
player !=
nullptr) {
1017 _(
"Cannot change nation for player %d (%s) "
1018 "to nation %d (%s) because that nation is "
1019 "already assigned to player %d (%s)."),
1026 _(
"Cannot change nation for player %d (%s) "
1027 "to nation %d (%s) because that nation is "
1028 "not in the current nation set."),
1035 _(
"Cannot change nation for player %d (%s) "
1036 "to nation %d (%s) because that nation is "
1037 "unsuitable for this player."),
1049 update_research =
true;
1056 if ((packet->inventions[tech] && known == TECH_KNOWN)
1057 || (!packet->inventions[tech] && known != TECH_KNOWN)) {
1060 if (packet->inventions[tech]) {
1069 update_research =
true;
1075 if (!(0 <= packet->gold && packet->gold <= 1000000)) {
1077 _(
"Cannot set gold for player %d (%s) because "
1078 "the value %d is outside the allowed range."),
1104 if (packet->scenario_reserved) {
1118 if (update_research) {
1131 if (known != TECH_PREREQS_KNOWN) {
1139 if (known != TECH_KNOWN) {
1150 if (known == TECH_KNOWN) {
1171 bool known,
int size)
1174 struct tile *ptile_center;
1177 if (!ptile_center) {
1179 _(
"Cannot edit vision because %d is not a valid "
1180 "tile index on this map!"),
1189 _(
"Cannot edit vision for the tile at %s because "
1190 "given player id %d is invalid."),
1200 bool cannot_make_unknown =
false;
1210 cannot_make_unknown =
true;
1216 if (cannot_make_unknown) {
1228 dsend_packet_unit_remove(pconn, punit->id);
1263 if (pcity ==
nullptr) {
1265 _(
"No such city (ID %d)."),
id);
1291 _(
"Cannot toggle fog-of-war when it is already "
1299 _(
"Cannot toggle fog-of-war for invalid player ID %d."),
1319 const struct packet_edit_startpos *packet)
1325 if (
nullptr == ptile) {
1327 _(
"Invalid tile index %d for start position."), packet->id);
1332 if (packet->removal) {
1348 send_packet_edit_startpos(aconn, packet);
1359 struct connection *pconn,
const struct packet_edit_startpos_full *packet)
1365 if (
nullptr == ptile) {
1367 _(
"Invalid tile index %d for start position."), packet->id);
1372 if (
nullptr == psp) {
1374 _(
"Cannot edit start position nations at (%d, %d) "
1375 "because there is no start position there."),
1386 send_packet_edit_startpos_full(aconn, packet);
1397 const struct packet_edit_game *packet)
1399 bool changed =
false;
1406 if (0 != strncmp(packet->scenario_name,
game.
scenario.name, 256)) {
1412 != strncmp(packet->scenario_authors,
game.
scenario.authors,
1413 sizeof(packet->scenario_authors))) {
1418 if (packet->scenario_random !=
game.
scenario.save_random) {
1423 if (packet->scenario_players !=
game.
scenario.players) {
1428 if (packet->startpos_nations !=
game.
scenario.startpos_nations) {
1429 game.
scenario.startpos_nations = packet->startpos_nations;
1433 if (packet->prevent_new_cities !=
game.
scenario.prevent_new_cities) {
1434 game.
scenario.prevent_new_cities = packet->prevent_new_cities;
1438 if (packet->lake_flooding !=
game.
scenario.lake_flooding) {
1443 if (packet->ruleset_locked !=
game.
scenario.ruleset_locked) {
1458 const char *scenario_desc)
1475 _(
"No permissions to remotely save scenario."));
1482 _(
"Scenario information not set. Cannot save scenario."));
const char * default_ai_type_name()
Return name of default ai type.
bool BV_ISSET(const BV &bv, int bit)
#define BV_ARE_EQUAL(vec1, vec2)
#define BV_ISSET_ANY(vec)
int city_granary_size(int city_size)
Generalized formula used to calculate granary size.
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
Return TRUE iff the city has this building in it.
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
void city_remove_improvement(struct city *pcity, const struct impr_type *pimprove)
Removes an improvement (and its effects) from a city.
struct tile * city_tile(const struct city *pcity)
Return the tile location of the city.
bool city_can_be_built_here(const struct tile *ptile, const struct unit *punit)
Returns TRUE if the given unit can build a city at the given map coordinates.
void city_add_improvement(struct city *pcity, const struct impr_type *pimprove)
Adds an improvement (and its effects) to a city.
citizens city_size_get(const struct city *pcity)
Get the city size.
void city_refresh_queue_add(struct city *pcity)
Queue pending city_refresh() for later.
bool city_change_size(struct city *pcity, citizens size, struct player *nationality, const char *reason)
Change the city size.
void city_refresh_queue_processing()
Refresh the listed cities.
void connection_detach(struct connection *pconn, bool remove_unused_player)
Remove pconn as a client connected to pplayer: Updates pconn->playing, pconn->playing->connections,...
void conn_list_do_unbuffer(struct conn_list *dest)
Convenience functions to unbuffer a list of connections.
bool can_conn_edit(const struct connection *pconn)
Return TRUE iff the connection is currently allowed to edit.
const char * conn_description(const struct connection *pconn, bool is_private)
° Return pointer to static string containing a description for this ° connection, based on pconn->nam...
void conn_list_do_buffer(struct conn_list *dest)
Convenience functions to buffer a list of connections.
bool can_conn_enable_editing(const struct connection *pconn)
Return TRUE iff the connection is allowed to start editing.
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
void handle_edit_unit_remove_by_id(struct connection *pc, Unit_type_id id)
Handle a request to remove a unit given by its id.
void handle_edit_tile(struct connection *pc, const struct packet_edit_tile *packet)
Handles tile information from the client, to make edits to tiles.
void handle_edit_scenario_desc(struct connection *pc, const char *scenario_desc)
Handle edit requests to scenario description.
void handle_edit_check_tiles(struct connection *pc)
Run any pending tile checks.
static void check_edited_tile_terrains()
Do the potentially slow checks required after one or several tiles' terrain has change.
void handle_edit_mode(struct connection *pc, bool is_edit_mode)
Handles a request by the client to enter edit mode.
void handle_edit_tile_terrain(struct connection *pc, int tile, Terrain_type_id terrain, int size)
Handles a client request to change the terrain of the tile at the given x, y coordinates.
void handle_edit_player(struct connection *pc, const struct packet_edit_player *packet)
Handle editing of any or all player properties.
static bool need_continents_reassigned
void edithand_send_initial_packets(struct conn_list *dest)
Send the needed packets for connections entering in the editing mode.
void edithand_free()
Free all memory used by data structures required for edit mode.
static bool * unfogged_players
void handle_edit_player_remove(struct connection *pc, int id)
Handle a request to remove a player.
static bool edit_tile_terrain_handling(struct tile *ptile, struct terrain *pterrain, bool send_info)
Base function to edit the terrain property of a tile.
void handle_edit_city_remove(struct connection *pc, int id)
Remove any city at the given location.
void handle_edit_player_vision(struct connection *pc, int plr_no, int tile, bool known, int size)
Handles vision editing requests from client.
void handle_edit_city(struct connection *pc, const struct packet_edit_city *packet)
Handle a request to change the internal state of a city.
void handle_edit_city_create(struct connection *pc, int owner, int tile, int size, int tag)
Allows the editing client to create a city at the given position and of size 'size'.
static bool edit_tile_extra_handling(struct tile *ptile, struct extra_type *pextra, bool remove_mode, bool send_info)
Base function to edit the extras property of a tile.
void handle_edit_game(struct connection *pc, const struct packet_edit_game *packet)
Handle edit requests to the main game data structure.
void handle_edit_unit_remove(struct connection *pc, int owner, int tile, Unit_type_id utid, int count)
Remove 'count' units of type 'utid' owned by player number 'owner' at tile (x, y).
void handle_edit_toggle_fogofwar(struct connection *pc, int plr_no)
Temporarily remove fog-of-war for the player with player number 'plr_no'.
void handle_edit_startpos_full(struct connection *pconn, const struct packet_edit_startpos_full *packet)
Setup which nations can start at a start position.
void handle_edit_player_create(struct connection *pc, int tag)
Handle a request to create a new player.
void handle_edit_recalculate_borders(struct connection *pc)
Client editor requests us to recalculate borders.
void handle_save_scenario(struct connection *pc, const char *name)
Make scenario file out of current game.
void edithand_init()
Initialize data structures required for edit mode.
static void check_leaving_edit_mode()
Do any necessary checks after leaving edit mode to ensure that the game is in a consistent state.
void handle_edit_tile_extra(struct connection *pc, int tile, int id, bool removal, int eowner, int size)
Handle a request to change one or more tiles' extras.
void handle_edit_unit_create(struct connection *pc, int owner, int tile, Unit_type_id utid, int count, int tag)
Handle a request to create 'count' units of type 'utid' at the tile given by the x,...
void handle_edit_unit(struct connection *pc, const struct packet_edit_unit *packet)
Handles unit information from the client, to make edits to units.
void handle_edit_startpos(struct connection *pconn, const struct packet_edit_startpos *packet)
Create or remove a start position at a tile.
#define MAX_NUM_PLAYER_SLOTS
const char * tile_link(const struct tile *ptile)
Get a text link to a tile.
const struct ft_color ftc_editor
const char * city_link(const struct city *pcity)
Get a text link to a city.
const char * unit_link(const struct unit *punit)
Get a text link to an unit.
struct unit * game_unit_by_number(int id)
Find unit out of all units in game: now uses fast idex method, instead of looking through all units o...
struct city * game_city_by_number(int id)
Often used function to get a city pointer from a city ID.
void send_scenario_description(struct conn_list *dest)
Send description of the current scenario.
void send_scenario_info(struct conn_list *dest)
Send current scenario info.
void send_game_info(struct conn_list *dest)
Send game_info packet; some server options and various stuff...
struct government * government_by_number(const Government_type_id gov)
Return the government with the given index.
struct city * city_from_great_wonder(const struct impr_type *pimprove)
Get the world city with this great wonder.
bool is_special_improvement(const struct impr_type *pimprove)
Returns TRUE if this is a "special" improvement.
struct city * city_from_small_wonder(const struct player *pplayer, const struct impr_type *pimprove)
Get the player city with this small wonder.
Impr_type_id improvement_number(const struct impr_type *pimprove)
Return the improvement index.
bool is_great_wonder(const struct impr_type *pimprove)
Is this building a great wonder?
const char * improvement_name_translation(const struct impr_type *pimprove)
Return the (translated) name of the given improvement.
bool is_small_wonder(const struct impr_type *pimprove)
Is this building a small wonder?
#define improvement_iterate_end
#define improvement_iterate(_p)
struct startpos * map_startpos_get(const struct tile *ptile)
Returns the start position at the given tile, or nullptr if none exists there.
bool startpos_pack(const struct startpos *psp, struct packet_edit_startpos_full *packet)
Fills the packet with all of the information at this start position.
bool map_startpos_remove(struct tile *ptile)
Remove the start position at the given tile.
struct startpos * map_startpos_new(struct tile *ptile)
Create a new start position at the given tile and return it.
struct tile * startpos_tile(const struct startpos *psp)
Returns the tile where this start position is located.
bool startpos_unpack(struct startpos *psp, const struct packet_edit_startpos_full *packet)
Fills the start position with the nation information in the packet.
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
Return the tile for the given index position.
#define square_iterate(nmap, center_tile, radius, tile_itr)
#define square_iterate_end
#define MAP_TILE_OWNER_NULL
void assign_continent_numbers()
Assigns continent and ocean numbers to all tiles, and set map.num_continents and map....
void map_calculate_borders()
Update borders for all sources.
bool really_gives_vision(struct player *me, struct player *them)
Return TRUE iff the player me really gives shared vision to player them.
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.
void send_all_known_tiles(struct conn_list *dest)
Send all tiles known to specified clients.
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 disable_fog_of_war_player(struct player *pplayer)
Turns FoW off for player.
void map_show_tile(struct player *src_player, struct tile *ptile)
Shows the area to the player.
void terrain_changed(struct tile *ptile)
Handle local side effects for a terrain change.
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 update_tile_knowledge(struct tile *ptile)
Update playermap knowledge for everybody who sees the tile, and send a packet to everyone whose info ...
void map_hide_tile(struct player *src_player, struct tile *ptile)
Hides the area to the player.
bool can_exist_at_tile(const struct civ_map *nmap, const struct unit_type *utype, const struct tile *ptile)
Return TRUE iff a unit of the given unit type can "exist" at this location.
struct nation_type * nation_by_number(const Nation_type_id nation)
Return the nation with the given index.
struct government * init_government_of_nation(const struct nation_type *pnation)
Returns initial government type for this nation.
bool is_nation_playable(const struct nation_type *nation)
Return whether a nation is "playable"; i.e., whether a human player can choose this nation.
const char * nation_plural_translation(const struct nation_type *pnation)
Return the (translated) plural noun of the given nation.
struct nation_type * nation_of_player(const struct player *pplayer)
Return the nation of a player.
enum barbarian_type nation_barbarian_type(const struct nation_type *nation)
Returns which kind of barbarians can use this nation.
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
See notify_conn_packet - this is just the "non-v" version, with varargs.
struct player * player_by_number(const int player_id)
Return struct player pointer for the given player index.
int player_number(const struct player *pplayer)
Return the player index/number/id.
int player_count()
Return the number of players.
bool player_has_flag(const struct player *pplayer, enum plr_flag_id flag)
Check if player has given flag.
int player_index(const struct player *pplayer)
Return the player index.
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
Set the player's nation to the given nation (may be nullptr).
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.
#define players_iterate_end
#define players_iterate(_pplayer)
static bool is_barbarian(const struct player *pplayer)
void send_player_all_c(struct player *src, struct conn_list *dest)
Send all information about a player (player_info and all player_diplstates) to the given connections.
struct player * server_create_player(int player_id, const char *ai_tname, struct rgbcolor *prgbcolor, bool allow_ai_type_fallbacking)
Creates a new, uninitialized, used player slot.
bool server_player_set_name_full(const struct connection *caller, struct player *pplayer, const struct nation_type *pnation, const char *name, char *error_buf, size_t error_buf_len)
Try to set the player name to 'name'.
void assign_player_colors()
Permanently assign colors to any players that don't already have them.
void kill_player(struct player *pplayer)
Murder a player in cold blood.
void send_player_info_c(struct player *src, struct conn_list *dest)
Send information about player slot 'src', or all valid (i.e.
struct nation_type * pick_a_nation(const struct nation_list *choices, bool ignore_conflicts, bool needs_startpos, enum barbarian_type barb_type)
This function returns a random-ish nation that is suitable for 'barb_type' and is usable (not already...
void server_remove_player(struct player *pplayer)
This function does not close any connections attached to this player.
void government_change(struct player *pplayer, struct government *gov, bool revolution_finished)
Finish the revolution and set the player's government.
void server_player_init(struct player *pplayer, bool initmap, bool needs_team)
Initialize ANY newly-created player on the server.
struct player_economic player_limit_to_max_rates(struct player *pplayer)
The following limits a player's rates to those that are acceptable for the present form of government...
bool nation_is_in_current_set(const struct nation_type *pnation)
Is the nation in the currently selected nationset? If not, it's not allowed to appear in the game.
int revolution_length(struct government *gov, struct player *plr)
Get length of a revolution.
enum tech_state research_invention_set(struct research *presearch, Tech_type_id tech, enum tech_state value)
Set research knowledge about tech to given state.
struct research * research_get(const struct player *pplayer)
Returns the research structure associated with the player.
Q_GLOBAL_STATIC(QVector< QString >, future_name_translation)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Returns state of the tech for current research.
void research_update(struct research *presearch)
Mark as TECH_PREREQS_KNOWN each tech which is available, not known and which has all requirements ful...
#define sanity_check_tile(x)
void save_game(const char *orig_filename, const char *save_reason, bool scenario)
Unconditionally save the game, with specified filename.
#define CLIP(lower, current, upper)
void player_nation_defaults(struct player *pplayer, struct nation_type *pnation, bool set_name)
Set nation for player with nation default values.
bool game_was_started()
Returns iff the game was started once upon a time.
char name[MAX_LEN_CITYNAME]
struct packet_scenario_description scenario_desc
struct packet_ruleset_control control
struct conn_list * est_connections
struct packet_game_info info
struct packet_scenario_info scenario
struct government * government_during_revolution
QHash< struct tile *, struct startpos * > * startpos_table
enum cmdlevel access_level
enum barbarian_type barbarian_type
struct player_ai ai_common
char username[MAX_LEN_NAME]
struct player::@65::@67 server
struct government * government
struct conn_list * connections
struct player_economic economic
struct player * extras_owner
#define sz_strlcpy(dest, src)
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
struct terrain * terrain_by_number(const Terrain_type_id type)
Return the terrain for the given terrain index.
#define terrain_has_flag(terr, flag)
void tile_change_terrain(struct tile *ptile, struct terrain *pterrain)
Change the terrain to the given type.
bool tile_extra_rm_apply(struct tile *ptile, struct extra_type *tgt)
Remove extra and adjust other extras accordingly.
bool tile_set_label(struct tile *ptile, const char *label)
Sets label for tile.
bool tile_extra_apply(struct tile *ptile, const extra_type *tgt)
Add extra and adjust other extras accordingly.
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
#define tile_terrain(_tile)
#define tile_has_extra(ptile, pextra)
struct unit * is_non_allied_unit_tile(const struct tile *ptile, const struct player *pplayer)
Is there an non-allied unit on this tile?
struct unit * is_enemy_unit_tile(const struct tile *ptile, const struct player *pplayer)
Is there an enemy unit on this tile? Returns the unit or nullptr if none.
#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.
struct unit_type * utype_by_number(const Unit_type_id id)
Return a pointer for the unit type struct for the given unit type id.
const char * utype_name_translation(const struct unit_type *punittype)
Return the (translated) name of the unit type.
const struct veteran_level * utype_veteran_level(const struct unit_type *punittype, int level)
Return veteran level properties of given unit in given veterancy level.
#define utype_fuel(ptype)