diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-07-26 23:50:53 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-07-27 07:56:48 +0200 |
commit | 4eb59aeeb2f2b535f4eb2a1608189bb03098454e (patch) | |
tree | 2610b979865d6f64dcc0c2e37e1fb1376f1ac692 | |
parent | c27504a322ad3dcc1ff483b416df265148486710 (diff) | |
download | minetest-4eb59aeeb2f2b535f4eb2a1608189bb03098454e.tar.gz minetest-4eb59aeeb2f2b535f4eb2a1608189bb03098454e.tar.bz2 minetest-4eb59aeeb2f2b535f4eb2a1608189bb03098454e.zip |
MapBlock::actuallyUpdateDayNightDiff(): little performance optimization
don't check isLightDayNightEq if checked on previous node
-rw-r--r-- | src/mapblock.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mapblock.cpp b/src/mapblock.cpp index f52a5ee3f..d94955a3b 100644 --- a/src/mapblock.cpp +++ b/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; } /* |