supertux
world.hpp
1 // SuperTux
2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HEADER_SUPERTUX_SUPERTUX_WORLD_HPP
18 #define HEADER_SUPERTUX_SUPERTUX_WORLD_HPP
19 
20 #include <memory>
21 #include <string>
22 
23 class World final
24 {
25 public:
28  static std::unique_ptr<World> from_directory(const std::string& directory);
29  static std::unique_ptr<World> create(const std::string& title, const std::string& desc);
30 
31 private:
32  World(const std::string& directory);
33 
34 public:
35  std::string get_basedir() const { return m_basedir; }
36  std::string get_title() const { return m_title; }
37 
38  bool hide_from_contribs() const { return m_hide_from_contribs; }
39 
40  bool is_levelset() const { return m_is_levelset; }
41  bool is_worldmap() const { return !m_is_levelset; }
42 
43  std::string get_worldmap_filename() const;
44  std::string get_savegame_filename() const;
45 
46  void save(bool retry = false);
47 
48 public:
49  std::string m_title;
50  std::string m_description;
51  bool m_is_levelset;
52 
53 private:
54  std::string m_basedir;
55  bool m_hide_from_contribs;
56 
57 private:
58  World(const World&) = delete;
59  World& operator=(const World&) = delete;
60 };
61 
62 #endif
63 
64 /* EOF */
Definition: world.hpp:23
static std::unique_ptr< World > from_directory(const std::string &directory)
Load a World.
Definition: world.cpp:32