]> git.lizzy.rs Git - minetest.git/blobdiff - src/map.cpp
Add Client::getEnv() and remove some unnecessary wrappers
[minetest.git] / src / map.cpp
index f1fbc7a1c1c8dbf1c5287dd5b96709877057f574..03a842e7425bb3ae9e4f3014ad79eb9f7f0d25ce 100644 (file)
@@ -21,23 +21,22 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapsector.h"
 #include "mapblock.h"
 #include "main.h"
-#ifndef SERVER
-#include "client.h"
-#endif
 #include "filesys.h"
 #include "utility.h"
 #include "voxel.h"
 #include "porting.h"
 #include "mapgen.h"
 #include "nodemetadata.h"
-#ifndef SERVER
-#include <IMaterialRenderer.h>
-#endif
 #include "settings.h"
 #include "log.h"
 #include "profiler.h"
 #include "nodedef.h"
 #include "gamedef.h"
+#ifndef SERVER
+#include "client.h"
+#include "mapblock_mesh.h"
+#include <IMaterialRenderer.h>
+#endif
 
 #define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
 
@@ -214,7 +213,7 @@ void Map::setNode(v3s16 p, MapNode & n)
                                <<" while trying to replace \""
                                <<m_gamedef->ndef()->get(block->getNodeNoCheck(relpos)).name
                                <<"\" at "<<PP(p)<<" (block "<<PP(blockpos)<<")"<<std::endl;
-               debug_stacks_print_to(errorstream);
+               debug_stacks_print_to(infostream);
                return;
        }
        block->setNodeNoCheck(relpos, n);
