Skip to content
Permalink
Browse files

MapBlock::actuallyUpdateDayNightDiff(): little performance optimization

don't check isLightDayNightEq if checked on previous node
  • Loading branch information
nerzhul committed Jul 27, 2017
1 parent c27504a commit 4eb59aeeb2f2b535f4eb2a1608189bb03098454e
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/mapblock.cpp
@@ -366,12 +366,19 @@ void MapBlock::actuallyUpdateDayNightDiff()
/*
Check if any lighting value differs
*/

MapNode previous_n;
for (u32 i = 0; i < nodecount; i++) {
MapNode &n = data[i];
MapNode n = data[i];

// If node is identical to previous node, don't verify if it differs
if (n == previous_n)
continue;

differs = !n.isLightDayNightEq(nodemgr);
if (differs)
break;
previous_n = n;
}

/*

0 comments on commit 4eb59ae

Please sign in to comment.