From cce9ccd344bb965f94501892677df7bc607b356b Mon Sep 17 00:00:00 2001 From: darkrose Date: Fri, 30 Jun 2017 14:14:26 +1000 Subject: [PATCH] some little cleanups and tweaks --- data/textures/wildgrass_long.png | Bin 897 -> 897 bytes src/mapgen/mapgen_util.cpp | 18 +++++++++++------- src/path.c | 5 +---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/data/textures/wildgrass_long.png b/data/textures/wildgrass_long.png index 4830c0e5240afcc2d525b8ff048a1b15e2aa59a4..281c5c9dbac9c08bc6ef1e4c90ca9f80c42215eb 100644 GIT binary patch delta 21 dcmZo350{~4M2Z{gy delta 21 ccmZoa^7tIfjbYl%07a_?a{vGU diff --git a/src/mapgen/mapgen_util.cpp b/src/mapgen/mapgen_util.cpp index 6bd3220..fb6a474 100644 --- a/src/mapgen/mapgen_util.cpp +++ b/src/mapgen/mapgen_util.cpp @@ -97,20 +97,24 @@ bool is_cave(uint64_t seed, v3s16 p) // Amount of trees per area in nodes uint32_t get_tree_density(BlockMakeData *data, v2s16 p) { - double noise = noise2d_perlin( + + double zeroval = -0.39; + double density = 0.0; + double noise = 0.0; + uint32_t r = 0; + + noise = noise2d_perlin( 0.5+(float)p.X/125, 0.5+(float)p.Y/125, data->seed+2, 4, 0.66 ); - double zeroval = -0.39; - if (noise < zeroval) - return 0; - double density = 0.04 * (noise-zeroval) / (1.0-zeroval); - - uint32_t r = density*(double)(MAP_BLOCKSIZE*MAP_BLOCKSIZE); + if (noise >= zeroval) { + density = 0.04 * (noise-zeroval) / (1.0-zeroval); + r = density*(double)(MAP_BLOCKSIZE*MAP_BLOCKSIZE); + } if (data->biome == BIOME_JUNGLE || data->biome == BIOME_FOREST) { if (r < 1) { diff --git a/src/path.c b/src/path.c index 8552b56..6df1225 100644 --- a/src/path.c +++ b/src/path.c @@ -420,10 +420,7 @@ char* path_get(char* type, char* file, int must_exist, char* buff, int size) if (!path.world) return NULL; ck = path_check(path.world,"players"); - if (!ck) { - } - - if (ck != 2) + if (ck == 1 || (!ck && must_exist)) return NULL; if (file) {