summaryrefslogtreecommitdiff
path: root/src/mapblock.h
diff options
context:
space:
mode:
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
*/