Skip to content

Commit

Permalink
Remove unused Map::getDayNightDiff + fix one undefined variable in ma…
Browse files Browse the repository at this point in the history
…pblock.cpp
  • Loading branch information
nerzhul committed Jul 26, 2017
1 parent 3e50850 commit 9d412dd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 68 deletions.
57 changes: 0 additions & 57 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions src/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,6 @@ class Map /*: public NodeContainer*/
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; }
Expand Down
4 changes: 2 additions & 2 deletions src/mapblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void MapBlock::actuallyUpdateDayNightDiff()
return;
}

bool differs;
bool differs = false;

/*
Check if any lighting value differs
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9d412dd

Please sign in to comment.