]> git.lizzy.rs Git - minetest.git/blobdiff - src/mg_schematic.h
Do not allow the m_transforming_liquid queue to increase until all RAM is consumed
[minetest.git] / src / mg_schematic.h
index 8a495fef2e1fec2b011219c86b5935ccae3fe96d..df54d79bae0e008686f6c37c01a9c5bbf522130a 100644 (file)
@@ -30,11 +30,8 @@ class ManualMapVoxelManipulator;
 class PseudoRandom;
 class NodeResolver;
 
-/////////////////// Decoration flags
-#define DECO_PLACE_CENTER_X     1
-#define DECO_PLACE_CENTER_Y     2
-#define DECO_PLACE_CENTER_Z     4
-#define DECO_SCHEM_CIDS_UPDATED 8
+/////////////////// Schematic flags
+#define SCHEM_CIDS_UPDATED 0x08
 
 
 #define MTSCHEM_FILE_SIGNATURE 0x4d54534d // 'MTSM'
@@ -44,42 +41,50 @@ class NodeResolver;
 #define MTSCHEM_PROB_NEVER  0x00
 #define MTSCHEM_PROB_ALWAYS 0xFF
 
-extern FlagDesc flagdesc_deco_schematic[];
 
-class DecoSchematic : public Decoration {
+class Schematic : public GenElement {
 public:
-       std::string filename;
-
        std::vector<content_t> c_nodes;
 
        u32 flags;
-       Rotation rotation;
        v3s16 size;
-       MapNode *schematic;
+       MapNode *schemdata;
        u8 *slice_probs;
 
-       DecoSchematic();
-       ~DecoSchematic();
+       Schematic();
+       ~Schematic();
 
        void updateContentIds();
-       virtual void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p);
-       virtual int getHeight();
-       virtual std::string getName();
 
        void blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm,
-                                       Rotation rot, bool force_placement);
+               Rotation rot, bool force_placement, INodeDefManager *ndef);
 
-       bool loadSchematicFile(NodeResolver *resolver,
+       bool loadSchematicFromFile(const char *filename, NodeResolver *resolver,
                std::map<std::string, std::string> &replace_names);
-       void saveSchematicFile(INodeDefManager *ndef);
-
+       void saveSchematicToFile(const char *filename, INodeDefManager *ndef);
        bool getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2);
-       void placeStructure(Map *map, v3s16 p, bool force_placement);
+
+       void placeStructure(Map *map, v3s16 p, u32 flags,
+               Rotation rot, bool force_placement, INodeDefManager *nef);
        void applyProbabilities(v3s16 p0,
                std::vector<std::pair<v3s16, u8> > *plist,
                std::vector<std::pair<s16, u8> > *splist);
 };
 
+class SchematicManager : public GenElementManager {
+public:
+       static const char *ELEMENT_TITLE;
+       static const size_t ELEMENT_LIMIT = 0x10000;
+
+       SchematicManager(IGameDef *gamedef);
+       ~SchematicManager() {}
+
+       Schematic *create(int type)
+       {
+               return new Schematic;
+       }
+};
+
 void build_nnlist_and_update_ids(MapNode *nodes, u32 nodecount,
                                        std::vector<content_t> *usednodes);