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

#include <SetChunkData.h>

Collaboration diagram for cSetChunkData:
Collaboration graph
[legend]

Public Member Functions

bool AreBiomesValid (void) const
 Returns whether the biomes stored in this object are valid. More...
 
void CalculateHeightMap (void)
 Calculates the heightmap based on the contained blocktypes and marks it valid. More...
 
 cSetChunkData (int a_ChunkX, int a_ChunkZ, bool a_ShouldMarkDirty)
 Constructs a new instance with empty data. More...
 
 cSetChunkData (int a_ChunkX, int a_ChunkZ, const BLOCKTYPE *a_BlockTypes, const NIBBLETYPE *a_BlockMetas, const NIBBLETYPE *a_BlockLight, const NIBBLETYPE *a_SkyLight, const cChunkDef::HeightMap *a_HeightMap, const cChunkDef::BiomeMap *a_Biomes, cEntityList &&a_Entities, cBlockEntities &&a_BlockEntities, bool a_ShouldMarkDirty)
 Constructs a new instance based on data existing elsewhere, will copy all the memory. More...
 
cChunkDef::BiomeMapGetBiomes (void)
 Returns the internal storage for biomes, read-write. More...
 
cBlockEntitiesGetBlockEntities (void)
 Returns the internal storage for block entities, read-write. More...
 
cChunkDataGetChunkData (void)
 Returns the internal storage of block types, metas and lighting. More...
 
int GetChunkX (void) const
 
int GetChunkZ (void) const
 
cEntityListGetEntities (void)
 Returns the internal storage for entities, read-write. More...
 
const cChunkDef::HeightMapGetHeightMap (void) const
 Returns the internal storage for heightmap, read-only. More...
 
bool IsHeightMapValid (void) const
 Returns whether the heightmap stored in this object is valid. More...
 
bool IsLightValid (void) const
 Returns whether both light arrays stored in this object are valid. More...
 
void MarkBiomesValid (void)
 Marks the biomes stored in this object as valid. More...
 
void RemoveInvalidBlockEntities (void)
 Removes the block entities that don't have a proper blocktype at their corresponding coords. More...
 
bool ShouldMarkDirty (void) const
 Returns whether the chunk should be marked as dirty after its data is set. More...
 

Protected Attributes

bool m_AreBiomesValid
 
cChunkDef::BiomeMap m_Biomes
 
cBlockEntities m_BlockEntities
 
cChunkData m_ChunkData
 
int m_ChunkX
 
int m_ChunkZ
 
cEntityList m_Entities
 
cChunkDef::HeightMap m_HeightMap
 
bool m_IsHeightMapValid
 
bool m_IsLightValid
 
cListAllocationPool< cChunkData::sChunkSectionm_Pool
 
bool m_ShouldMarkDirty
 

Detailed Description

Definition at line 14 of file SetChunkData.h.

Constructor & Destructor Documentation

cSetChunkData::cSetChunkData ( int  a_ChunkX,
int  a_ChunkZ,
bool  a_ShouldMarkDirty 
)

Constructs a new instance with empty data.

Allocates new buffers for the block data. Prefer to use this constructor, then fill the object with data and then send it to cWorld, as this will reduce the copying required to queue the set operation.

Definition at line 26 of file SetChunkData.cpp.

cSetChunkData::cSetChunkData ( int  a_ChunkX,
int  a_ChunkZ,
const BLOCKTYPE a_BlockTypes,
const NIBBLETYPE a_BlockMetas,
const NIBBLETYPE a_BlockLight,
const NIBBLETYPE a_SkyLight,
const cChunkDef::HeightMap a_HeightMap,
const cChunkDef::BiomeMap a_Biomes,
cEntityList &&  a_Entities,
cBlockEntities &&  a_BlockEntities,
bool  a_ShouldMarkDirty 
)

Constructs a new instance based on data existing elsewhere, will copy all the memory.

Prefer to use the other constructor as much as possible. Will move the entity list and blockentities into the internal storage, and invalidate a_Entities and a_BlockEntities. When passing an lvalue, a_Entities and a_BlockEntities must be explicitly converted to an rvalue beforehand with std::move(). a_BlockTypes and a_BlockMetas must always be valid. If either of the light arrays are nullptr, the chunk data will be marked as not having any light at all and will be scheduled for re-lighting once it is set into the chunkmap. If a_Biomes is not valid, the internal flag is set and the world will calculate the biomes using the chunk generator when setting the chunk data. If a_HeightMap is not assigned, the world will calculate the heightmap based on the blocktypes when setting the chunk data.

