]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mapgen_singlenode.cpp
Translated using Weblate (Czech)
[dragonfireclient.git] / src / mapgen_singlenode.cpp
index 04bf02bd1c37fbe5ceb5cbdf5702c920e5a22b62..fd443995c6ef50a0c9040f484260ff82a5266baa 100644 (file)
@@ -25,8 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "nodedef.h"
 #include "voxelalgorithms.h"
 #include "profiler.h"
-#include "settings.h" // For g_settings
-#include "main.h" // For g_profiler
 #include "emerge.h"
 
 //////////////////////// Mapgen Singlenode parameter read/write
@@ -42,6 +40,7 @@ void MapgenSinglenodeParams::writeParams(Settings *settings) {
 ///////////////////////////////////////////////////////////////////////////////
 
 MapgenSinglenode::MapgenSinglenode(int mapgenid, MapgenSinglenodeParams *params) {
+       flags = params->flags;
 }
 
 
@@ -72,20 +71,28 @@ void MapgenSinglenode::makeChunk(BlockMakeData *data) {
        v3s16 node_max = (blockpos_max+v3s16(1,1,1))*MAP_BLOCKSIZE-v3s16(1,1,1);
 
        content_t c_node = ndef->getId("mapgen_singlenode");
-       if(c_node == CONTENT_IGNORE)
+       if (c_node == CONTENT_IGNORE)
                c_node = CONTENT_AIR;
-       for(s16 z=node_min.Z; z<=node_max.Z; z++)
-       for(s16 y=node_min.Y; y<=node_max.Y; y++)
-       for(s16 x=node_min.X; x<=node_max.X; x++)
-       {
-               data->vmanip->setNode(v3s16(x,y,z), MapNode(c_node));
+       
+       MapNode n_node(c_node);
+       
+       for (s16 z = node_min.Z; z <= node_max.Z; z++)
+       for (s16 y = node_min.Y; y <= node_max.Y; y++) {
+               u32 i = vm->m_area.index(node_min.X, y, z);
+               for (s16 x = node_min.X; x <= node_max.X; x++) {
+                       if (vm->m_data[i].getContent() == CONTENT_IGNORE)
+                               vm->m_data[i] = n_node;
+                       i++;
+               }
        }
 
        // Add top and bottom side of water to transforming_liquid queue
        updateLiquid(&data->transforming_liquid, node_min, node_max);
 
        // Calculate lighting
-       calcLighting(node_min, node_max);
+       if (!(flags & MG_NOLIGHT))
+               calcLighting(node_min - v3s16(1, 0, 1) * MAP_BLOCKSIZE,
+                                        node_max + v3s16(1, 0, 1) * MAP_BLOCKSIZE);
        
        this->generating = false;
 }