36 #define TILE_XY(ptile) \
37 ((ptile) ? index_to_map_pos_x(tile_index(ptile)) : -1), \
38 ((ptile) ? index_to_map_pos_y(tile_index(ptile)) : -1)
40 #define TILE_INDEX_NONE (-1)
62 #define SPECLIST_TAG tile
63 #define SPECLIST_TYPE struct tile
65 #define tile_list_iterate(tile_list, ptile) \
66 TYPED_LIST_ITERATE(struct tile, tile_list, ptile)
67 #define tile_list_iterate_end LIST_ITERATE_END
70 #define tile_index(_pt_) (_pt_)->index
74 #define tile_continent(_tile) ((_tile)->continent)
78 #define tile_owner(_tile) ((_tile)->owner)
81 struct tile *claimer);
82 #define tile_claimer(_tile) ((_tile)->claimer)
84 #define tile_resource(_tile) ((_tile)->resource)
93 #define tile_terrain(_tile) ((_tile)->terrain)
97 #define tile_worked(_tile) ((_tile)->worked)
110 enum base_flag_id flag);
130 #define tile_has_extra(ptile, pextra) \
131 BV_ISSET(ptile->extras, extra_index(pextra))
143 const struct player *pplayer);
146 const struct player *pow_player);
151 #define ACTIVITY_FACTOR 10
160 #define TILE_LB_TERRAIN_RIVER (1 << 0)
161 #define TILE_LB_RIVER_RESOURCE (1 << 1)
162 #define TILE_LB_RESOURCE_POLL (1 << 2)
164 bool include_nuisances,
int linebreaks);
bool BV_ISSET(const BV &bv, int bit)
enum unit_activity Activity_type_id
signed short Continent_id
struct extra_type * resource
struct player * extras_owner
struct extra_type * placing
int tile_extras_class_defense_bonus(const struct tile *ptile, const struct unit_class *pclass)
Calculate defense bonus given for unit class by extras.
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...
bool tile_is_placing(const struct tile *ptile)
Is there a placing ongoing?
bool tile_has_river(const struct tile *tile)
Tile has any river type.
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.
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 tile_resource_is_valid(const struct tile *ptile)
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.
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.
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.
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 const bv_extras * tile_extras(const struct tile *ptile)
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.