Freeciv21
Develop your civilization from humble roots to a global empire
layer_abstract_activities.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPLv3-or-later
2 // SPDX-FileCopyrightText: Freeciv authors
3 // SPDX-FileCopyrightText: Freeciv21 authors
4 // SPDX-FileCopyrightText: Louis Moureaux <m_louis30@yahoo.com>
5 
6 #pragma once
7 
8 #include <array>
9 
10 #include "fc_types.h"
11 #include "layer.h"
12 
13 class QPixmap;
14 struct tileset;
15 
16 namespace freeciv {
17 
19 public:
21  using layer::layer;
22 
23  void load_sprites() override;
24 
25  void initialize_extra(const extra_type *extra, const QString &tag,
26  extrastyle_id style) override;
27 
28  void reset_ruleset() override;
29 
30  QPixmap *activity_sprite(unit_activity id, const extra_type *extra) const;
31 
32 private:
33  std::array<QPixmap *, ACTIVITY_LAST> m_activities = {nullptr};
34  std::vector<QPixmap *> m_extra_activities, m_extra_rm_activities;
35 };
36 
37 } // namespace freeciv
An abstract class for layers that need sprites for unit activities.
void reset_ruleset() override
Resets data about extras.
std::vector< QPixmap * > m_extra_rm_activities
std::array< QPixmap *, ACTIVITY_LAST > m_activities
void load_sprites() override
Loads the sprites in memory.
void initialize_extra(const extra_type *extra, const QString &tag, extrastyle_id style) override
Loads the extra activity and remove activity sprites.
QPixmap * activity_sprite(unit_activity id, const extra_type *extra) const
Returns the sprite used to represent a given activity on the map.
A layer when drawing the map.
Definition: layer.h:153
layer(struct tileset *ts, mapview_layer layer)
Constructor.
Definition: layer.h:158
Definition: path.cpp:10