From 479f38973e13680d6a39d9c2a7f29fd330b67d41 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Thu, 16 Apr 2015 04:12:26 -0400 Subject: Schematics: Refactor NodeResolver and add NodeResolveMethod NodeResolver name lists now belong to the NodeResolver object instead of the associated NodeDefManager. In addition to minimizing unnecessary abstraction and overhead, this move permits NodeResolvers to look up nodes that they had previously set pending for resolution. So far, this functionality has been used in the case of schematics for serialization/deserialization. --- src/mg_schematic.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/mg_schematic.h') diff --git a/src/mg_schematic.h b/src/mg_schematic.h index 50d48b1f1..63cea21f6 100644 --- a/src/mg_schematic.h +++ b/src/mg_schematic.h @@ -94,23 +94,21 @@ public: Schematic(); virtual ~Schematic(); - virtual void resolveNodeNames(NodeResolveInfo *nri); + virtual void resolveNodeNames(); void updateContentIds(); void blitToVManip(v3s16 p, MMVManip *vm, Rotation rot, bool force_placement, INodeDefManager *ndef); - bool loadSchematicFromFile(const char *filename, INodeDefManager *ndef, - StringMap *replace_names); - bool saveSchematicToFile(const char *filename, INodeDefManager *ndef); + bool loadSchematicFromFile(const std::string &filename, INodeDefManager *ndef, + StringMap *replace_names, NodeResolveMethod resolve_method); + bool saveSchematicToFile(const std::string &filename); bool getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2); - bool deserializeFromMts(std::istream *is, INodeDefManager *ndef, - std::vector *names); - bool serializeToMts(std::ostream *os, INodeDefManager *ndef); - bool serializeToLua(std::ostream *os, - INodeDefManager *ndef, bool use_comments); + bool deserializeFromMts(std::istream *is, std::vector *names_out); + bool serializeToMts(std::ostream *os); + bool serializeToLua(std::ostream *os, bool use_comments); void placeStructure(Map *map, v3s16 p, u32 flags, @@ -118,8 +116,6 @@ public: void applyProbabilities(v3s16 p0, std::vector > *plist, std::vector > *splist); - - std::string getAsLuaTable(INodeDefManager *ndef, bool use_comments); }; class SchematicManager : public ObjDefManager { -- cgit v1.2.3