aboutsummaryrefslogtreecommitdiff
path: root/src/cavegen.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2016-05-10 13:21:13 -0400
committerkwolekr <kwolekr@minetest.net>2016-05-27 23:23:58 -0400
commita605d690921670008d605d067f1cf8cd1619def7 (patch)
tree6835d2a737063077be5022775248c10c990566a0 /src/cavegen.h
parentbf25837617541eee0317e1231abca65233edeb8e (diff)
downloadminetest-a605d690921670008d605d067f1cf8cd1619def7.tar.gz
minetest-a605d690921670008d605d067f1cf8cd1619def7.tar.bz2
minetest-a605d690921670008d605d067f1cf8cd1619def7.zip
Cavegen: Remove CavesV6 dependency on Mapgen
Diffstat (limited to 'src/cavegen.h')
-rw-r--r--src/cavegen.h43
1 files changed, 29 insertions, 14 deletions
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);
};