Cuberite
A lightweight, fast and extensible game server for Minecraft
MapSerializer.h
Go to the documentation of this file.
1 
2 // MapSerializer.h
3 
4 // Declares the cMapSerializer class that is used for saving maps into NBT format used by Anvil
5 
6 
7 
8 
9 
10 #pragma once
11 
12 
13 
14 
15 
16 // fwd:
17 class cFastNBTWriter;
18 class cParsedNBT;
19 class cMap;
20 
21 
22 
23 
26 {
27 public:
28 
29  cMapSerializer(const AString & a_WorldName, cMap * a_Map);
30 
32  bool Load(void);
33 
35  bool Save(void);
36 
37 
38 private:
39 
40  void SaveMapToNBT(cFastNBTWriter & a_Writer);
41 
42  bool LoadMapFromNBT(const cParsedNBT & a_NBT);
43 
45 
47 
48 
49 } ;
50 
51 
52 
53 
59 {
60 public:
61 
62  cIDCountSerializer(const AString & a_WorldName);
63 
65  bool Load(void);
66 
68  bool Save(void);
69 
70  inline unsigned int GetMapCount(void) const { return m_MapCount; }
71 
72  inline void SetMapCount(unsigned int a_MapCount) { m_MapCount = a_MapCount; }
73 
74 
75 private:
76 
78 
79  unsigned int m_MapCount;
80 
81 };
82 
83 
84 
85 
std::string AString
Definition: StringUtils.h:11
Encapsulates an in-game world map.
Definition: Map.h:83
Parses and contains the parsed data Also implements data accessor functions for tree traversal and va...
Definition: FastNBT.h:153
Utility class used to serialize maps.
Definition: MapSerializer.h:26
void SaveMapToNBT(cFastNBTWriter &a_Writer)
bool LoadMapFromNBT(const cParsedNBT &a_NBT)
bool Load(void)
Try to load the map.
cMapSerializer(const AString &a_WorldName, cMap *a_Map)
bool Save(void)
Try to save the map.
Utility class used to serialize item ID counts.
Definition: MapSerializer.h:59
bool Save(void)
Try to save the ID counts.
unsigned int m_MapCount
Definition: MapSerializer.h:79
bool Load(void)
Try to load the ID counts.
cIDCountSerializer(const AString &a_WorldName)
void SetMapCount(unsigned int a_MapCount)
Definition: MapSerializer.h:72
unsigned int GetMapCount(void) const
Definition: MapSerializer.h:70