Remove unused Map::getDayNightDiff + fix one undefined variable in mapblock.cpp
authorLoic Blot <loic.blot@unix-experience.fr>
Wed, 26 Jul 2017 21:11:46 +0000 (23:11 +0200)
committerLoic Blot <loic.blot@unix-experience.fr>
Wed, 26 Jul 2017 21:11:46 +0000 (23:11 +0200)
src/map.cpp
src/map.h
src/mapblock.cpp

index d4734cdc6606272a4889a3f006fb6fa541231e04..972c666e4d6c4ce201824b033dc06140b3bdfffd 100644 (file)
@@ -362,63 +362,6 @@ bool Map::removeNodeWithEvent(v3s16 p)
        return succeeded;
 }
 
-bool Map::getDayNightDiff(v3s16 blockpos)
-{
-       try{
-               v3s16 p = blockpos + v3s16(0,0,0);
-               MapBlock *b = getBlockNoCreate(p);
-               if(b->getDayNightDiff())
-                       return true;
-       }
-       catch(InvalidPositionException &e){}
-       // Leading edges
-       try{
-               v3s16 p = blockpos + v3s16(-1,0,0);
-               MapBlock *b = getBlockNoCreate(p);
-               if(b->getDayNightDiff())
-                       return true;
-       }
-       catch(InvalidPositionException &e){}
-       try{
-               v3s16 p = blockpos + v3s16(0,-1,0);
-               MapBlock *b = getBlockNoCreate(p);
-               if(b->getDayNightDiff())
-                       return true;
-       }
-       catch(InvalidPositionException &e){}
-       try{
-               v3s16 p = blockpos + v3s16(0,0,-1);
-               MapBlock *b = getBlockNoCreate(p);
-               if(b->getDayNightDiff())
-                       return true;
-       }
-       catch(InvalidPositionException &e){}
-       // Trailing edges
-       try{
-               v3s16 p = blockpos + v3s16(1,0,0);
-               MapBlock *b = getBlockNoCreate(p);
-               if(b->getDayNightDiff())
-                       return true;
-       }
-       catch(InvalidPositionException &e){}
-       try{
-               v3s16 p = blockpos + v3s16(0,1,0);
-               MapBlock *b = getBlockNoCreate(p);
-               if(b->getDayNightDiff())
-                       return true;
-       }
-       catch(InvalidPositionException &e){}
-       try{
-               v3s16 p = blockpos + v3s16(0,0,1);
-               MapBlock *b = getBlockNoCreate(p);
-               if(b->getDayNightDiff())
-                       return true;
-       }
-       catch(InvalidPositionException &e){}
-
-       return false;
-}
-
 struct TimeOrderedMapBlock {
        MapSector *sect;
        MapBlock *block;
index 377e75ed0c9485de2f562bb9e2ffcf6cc18eb751..c3a1c1897dbc35d5594b140b888678c7aa12006b 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -216,15 +216,6 @@ public:
        bool addNodeWithEvent(v3s16 p, MapNode n, bool remove_metadata = true);
        bool removeNodeWithEvent(v3s16 p);
 
-       /*
-               Takes the blocks at the edges into account
-       */
-       bool getDayNightDiff(v3s16 blockpos);
-
-       //core::aabbox3d<s16> getDisplayedBlockArea();
-
-       //bool updateChangedVisibleArea();
-
        // Call these before and after saving of many blocks
        virtual void beginSave() { return; }
        virtual void endSave() { return; }
index ed4f096924982a3d2146ff0193793efe07522f7d..910e91316b294558c03ad2d74921c6e95f989d56 100644 (file)
@@ -361,7 +361,7 @@ void MapBlock::actuallyUpdateDayNightDiff()
                return;
        }
 
-       bool differs;
+       bool differs = false;
 
        /*
                Check if any lighting value differs
@@ -465,7 +465,7 @@ static void getBlockNodeIdMapping(NameIdMapping *nimap, MapNode *nodes,
 
                        const ContentFeatures &f = nodedef->get(global_id);
                        const std::string &name = f.name;
-                       if(name == "")
+                       if (name.empty())
                                unknown_contents.insert(global_id);
                        else
                                nimap->set(id, name);