@@ -915,7 +914,7 @@ void Map::updateLighting(core::map<v3s16, MapBlock*> & a_blocks,
 /*
 */
 void Map::addNodeAndUpdate(v3s16 p, MapNode n,
-               core::map<v3s16, MapBlock*> &modified_blocks, std::string &player_name)
+               core::map<v3s16, MapBlock*> &modified_blocks)
 {
        INodeDefManager *nodemgr = m_gamedef->ndef();
 
@@ -1007,8 +1006,12 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
        std::string metadata_name = nodemgr->get(n).metadata_name;
        if(metadata_name != ""){
                NodeMetadata *meta = NodeMetadata::create(metadata_name, m_gamedef);
-               meta->setOwner(player_name);
-               setNodeMetadata(p, meta);
+               if(!meta){
+                       errorstream<<"Failed to create node metadata \""
+                                       <<metadata_name<<"\""<<std::endl;
+               } else {
+                       setNodeMetadata(p, meta);
+               }
        }
 
        /*
@@ -1286,8 +1289,7 @@ bool Map::addNodeWithEvent(v3s16 p, MapNode n)
        bool succeeded = true;
        try{
                core::map<v3s16, MapBlock*> modified_blocks;
-               std::string st = std::string("");
-               addNodeAndUpdate(p, n, modified_blocks, st);
+               addNodeAndUpdate(p, n, modified_blocks);
 
                // Copy modified_blocks to event
                for(core::map<v3s16, MapBlock*>::Iterator
@@ -1678,7 +1680,9 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
                                        if (nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing) != liquid_kind) {
                                                neutrals[num_neutrals++] = nb;
                                        } else {
-                                               sources[num_sources++] = nb;
+                                               // Do not count bottom source, it will screw things up
+                                               if(dirs[i].Y != -1)
+                                                       sources[num_sources++] = nb;
                                        }
                                        break;
                                case LIQUID_FLOWING:
@@ -1911,7 +1915,7 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef):
        m_database_read(NULL),
        m_database_write(NULL)
 {
-       infostream<<__FUNCTION_NAME<<std::endl;
+       verbosestream<<__FUNCTION_NAME<<std::endl;
 
        //m_chunksize = 8; // Takes a few seconds
 
@@ -1949,7 +1953,7 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef):
                        // If directory is empty, it is safe to save into it.
                        if(fs::GetDirListing(m_savedir).size() == 0)
                        {
-                               infostream<<"Server: Empty save directory is valid."
+                               infostream<<"ServerMap: Empty save directory is valid."
                                                <<std::endl;
                                m_map_saving_enabled = true;
                        }
@@ -1966,25 +1970,10 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef):
                                        //m_chunksize = 0;
                                }
 
-                               /*try{
-                                       // Load chunk metadata
-                                       loadChunkMeta();
-                               }
-                               catch(FileNotGoodException &e){
-                                       infostream<<"WARNING: Could not load chunk metadata."
-                                                       <<" Disabling chunk-based generator."
-                                                       <<std::endl;
-                                       m_chunksize = 0;
-                               }*/
-
-                               /*infostream<<"Server: Successfully loaded chunk "
-                                               "metadata and sector (0,0) from "<<savedir<<
-                                               ", assuming valid save directory."
-                                               <<std::endl;*/
-
-                               infostream<<"Server: Successfully loaded map "
-                                               <<"and chunk metadata from "<<savedir
+                               infostream<<"ServerMap: Successfully loaded map "
+                                               <<"metadata from "<<savedir
                                                <<", assuming valid save directory."
+                                               <<" seed="<<m_seed<<"."
                                                <<std::endl;
 
                                m_map_saving_enabled = true;
@@ -1999,7 +1988,7 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef):
        }
        catch(std::exception &e)
        {
-               infostream<<"WARNING: Server: Failed to load map from "<<savedir
+               infostream<<"WARNING: ServerMap: Failed to load map from "<<savedir
                                <<", exception: "<<e.what()<<std::endl;
                infostream<<"Please remove the map or fix it."<<std::endl;
                infostream<<"WARNING: Map saving will be disabled."<<std::endl;
@@ -2011,29 +2000,29 @@ ServerMap::ServerMap(std::string savedir, IGameDef *gamedef):
        emergeSector(v2s16(0,0));
 
        // Initially write whole map
-       save(false);
+       save(MOD_STATE_CLEAN);
 }
 
 ServerMap::~ServerMap()
 {
-       infostream<<__FUNCTION_NAME<<std::endl;
+       verbosestream<<__FUNCTION_NAME<<std::endl;
 
        try
        {
                if(m_map_saving_enabled)
                {
                        // Save only changed parts
-                       save(true);
-                       infostream<<"Server: saved map to "<<m_savedir<<std::endl;
+                       save(MOD_STATE_WRITE_AT_UNLOAD);
+                       infostream<<"ServerMap: Saved map to "<<m_savedir<<std::endl;
                }
                else
                {
-                       infostream<<"Server: map not saved"<<std::endl;
+                       infostream<<"ServerMap: Map not saved"<<std::endl;
                }
        }
        catch(std::exception &e)
        {
-               infostream<<"Server: Failed to save map to "<<m_savedir
+               infostream<<"ServerMap: Failed to save map to "<<m_savedir
                                <<", exception: "<<e.what()<<std::endl;
        }
 
@@ -2324,7 +2313,7 @@ MapBlock* ServerMap::finishBlockMake(mapgen::BlockMakeData *data,
                Save changed parts of map
                NOTE: Will be saved later.
        */
-       //save(true);
+       //save(MOD_STATE_WRITE_AT_UNLOAD);
 
        /*infostream<<"finishBlockMake() done for ("<<blockpos.X<<","<<blockpos.Y<<","
                        <<blockpos.Z<<")"<<std::endl;*/
@@ -2688,7 +2677,7 @@ void ServerMap::createDatabase() {
        if(e == SQLITE_ABORT)
                throw FileNotGoodException("Could not create database structure");
        else
-               infostream<<"Server: Database structure was created";
+               infostream<<"ServerMap: Database structure was created";
 }
 
 void ServerMap::verifyDatabase() {
@@ -2736,7 +2725,7 @@ void ServerMap::verifyDatabase() {
                        throw FileNotGoodException("Cannot prepare read statement");
                }
                
-               infostream<<"Server: Database opened"<<std::endl;
+               infostream<<"ServerMap: Database opened"<<std::endl;
        }
 }
 
@@ -2832,7 +2821,7 @@ std::string ServerMap::getBlockFilename(v3s16 p)
        return cc;
 }
 
-void ServerMap::save(bool only_changed)
+void ServerMap::save(ModifiedState save_level)
 {
        DSTACK(__FUNCTION_NAME);
        if(m_map_saving_enabled == false)
@@ -2841,11 +2830,11 @@ void ServerMap::save(bool only_changed)
                return;
        }
        
