summaryrefslogtreecommitdiff
path: root/src/mapblock.h
diff options
context:
space:
mode:
authorLars Hofhansl <larsh@apache.org>2018-07-21 03:07:43 -0700
committerLars Hofhansl <larsh@apache.org>2018-07-21 03:09:39 -0700
commit25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac (patch)
tree87a63bc5bbee4e5908a5bf81ab2d28086957122b /src/mapblock.h
parentc022ddce4bb0da68a842c6479ecd7d9660d7c2fe (diff)
downloadminetest-25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac.tar.gz
minetest-25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac.tar.bz2
minetest-25cc5d1a3263aaca46f77f64b6cc20b1d2c32cac.zip
Optimize ABM checks.
See #7555 Cache (up to 64) node types for each active block. Check this cache first to see whether any ABM needs to be triggered for a block.
Diffstat (limited to 'src/mapblock.h')
-rw-r--r--src/mapblock.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mapblock.h b/src/mapblock.h
index 00695a94e..6b5015cab 100644
--- a/src/mapblock.h
+++ b/src/mapblock.h
@@ -114,6 +114,8 @@ public:
} else if (mod == m_modified) {
m_modified_reason |= reason;
}
+ if (mod == MOD_STATE_WRITE_NEEDED)
+ contents_cached = false;
}
inline u32 getModified()
@@ -529,6 +531,14 @@ public:
static const u32 nodecount = MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE;
+ //// ABM optimizations ////
+ // Cache of content types
+ std::unordered_set<content_t> contents;
+ // True if content types are cached
+ bool contents_cached = false;
+ // True if we never want to cache content types for this block
+ bool do_not_cache_contents = false;
+
private:
/*
Private member variables