supertux
spawn_point.hpp
1 // SuperTux - Worldmap Spawnpoint
2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 // 2023 Vankata453
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #ifndef HEADER_SUPERTUX_WORLDMAP_SPAWN_POINT_HPP
19 #define HEADER_SUPERTUX_WORLDMAP_SPAWN_POINT_HPP
20 
21 #include "worldmap/worldmap_object.hpp"
22 
23 #include <string>
24 
25 #include "math/vector.hpp"
26 #include "worldmap/direction.hpp"
27 
28 namespace worldmap {
29 
30 class SpawnPoint final
31 {
32 public:
33  SpawnPoint(const ReaderMapping& mapping);
34 
35  const std::string& get_name() const { return m_name; }
36  Vector get_pos() const { return m_pos; }
37  Direction get_auto_dir() const { return m_auto_dir; }
38 
39 private:
40  std::string m_name;
41  Vector m_pos;
42  Direction m_auto_dir;
44 private:
45  SpawnPoint(const SpawnPoint&) = delete;
46  SpawnPoint& operator=(const SpawnPoint&) = delete;
47 };
48 
49 
50 class SpawnPointObject final : public WorldMapObject
51 {
52 public:
53  SpawnPointObject(const ReaderMapping& mapping);
54  SpawnPointObject(const std::string& name, const Vector& pos);
55 
56  static std::string class_name() { return "worldmap-spawnpoint"; }
57  virtual std::string get_class_name() const override { return class_name(); }
58  static std::string display_name() { return _("Spawn point"); }
59  virtual std::string get_display_name() const override { return display_name(); }
60  virtual GameObjectClasses get_class_types() const override { return WorldMapObject::get_class_types().add(typeid(SpawnPointObject)); }
61 
62  virtual ObjectSettings get_settings() override;
63 
64 private:
65  Direction m_dir;
66 
67 private:
68  SpawnPointObject(const SpawnPointObject&) = delete;
69  SpawnPointObject& operator=(const SpawnPointObject&) = delete;
70 };
71 
72 } // namespace worldmap
73 
74 #endif
75 
76 /* EOF */
Definition: spawn_point.hpp:30
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user&#39;s locale.
Definition: spawn_point.hpp:59
Definition: worldmap_object.hpp:30
Definition: object_settings.hpp:39
Definition: object_settings.hpp:32
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: spawn_point.hpp:60
Definition: spawn_point.hpp:50
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