-       if(only_changed == false)
+       if(save_level == MOD_STATE_CLEAN)
                infostream<<"ServerMap: Saving whole map, this can take time."
                                <<std::endl;
        
-       if(only_changed == false || m_map_metadata_changed)
+       if(m_map_metadata_changed || save_level == MOD_STATE_CLEAN)
        {
                saveMapMeta();
        }
@@ -2866,7 +2855,7 @@ void ServerMap::save(bool only_changed)
                ServerMapSector *sector = (ServerMapSector*)i.getNode()->getValue();
                assert(sector->getId() == MAPSECTOR_SERVER);
        
-               if(sector->differs_from_disk || only_changed == false)
+               if(sector->differs_from_disk || save_level == MOD_STATE_CLEAN)
                {
                        saveSectorMeta(sector);
                        sector_meta_count++;
@@ -2881,8 +2870,7 @@ void ServerMap::save(bool only_changed)
                        
                        block_count_all++;
 
-                       if(block->getModified() >= MOD_STATE_WRITE_NEEDED 
-                                       || only_changed == false)
+                       if(block->getModified() >= save_level)
                        {
                                // Lazy beginSave()
                                if(!save_started){
@@ -2909,7 +2897,7 @@ void ServerMap::save(bool only_changed)
        /*
                Only print if something happened or saved whole map
        */
-       if(only_changed == false || sector_meta_count != 0
+       if(save_level == MOD_STATE_CLEAN || sector_meta_count != 0
                        || block_count != 0)
        {
                infostream<<"ServerMap: Written: "
@@ -2973,9 +2961,9 @@ void ServerMap::saveMapMeta()
 {
        DSTACK(__FUNCTION_NAME);
        
-       infostream<<"ServerMap::saveMapMeta(): "
+       /*infostream<<"ServerMap::saveMapMeta(): "
                        <<"seed="<<m_seed
-                       <<std::endl;
+                       <<std::endl;*/
 
        createDirs(m_savedir);
        
@@ -3002,8 +2990,8 @@ void ServerMap::loadMapMeta()
 {
        DSTACK(__FUNCTION_NAME);
        
-       infostream<<"ServerMap::loadMapMeta(): Loading map metadata"
-                       <<std::endl;
+       /*infostream<<"ServerMap::loadMapMeta(): Loading map metadata"
+                       <<std::endl;*/
 
        std::string fullpath = m_savedir + DIR_DELIM + "map_meta.txt";
        std::ifstream is(fullpath.c_str(), std::ios_base::binary);
@@ -3031,7 +3019,7 @@ void ServerMap::loadMapMeta()
 
        m_seed = params.getU64("seed");
 
-       infostream<<"ServerMap::loadMapMeta(): "<<"seed="<<m_seed<<std::endl;
+       verbosestream<<"ServerMap::loadMapMeta(): "<<"seed="<<m_seed<<std::endl;
 }
 
 void ServerMap::saveSectorMeta(ServerMapSector *sector)
@@ -3265,10 +3253,7 @@ void ServerMap::saveBlock(MapBlock *block)
        o.write((char*)&version, 1);
        
        // Write basic data
-       block->serialize(o, version);
-       
-       // Write extra data stored on disk
-       block->serializeDiskExtra(o, version);
+       block->serialize(o, version, true);
        
        // Write block to database
        
@@ -3330,11 +3315,8 @@ void ServerMap::loadBlock(std::string sectordir, std::string blockfile, MapSecto
                }
                
                // Read basic data
-               block->deSerialize(is, version);
+               block->deSerialize(is, version, true);
 
-               // Read extra data stored on disk
-               block->deSerializeDiskExtra(is, version);
-               
                // If it's a new block, insert it to the map
                if(created_new)
                        sector->insertBlock(block);
@@ -3400,10 +3382,7 @@ void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool
                }
                
                // Read basic data
-               block->deSerialize(is, version);
-
-               // Read extra data stored on disk
-               block->deSerializeDiskExtra(is, version);
+               block->deSerialize(is, version, true);
                
                // If it's a new block, insert it to the map
                if(created_new)
@@ -3696,7 +3675,12 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
        */
        int time1 = time(0);
 
-       //u32 daynight_ratio = m_client->getDayNightRatio();
+       /*
+               Get animation parameters
+       */
+       float animation_time = m_client->getAnimationTime();
+       int crack = m_client->getCrackLevel();
+       u32 daynight_ratio = m_client->getDayNightRatio();
 
        m_camera_mutex.Lock();
        v3f camera_position = m_camera_position;
@@ -3729,8 +3713,9 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
        u32 vertex_count = 0;
        u32 meshbuffer_count = 0;
        
-       // For limiting number of mesh updates per frame
-       u32 mesh_update_count = 0;
+       // For limiting number of mesh animations per frame
+       u32 mesh_animate_count = 0;
+       u32 mesh_animate_count_far = 0;
        
        // Number of blocks in rendering range
        u32 blocks_in_range = 0;
@@ -3811,57 +3796,18 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
 
                        blocks_in_range++;
                        
-#if 1
                        /*
-                               Update expired mesh (used for day/night change)
-
-                               It doesn't work exactly like it should now with the
-                               tasked mesh update but whatever.
+                               Ignore if mesh doesn't exist
                        */
-
-                       bool mesh_expired = false;
-                       
                        {
-                               JMutexAutoLock lock(block->mesh_mutex);
-
-                               mesh_expired = block->getMeshExpired();
+                               //JMutexAutoLock lock(block->mesh_mutex);
 
-                               // Mesh has not been expired and there is no mesh:
-                               // block has no content
-                               if(block->mesh == NULL && mesh_expired == false){
+                               if(block->mesh == NULL){
                                        blocks_in_range_without_mesh++;
                                        continue;
                                }
                        }
 
-                       f32 faraway = BS*50;
-                       //f32 faraway = m_control.wanted_range * BS;
-                       
-                       /*
-                               This has to be done with the mesh_mutex unlocked
-                       */
-                       // Pretty random but this should work somewhat nicely
-                       if(mesh_expired && (
-                                       (mesh_update_count < 3
-                                               && (d < faraway || mesh_update_count < 2)
-                                       )
-                                       || 
-                                       (m_control.range_all && mesh_update_count < 20)
-                               )
-                       )
-                       /*if(mesh_expired && mesh_update_count < 6
-                                       && (d < faraway || mesh_update_count < 3))*/
-                       {
-                               mesh_update_count++;
-
-                               // Mesh has been expired: generate new mesh
-                               //block->updateMesh(daynight_ratio);
-                               m_client->addUpdateMeshTask(block->getPos());
-
-                               mesh_expired = false;
-                       }
-#endif
-
                        /*
                                Occlusion culling
                        */
@@ -3903,27 +3849,40 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                        // This block is in range. Reset usage timer.
                        block->resetUsageTimer();
 
-                       /*
-                               Ignore if mesh doesn't exist
-                       */
-                       {
-                               JMutexAutoLock lock(block->mesh_mutex);
-
-                               scene::SMesh *mesh = block->mesh;
-                               
-                               if(mesh == NULL){
-                                       blocks_in_range_without_mesh++;
-                                       continue;
-                               }
-                       }
-                       
                        // Limit block count in case of a sudden increase
                        blocks_would_have_drawn++;
                        if(blocks_drawn >= m_control.wanted_max_blocks
                                        && m_control.range_all == false
                                        && d > m_control.wanted_min_range * BS)
                                continue;
-                       
+
+                       // Mesh animation
+                       {
+                               //JMutexAutoLock lock(block->mesh_mutex);
+                               MapBlockMesh *mapBlockMesh = block->mesh;
+                               // Pretty random but this should work somewhat nicely
+                               bool faraway = d >= BS*50;
+                               //bool faraway = d >= m_control.wanted_range * BS;
+                               if(mapBlockMesh->isAnimationForced() ||
+                                               !faraway ||
+                                               mesh_animate_count_far < (m_control.range_all ? 200 : 50))
+                               {
+                                       bool animated = mapBlockMesh->animate(
+                                                       faraway,
+                                                       animation_time,
+                                                       crack,
+                                                       daynight_ratio);
+                                       if(animated)
+                                               mesh_animate_count++;
+                                       if(animated && faraway)
+                                               mesh_animate_count_far++;
+                               }
+                               else
+                               {
+                                       mapBlockMesh->decreaseAnimationForceTimer();
+                               }
+                       }
+
                        // Add to set
                        drawset[block->getPos()] = block;
                        
@@ -3971,11 +3930,14 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                        Draw the faces of the block
                */
                {
-                       JMutexAutoLock lock(block->mesh_mutex);
+                       //JMutexAutoLock lock(block->mesh_mutex);
+
+                       MapBlockMesh *mapBlockMesh = block->mesh;
+                       assert(mapBlockMesh);
 
-                       scene::SMesh *mesh = block->mesh;
+                       scene::SMesh *mesh = mapBlockMesh->getMesh();
                        assert(mesh);
-                       
+
                        u32 c = mesh->getMeshBufferCount();
                        bool stuff_actually_drawn = false;
                        for(u32 i=0; i<c; i++)
@@ -4019,6 +3981,8 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                        g_profiler->avg("CM: blocks in range without mesh (frac)",
                                        (float)blocks_in_range_without_mesh/blocks_in_range);
                g_profiler->avg("CM: blocks drawn", blocks_drawn);
+               g_profiler->avg("CM: animated meshes", mesh_animate_count);
+               g_profiler->avg("CM: animated meshes (far)", mesh_animate_count_far);
        }
        
        g_profiler->avg(prefix+"vertices drawn", vertex_count);
@@ -4067,205 +4031,6 @@ void ClientMap::renderPostFx()
        }
 }
 
-bool ClientMap::setTempMod(v3s16 p, NodeMod mod,
-               core::map<v3s16, MapBlock*> *affected_blocks)
-{
-       bool changed = false;
-       /*
-               Add it to all blocks touching it
-       */
-       v3s16 dirs[7] = {
-               v3s16(0,0,0), // this
-               v3s16(0,0,1), // back
-               v3s16(0,1,0), // top
-               v3s16(1,0,0), // right
-               v3s16(0,0,-1), // front
-               v3s16(0,-1,0), // bottom
-               v3s16(-1,0,0), // left
-       };
-       for(u16 i=0; i<7; i++)
-       {
-               v3s16 p2 = p + dirs[i];
-               // Block position of neighbor (or requested) node
-               v3s16 blockpos = getNodeBlockPos(p2);
-               MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
-               if(blockref == NULL)
-                       continue;
-               // Relative position of requested node
-               v3s16 relpos = p - blockpos*MAP_BLOCKSIZE;
-               if(blockref->setTempMod(relpos, mod))
-               {
-                       changed = true;
-               }
-       }
-       if(changed && affected_blocks!=NULL)
-       {
-               for(u16 i=0; i<7; i++)
-               {
-                       v3s16 p2 = p + dirs[i];
-                       // Block position of neighbor (or requested) node
-                       v3s16 blockpos = getNodeBlockPos(p2);
-                       MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
-                       if(blockref == NULL)
-                               continue;
-                       affected_blocks->insert(blockpos, blockref);
-               }
-       }
-       return changed;
-}
-
-bool ClientMap::clearTempMod(v3s16 p,
-               core::map<v3s16, MapBlock*> *affected_blocks)
-{
-       bool changed = false;
-       v3s16 dirs[7] = {
-               v3s16(0,0,0), // this
-               v3s16(0,0,1), // back
-               v3s16(0,1,0), // top
-               v3s16(1,0,0), // right
-               v3s16(0,0,-1), // front
-               v3s16(0,-1,0), // bottom
-               v3s16(-1,0,0), // left
-       };
-       for(u16 i=0; i<7; i++)
-       {
-               v3s16 p2 = p + dirs[i];
-               // Block position of neighbor (or requested) node
-               v3s16 blockpos = getNodeBlockPos(p2);
-               MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
-               if(blockref == NULL)
-                       continue;
-               // Relative position of requested node
-               v3s16 relpos = p - blockpos*MAP_BLOCKSIZE;
-               if(blockref->clearTempMod(relpos))
-               {
-                       changed = true;
-               }
-       }
-       if(changed && affected_blocks!=NULL)
-       {
-               for(u16 i=0; i<7; i++)
-               {
-                       v3s16 p2 = p + dirs[i];
-                       // Block position of neighbor (or requested) node
-                       v3s16 blockpos = getNodeBlockPos(p2);
-                       MapBlock * blockref = getBlockNoCreateNoEx(blockpos);
-                       if(blockref == NULL)
-                               continue;
-                       affected_blocks->insert(blockpos, blockref);
-               }
-       }
-       return changed;
-}
-
-void ClientMap::expireMeshes(bool only_daynight_diffed)
-{
-       TimeTaker timer("expireMeshes()");
-
-       core::map<v2s16, MapSector*>::Iterator si;
-       si = m_sectors.getIterator();
-       for(; si.atEnd() == false; si++)
-       {
-               MapSector *sector = si.getNode()->getValue();
-
-               core::list< MapBlock * > sectorblocks;
-               sector->getBlocks(sectorblocks);
-               
-               core::list< MapBlock * >::Iterator i;
-               for(i=sectorblocks.begin(); i!=sectorblocks.end(); i++)
-               {
-                       MapBlock *block = *i;
-
-                       if(only_daynight_diffed && dayNightDiffed(block->getPos()) == false)
-                       {
-                               continue;
-                       }
-                       
-                       {
-                               JMutexAutoLock lock(block->mesh_mutex);
-                               if(block->mesh != NULL)
-                               {
-                                       /*block->mesh->drop();
-                                       block->mesh = NULL;*/
-                                       block->setMeshExpired(true);
-                               }
-                       }
-               }
-       }
-}
-
-void ClientMap::updateMeshes(v3s16 blockpos, u32 daynight_ratio)
-{
-       assert(mapType() == MAPTYPE_CLIENT);
-
-       try{
-               v3s16 p = blockpos + v3s16(0,0,0);
-               MapBlock *b = getBlockNoCreate(p);
-               b->updateMesh(daynight_ratio);
-               //b->setMeshExpired(true);
-       }
-       catch(InvalidPositionException &e){}
-       // Leading edge
-       try{
-               v3s16 p = blockpos + v3s16(-1,0,0);
-               MapBlock *b = getBlockNoCreate(p);
-               b->updateMesh(daynight_ratio);
-               //b->setMeshExpired(true);
-       }
-       catch(InvalidPositionException &e){}
-       try{
-               v3s16 p = blockpos + v3s16(0,-1,0);
-               MapBlock *b = getBlockNoCreate(p);
-               b->updateMesh(daynight_ratio);
-               //b->setMeshExpired(true);
-       }
-       catch(InvalidPositionException &e){}
-       try{
-               v3s16 p = blockpos + v3s16(0,0,-1);
-               MapBlock *b = getBlockNoCreate(p);
-               b->updateMesh(daynight_ratio);
-               //b->setMeshExpired(true);
-       }
-       catch(InvalidPositionException &e){}
-}
-
-#if 0
-/*
-       Update mesh of block in which the node is, and if the node is at the
-       leading edge, update the appropriate leading blocks too.
-*/
-void ClientMap::updateNodeMeshes(v3s16 nodepos, u32 daynight_ratio)
-{
-       v3s16 dirs[4] = {
-               v3s16(0,0,0),
-               v3s16(-1,0,0),
-               v3s16(0,-1,0),
-               v3s16(0,0,-1),
-       };
-       v3s16 blockposes[4];
-       for(u32 i=0; i<4; i++)
-       {
-               v3s16 np = nodepos + dirs[i];
-               blockposes[i] = getNodeBlockPos(np);
-               // Don't update mesh of block if it has been done already
-               bool already_updated = false;
-               for(u32 j=0; j<i; j++)
-               {
-                       if(blockposes[j] == blockposes[i])
-                       {
-                               already_updated = true;
-                               break;
-                       }
-               }
-               if(already_updated)
-                       continue;
-               // Update mesh
-               MapBlock *b = getBlockNoCreate(blockposes[i]);
-               b->updateMesh(daynight_ratio);
-       }
-}
-#endif
-
 void ClientMap::PrintInfo(std::ostream &out)
 {
        out<<"ClientMap: ";