Cuberite
A lightweight, fast and extensible game server for Minecraft
Classes | Public Member Functions | Protected Attributes | List of all members
cCompoGenCache Class Reference

Caches most-recently-used chunk composition of another composition generator. More...

#include <CompoGen.h>

Inheritance diagram for cCompoGenCache:
Inheritance graph
[legend]
Collaboration diagram for cCompoGenCache:
Collaboration graph
[legend]

Classes

struct  sCacheData
 

Public Member Functions

 cCompoGenCache (std::unique_ptr< cTerrainCompositionGen > a_Underlying, int a_CacheSize)
 
virtual void ComposeTerrain (cChunkDesc &a_ChunkDesc, const cChunkDesc::Shape &a_Shape) override
 Generates the chunk's composition into a_ChunkDesc, using the terrain shape provided in a_Shape. More...
 
virtual void InitializeCompoGen (cIniFile &a_IniFile) override
 Reads parameters from the ini file, prepares generator for use. More...
 
virtual ~cCompoGenCache () override
 
- Public Member Functions inherited from cTerrainCompositionGen
virtual ~cTerrainCompositionGen ()
 

Protected Attributes

sCacheDatam_CacheData
 
int * m_CacheOrder
 
int m_CacheSize
 
int m_NumHits
 
int m_NumMisses
 
int m_TotalChain
 
std::unique_ptr< cTerrainCompositionGenm_Underlying
 

Additional Inherited Members

- Static Public Member Functions inherited from cTerrainCompositionGen
static std::unique_ptr< cTerrainCompositionGenCreateCompositionGen (cIniFile &a_IniFile, cBiomeGen &a_BiomeGen, cTerrainShapeGen &a_ShapeGen, int a_Seed)
 Creates the correct TerrainCompositionGen descendant based on the ini file settings and the seed provided. More...
 

Detailed Description

Caches most-recently-used chunk composition of another composition generator.

Caches only the types and metas

Definition at line 114 of file CompoGen.h.

Constructor & Destructor Documentation

◆ cCompoGenCache()

cCompoGenCache::cCompoGenCache ( std::unique_ptr< cTerrainCompositionGen a_Underlying,
int  a_CacheSize 
)

Definition at line 332 of file CompoGen.cpp.

◆ ~cCompoGenCache()

cCompoGenCache::~cCompoGenCache ( )
overridevirtual

Definition at line 353 of file CompoGen.cpp.

Member Function Documentation

◆ ComposeTerrain()

void cCompoGenCache::ComposeTerrain ( cChunkDesc a_ChunkDesc,
const cChunkDesc::Shape a_Shape 
)
overridevirtual

Generates the chunk's composition into a_ChunkDesc, using the terrain shape provided in a_Shape.

Is expected to fill a_ChunkDesc's heightmap with the data from a_Shape.

Implements cTerrainCompositionGen.

Definition at line 365 of file CompoGen.cpp.

◆ InitializeCompoGen()

void cCompoGenCache::InitializeCompoGen ( cIniFile a_IniFile)
overridevirtual

Reads parameters from the ini file, prepares generator for use.

Reimplemented from cTerrainCompositionGen.

Definition at line 429 of file CompoGen.cpp.

Member Data Documentation

◆ m_CacheData

sCacheData* cCompoGenCache::m_CacheData
protected

Definition at line 141 of file CompoGen.h.

◆ m_CacheOrder

int* cCompoGenCache::m_CacheOrder
protected

Definition at line 140 of file CompoGen.h.

◆ m_CacheSize

int cCompoGenCache::m_CacheSize
protected

Definition at line 139 of file CompoGen.h.

◆ m_NumHits

int cCompoGenCache::m_NumHits
protected

Definition at line 144 of file CompoGen.h.

◆ m_NumMisses

int cCompoGenCache::m_NumMisses
protected

Definition at line 145 of file CompoGen.h.

◆ m_TotalChain

int cCompoGenCache::m_TotalChain
protected

Definition at line 146 of file CompoGen.h.

◆ m_Underlying

std::unique_ptr<cTerrainCompositionGen> cCompoGenCache::m_Underlying
protected

Definition at line 127 of file CompoGen.h.


The documentation for this class was generated from the following files: