![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
Records regions of the map that should be updated. More...
#include <map_updates_handler.h>
Inheritance diagram for freeciv::map_updates_handler:
Collaboration diagram for freeciv::map_updates_handler:Public Types | |
| enum class | update_type { tile_single = 0x01 , tile_full = 0x02 , unit = 0x04 , city_description = 0x08 , city_map = 0x10 , tile_label = 0x20 } |
| What kind of update should be performed. More... | |
Public Types inherited from listener< map_updates_handler > | |
| typedef map_updates_handler | type_t |
Signals | |
| void | repaint_needed () |
Public Member Functions | |
| map_updates_handler (QObject *parent=nullptr) | |
| Constructor. More... | |
| virtual | ~map_updates_handler ()=default |
| bool | full () const |
| Returns true if the whole map should be updated. More... | |
| auto | list () const |
| Returns the list of pending updates. More... | |
| void | clear () |
| Clears all pending updates. More... | |
| void | update (const city *city, bool full) |
| Registers a city for update. More... | |
| void | update (const tile *tile, bool full) |
| Registers a tile for update. More... | |
| void | update (const unit *unit, bool full) |
| Registers a unit for update. More... | |
| void | update_all () |
| Requests an update of the whole (visible) map. More... | |
| void | update_city_description (const city *city) |
| Registers a city label for update. More... | |
| void | update_tile_label (const tile *tile) |
| Registers a tile label for update. More... | |
Private Attributes | |
| bool | m_full_update = false |
| std::map< const tile *, updates > | m_updates |
Additional Inherited Members | |
Static Public Member Functions inherited from listener< map_updates_handler > | |
| static void | invoke (_member_fct_ function, _args_ &&...args) |
Protected Member Functions inherited from listener< map_updates_handler > | |
| listener () | |
| virtual | ~listener () |
| void | listen () |
Records regions of the map that should be updated.
This class records a list of all regions on the map that need an update, and the extent of the necessary update (as a combination of update_type). It has nothing to do with tilesets and doesn't know about the map geometry, but some tilesets assumptions are hard-coded.
Definition at line 21 of file map_updates_handler.h.
|
strong |
What kind of update should be performed.
| Enumerator | |
|---|---|
| tile_single | |
| tile_full | |
| unit | |
| city_description | |
| city_map | |
| tile_label | |
Definition at line 29 of file map_updates_handler.h.
|
explicit |
Constructor.
Definition at line 27 of file map_updates_handler.cpp.
|
virtualdefault |
| void freeciv::map_updates_handler::clear | ( | ) |
Clears all pending updates.
Definition at line 35 of file map_updates_handler.cpp.
Referenced by freeciv::renderer::unqueue_updates().
|
inline |
Returns true if the whole map should be updated.
Definition at line 43 of file map_updates_handler.h.
Referenced by freeciv::renderer::unqueue_updates(), and update().
|
inline |
Returns the list of pending updates.
Definition at line 46 of file map_updates_handler.h.
Referenced by freeciv::renderer::unqueue_updates().
|
signal |
| void freeciv::map_updates_handler::update | ( | const city * | city, |
| bool | full | ||
| ) |
Registers a city for update.
If full, also update the city label.
Definition at line 45 of file map_updates_handler.cpp.
Referenced by refresh_city_mapcanvas(), refresh_tile_mapcanvas(), and refresh_unit_mapcanvas().
| void freeciv::map_updates_handler::update | ( | const tile * | tile, |
| bool | full | ||
| ) |
Registers a tile for update.
If full, also update the neighboring area.
Definition at line 62 of file map_updates_handler.cpp.
| void freeciv::map_updates_handler::update | ( | const unit * | unit, |
| bool | full | ||
| ) |
Registers a unit for update.
Definition at line 77 of file map_updates_handler.cpp.
| void freeciv::map_updates_handler::update_all | ( | ) |
Requests an update of the whole (visible) map.
Definition at line 96 of file map_updates_handler.cpp.
Referenced by update(), and update_map_canvas_visible().
| void freeciv::map_updates_handler::update_city_description | ( | const city * | city | ) |
Registers a city label for update.
Definition at line 107 of file map_updates_handler.cpp.
Referenced by update_city_description().
| void freeciv::map_updates_handler::update_tile_label | ( | const tile * | tile | ) |
Registers a tile label for update.
Definition at line 118 of file map_updates_handler.cpp.
Referenced by update_tile_label().
|
private |
Definition at line 61 of file map_updates_handler.h.
Referenced by clear(), full(), update(), update_all(), update_city_description(), and update_tile_label().
|
private |
Definition at line 62 of file map_updates_handler.h.
Referenced by clear(), list(), update(), update_all(), update_city_description(), and update_tile_label().