summaryrefslogtreecommitdiff
path: root/src/mg_schematic.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-04-16 04:12:26 -0400
committerkwolekr <kwolekr@minetest.net>2015-04-16 16:27:05 -0400
commit479f38973e13680d6a39d9c2a7f29fd330b67d41 (patch)
treec6719cf37bfbc44f98cc33b9b2693542b8fdd8cc /src/mg_schematic.h
parent0c634a97197d50f2ca58825f1b215d0407397ac6 (diff)
downloadminetest-479f38973e13680d6a39d9c2a7f29fd330b67d41.tar.gz
minetest-479f38973e13680d6a39d9c2a7f29fd330b67d41.tar.bz2
minetest-479f38973e13680d6a39d9c2a7f29fd330b67d41.zip
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.
Diffstat (limited to 'src/mg_schematic.h')
-rw-r--r--src/mg_schematic.h18
1 files changed, 7 insertions, 11 deletions
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<std::string> *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<std::string> *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<std::pair<v3s16, u8> > *plist,
std::vector<std::pair<s16, u8> > *splist);
-
- std::string getAsLuaTable(INodeDefManager *ndef, bool use_comments);
};
class SchematicManager : public ObjDefManager {