diff options
Diffstat (limited to 'src/mapgen')
-rw-r--r-- | src/mapgen/cavegen.cpp | 8 | ||||
-rw-r--r-- | src/mapgen/cavegen.h | 30 | ||||
-rw-r--r-- | src/mapgen/dungeongen.cpp | 2 | ||||
-rw-r--r-- | src/mapgen/dungeongen.h | 6 | ||||
-rw-r--r-- | src/mapgen/mapgen.h | 4 | ||||
-rw-r--r-- | src/mapgen/mapgen_singlenode.cpp | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_v6.cpp | 2 | ||||
-rw-r--r-- | src/mapgen/mg_schematic.cpp | 6 | ||||
-rw-r--r-- | src/mapgen/mg_schematic.h | 9 | ||||
-rw-r--r-- | src/mapgen/treegen.cpp | 14 | ||||
-rw-r--r-- | src/mapgen/treegen.h | 16 |
11 files changed, 51 insertions, 48 deletions
diff --git a/src/mapgen/cavegen.cpp b/src/mapgen/cavegen.cpp index 185c39fb0..cfaaab9df 100644 --- a/src/mapgen/cavegen.cpp +++ b/src/mapgen/cavegen.cpp @@ -36,7 +36,7 @@ static NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0 //// CavesNoiseIntersection::CavesNoiseIntersection( - INodeDefManager *nodedef, BiomeManager *biomemgr, v3s16 chunksize, + const NodeDefManager *nodedef, BiomeManager *biomemgr, v3s16 chunksize, NoiseParams *np_cave1, NoiseParams *np_cave2, s32 seed, float cave_width) { assert(nodedef); @@ -174,7 +174,7 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm, //// CavernsNoise::CavernsNoise( - INodeDefManager *nodedef, v3s16 chunksize, NoiseParams *np_cavern, + const NodeDefManager *nodedef, v3s16 chunksize, NoiseParams *np_cavern, s32 seed, float cavern_limit, float cavern_taper, float cavern_threshold) { assert(nodedef); @@ -272,7 +272,7 @@ bool CavernsNoise::generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax) //// CavesRandomWalk::CavesRandomWalk( - INodeDefManager *ndef, + const NodeDefManager *ndef, GenerateNotifier *gennotify, s32 seed, int water_level, @@ -585,7 +585,7 @@ inline bool CavesRandomWalk::isPosAboveSurface(v3s16 p) //// CavesV6 //// -CavesV6::CavesV6(INodeDefManager *ndef, GenerateNotifier *gennotify, +CavesV6::CavesV6(const NodeDefManager *ndef, GenerateNotifier *gennotify, int water_level, content_t water_source, content_t lava_source) { assert(ndef); diff --git a/src/mapgen/cavegen.h b/src/mapgen/cavegen.h index f691a4b8f..871ef3bcf 100644 --- a/src/mapgen/cavegen.h +++ b/src/mapgen/cavegen.h @@ -39,15 +39,15 @@ class GenerateNotifier; class CavesNoiseIntersection { public: - CavesNoiseIntersection(INodeDefManager *nodedef, BiomeManager *biomemgr, - v3s16 chunksize, NoiseParams *np_cave1, NoiseParams *np_cave2, - s32 seed, float cave_width); + CavesNoiseIntersection(const NodeDefManager *nodedef, + BiomeManager *biomemgr, v3s16 chunksize, NoiseParams *np_cave1, + NoiseParams *np_cave2, s32 seed, float cave_width); ~CavesNoiseIntersection(); void generateCaves(MMVManip *vm, v3s16 nmin, v3s16 nmax, u8 *biomemap); private: - INodeDefManager *m_ndef; + const NodeDefManager *m_ndef; BiomeManager *m_bmgr; // configurable parameters @@ -68,15 +68,15 @@ private: class CavernsNoise { public: - CavernsNoise(INodeDefManager *nodedef, v3s16 chunksize, NoiseParams *np_cavern, - s32 seed, float cavern_limit, float cavern_taper, - float cavern_threshold); + CavernsNoise(const NodeDefManager *nodedef, v3s16 chunksize, + NoiseParams *np_cavern, s32 seed, float cavern_limit, + float cavern_taper, float cavern_threshold); ~CavernsNoise(); bool generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax); private: - INodeDefManager *m_ndef; + const NodeDefManager *m_ndef; // configurable parameters v3s16 m_csize; @@ -111,7 +111,7 @@ class CavesRandomWalk { public: MMVManip *vm; - INodeDefManager *ndef; + const NodeDefManager *ndef; GenerateNotifier *gennotify; s16 *heightmap; @@ -153,10 +153,10 @@ public: // ndef is a mandatory parameter. // If gennotify is NULL, generation events are not logged. - CavesRandomWalk(INodeDefManager *ndef, GenerateNotifier *gennotify = NULL, - s32 seed = 0, int water_level = 1, - content_t water_source = CONTENT_IGNORE, - content_t lava_source = CONTENT_IGNORE, int lava_depth = -256); + CavesRandomWalk(const NodeDefManager *ndef, GenerateNotifier *gennotify = + NULL, s32 seed = 0, int water_level = 1, content_t water_source = + CONTENT_IGNORE, content_t lava_source = CONTENT_IGNORE, + int lava_depth = -256); // vm and ps are mandatory parameters. // If heightmap is NULL, the surface level at all points is assumed to @@ -188,7 +188,7 @@ class CavesV6 { public: MMVManip *vm; - INodeDefManager *ndef; + const NodeDefManager *ndef; GenerateNotifier *gennotify; PseudoRandom *ps; PseudoRandom *ps2; @@ -224,7 +224,7 @@ public: // ndef is a mandatory parameter. // If gennotify is NULL, generation events are not logged. - CavesV6(INodeDefManager *ndef, GenerateNotifier *gennotify = NULL, + CavesV6(const NodeDefManager *ndef, GenerateNotifier *gennotify = NULL, int water_level = 1, content_t water_source = CONTENT_IGNORE, content_t lava_source = CONTENT_IGNORE); diff --git a/src/mapgen/dungeongen.cpp b/src/mapgen/dungeongen.cpp index 9c7abd954..634139a27 100644 --- a/src/mapgen/dungeongen.cpp +++ b/src/mapgen/dungeongen.cpp @@ -37,7 +37,7 @@ NoiseParams nparams_dungeon_alt_wall(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, /////////////////////////////////////////////////////////////////////////////// -DungeonGen::DungeonGen(INodeDefManager *ndef, +DungeonGen::DungeonGen(const NodeDefManager *ndef, GenerateNotifier *gennotify, DungeonParams *dparams) { assert(ndef); diff --git a/src/mapgen/dungeongen.h b/src/mapgen/dungeongen.h index e72516de1..182581447 100644 --- a/src/mapgen/dungeongen.h +++ b/src/mapgen/dungeongen.h @@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., VMANIP_FLAG_DUNGEON_INSIDE|VMANIP_FLAG_DUNGEON_PRESERVE) class MMVManip; -class INodeDefManager; +class NodeDefManager; v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs); v3s16 turn_xz(v3s16 olddir, int t); @@ -69,7 +69,7 @@ struct DungeonParams { class DungeonGen { public: MMVManip *vm; - INodeDefManager *ndef; + const NodeDefManager *ndef; GenerateNotifier *gennotify; u32 blockseed; @@ -83,7 +83,7 @@ public: v3s16 m_pos; v3s16 m_dir; - DungeonGen(INodeDefManager *ndef, + DungeonGen(const NodeDefManager *ndef, GenerateNotifier *gennotify, DungeonParams *dparams); void generate(MMVManip *vm, u32 bseed, diff --git a/src/mapgen/mapgen.h b/src/mapgen/mapgen.h index e58d4d892..f97eabf82 100644 --- a/src/mapgen/mapgen.h +++ b/src/mapgen/mapgen.h @@ -41,7 +41,7 @@ typedef u8 biome_t; // copy from mg_biome.h to avoid an unnecessary include class Settings; class MMVManip; -class INodeDefManager; +class NodeDefManager; extern FlagDesc flagdesc_mapgen[]; extern FlagDesc flagdesc_gennotify[]; @@ -170,7 +170,7 @@ public: int id = -1; MMVManip *vm = nullptr; - INodeDefManager *ndef = nullptr; + const NodeDefManager *ndef = nullptr; u32 blockseed; s16 *heightmap = nullptr; diff --git a/src/mapgen/mapgen_singlenode.cpp b/src/mapgen/mapgen_singlenode.cpp index d837ee208..a4cde7ece 100644 --- a/src/mapgen/mapgen_singlenode.cpp +++ b/src/mapgen/mapgen_singlenode.cpp @@ -35,7 +35,7 @@ MapgenSinglenode::MapgenSinglenode(int mapgenid, { flags = params->flags; - INodeDefManager *ndef = emerge->ndef; + const NodeDefManager *ndef = emerge->ndef; c_node = ndef->getId("mapgen_singlenode"); if (c_node == CONTENT_IGNORE) diff --git a/src/mapgen/mapgen_v6.cpp b/src/mapgen/mapgen_v6.cpp index 182c87c95..9a638bb53 100644 --- a/src/mapgen/mapgen_v6.cpp +++ b/src/mapgen/mapgen_v6.cpp @@ -85,7 +85,7 @@ MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge) csize.X + 2 * MAP_BLOCKSIZE, csize.Y + 2 * MAP_BLOCKSIZE); //// Resolve nodes to be used - INodeDefManager *ndef = emerge->ndef; + const NodeDefManager *ndef = emerge->ndef; c_stone = ndef->getId("mapgen_stone"); c_dirt = ndef->getId("mapgen_dirt"); diff --git a/src/mapgen/mg_schematic.cpp b/src/mapgen/mg_schematic.cpp index aa3472699..fc77194ac 100644 --- a/src/mapgen/mg_schematic.cpp +++ b/src/mapgen/mg_schematic.cpp @@ -427,7 +427,7 @@ bool Schematic::serializeToLua(std::ostream *os, bool Schematic::loadSchematicFromFile(const std::string &filename, - INodeDefManager *ndef, StringMap *replace_names) + const NodeDefManager *ndef, StringMap *replace_names) { std::ifstream is(filename.c_str(), std::ios_base::binary); if (!is.good()) { @@ -461,7 +461,7 @@ bool Schematic::loadSchematicFromFile(const std::string &filename, bool Schematic::saveSchematicToFile(const std::string &filename, - INodeDefManager *ndef) + const NodeDefManager *ndef) { MapNode *orig_schemdata = schemdata; std::vector<std::string> ndef_nodenames; @@ -554,7 +554,7 @@ void Schematic::applyProbabilities(v3s16 p0, void generate_nodelist_and_update_ids(MapNode *nodes, size_t nodecount, - std::vector<std::string> *usednodes, INodeDefManager *ndef) + std::vector<std::string> *usednodes, const NodeDefManager *ndef) { std::unordered_map<content_t, content_t> nodeidmap; content_t numids = 0; diff --git a/src/mapgen/mg_schematic.h b/src/mapgen/mg_schematic.h index 236656f47..371b37557 100644 --- a/src/mapgen/mg_schematic.h +++ b/src/mapgen/mg_schematic.h @@ -97,9 +97,10 @@ public: virtual void resolveNodeNames(); - bool loadSchematicFromFile(const std::string &filename, INodeDefManager *ndef, - StringMap *replace_names=NULL); - bool saveSchematicToFile(const std::string &filename, INodeDefManager *ndef); + bool loadSchematicFromFile(const std::string &filename, + const NodeDefManager *ndef, StringMap *replace_names = NULL); + bool saveSchematicToFile(const std::string &filename, + const NodeDefManager *ndef); bool getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2); bool deserializeFromMts(std::istream *is, std::vector<std::string> *names); @@ -144,4 +145,4 @@ private: }; void generate_nodelist_and_update_ids(MapNode *nodes, size_t nodecount, - std::vector<std::string> *usednodes, INodeDefManager *ndef); + std::vector<std::string> *usednodes, const NodeDefManager *ndef); diff --git a/src/mapgen/treegen.cpp b/src/mapgen/treegen.cpp index 238bebec2..4c351fcef 100644 --- a/src/mapgen/treegen.cpp +++ b/src/mapgen/treegen.cpp @@ -33,8 +33,8 @@ with this program; if not, write to the Free Software Foundation, Inc., namespace treegen { -void make_tree(MMVManip &vmanip, v3s16 p0, - bool is_apple_tree, INodeDefManager *ndef, s32 seed) +void make_tree(MMVManip &vmanip, v3s16 p0, bool is_apple_tree, + const NodeDefManager *ndef, s32 seed) { /* NOTE: Tree-placing code is currently duplicated in the engine @@ -115,7 +115,7 @@ void make_tree(MMVManip &vmanip, v3s16 p0, // L-System tree LUA spawner treegen::error spawn_ltree(ServerEnvironment *env, v3s16 p0, - INodeDefManager *ndef, const TreeDef &tree_definition) + const NodeDefManager *ndef, const TreeDef &tree_definition) { ServerMap *map = &env->getServerMap(); std::map<v3s16, MapBlock*> modified_blocks; @@ -142,7 +142,7 @@ treegen::error spawn_ltree(ServerEnvironment *env, v3s16 p0, //L-System tree generator treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, - INodeDefManager *ndef, TreeDef tree_definition) + const NodeDefManager *ndef, TreeDef tree_definition) { MapNode dirtnode(ndef->getId("mapgen_dirt")); s32 seed; @@ -648,7 +648,8 @@ v3f transposeMatrix(irr::core::matrix4 M, v3f v) } -void make_jungletree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed) +void make_jungletree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, + s32 seed) { /* NOTE: Tree-placing code is currently duplicated in the engine @@ -747,7 +748,8 @@ void make_jungletree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed } -void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed) +void make_pine_tree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, + s32 seed) { /* NOTE: Tree-placing code is currently duplicated in the engine diff --git a/src/mapgen/treegen.h b/src/mapgen/treegen.h index 46db910e2..5ab79f428 100644 --- a/src/mapgen/treegen.h +++ b/src/mapgen/treegen.h @@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "noise.h" class MMVManip; -class INodeDefManager; +class NodeDefManager; class ServerEnvironment; @@ -61,20 +61,20 @@ namespace treegen { // Add default tree void make_tree(MMVManip &vmanip, v3s16 p0, - bool is_apple_tree, INodeDefManager *ndef, s32 seed); + bool is_apple_tree, const NodeDefManager *ndef, s32 seed); // Add jungle tree void make_jungletree(MMVManip &vmanip, v3s16 p0, - INodeDefManager *ndef, s32 seed); + const NodeDefManager *ndef, s32 seed); // Add pine tree void make_pine_tree(MMVManip &vmanip, v3s16 p0, - INodeDefManager *ndef, s32 seed); + const NodeDefManager *ndef, s32 seed); // Add L-Systems tree (used by engine) - treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, - TreeDef tree_definition); + treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, + const NodeDefManager *ndef, TreeDef tree_definition); // Spawn L-systems tree from LUA - treegen::error spawn_ltree (ServerEnvironment *env, v3s16 p0, INodeDefManager *ndef, - const TreeDef &tree_definition); + treegen::error spawn_ltree (ServerEnvironment *env, v3s16 p0, + const NodeDefManager *ndef, const TreeDef &tree_definition); // L-System tree gen helper functions void tree_node_placement(MMVManip &vmanip, v3f p0, |