]> git.localhorst.tv Git - blank.git/blob - src/io/WorldSave.hpp
split chunk stuff
[blank.git] / src / io / WorldSave.hpp
1 #ifndef BLANK_IO_WORLDSAVE_HPP_
2 #define BLANK_IO_WORLDSAVE_HPP_
3
4 #include "../world/Chunk.hpp"
5 #include "../world/Generator.hpp"
6 #include "../world/World.hpp"
7
8 #include <memory>
9 #include <string>
10
11
12 namespace blank {
13
14 class WorldSave {
15
16 public:
17         explicit WorldSave(const std::string &path);
18
19 public:
20         // whole save
21         bool Exists() const noexcept;
22         void Read(World::Config &) const;
23         void Write(const World::Config &) const;
24         void Read(Generator::Config &) const;
25         void Write(const Generator::Config &) const;
26
27         // single chunk
28         bool Exists(const Chunk::Pos &) const noexcept;
29         void Read(Chunk &) const;
30         void Write(Chunk &) const;
31
32         const char *ChunkPath(const Chunk::Pos &) const;
33
34 private:
35         std::string root_path;
36         std::string world_conf_path;
37         std::string gen_conf_path;
38         std::string chunk_path;
39         std::size_t chunk_bufsiz;
40         std::unique_ptr<char[]> chunk_buf;
41
42 };
43
44 }
45
46 #endif