diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-10-29 23:17:44 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2016-03-07 16:33:20 -0500 |
commit | f021db724301f082cbde719afb2405ec1d8cf82c (patch) | |
tree | 0d102e6a21c1f427d31b6b318338b6514a5a8fc5 /src | |
parent | 095db16990eea878ce01b29c1eb85a128f98381a (diff) | |
download | minetest-f021db724301f082cbde719afb2405ec1d8cf82c.tar.gz minetest-f021db724301f082cbde719afb2405ec1d8cf82c.tar.bz2 minetest-f021db724301f082cbde719afb2405ec1d8cf82c.zip |
Make AreaStore cache setting private
Diffstat (limited to 'src')
-rw-r--r-- | src/areastore.cpp | 6 | ||||
-rw-r--r-- | src/areastore.h | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/areastore.cpp b/src/areastore.cpp index c2cc4ce97..b1b5c0db4 100644 --- a/src/areastore.cpp +++ b/src/areastore.cpp @@ -112,14 +112,14 @@ void AreaStore::serialize(std::ostream &os) const void AreaStore::invalidateCache() { - if (cache_enabled) { + if (m_cache_enabled) { m_res_cache.invalidate(); } } void AreaStore::setCacheParams(bool enabled, u8 block_radius, size_t limit) { - cache_enabled = enabled; + m_cache_enabled = enabled; m_cacheblock_radius = MYMAX(block_radius, 16); m_res_cache.setLimit(MYMAX(limit, 20)); invalidateCache(); @@ -148,7 +148,7 @@ void AreaStore::cacheMiss(void *data, const v3s16 &mpos, std::vector<Area *> *de void AreaStore::getAreasForPos(std::vector<Area *> *result, v3s16 pos) { - if (cache_enabled) { + if (m_cache_enabled) { v3s16 mblock = getContainerPos(pos, m_cacheblock_radius); const std::vector<Area *> *pre_list = m_res_cache.lookupCache(mblock); diff --git a/src/areastore.h b/src/areastore.h index de4588706..493b4fc25 100644 --- a/src/areastore.h +++ b/src/areastore.h @@ -62,7 +62,6 @@ protected: // TODO change to unordered_map when we can std::map<u32, Area> areas_map; - bool cache_enabled; // don't write to this from subclasses, only read. public: // Updates the area's ID virtual bool insertArea(Area *a) = 0; @@ -83,10 +82,10 @@ public: {} AreaStore() : - cache_enabled(true), m_cacheblock_radius(64), m_res_cache(1000, &cacheMiss, this), - m_next_id(0) + m_next_id(0), + m_cache_enabled(true) { } @@ -103,7 +102,7 @@ private: u8 m_cacheblock_radius; // if you modify this, call invalidateCache() LRUCache<v3s16, std::vector<Area *> > m_res_cache; u32 m_next_id; - + bool m_cache_enabled; }; |