supertux
level_tile.hpp
1 // SuperTux
2 // Copyright (C) 2004 Ingo Ruhnke <grumbel@gmail.com>
3 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
4 // 2023 Vankata453
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 #ifndef HEADER_SUPERTUX_WORLDMAP_LEVEL_TILE_HPP
20 #define HEADER_SUPERTUX_WORLDMAP_LEVEL_TILE_HPP
21 
22 #include "worldmap/worldmap_object.hpp"
23 
24 #include "supertux/statistics.hpp"
25 
26 namespace worldmap {
27 
28 class LevelTile final : public WorldMapObject
29 {
30 public:
31  LevelTile(const ReaderMapping& mapping);
32  ~LevelTile() override;
33 
34  static std::string class_name() { return "level"; }
35  virtual std::string get_class_name() const override { return class_name(); }
36  static std::string display_name() { return _("Level"); }
37  virtual std::string get_display_name() const override { return display_name(); }
38  virtual GameObjectClasses get_class_types() const override { return WorldMapObject::get_class_types().add(typeid(LevelTile)); }
39 
40  virtual ObjectSettings get_settings() override;
41 
42  void set_solved(bool v);
43  bool is_solved() const { return m_solved; }
44 
45  void set_perfect(bool v);
46  bool is_perfect() const { return m_perfect; }
47 
48  Statistics& get_statistics() { return m_statistics; }
49  const Statistics& get_statistics() const { return m_statistics; }
50 
51  void update_sprite_action();
52 
53  const std::string& get_title() const { return m_title; }
54  const std::string& get_level_filename() const { return m_level_filename; }
55  const std::string& get_basedir() const { return m_basedir; }
56  Color get_title_color() const { return m_title_color; }
57  const std::string& get_extro_script() const { return m_extro_script; }
58  float get_target_time() const { return m_target_time; }
59  bool is_auto_play() const { return m_auto_play; }
60 
61 private:
62  void load_level_information();
63 
64 private:
65  std::string m_basedir;
66  std::string m_level_filename;
67  std::string m_title;
68 
70  bool m_auto_play;
71 
72  float m_target_time;
73 
75  std::string m_extro_script;
76 
78  bool m_solved;
79  bool m_perfect;
80 
81  Statistics m_statistics;
82 
83  Color m_title_color;
84 
85 private:
86  LevelTile(const LevelTile&) = delete;
87  LevelTile& operator=(const LevelTile&) = delete;
88 };
89 
90 } // namespace worldmap
91 
92 #endif
93 
94 /* EOF */
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user&#39;s locale.
Definition: level_tile.hpp:37
Definition: worldmap_object.hpp:30
This class is a layer between level and worldmap to keep track of stuff like scores, and minor, but funny things, like number of jumps and stuff.
Definition: statistics.hpp:36
Definition: object_settings.hpp:39
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: level_tile.hpp:38
Definition: object_settings.hpp:32
Definition: level_tile.hpp:28
Definition: color.hpp:26
A helper structure to list all the type_indexes of the classes in the type hierarchy of a given class...
Definition: game_object.hpp:57
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: worldmap_object.hpp:39
Definition: reader_mapping.hpp:32