2014-02-13 10:13:09 -05:00
|
|
|
|
|
|
|
// MapSerializer.h
|
|
|
|
|
|
|
|
// Declares the cMapSerializer class that is used for saving maps into NBT format used by Anvil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fwd:
|
|
|
|
class cFastNBTWriter;
|
|
|
|
class cParsedNBT;
|
|
|
|
class cMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cMapSerializer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
cMapSerializer(const AString& a_WorldName, cMap * a_Map);
|
|
|
|
|
2014-02-17 09:27:12 -05:00
|
|
|
/** Try to load the scoreboard */
|
2014-02-13 10:13:09 -05:00
|
|
|
bool Load(void);
|
|
|
|
|
2014-02-17 09:27:12 -05:00
|
|
|
/** Try to save the scoreboard */
|
2014-02-13 10:13:09 -05:00
|
|
|
bool Save(void);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void SaveMapToNBT(cFastNBTWriter & a_Writer);
|
|
|
|
|
|
|
|
bool LoadMapFromNBT(const cParsedNBT & a_NBT);
|
|
|
|
|
|
|
|
cMap * m_Map;
|
|
|
|
|
|
|
|
AString m_Path;
|
|
|
|
|
|
|
|
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-13 14:36:24 -05:00
|
|
|
class cIDCountSerializer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
cIDCountSerializer(const AString & a_WorldName);
|
|
|
|
|
2014-02-17 09:27:12 -05:00
|
|
|
/** Try to load the ID counts */
|
2014-02-13 14:36:24 -05:00
|
|
|
bool Load(void);
|
|
|
|
|
2014-02-17 09:27:12 -05:00
|
|
|
/** Try to save the ID counts */
|
2014-02-13 14:36:24 -05:00
|
|
|
bool Save(void);
|
|
|
|
|
|
|
|
inline unsigned int GetMapCount(void) const { return m_MapCount; }
|
|
|
|
|
|
|
|
inline void SetMapCount(unsigned int a_MapCount) { m_MapCount = a_MapCount; }
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
AString m_Path;
|
|
|
|
|
|
|
|
unsigned int m_MapCount;
|
2014-02-17 09:27:12 -05:00
|
|
|
|
2014-02-13 14:36:24 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|