Replace instances of height_min/height_max with y_min/y_max to remove ambiguity
[oweals/minetest.git] / src / mg_decoration.h
index c698710b5343d38c383c0b8bf1970f7257c33aef..59c3ff5583b22a722816b4803e0b4846c3012be4 100644 (file)
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <set>
 #include "mapgen.h"
 
-class NoiseParams;
+struct NoiseParams;
 class Mapgen;
 class ManualMapVoxelManipulator;
 class PseudoRandom;
@@ -38,8 +38,9 @@ enum DecorationType {
 #define DECO_PLACE_CENTER_X 0x01
 #define DECO_PLACE_CENTER_Y 0x02
 #define DECO_PLACE_CENTER_Z 0x04
+#define DECO_USE_NOISE      0x08
 
-extern FlagDesc flagdesc_deco_schematic[];
+extern FlagDesc flagdesc_deco[];
 
 
 #if 0
@@ -57,15 +58,18 @@ struct CutoffData {
 };
 #endif
 
-class Decoration : public GenElement {
+class Decoration : public GenElement, public NodeResolver {
 public:
        INodeDefManager *ndef;
 
+       u32 flags;
        int mapseed;
        std::vector<content_t> c_place_on;
        s16 sidelen;
+       s16 y_min;
+       s16 y_max;
        float fill_ratio;
-       NoiseParams *np;
+       NoiseParams np;
 
        std::set<u8> biomes;
        //std::list<CutoffData> cutoffs;
@@ -74,6 +78,8 @@ public:
        Decoration();
        virtual ~Decoration();
 
+       virtual void resolveNodeNames(NodeResolveInfo *nri);
+
        size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
        size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
 
@@ -89,7 +95,7 @@ public:
        s16 deco_height_max;
        s16 nspawnby;
 
-       ~DecoSimple() {}
+       virtual void resolveNodeNames(NodeResolveInfo *nri);
 
        bool canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p);
        virtual size_t generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p);
@@ -98,13 +104,10 @@ public:
 
 class DecoSchematic : public Decoration {
 public:
-       u32 flags;
        Rotation rotation;
        Schematic *schematic;
        std::string filename;
 
-       ~DecoSchematic() {}
-
        virtual size_t generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p);
        virtual int getHeight();
 };
@@ -122,7 +125,7 @@ public:
        static const char *ELEMENT_TITLE;
        static const size_t ELEMENT_LIMIT = 0x10000;
 
-       DecorationManager(IGameDef *gamedef) {}
+       DecorationManager(IGameDef *gamedef);
        ~DecorationManager() {}
 
        Decoration *create(int type)
@@ -139,6 +142,8 @@ public:
                }
        }
 
+       void clear();
+
        size_t placeAllDecos(Mapgen *mg, u32 seed, v3s16 nmin, v3s16 nmax);
 };