26 const QPoint &activity_offset,
27 const QPoint &select_offset,
28 const QPoint &unit_offset,
29 const QPoint &unit_flag_offset)
31 m_activity_offset(activity_offset), m_select_offset(select_offset),
32 m_unit_offset(unit_offset), m_unit_flag_offset(unit_flag_offset)
56 QStringList buffer = {QStringLiteral(
"unit.battlegroup_%1").arg(i),
57 QStringLiteral(
"city.size_%1").arg(i + 1)};
61 for (
int i = 0; i <= 100; i++) {
62 auto name = QStringLiteral(
"unit.hp_%1").arg(i);
69 "No unit.hp_* sprite in the tileset.");
78 auto name = QStringLiteral(
"unit.vet_%1").arg(i);
82 for (
int i = 0;; i++) {
83 auto buffer = QStringLiteral(
"unit.select%1").arg(QString::number(i));
92 std::vector<drawn_sprite>
95 const unit *punit)
const
111 std::vector<drawn_sprite> sprs;
137 const auto color = rgb ? QColor(rgb->r, rgb->g, rgb->b) : QColor();
151 sprs.emplace_back(
tileset(), sprite,
true,
187 if ((ptile && unit_list_size(ptile->
units) > 1)
188 || punit->
client.occupied) {
213 const QPoint &full_offset)
const
215 QPixmap *sprite =
nullptr;
221 case SSA_AUTOSETTLER:
224 case SSA_AUTOEXPLORE:
235 sprs.emplace_back(
tileset(), sprite,
true, full_offset + offset);
244 const QPoint &full_offset)
const
249 }
else if (punit->
activity != ACTIVITY_IDLE) {
An abstract class for layers that need sprites for unit activities.
void load_sprites() override
Loads the sprites in memory.
QPixmap * activity_sprite(unit_activity id, const extra_type *extra) const
Returns the sprite used to represent a given activity on the map.
QPixmap * m_action_decision_want
std::array< QPixmap *, MAX_VET_LEVELS > m_veteran_level
std::vector< QPixmap * > m_select
layer_units(struct tileset *ts, mapview_layer layer, const QPoint &activity_offset, const QPoint &select_offset, const QPoint &unit_offset, const QPoint &unit_flag_offset)
Constructor.
int focus_unit_state() const
Returns the current state of the focused unit animation.
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.
void add_automated_sprite(std::vector< drawn_sprite > &sprs, const unit *punit, const QPoint &full_offset) const
Adds the sprite used to represent an automated unit on the map to sprs.
std::array< QPixmap *, MAX_NUM_BATTLEGROUPS > m_battlegroup
void load_sprites() override
Loads all static sprites needed by this layer (activities etc).
std::vector< QPixmap * > m_hp_bar
void add_orders_sprite(std::vector< drawn_sprite > &sprs, const unit *punit, const QPoint &full_offset) const
Adds the sprite used to represent unit orders to sprs.
QPoint m_unit_flag_offset
A layer when drawing the map.
mapview_layer type() const
QPixmap * load_sprite(const QStringList &possible_names, bool required=false, bool verbose=true) const
Shortcut to load a sprite from the tileset.
bool do_draw_unit(const tile *ptile, const unit *punit) const
Whether a unit should be drawn.
struct tileset * tileset() const
bool unit_is_in_focus(const struct unit *punit)
Return TRUE iff this unit is in focus.
bool should_ask_server_for_actions(const struct unit *punit)
Returns TRUE iff the client should ask the server about what actions a unit can perform.
client_options * gui_options
#define CLIP(lower, current, upper)
bool solid_color_behind_units
Local Options:
enum unit_activity activity
struct unit::@76::@78 client
struct extra_type * activity_target
enum server_side_agent ssa_controller
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
QPoint tileset_full_tile_offset(const struct tileset *t)
Return the x and y offsets of full tiles in the tileset.
const QPixmap * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum direction8 facing, const QColor &replace)
Return the sprite for the unit type (the base "unit" sprite).
void tileset_error(struct tileset *t, QtMsgType level, const char *format,...)
Called when ever there's problem in ruleset/tileset compatibility.
QPixmap * get_unit_nation_flag_sprite(const struct tileset *t, const struct unit *punit)
Return a sprite for the national flag for this unit.
bool unit_transported(const struct unit *pcargo)
Returns TRUE iff the unit is transported.
bool unit_has_orders(const struct unit *punit)
Return TRUE iff the unit is following client-side orders.
#define MAX_NUM_BATTLEGROUPS
const struct unit_type * unit_type_get(const struct unit *punit)
Return the unit type for this unit.
#define utype_fuel(ptype)