summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/SchematicFileSerializer.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-04-02 11:56:27 +0200
committermadmaxoft <github@xoft.cz>2014-04-02 11:56:27 +0200
commitbcd7f9669ba98f4ecb71ba728d72836ff14b3c0f (patch)
tree1682da1b21568237744c5b6056872a80859c7c95 /src/WorldStorage/SchematicFileSerializer.cpp
parentFixed StringCompression's GZIP handling for larger strings. (diff)
downloadcuberite-bcd7f9669ba98f4ecb71ba728d72836ff14b3c0f.tar
cuberite-bcd7f9669ba98f4ecb71ba728d72836ff14b3c0f.tar.gz
cuberite-bcd7f9669ba98f4ecb71ba728d72836ff14b3c0f.tar.bz2
cuberite-bcd7f9669ba98f4ecb71ba728d72836ff14b3c0f.tar.lz
cuberite-bcd7f9669ba98f4ecb71ba728d72836ff14b3c0f.tar.xz
cuberite-bcd7f9669ba98f4ecb71ba728d72836ff14b3c0f.tar.zst
cuberite-bcd7f9669ba98f4ecb71ba728d72836ff14b3c0f.zip
Diffstat (limited to 'src/WorldStorage/SchematicFileSerializer.cpp')
-rw-r--r--src/WorldStorage/SchematicFileSerializer.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/WorldStorage/SchematicFileSerializer.cpp b/src/WorldStorage/SchematicFileSerializer.cpp
index d8531d965..9d594a084 100644
--- a/src/WorldStorage/SchematicFileSerializer.cpp
+++ b/src/WorldStorage/SchematicFileSerializer.cpp
@@ -14,6 +14,39 @@
+#ifdef SELF_TEST
+
+static class cSchematicStringSelfTest
+{
+public:
+ cSchematicStringSelfTest(void)
+ {
+ cBlockArea ba;
+ ba.Create(21, 256, 21);
+ ba.RelLine(0, 0, 0, 9, 8, 7, cBlockArea::baTypes | cBlockArea::baMetas, E_BLOCK_WOODEN_STAIRS, 1);
+ AString Schematic;
+ if (!cSchematicFileSerializer::SaveToSchematicString(ba, Schematic))
+ {
+ assert_test(!"Schematic failed to save!");
+ }
+ cBlockArea ba2;
+ if (!cSchematicFileSerializer::LoadFromSchematicString(ba2, Schematic))
+ {
+ assert_test(!"Schematic failed to load!");
+ }
+ }
+} g_SelfTest;
+
+#endif
+
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cSchematicFileSerializer:
+
bool cSchematicFileSerializer::LoadFromSchematicFile(cBlockArea & a_BlockArea, const AString & a_FileName)
{
// Un-GZip the contents: