64 ptile->
owner = pplayer;
130 "At (%d, %d), the terrain \"%s\" (nb %d) doesn't "
131 "support cities, whereas \"%s\" (nb %d) is built there.",
137 if (
nullptr != pterrain
151 static bool empty_cleared =
false;
153 if (!empty_cleared) {
155 empty_cleared =
true;
184 enum base_flag_id flag)
235 int natural_bonus = 0;
236 int fortification_bonus = 0;
243 natural_bonus += pextra->defense_bonus;
252 fortification_bonus += pextra->defense_bonus;
258 (100 + natural_bonus) * (100 + fortification_bonus) / 100 - 100;
283 + incr *
tile_terrain(ptile)->road_output_incr_pct[o] / 100;
342 #ifndef tile_resource
364 if (presource !=
nullptr) {
373 #ifndef tile_continent
399 const struct player *pplayer)
417 const struct player *pow_player)
434 && activity != ACTIVITY_AIRBASE,
438 case ACTIVITY_POLLUTION:
439 case ACTIVITY_FALLOUT:
440 case ACTIVITY_PILLAGE:
443 case ACTIVITY_TRANSFORM:
445 case ACTIVITY_CULTIVATE:
449 case ACTIVITY_IRRIGATE:
452 case ACTIVITY_GEN_ROAD:
553 if (pdep == pextra) {
625 if (tgt !=
nullptr) {
647 if (tgt !=
nullptr) {
711 case ACTIVITY_IRRIGATE:
715 case ACTIVITY_TRANSFORM:
719 case ACTIVITY_CULTIVATE:
727 case ACTIVITY_OLD_ROAD:
728 case ACTIVITY_OLD_RAILROAD:
729 case ACTIVITY_FORTRESS:
730 case ACTIVITY_AIRBASE:
734 case ACTIVITY_PILLAGE:
736 case ACTIVITY_GEN_ROAD:
737 case ACTIVITY_POLLUTION:
738 case ACTIVITY_FALLOUT:
743 case ACTIVITY_FORTIFIED:
744 case ACTIVITY_SENTRY:
746 case ACTIVITY_EXPLORE:
747 case ACTIVITY_CONVERT:
748 case ACTIVITY_UNKNOWN:
749 case ACTIVITY_FORTIFYING:
750 case ACTIVITY_PATROL_UNUSED:
765 const struct tile *ptile,
800 bool include_nuisances,
int linebreaks)
805 int bufsz =
sizeof(s);
815 if (pextra->category == ECAT_NATURAL
847 if (include_nuisances) {
851 if (pextra->category == ECAT_NUISANCE) {
976 if (pextra !=
nullptr) {
986 if (pextra !=
nullptr) {
1001 vtile =
new tile[1]();
1010 vtile->
units = unit_list_new();
1012 vtile->
owner =
nullptr;
1067 unit_list_destroy(vtile->
units);
1068 vtile->
units =
nullptr;
1106 bool changed =
false;
1109 if (label !=
nullptr && label[0] ==
'\0') {
1113 if (ptile->
label !=
nullptr) {
1114 if (label ==
nullptr) {
1116 }
else if (strcmp(ptile->
label, label)) {
1119 delete[] ptile->
label;
1120 ptile->
label =
nullptr;
1121 }
else if (label !=
nullptr) {
1125 if (label !=
nullptr) {
1127 qCritical(
"Overlong map label '%s'", label);
1140 return ptile->
placing !=
nullptr;
bool base_has_flag(const struct base_type *pbase, enum base_flag_id flag)
Check if base provides effect.
bool base_has_flag_for_utype(const struct base_type *pbase, enum base_flag_id flag, const struct unit_type *punittype)
Base provides base flag for unit? Checks if base provides flag and if base is native to unit.
bool territory_claiming_base(const struct base_type *pbase)
Does this base type claim territory?
bool BV_ISSET(const BV &bv, int bit)
bool city_is_virtual(const struct city *pcity)
Return TRUE if the city is a virtual city.
const char * city_name_get(const struct city *pcity)
Return the name of the city.
void destroy_city_virtual(struct city *pcity)
Removes the virtual skeleton of a city.
bool is_city_center(const struct city *pcity, const struct tile *ptile)
Return TRUE if the city is centered at the given tile.
const struct functions * fc_funcs
enum unit_activity Activity_type_id
#define EC_NATURAL_DEFENSIVE
#define MAX_LEN_MAP_LABEL
signed short Continent_id
bool is_server()
Is program type server?
#define fc_assert_msg(condition, message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
bool map_is_empty()
Returns TRUE if we are at a stage of the game where the map has not yet been generated/loaded.
int map_num_tiles()
Returns the total number of (real) positions (or tiles) on the map.
bool road_has_flag(const struct road_type *proad, enum road_flag_id flag)
Check if road provides effect.
struct extra_type * road_extra_get(const struct road_type *proad)
Return extra that road is.
struct packet_game_info info
void(* create_extra)(struct tile *ptile, const extra_type *pextra, struct player *pplayer)
bool(* player_tile_vision_get)(const struct tile *ptile, const struct player *pplayer, enum vision_layer vision)
void(* destroy_extra)(struct tile *ptile, struct extra_type *pextra)
int tile_incr_const[O_LAST]
struct terrain * irrigation_result
struct terrain * mining_result
struct terrain * transform_result
struct extra_type * resource
struct player * extras_owner
struct extra_type * placing
size_t fc_strlcat(char *dest, const char *src, size_t n)
fc_strlcat() provides utf-8 version of (non-standard) function strlcat() It is intended as more user-...
int cat_snprintf(char *str, size_t n, const char *format,...)
cat_snprintf is like a combination of fc_snprintf and fc_strlcat; it does snprintf to the end of an e...
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
int terrain_extra_removal_time(const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt)
Time to complete the extra removal activity on the given terrain.
const char * terrain_rule_name(const struct terrain *pterrain)
Return the (untranslated) rule name of the terrain.
bool terrain_has_resource(const struct terrain *pterrain, const struct extra_type *presource)
Check for resource in terrain resources list.
const char * terrain_name_translation(const struct terrain *pterrain)
Return the (translated) name of the terrain.
int terrain_extra_build_time(const struct terrain *pterrain, enum unit_activity activity, const struct extra_type *tgt)
Time to complete the extra building activity on the given terrain.
Terrain_type_id terrain_number(const struct terrain *pterrain)
Return the terrain index.
#define terrain_has_flag(terr, flag)
int tile_extras_class_defense_bonus(const struct tile *ptile, const struct unit_class *pclass)
Calculate defense bonus given for unit class by extras.
static bool tile_info_pollution(char *buf, int bufsz, const struct tile *ptile, struct extra_type *pextra, bool prevp, bool linebreak)
Add one entry about pollution situation to buffer.
static void tile_cultivate(struct tile *ptile)
Cultivate (ACTIVITY_CULTIVATE) the tile.
void tile_add_extra(struct tile *ptile, const struct extra_type *pextra)
Adds extra to tile.
int tile_roads_output_bonus(const struct tile *ptile, enum output_type_id o)
Calculate output bonus given by roads.
bool tile_has_extra_flag(const struct tile *ptile, enum extra_flag_id flag)
Check if tile contains extra providing effect.
bool tile_has_claimable_base(const struct tile *ptile, const struct unit_type *punittype)
Check if tile contains base providing effect for unit.
void tile_set_terrain(struct tile *ptile, struct terrain *pterrain)
Set the given terrain at the specified tile.
void tile_virtual_destroy(struct tile *vtile)
Frees all memory used by the virtual tile, including freeing virtual units in the tile's unit list an...
static void tile_irrigate(struct tile *ptile, struct extra_type *tgt)
Build irrigation on the tile.
bool tile_has_river(const struct tile *ptile)
Tile has any river type.
static void tile_destroy_extra(struct tile *ptile, struct extra_type *pextra)
Destroy extra from tile.
bool tile_is_placing(const struct tile *ptile)
Is there a placing ongoing?
bool tile_has_base_flag(const struct tile *ptile, enum base_flag_id flag)
Check if tile contains base providing effect.
bool tile_apply_activity(struct tile *ptile, Activity_type_id act, struct extra_type *tgt)
Apply an activity (Activity_type_id, e.g., ACTIVITY_TRANSFORM) to a tile.
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
Return a (static) string with tile name describing terrain and extras of some categories.
const bv_extras * tile_extras_null()
Returns a bit vector of the extras present at nullptr tile.
static void tile_transform(struct tile *ptile)
Transform (ACTIVITY_TRANSFORM) the tile.
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_has_visible_extra(const struct tile *ptile, const struct extra_type *pextra)
Returns TRUE if the given tile has a road of given type on it.
static bool add_recursive_extras(struct tile *ptile, const extra_type *pextra, int rec)
Recursively add all extra dependencies to add given extra.
int tile_extras_defense_bonus(const struct tile *ptile, const struct unit_type *punittype)
Calculate defense bonus given for unit type by bases and roads.
static void tile_mine(struct tile *ptile, struct extra_type *tgt)
Build a mine on the tile.
bool tile_has_base_flag_for_unit(const struct tile *ptile, const struct unit_type *punittype, enum base_flag_id flag)
Check if tile contains base providing effect for unit.
bool tile_has_road(const struct tile *ptile, const struct road_type *proad)
Returns TRUE if the given tile has a road of given type on it.
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.
static void tile_create_extra(struct tile *ptile, const extra_type *pextra)
Create extra to tile.
static void tile_plant(struct tile *ptile)
Plant (ACTIVITY_PLANT) the tile.
void tile_set_owner(struct tile *ptile, struct player *pplayer, struct tile *claimer)
Set the owner of a tile (may be nullptr).
bool tile_is_seen(const struct tile *target_tile, const struct player *pow_player)
Returns TRUE iff the target_tile is seen by pow_player.
int tile_activity_time(enum unit_activity activity, const struct tile *ptile, const struct extra_type *tgt)
Time to complete the given activity on the given tile.
bool tile_has_native_base(const struct tile *ptile, const struct unit_type *punittype)
Check if tile contains base native for unit.
int tile_roads_output_incr(const struct tile *ptile, enum output_type_id o)
Calculate output increment given by roads.
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.
static bool rm_recursive_extras(struct tile *ptile, struct extra_type *pextra, int rec)
Recursively remove all extras depending on given extra.
void tile_set_resource(struct tile *ptile, struct extra_type *presource)
Set the given resource at the specified tile.
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
Return a known_type enumeration value for the tile.
bool tile_extra_apply(struct tile *ptile, const extra_type *tgt)
Add extra and adjust other extras accordingly.
bool tile_has_refuel_extra(const struct tile *ptile, const struct unit_type *punittype)
Check if tile contains refuel extra native for unit.
bool tile_has_road_flag(const struct tile *ptile, enum road_flag_id flag)
Check if tile contains road providing effect.
static bv_extras empty_extras
void tile_set_worked(struct tile *ptile, struct city *pcity)
Set the city/worker on the tile (may be nullptr).
void tile_set_continent(struct tile *ptile, Continent_id val)
Set the continent ID of the tile.
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
struct tile * tile_virtual_new(const struct tile *ptile)
Returns a virtual tile.
#define TILE_LB_RIVER_RESOURCE
#define tile_claimer(_tile)
#define TILE_LB_RESOURCE_POLL
static bool tile_resource_is_valid(const struct tile *ptile)
#define tile_worked(_tile)
#define tile_resource(_tile)
#define TILE_LB_TERRAIN_RIVER
#define tile_terrain(_tile)
#define tile_continent(_tile)
#define tile_has_extra(ptile, pextra)
#define tile_owner(_tile)
void unit_virtual_destroy(struct unit *punit)
Free the memory used by virtual unit.
bool unit_is_virtual(const struct unit *punit)
Return TRUE if this is a valid unit pointer but does not correspond to any unit that exists in the ga...
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end