summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDayBr3ak <benj.groeneveld@gmail.com>2014-09-01 21:37:36 +0200
committerDayBr3ak <benj.groeneveld@gmail.com>2014-09-01 21:37:36 +0200
commit7695471ff9423c14d9e7188a85a270b368760402 (patch)
tree150e74f9db880a54ef2913ac206a619f8c01ee56
parentFixed Bindings regeneration under MSVC. (diff)
downloadcuberite-7695471ff9423c14d9e7188a85a270b368760402.tar
cuberite-7695471ff9423c14d9e7188a85a270b368760402.tar.gz
cuberite-7695471ff9423c14d9e7188a85a270b368760402.tar.bz2
cuberite-7695471ff9423c14d9e7188a85a270b368760402.tar.lz
cuberite-7695471ff9423c14d9e7188a85a270b368760402.tar.xz
cuberite-7695471ff9423c14d9e7188a85a270b368760402.tar.zst
cuberite-7695471ff9423c14d9e7188a85a270b368760402.zip
-rw-r--r--src/Generating/BioGen.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Generating/BioGen.h b/src/Generating/BioGen.h
index 227ec97d7..a53d8bca2 100644
--- a/src/Generating/BioGen.h
+++ b/src/Generating/BioGen.h
@@ -77,7 +77,42 @@ protected:
} ;
+class cBioGenMulticache :
+ public cBiomeGen
+{
+
+ typedef cBiomeGen super;
+
+public:
+ cBioGenMulticache(cBiomeGen * a_BioGenToCache, int a_CacheSize, int a_CacheLength); // Doesn't take ownership of a_BioGenToCache
+ ~cBioGenMulticache();
+
+protected:
+
+ cBiomeGen * m_BioGenToCache;
+ struct sCacheData
+ {
+ int m_ChunkX;
+ int m_ChunkZ;
+ cChunkDef::BiomeMap m_BiomeMap;
+ };
+
+ // To avoid moving large amounts of data for the MRU behavior, we MRU-ize indices to an array of the actual data
+ int m_CacheSize;
+ int m_CacheLength;
+
+ int **m_CachesOrder; // MRU-ized order, indices into the multiple m_CachesData array
+ sCacheData ** m_CachesData;
+
+ // Cache statistics
+ int m_NumHits;
+ int m_NumMisses;
+ int m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
+
+ virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
+};
/// Base class for generators that use a list of available biomes. This class takes care of the list.