![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <layer_city.h>
Inheritance diagram for freeciv::layer_city:
Collaboration diagram for freeciv::layer_city:Public Types | |
| using | styles = std::vector< std::unique_ptr< freeciv::colorizer > > |
| using | city_sprite = std::vector< styles > |
Public Member Functions | |
| layer_city (struct tileset *ts, const QPoint &city_offset, const QPoint &city_flag_offset, const QPoint &occupied_offset) | |
| virtual | ~layer_city ()=default |
| void | load_sprites () override |
| Loads the disorder and happy sprites. More... | |
| void | initialize_city_style (const citystyle &style, int index) override |
| Loads all sprites for a city style. More... | |
| std::vector< drawn_sprite > | fill_sprite_array (const tile *ptile, const tile_edge *pedge, const tile_corner *pcorner, const unit *punit) const override |
| Fill in the given sprite array with any needed city sprites. More... | |
| std::vector< drawn_sprite > | fill_sprite_array_no_flag (const city *pcity, bool show_occupied) const |
| Fill in the given sprite array with any city sprites. More... | |
| QPixmap | sample_sprite (int style_index=0) const |
| Returns an example of what a city might look like. More... | |
| void | reset_ruleset () override |
| All sprites depend on the ruleset-defined city styles and need to be reset. More... | |
Public Member Functions inherited from freeciv::layer | |
| layer (struct tileset *ts, mapview_layer layer) | |
| Constructor. More... | |
| virtual | ~layer ()=default |
| Destructor. More... | |
| virtual void | initialize_player (const player *player) |
| Initializes data specific to one player. More... | |
| virtual void | free_player (int player_id) |
| Frees data initialized by initialize_player. More... | |
| virtual void | initialize_extra (const extra_type *extra, const QString &tag, extrastyle_id style) |
| Initializes extra-specific data. More... | |
| virtual void | initialize_terrain (const terrain *terrain) |
| Initializes terrain-specific data. More... | |
| mapview_layer | type () const |
Static Public Attributes | |
| constexpr static int | NUM_WALL_TYPES = 7 |
Private Member Functions | |
| layer_city::styles | load_city_size_sprites (const QString &tag, const citystyle &style) |
Loads a set of size-dependent city sprites, with tags of the form graphic_tag_size. More... | |
Private Attributes | |
| QPoint | m_city_offset |
| QPoint | m_city_flag_offset |
| QPoint | m_occupied_offset |
| QPixmap * | m_disorder |
| QPixmap * | m_happy |
| city_sprite | m_tile |
| city_sprite | m_single_wall |
| city_sprite | m_occupied |
| std::array< city_sprite, NUM_WALL_TYPES > | m_walls |
Additional Inherited Members | |
Protected Member Functions inherited from freeciv::layer | |
| struct tileset * | tileset () const |
| bool | do_draw_unit (const tile *ptile, const unit *punit) const |
| Whether a unit should be drawn. More... | |
| 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. More... | |
| QPixmap * | load_sprite (const QStringList &possible_names, bool required=false, bool verbose=true) const |
| Shortcut to load a sprite from the tileset. More... | |
Definition at line 20 of file layer_city.h.
| using freeciv::layer_city::city_sprite = std::vector<styles> |
Definition at line 23 of file layer_city.h.
| using freeciv::layer_city::styles = std::vector<std::unique_ptr<freeciv::colorizer> > |
Definition at line 22 of file layer_city.h.
|
explicit |
Definition at line 17 of file layer_city.cpp.
|
virtualdefault |
|
overridevirtual |
Fill in the given sprite array with any needed city sprites.
The city size is not included.
Reimplemented from freeciv::layer.
Definition at line 165 of file layer_city.cpp.
| std::vector< drawn_sprite > freeciv::layer_city::fill_sprite_array_no_flag | ( | const city * | pcity, |
| bool | show_occupied | ||
| ) | const |
Fill in the given sprite array with any city sprites.
Doesn't account for options->draw_cities. The flag and city size are not included, and the occupied city indicator is only shown if requested.
Definition at line 200 of file layer_city.cpp.
Referenced by fill_sprite_array(), freeciv::city_icon_widget::paintEvent(), and freeciv::city_icon_widget::sizeHint().
|
overridevirtual |
Loads all sprites for a city style.
Reimplemented from freeciv::layer.
Definition at line 87 of file layer_city.cpp.
|
private |
Loads a set of size-dependent city sprites, with tags of the form graphic_tag_size.
Definition at line 39 of file layer_city.cpp.
Referenced by initialize_city_style().
|
overridevirtual |
Loads the disorder and happy sprites.
Reimplemented from freeciv::layer.
Definition at line 29 of file layer_city.cpp.
|
overridevirtual |
All sprites depend on the ruleset-defined city styles and need to be reset.
Reimplemented from freeciv::layer.
Definition at line 268 of file layer_city.cpp.
|
inline |
Returns an example of what a city might look like.
Definition at line 46 of file layer_city.h.
Referenced by races_dialog::races_dialog().
|
private |
Definition at line 58 of file layer_city.h.
Referenced by fill_sprite_array().
|
private |
Definition at line 58 of file layer_city.h.
Referenced by fill_sprite_array_no_flag().
|
private |
Definition at line 59 of file layer_city.h.
Referenced by fill_sprite_array_no_flag(), and load_sprites().
|
private |
Definition at line 59 of file layer_city.h.
Referenced by fill_sprite_array_no_flag(), and load_sprites().
|
private |
Definition at line 61 of file layer_city.h.
Referenced by fill_sprite_array_no_flag(), initialize_city_style(), and reset_ruleset().
|
private |
Definition at line 58 of file layer_city.h.
Referenced by fill_sprite_array_no_flag().
|
private |
Definition at line 61 of file layer_city.h.
Referenced by fill_sprite_array_no_flag(), initialize_city_style(), and reset_ruleset().
|
private |
Definition at line 61 of file layer_city.h.
Referenced by fill_sprite_array_no_flag(), initialize_city_style(), reset_ruleset(), and sample_sprite().
|
private |
Definition at line 62 of file layer_city.h.
Referenced by fill_sprite_array_no_flag(), initialize_city_style(), and reset_ruleset().
|
staticconstexpr |
Definition at line 24 of file layer_city.h.
Referenced by fill_sprite_array_no_flag().