]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/map.cpp
Merge remote-tracking branch 'origin/master'
[dragonfireclient.git] / src / map.cpp
index 39f5e30fbef8e32de3b3cc5076e9b3dc162c29bd..43502253b14121b2aa3fb12e9f5e9af64f221cdb 100644 (file)
@@ -288,10 +288,10 @@ void Map::unspreadLight(enum LightBank bank,
                        continue;
 
                // Calculate relative position in block
-               v3s16 relpos = pos - blockpos_last * MAP_BLOCKSIZE;
+               //v3s16 relpos = pos - blockpos_last * MAP_BLOCKSIZE;
 
                // Get node straight from the block
-               MapNode n = block->getNode(relpos);
+               //MapNode n = block->getNode(relpos);
 
                u8 oldlight = j->second;
 
@@ -937,7 +937,7 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
        */
 
        v3s16 toppos = p + v3s16(0,1,0);
-       v3s16 bottompos = p + v3s16(0,-1,0);
+       //v3s16 bottompos = p + v3s16(0,-1,0);
 
        bool node_under_sunlight = true;
        std::set<v3s16> light_sources;
@@ -1246,7 +1246,7 @@ void Map::removeNodeAndUpdate(v3s16 p,
                // Get the brightest neighbour node and propagate light from it
                v3s16 n2p = getBrightestNeighbour(bank, p);
                try{
-                       MapNode n2 = getNode(n2p);
+                       //MapNode n2 = getNode(n2p);
                        lightNeighbors(bank, n2p, modified_blocks);
                }
                catch(InvalidPositionException &e)
@@ -1755,7 +1755,7 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
                }
 
                //relax up
-               if (relax && p0.Y <= water_level && liquid_levels[D_TOP] == 0 &&
+               if (relax && ((p0.Y == water_level) || (fast_flood && p0.Y <= water_level)) && liquid_levels[D_TOP] == 0 &&
                        liquid_levels[D_BOTTOM] == LIQUID_LEVEL_SOURCE &&
                        total_level >= LIQUID_LEVEL_SOURCE * can_liquid_same_level-
                        (can_liquid_same_level - relax) &&
@@ -1763,9 +1763,9 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
                        total_level = LIQUID_LEVEL_SOURCE * can_liquid_same_level; 
                }
 
-               // prevent lakes in air under unloaded blocks
-               if (p0.Y > water_level && neighbors[D_BOTTOM].n.getContent() == CONTENT_IGNORE) {
-                       total_level = 0;
+               // prevent lakes in air above unloaded blocks
+               if (liquid_levels[D_TOP] == 0 && (p0.Y > water_level || !fast_flood) && neighbors[D_BOTTOM].n.getContent() == CONTENT_IGNORE) {
+                       --total_level;
                }
 
                // calculate self level 5 blocks
@@ -2494,6 +2494,8 @@ ServerMap::~ServerMap()
                delete chunk;
        }
 #endif
+
+       delete m_mgparams;
 }
 
 bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
@@ -2829,7 +2831,7 @@ ServerMapSector * ServerMap::createSector(v2s16 p2d)
        sector = new ServerMapSector(this, p2d, m_gamedef);
 
        // Sector position on map in nodes
-       v2s16 nodepos2d = p2d * MAP_BLOCKSIZE;
+       //v2s16 nodepos2d = p2d * MAP_BLOCKSIZE;
 
        /*
                Insert to container
@@ -3466,8 +3468,16 @@ void ServerMap::loadMapMeta()
                        break;
                params.parseConfigLine(line);
        }
-
-       MapgenParams *mgparams = m_emerge->getParamsFromSettings(&params);
+       
+       MapgenParams *mgparams;
+       try {
+               mgparams = m_emerge->getParamsFromSettings(&params);
+       } catch (SettingNotFoundException &e) {
+               infostream << "Couldn't get a setting from map_meta.txt: "
+                                  << e.what() << std::endl;
+               mgparams = NULL;
+       }
+       
        if (mgparams) {
                if (m_mgparams)
                        delete m_mgparams;