+ MapNode *orig_schemdata = schemdata;
+ std::vector<std::string> ndef_nodenames;
+ std::vector<std::string> *names;
+
+ if (m_resolve_done && ndef == NULL)
+ ndef = m_ndef;
+
+ if (ndef) {
+ names = &ndef_nodenames;
+
+ u32 volume = size.X * size.Y * size.Z;
+ schemdata = new MapNode[volume];
+ for (u32 i = 0; i != volume; i++)
+ schemdata[i] = orig_schemdata[i];
+
+ generate_nodelist_and_update_ids(schemdata, volume, names, ndef);
+ } else { // otherwise, use the names we have on hand in the list
+ names = &m_nodenames;
+ }
+
+ std::ostringstream os(std::ios_base::binary);
+ bool status = serializeToMts(&os, *names);
+
+ if (ndef) {
+ delete []schemdata;
+ schemdata = orig_schemdata;
+ }
+
+ if (!status)
+ return false;
+
+ return fs::safeWriteToFile(filename, os.str());
+}
+
+
+bool Schematic::getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2)
+{
+ MMVManip *vm = new MMVManip(map);