1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

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.
This commit is contained in:
Lars Hofhansl 2018-07-21 03:07:43 -07:00
parent c022ddce4b
commit 25cc5d1a32
2 changed files with 50 additions and 2 deletions

View file

@ -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