From a605d690921670008d605d067f1cf8cd1619def7 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Tue, 10 May 2016 13:21:13 -0400 Subject: Cavegen: Remove CavesV6 dependency on Mapgen --- src/cavegen.h | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'src/cavegen.h') diff --git a/src/cavegen.h b/src/cavegen.h index b50455c1c..74cd0b416 100644 --- a/src/cavegen.h +++ b/src/cavegen.h @@ -23,13 +23,14 @@ with this program; if not, write to the Free Software Foundation, Inc., #define VMANIP_FLAG_CAVE VOXELFLAG_CHECKED1 #define DEFAULT_LAVA_DEPTH (-256) -class MapgenV6; +class GenerateNotifier; class CavesRandomWalk { public: Mapgen *mg; MMVManip *vm; INodeDefManager *ndef; + s16 *heightmap; // variables int lava_depth; @@ -64,7 +65,7 @@ public: content_t c_ice; int water_level; - int ystride; + u16 ystride; CavesRandomWalk(Mapgen *mg, PseudoRandom *ps); void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height); @@ -87,9 +88,18 @@ public: */ class CavesV6 { public: - MapgenV6 *mg; MMVManip *vm; INodeDefManager *ndef; + GenerateNotifier *gennotify; + PseudoRandom *ps; + PseudoRandom *ps2; + + s16 *heightmap; + content_t c_water_source; + content_t c_lava_source; + int water_level; + + u16 ystride; s16 min_tunnel_diameter; s16 max_tunnel_diameter; @@ -100,7 +110,6 @@ public: bool large_cave; bool large_cave_is_flat; - s16 max_stone_y; v3s16 node_min; v3s16 node_max; @@ -113,16 +122,22 @@ public: s16 route_y_min; s16 route_y_max; - PseudoRandom *ps; - PseudoRandom *ps2; - - content_t c_water_source; - content_t c_lava_source; - - int water_level; - - CavesV6(MapgenV6 *mg, PseudoRandom *ps, PseudoRandom *ps2, bool large_cave); - void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height); + // ndef is a mandatory parameter. + // If gennotify is NULL, generation events are not logged. + CavesV6(INodeDefManager *ndef, + GenerateNotifier *gennotify = NULL, + int water_level = 1, + content_t water_source = CONTENT_IGNORE, + content_t lava_source = CONTENT_IGNORE); + + // vm, ps, and ps2 are mandatory parameters. + // If heightmap is NULL, the surface level at all points is assumed to + // be water_level. + void makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax, + PseudoRandom *ps, PseudoRandom *ps2, + bool is_large_cave, int max_stone_height, s16 *heightmap = NULL); + +private: void makeTunnel(bool dirswitch); void carveRoute(v3f vec, float f, bool randomize_xz, bool tunnel_above_ground); }; -- cgit v1.2.3