1
0
Fork 0

formatting changes

This commit is contained in:
Tycho 2014-01-22 10:13:41 -08:00
parent c832fbeb8e
commit 1c320fa18c
2 changed files with 26 additions and 6 deletions

View File

@ -6,7 +6,7 @@
#include "SchematicFileSerilizer.h"
bool cSchematicFileSerializer::LoadFromSchematicFile(cBlockArea& a_BlockArea, const AString & a_FileName)
bool cSchematicFileSerializer::LoadFromSchematicFile(cBlockArea & a_BlockArea, const AString & a_FileName)
{
// Un-GZip the contents:
AString Contents;
@ -35,7 +35,12 @@ bool cSchematicFileSerializer::LoadFromSchematicFile(cBlockArea& a_BlockArea, co
return LoadFromSchematicNBT(a_BlockArea, NBT);
}
bool cSchematicFileSerializer::SaveToSchematicFile(cBlockArea& a_BlockArea, const AString & a_FileName)
bool cSchematicFileSerializer::SaveToSchematicFile(cBlockArea & a_BlockArea, const AString & a_FileName)
{
cFastNBTWriter Writer("Schematic");
Writer.AddShort("Width", a_BlockArea.m_SizeX);
@ -82,7 +87,12 @@ bool cSchematicFileSerializer::SaveToSchematicFile(cBlockArea& a_BlockArea, cons
return true;
}
bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea& a_BlockArea, cParsedNBT & a_NBT)
bool cSchematicFileSerializer::LoadFromSchematicNBT(cBlockArea & a_BlockArea, cParsedNBT & a_NBT)
{
int TMaterials = a_NBT.FindChildByName(a_NBT.GetRoot(), "Materials");
if ((TMaterials > 0) && (a_NBT.GetType(TMaterials) == TAG_String))

View File

@ -1,20 +1,30 @@
#pragma once
#include "../BlockArea.h"
// fwd: FastNBT.h
class cParsedNBT;
class cSchematicFileSerializer
{
public:
/// Loads an area from a .schematic file. Returns true if successful
static bool LoadFromSchematicFile(cBlockArea& a_BlockArea, const AString & a_FileName);
static bool LoadFromSchematicFile(cBlockArea & a_BlockArea, const AString & a_FileName);
/// Saves the area into a .schematic file. Returns true if successful
static bool SaveToSchematicFile(cBlockArea& a_BlockArea, const AString & a_FileName);
static bool SaveToSchematicFile(cBlockArea & a_BlockArea, const AString & a_FileName);
private:
/// Loads the area from a schematic file uncompressed and parsed into a NBT tree. Returns true if successful.
static bool LoadFromSchematicNBT(cBlockArea& a_BlockArea, cParsedNBT & a_NBT);
static bool LoadFromSchematicNBT(cBlockArea & a_BlockArea, cParsedNBT & a_NBT);
};