Skip to content

Commit 9d412dd

Browse files
committedJul 26, 2017
Remove unused Map::getDayNightDiff + fix one undefined variable in mapblock.cpp
1 parent 3e50850 commit 9d412dd

File tree

3 files changed

+2
-68
lines changed

3 files changed

+2
-68
lines changed
 

‎src/map.cpp

-57
Original file line numberDiff line numberDiff line change
@@ -362,63 +362,6 @@ bool Map::removeNodeWithEvent(v3s16 p)
362362
return succeeded;
363363
}
364364

365-
bool Map::getDayNightDiff(v3s16 blockpos)
366-
{
367-
try{
368-
v3s16 p = blockpos + v3s16(0,0,0);
369-
MapBlock *b = getBlockNoCreate(p);
370-
if(b->getDayNightDiff())
371-
return true;
372-
}
373-
catch(InvalidPositionException &e){}
374-
// Leading edges
375-
try{
376-
v3s16 p = blockpos + v3s16(-1,0,0);
377-
MapBlock *b = getBlockNoCreate(p);
378-
if(b->getDayNightDiff())
379-
return true;
380-
}
381-
catch(InvalidPositionException &e){}
382-
try{
383-
v3s16 p = blockpos + v3s16(0,-1,0);
384-
MapBlock *b = getBlockNoCreate(p);
385-
if(b->getDayNightDiff())
386-
return true;
387-
}
388-
catch(InvalidPositionException &e){}
389-
try{
390-
v3s16 p = blockpos + v3s16(0,0,-1);
391-
MapBlock *b = getBlockNoCreate(p);
392-
if(b->getDayNightDiff())
393-
return true;
394-
}
395-
catch(InvalidPositionException &e){}
396-
// Trailing edges
397-
try{
398-
v3s16 p = blockpos + v3s16(1,0,0);
399-
MapBlock *b = getBlockNoCreate(p);
400-
if(b->getDayNightDiff())
401-
return true;
402-
}
403-
catch(InvalidPositionException &e){}
404-
try{
405-
v3s16 p = blockpos + v3s16(0,1,0);
406-
MapBlock *b = getBlockNoCreate(p);
407-
if(b->getDayNightDiff())
408-
return true;
409-
}
410-
catch(InvalidPositionException &e){}
411-
try{
412-
v3s16 p = blockpos + v3s16(0,0,1);
413-
MapBlock *b = getBlockNoCreate(p);
414-
if(b->getDayNightDiff())
415-
return true;
416-
}
417-
catch(InvalidPositionException &e){}
418-
419-
return false;
420-
}
421-
422365
struct TimeOrderedMapBlock {
423366
MapSector *sect;
424367
MapBlock *block;

‎src/map.h

-9
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,6 @@ class Map /*: public NodeContainer*/
216216
bool addNodeWithEvent(v3s16 p, MapNode n, bool remove_metadata = true);
217217
bool removeNodeWithEvent(v3s16 p);
218218

219-
/*
220-
Takes the blocks at the edges into account
221-
*/
222-
bool getDayNightDiff(v3s16 blockpos);
223-
224-
//core::aabbox3d<s16> getDisplayedBlockArea();
225-
226-
//bool updateChangedVisibleArea();
227-
228219
// Call these before and after saving of many blocks
229220
virtual void beginSave() { return; }
230221
virtual void endSave() { return; }

‎src/mapblock.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ void MapBlock::actuallyUpdateDayNightDiff()
361361
return;
362362
}
363363

364-
bool differs;
364+
bool differs = false;
365365

366366
/*
367367
Check if any lighting value differs
@@ -465,7 +465,7 @@ static void getBlockNodeIdMapping(NameIdMapping *nimap, MapNode *nodes,
465465

466466
const ContentFeatures &f = nodedef->get(global_id);
467467
const std::string &name = f.name;
468-
if(name == "")
468+
if (name.empty())
469469
unknown_contents.insert(global_id);
470470
else
471471
nimap->set(id, name);

0 commit comments

Comments
 (0)
Please sign in to comment.