Skip to content

Commit

Permalink
MapBlock::actuallyUpdateDayNightDiff(): little performance optimization
Browse files Browse the repository at this point in the history
don't check isLightDayNightEq if checked on previous node
  • Loading branch information
nerzhul committed Jul 27, 2017
1 parent c27504a commit 4eb59ae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/mapblock.cpp
Expand Up @@ -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;
}

/*
Expand Down

0 comments on commit 4eb59ae

Please sign in to comment.