diff options
author | rubenwardy <rw@rubenwardy.com> | 2021-01-21 19:08:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 19:08:06 +0000 |
commit | 4fcd000e20a26120349184cb9d40342b7876e6b8 (patch) | |
tree | 978429b471474d5c01c587dffc660cec659275f3 /src/mapgen/mg_ore.h | |
parent | 8ff209c4122fb83310939bf1b73f56b704a3c982 (diff) | |
download | minetest-4fcd000e20a26120349184cb9d40342b7876e6b8.tar.gz minetest-4fcd000e20a26120349184cb9d40342b7876e6b8.tar.bz2 minetest-4fcd000e20a26120349184cb9d40342b7876e6b8.zip |
MgOre: Fix invalid field polymorphism (#10846)
Diffstat (limited to 'src/mapgen/mg_ore.h')
-rw-r--r-- | src/mapgen/mg_ore.h | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/src/mapgen/mg_ore.h b/src/mapgen/mg_ore.h index 76420fab4..a58fa9bfe 100644 --- a/src/mapgen/mg_ore.h +++ b/src/mapgen/mg_ore.h @@ -52,7 +52,7 @@ extern FlagDesc flagdesc_ore[]; class Ore : public ObjDef, public NodeResolver { public: - static const bool NEEDS_NOISE = false; + const bool needs_noise; content_t c_ore; // the node to place std::vector<content_t> c_wherein; // the nodes to be placed in @@ -68,7 +68,7 @@ public: Noise *noise = nullptr; std::unordered_set<biome_t> biomes; - Ore() = default;; + explicit Ore(bool needs_noise): needs_noise(needs_noise) {} virtual ~Ore(); virtual void resolveNodeNames(); @@ -83,17 +83,17 @@ protected: class OreScatter : public Ore { public: - static const bool NEEDS_NOISE = false; + OreScatter() : Ore(false) {} ObjDef *clone() const; - virtual void generate(MMVManip *vm, int mapseed, u32 blockseed, - v3s16 nmin, v3s16 nmax, biome_t *biomemap); + void generate(MMVManip *vm, int mapseed, u32 blockseed, + v3s16 nmin, v3s16 nmax, biome_t *biomemap) override; }; class OreSheet : public Ore { public: - static const bool NEEDS_NOISE = true; + OreSheet() : Ore(true) {} ObjDef *clone() const; @@ -101,14 +101,12 @@ public: u16 column_height_max; float column_midpoint_factor; - virtual void generate(MMVManip *vm, int mapseed, u32 blockseed, - v3s16 nmin, v3s16 nmax, biome_t *biomemap); + void generate(MMVManip *vm, int mapseed, u32 blockseed, + v3s16 nmin, v3s16 nmax, biome_t *biomemap) override; }; class OrePuff : public Ore { public: - static const bool NEEDS_NOISE = true; - ObjDef *clone() const; NoiseParams np_puff_top; @@ -116,55 +114,50 @@ public: Noise *noise_puff_top = nullptr; Noise *noise_puff_bottom = nullptr; - OrePuff() = default; + OrePuff() : Ore(true) {} virtual ~OrePuff(); - virtual void generate(MMVManip *vm, int mapseed, u32 blockseed, - v3s16 nmin, v3s16 nmax, biome_t *biomemap); + void generate(MMVManip *vm, int mapseed, u32 blockseed, + v3s16 nmin, v3s16 nmax, biome_t *biomemap) override; }; class OreBlob : public Ore { public: - static const bool NEEDS_NOISE = true; - ObjDef *clone() const; - virtual void generate(MMVManip *vm, int mapseed, u32 blockseed, - v3s16 nmin, v3s16 nmax, biome_t *biomemap); + OreBlob() : Ore(true) {} + void generate(MMVManip *vm, int mapseed, u32 blockseed, + v3s16 nmin, v3s16 nmax, biome_t *biomemap) override; }; class OreVein : public Ore { public: - static const bool NEEDS_NOISE = true; - ObjDef *clone() const; float random_factor; Noise *noise2 = nullptr; int sizey_prev = 0; - OreVein() = default; + OreVein() : Ore(true) {} virtual ~OreVein(); - virtual void generate(MMVManip *vm, int mapseed, u32 blockseed, - v3s16 nmin, v3s16 nmax, biome_t *biomemap); + void generate(MMVManip *vm, int mapseed, u32 blockseed, + v3s16 nmin, v3s16 nmax, biome_t *biomemap) override; }; class OreStratum : public Ore { public: - static const bool NEEDS_NOISE = false; - ObjDef *clone() const; NoiseParams np_stratum_thickness; Noise *noise_stratum_thickness = nullptr; u16 stratum_thickness; - OreStratum() = default; + OreStratum() : Ore(false) {} virtual ~OreStratum(); - virtual void generate(MMVManip *vm, int mapseed, u32 blockseed, - v3s16 nmin, v3s16 nmax, biome_t *biomemap); + void generate(MMVManip *vm, int mapseed, u32 blockseed, + v3s16 nmin, v3s16 nmax, biome_t *biomemap) override; }; class OreManager : public ObjDefManager { |