From 2dba29ebf20e95068872b758a9c16daeb4c74440 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Fri, 8 May 2015 00:05:08 -0400 Subject: Tests: Add schematic unittests Improve schematic file-saving interface Add ability to create temporary test files --- src/mg_schematic.h | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'src/mg_schematic.h') diff --git a/src/mg_schematic.h b/src/mg_schematic.h index 5b546f879..3d3e328d3 100644 --- a/src/mg_schematic.h +++ b/src/mg_schematic.h @@ -85,26 +85,14 @@ enum SchematicFormatType { class Schematic : public ObjDef, public NodeResolver { public: - std::vector c_nodes; - - u32 flags; - v3s16 size; - MapNode *schemdata; - u8 *slice_probs; - Schematic(); virtual ~Schematic(); virtual void resolveNodeNames(); - void updateContentIds(); - - void blitToVManip(v3s16 p, MMVManip *vm, - Rotation rot, bool force_placement); - bool loadSchematicFromFile(const std::string &filename, INodeDefManager *ndef, - StringMap *replace_names); - bool saveSchematicToFile(const std::string &filename); + StringMap *replace_names=NULL); + bool saveSchematicToFile(const std::string &filename, INodeDefManager *ndef); bool getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2); bool deserializeFromMts(std::istream *is, std::vector *names); @@ -112,11 +100,18 @@ public: bool serializeToLua(std::ostream *os, const std::vector &names, bool use_comments, u32 indent_spaces); - void placeStructure(Map *map, v3s16 p, u32 flags, - Rotation rot, bool force_placement); + void blitToVManip(v3s16 p, MMVManip *vm, Rotation rot, bool force_place); + void placeStructure(Map *map, v3s16 p, u32 flags, Rotation rot, bool force_place); + void applyProbabilities(v3s16 p0, std::vector > *plist, std::vector > *splist); + + std::vector c_nodes; + u32 flags; + v3s16 size; + MapNode *schemdata; + u8 *slice_probs; }; class SchematicManager : public ObjDefManager { -- cgit v1.2.3