summaryrefslogtreecommitdiff
path: root/src/mapblock.h
diff options
context:
space:
mode:
authorgregorycu <gregory.currie@gmail.com>2015-01-14 01:19:54 +1100
committerCraig Robbins <kde.psych@gmail.com>2015-01-18 20:30:33 +1000
commitdb3466dbe885f27b87ceca0a4bb115169f844a0c (patch)
tree6e93becce3183574477ef766f641dcd7e54d680f /src/mapblock.h
parent805c8e51e5dd4dfad381a0d40b4388b5de90becf (diff)
downloadminetest-db3466dbe885f27b87ceca0a4bb115169f844a0c.tar.gz
minetest-db3466dbe885f27b87ceca0a4bb115169f844a0c.tar.bz2
minetest-db3466dbe885f27b87ceca0a4bb115169f844a0c.zip
Water fixes
Change must_reflow to a deque Add overload for MapBlock::raiseModified that takes a const char*. This is a speed improvement. Comment out unused variable Optimisations to block offset calculations
Diffstat (limited to 'src/mapblock.h')
-rw-r--r--src/mapblock.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mapblock.h b/src/mapblock.h
index 76c82c083..5cf2bc801 100644
--- a/src/mapblock.h
+++ b/src/mapblock.h
@@ -166,6 +166,29 @@ public:
}
}
}
+ void raiseModified(u32 mod, const char *reason)
+ {
+ if (mod > m_modified){
+ m_modified = mod;
+ m_modified_reason = reason;
+ m_modified_reason_too_long = false;
+
+ if (m_modified >= MOD_STATE_WRITE_AT_UNLOAD){
+ m_disk_timestamp = m_timestamp;
+ }
+ }
+ else if (mod == m_modified){
+ if (!m_modified_reason_too_long){
+ if (m_modified_reason.size() < 40)
+ m_modified_reason += ", " + std::string(reason);
+ else{
+ m_modified_reason += "...";
+ m_modified_reason_too_long = true;
+ }
+ }
+ }
+ }
+
u32 getModified()
{
return m_modified;
@@ -619,6 +642,16 @@ inline s16 getNodeBlockY(s16 y)
return getContainerPos(y, MAP_BLOCKSIZE);
}
+inline void getNodeBlockPosWithOffset(const v3s16 &p, v3s16 &block, v3s16 &offset)
+{
+ getContainerPosWithOffset(p, MAP_BLOCKSIZE, block, offset);
+}
+
+inline void getNodeSectorPosWithOffset(const v2s16 &p, v2s16 &block, v2s16 &offset)
+{
+ getContainerPosWithOffset(p, MAP_BLOCKSIZE, block, offset);
+}
+
/*
Get a quick string to describe what a block actually contains
*/