summaryrefslogtreecommitdiff
path: root/src/mapblock.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-29 00:28:48 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-03-29 00:28:48 +0300
commit02c035c548787a589c2bb813112b080a638e2972 (patch)
tree66ae02a8c29b5396bc86392e004c39ccc671b434 /src/mapblock.h
parent418041d9067319431e4b6301851da117d2f4075b (diff)
downloadminetest-02c035c548787a589c2bb813112b080a638e2972.tar.gz
minetest-02c035c548787a589c2bb813112b080a638e2972.tar.bz2
minetest-02c035c548787a589c2bb813112b080a638e2972.zip
Reduce EnvRef:set_node() time tenfold by postponing the dayNightDiff update until it is actually needed
Diffstat (limited to 'src/mapblock.h')
-rw-r--r--src/mapblock.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mapblock.h b/src/mapblock.h
index 272da8ce3..4f61d6aa7 100644
--- a/src/mapblock.h
+++ b/src/mapblock.h
@@ -360,10 +360,17 @@ public:
Sets m_day_night_differs to appropriate value.
These methods don't care about neighboring blocks.
*/
- void updateDayNightDiff();
+ void actuallyUpdateDayNightDiff();
+ /*
+ Call this to schedule what the previous function does to be done
+ when the value is actually needed.
+ */
+ void expireDayNightDiff();
- bool dayNightDiffed()
+ bool getDayNightDiff()
{
+ if(m_day_night_differs_expired)
+ actuallyUpdateDayNightDiff();
return m_day_night_differs;
}
@@ -517,6 +524,7 @@ private:
// Whether day and night lighting differs
bool m_day_night_differs;
+ bool m_day_night_differs_expired;
bool m_generated;