25 const QString &tag, extrastyle_id style)
27 if (style == ESTYLE_CARDINALS) {
45 data.
sprites.push_back(sprites);
50 }
else if (style == ESTYLE_RIVER) {
68 auto suffix = QStringLiteral(
"_outlet_%1")
75 outlet.
sprites.push_back(outlet_sprites);
76 river.
sprites.push_back(river_sprites);
95 static int get_irrigation_index(
const struct tileset *t,
97 bv_extras *textras_near)
117 const struct tileset *t, std::vector<drawn_sprite> &sprs,
118 bv_extras textras, bv_extras *textras_near,
const terrain *pterrain,
119 const city *pcity)
const
141 int idx = get_irrigation_index(t, cdata.extra, textras_near);
152 std::vector<drawn_sprite>
155 const unit *punit)
const
169 struct terrain *terrain_near[8] = {
nullptr};
170 bv_extras extras_near[8];
173 std::vector<drawn_sprite> sprs;
183 if (
BV_ISSET(extras_near[didx], idx)) {
195 for (
const auto &river :
m_rivers) {
204 if (terrain_near[cdir] ==
nullptr
206 ||
BV_ISSET(extras_near[cdir], idx)) {
bool BV_ISSET(const BV &bv, int bit)
std::vector< extra_data > m_cardinals
void reset_ruleset() override
Resets cached data that depends on the ruleset.
layer_water(struct tileset *ts)
void initialize_extra(const extra_type *extra, const QString &tag, extrastyle_id style) override
Collects all extras to be drawn (the ones with ESTYLE_CARDINALS or ESTYLE_RIVER).
void fill_irrigation_sprite_array(const struct tileset *t, std::vector< drawn_sprite > &sprs, bv_extras textras, bv_extras *textras_near, const terrain *pterrain, const city *pcity) const
Fill in the farmland/irrigation sprite for the tile.
std::vector< extra_data > m_outlets
std::vector< drawn_sprite > fill_sprite_array(const tile *ptile, const tile_edge *pedge, const tile_corner *pcorner, const unit *punit) const override
Returns the list of sprites drawn by this layer somewhere on the map.
std::vector< extra_data > m_rivers
A layer when drawing the map.
QPixmap * load_sprite(const QStringList &possible_names, bool required=false, bool verbose=true) const
Shortcut to load a sprite from the tileset.
bool solid_background(const tile *ptile, const unit *punit, const city *pcity) const
Whether a solid background should be drawn on a tile instead of its terrain.
struct tileset * tileset() const
client_options * gui_options
struct named_sprites sprites
Terrain_type_id terrain_index(const struct terrain *pterrain)
Return the terrain index.
enum terrain_class terrain_type_terrain_class(const struct terrain *pterrain)
What terrain class terrain type belongs to.
#define terrain_type_iterate(_p)
#define terrain_type_iterate_end
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
#define tile_terrain(_tile)
static const bv_extras * tile_extras(const struct tile *ptile)
int tileset_num_cardinal_dirs(const struct tileset *t)
Returns the number of cardinal directions used by the tileset.
std::array< direction8, 8 > tileset_cardinal_dirs(const struct tileset *t)
Returns the cardinal directions used by the tileset.
void build_tile_data(const struct tile *ptile, struct terrain *pterrain, struct terrain **tterrain_near, bv_extras *textras_near)
Assemble some data that is used in building the tile sprite arrays.
QString cardinal_index_str(const struct tileset *t, int idx)
Return a directional string for the cardinal directions.
int tileset_num_index_cardinals(const struct tileset *t)
Returns the number of cardinal indices used by the tileset.
bool is_extra_drawing_enabled(const extra_type *pextra)
Should the given extra be drawn FIXME: Some extras can not be switched.
QStringList make_tag_terrain_list(const QString &prefix, const QString &suffix, const struct terrain *pterrain)
Make the list of possible tag names for the extras which may vary depending on the terrain they're on...
QString dir_get_tileset_name(enum direction8 dir)
Return the tileset name of the direction.