diff options
author | kwolekr <kwolekr@minetest.net> | 2014-12-10 00:37:09 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2014-12-10 00:37:09 -0500 |
commit | fb2bc956b18bd70a47bff00d5726d4754867856a (patch) | |
tree | 1e8cb37de5f6b4db15cedec2e1b036e807710c06 /src/mg_ore.cpp | |
parent | 88c28414f4a88c8d66f9cadb150896f9e25527ae (diff) | |
download | minetest-fb2bc956b18bd70a47bff00d5726d4754867856a.tar.gz minetest-fb2bc956b18bd70a47bff00d5726d4754867856a.tar.bz2 minetest-fb2bc956b18bd70a47bff00d5726d4754867856a.zip |
Noise: Create a deep copy of NoiseParams
Diffstat (limited to 'src/mg_ore.cpp')
-rw-r--r-- | src/mg_ore.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/mg_ore.cpp b/src/mg_ore.cpp index 80e86130a..1aac59ddb 100644 --- a/src/mg_ore.cpp +++ b/src/mg_ore.cpp @@ -56,19 +56,6 @@ size_t OreManager::placeAllOres(Mapgen *mg, u32 seed, v3s16 nmin, v3s16 nmax) /////////////////////////////////////////////////////////////////////////////// -Ore::Ore() -{ - c_ore = CONTENT_IGNORE; - np = NULL; - noise = NULL; -} - -Ore::~Ore() -{ - delete np; - delete noise; -} - size_t Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { @@ -117,7 +104,8 @@ void OreScatter::generate(ManualMapVoxelManipulator *vm, int seed, int y0 = pr.range(nmin.Y, nmax.Y - csize + 1); int z0 = pr.range(nmin.Z, nmax.Z - csize + 1); - if (np && (NoisePerlin3D(np, x0, y0, z0, seed) < nthresh)) + if ((flags & OREFLAG_USE_NOISE) && + (NoisePerlin3D(&np, x0, y0, z0, seed) < nthresh)) continue; for (int z1 = 0; z1 != csize; z1++) @@ -148,7 +136,7 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed, if (!noise) { int sx = nmax.X - nmin.X + 1; int sz = nmax.Z - nmin.Z + 1; - noise = new Noise(np, 0, sx, sz); + noise = new Noise(&np, seed, sx, sz); } noise->seed = seed + y_start; noise->perlinMap2D(nmin.X, nmin.Z); @@ -161,7 +149,7 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed, continue; int height = max_height * (1. / pr.range(1, 3)); - int y0 = y_start + np->scale * noiseval; //pr.range(1, 3) - 1; + int y0 = y_start + np.scale * noiseval; //pr.range(1, 3) - 1; int y1 = y0 + height; for (int y = y0; y != y1; y++) { u32 i = vm->m_area.index(x, y, z); |