Definition at line 42 of file SetChunkData.cpp.

Member Function Documentation

bool cSetChunkData::AreBiomesValid ( void  ) const
inline

Returns whether the biomes stored in this object are valid.

Definition at line 74 of file SetChunkData.h.

void cSetChunkData::CalculateHeightMap ( void  )

Calculates the heightmap based on the contained blocktypes and marks it valid.

Definition at line 95 of file SetChunkData.cpp.

cChunkDef::BiomeMap& cSetChunkData::GetBiomes ( void  )
inline

Returns the internal storage for biomes, read-write.

Definition at line 59 of file SetChunkData.h.

cBlockEntities& cSetChunkData::GetBlockEntities ( void  )
inline

Returns the internal storage for block entities, read-write.

Definition at line 65 of file SetChunkData.h.

cChunkData& cSetChunkData::GetChunkData ( void  )
inline

Returns the internal storage of block types, metas and lighting.

Definition at line 53 of file SetChunkData.h.

int cSetChunkData::GetChunkX ( void  ) const
inline

Definition at line 49 of file SetChunkData.h.

int cSetChunkData::GetChunkZ ( void  ) const
inline

Definition at line 50 of file SetChunkData.h.

cEntityList& cSetChunkData::GetEntities ( void  )
inline

Returns the internal storage for entities, read-write.

Definition at line 62 of file SetChunkData.h.

const cChunkDef::HeightMap& cSetChunkData::GetHeightMap ( void  ) const
inline

Returns the internal storage for heightmap, read-only.

Definition at line 56 of file SetChunkData.h.

bool cSetChunkData::IsHeightMapValid ( void  ) const
inline

Returns whether the heightmap stored in this object is valid.

Definition at line 71 of file SetChunkData.h.

bool cSetChunkData::IsLightValid ( void  ) const
inline

Returns whether both light arrays stored in this object are valid.

Definition at line 68 of file SetChunkData.h.

void cSetChunkData::MarkBiomesValid ( void  )
inline

Marks the biomes stored in this object as valid.

Definition at line 81 of file SetChunkData.h.

void cSetChunkData::RemoveInvalidBlockEntities ( void  )

Removes the block entities that don't have a proper blocktype at their corresponding coords.

Definition at line 130 of file SetChunkData.cpp.

bool cSetChunkData::ShouldMarkDirty ( void  ) const
inline

Returns whether the chunk should be marked as dirty after its data is set.

Used by the generator to save chunks after generating.

Definition at line 78 of file SetChunkData.h.

Member Data Documentation

bool cSetChunkData::m_AreBiomesValid
protected

Definition at line 102 of file SetChunkData.h.

cChunkDef::BiomeMap cSetChunkData::m_Biomes
protected

Definition at line 96 of file SetChunkData.h.

cBlockEntities cSetChunkData::m_BlockEntities
protected

Definition at line 98 of file SetChunkData.h.

cChunkData cSetChunkData::m_ChunkData
protected

Definition at line 94 of file SetChunkData.h.

int cSetChunkData::m_ChunkX
protected

Definition at line 90 of file SetChunkData.h.

int cSetChunkData::m_ChunkZ
protected

Definition at line 91 of file SetChunkData.h.

cEntityList cSetChunkData::m_Entities
protected

Definition at line 97 of file SetChunkData.h.

cChunkDef::HeightMap cSetChunkData::m_HeightMap
protected

Definition at line 95 of file SetChunkData.h.

bool cSetChunkData::m_IsHeightMapValid
protected

Definition at line 101 of file SetChunkData.h.

bool cSetChunkData::m_IsLightValid
protected

Definition at line 100 of file SetChunkData.h.

cListAllocationPool<cChunkData::sChunkSection> cSetChunkData::m_Pool
protected

Definition at line 93 of file SetChunkData.h.

bool cSetChunkData::m_ShouldMarkDirty
protected

Definition at line 103 of file SetChunkData.h.


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