]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mapgen.cpp
Prevent world creation if the world already exists
[dragonfireclient.git] / src / mapgen.cpp
index 34ac3a0173f5dc672138cbf31480817e23c8978b..67e92f4498bca02d0f458a64cb818e7b498fa760 100644 (file)
@@ -3,16 +3,16 @@ Minetest-c55
 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
@@ -1297,7 +1297,9 @@ BiomeType get_biome(u64 seed, v2s16 p2d)
        double d = noise2d_perlin(
                        0.6+(float)p2d.X/250, 0.2+(float)p2d.Y/250,
                        seed+9130, 3, 0.50);
-       if(d > 0.35)
+       if(d > 0.45) 
+               return BT_DESERT;
+       if(d > 0.35 && (noise2d( p2d.X, p2d.Y, int(seed) ) + 1.0) > ( 0.45 - d ) * 20.0  ) 
                return BT_DESERT;
        return BT_NORMAL;
 };
@@ -1759,8 +1761,9 @@ void make_block(BlockMakeData *data)
                                                                        vmanip.m_data[i] = airnode;
                                                                }
                                                        } else {
-                                                               // Don't replace air or water or lava
-                                                               if(vmanip.m_data[i].getContent() == CONTENT_AIR ||
+                                                               // Don't replace air or water or lava or ignore
+                                                               if(vmanip.m_data[i].getContent() == CONTENT_IGNORE ||
+                                                               vmanip.m_data[i].getContent() == CONTENT_AIR ||
                                                                vmanip.m_data[i].getContent() == c_water_source ||
                                                                vmanip.m_data[i].getContent() == c_lava_source)
                                                                        continue;
@@ -2059,13 +2062,14 @@ void make_block(BlockMakeData *data)
                                
                                bool old_is_water = (n->getContent() == c_water_source);
                                // Move mud to new place
-                               if(!dropped_to_unknown)
+                               if(!dropped_to_unknown) {
                                        *n2 = *n;
-                               // Set old place to be air (or water)
-                               if(old_is_water)
-                                       *n = MapNode(c_water_source);
-                               else
-                                       *n = MapNode(CONTENT_AIR);
+                                       // Set old place to be air (or water)
+                                       if(old_is_water)
+                                               *n = MapNode(c_water_source);
+                                       else
+                                               *n = MapNode(CONTENT_AIR);
+                               }
 
                                // Done
                                break;
@@ -2512,19 +2516,7 @@ void make_block(BlockMakeData *data)
                                                {
                                                        if(have_sand)
                                                        {
-                                                               // Determine whether to have clay in the sand here
-                                                               double claynoise = noise2d_perlin(
-                                                                               0.5+(float)p2d.X/500, 0.5+(float)p2d.Y/500,
-                                                                               data->seed+4321, 6, 0.95) + 0.5;
-                               
-                                                               have_clay = (y <= WATER_LEVEL) && (y >= WATER_LEVEL-2) && (
-                                                                       ((claynoise > 0) && (claynoise < 0.04) && (current_depth == 0)) ||
-                                                                       ((claynoise > 0) && (claynoise < 0.12) && (current_depth == 1))
-                                                                       );
-                                                               if (have_clay)
-                                                                       vmanip.m_data[i] = MapNode(c_clay);
-                                                               else
-                                                                       vmanip.m_data[i] = MapNode(c_sand);
+                                                               vmanip.m_data[i] = MapNode(c_sand);
                                                        }
                                                        #if 1
                                                        else if(current_depth==0 && !water_detected