Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <ChunkData.h>
Classes | |
struct | sChunkSection |
Public Member Functions | |
void | Assign (const cChunkData &a_Other) |
Copy assign from another cChunkData. More... | |
void | Assign (cChunkData &&a_Other) |
Move assign from another cChunkData. More... | |
cChunkData (cAllocationPool< sChunkSection > &a_Pool) | |
cChunkData (cChunkData &&a_Other) | |
void | Clear () |
Clears all data. More... | |
void | CopyBlockLight (NIBBLETYPE *a_Dest) const |
Copies the block light data into the specified flat array. More... | |
void | CopyBlockTypes (BLOCKTYPE *a_Dest, size_t a_Idx=0, size_t a_Length=cChunkDef::NumBlocks) const |
Copies the blocktype data into the specified flat array. More... | |
void | CopyMetas (NIBBLETYPE *a_Dest) const |
Copies the metadata into the specified flat array. More... | |
void | CopySkyLight (NIBBLETYPE *a_Dest) const |
Copies the skylight data into the specified flat array. More... | |
void | FillBlockLight (NIBBLETYPE a_Value) |
Fills the chunk with the specified block light. More... | |
void | FillBlockTypes (BLOCKTYPE a_Value) |
Fills the chunk with the specified block. More... | |
void | FillMetas (NIBBLETYPE a_Value) |
Fills the chunk with the specified meta value. More... | |
void | FillSkyLight (NIBBLETYPE a_Value) |
Fills the chunk with the specified sky light. More... | |
BLOCKTYPE | GetBlock (Vector3i a_RelPos) const |
NIBBLETYPE | GetBlockLight (Vector3i a_RelPos) const |
NIBBLETYPE | GetMeta (Vector3i a_RelPos) const |
const sChunkSection * | GetSection (size_t a_SectionNum) const |
Return a pointer to the chunk section or nullptr if all air. More... | |
UInt16 | GetSectionBitmask () const |
Returns a bitmask of chunk sections which are currently stored. More... | |
NIBBLETYPE | GetSkyLight (Vector3i a_RelPos) const |
UInt32 | NumPresentSections () const |
Returns the number of sections present (i.e. More... | |
cChunkData & | operator= (cChunkData &&a_Other) |
void | SetBlock (Vector3i a_RelPos, BLOCKTYPE a_Block) |
void | SetBlockLight (const NIBBLETYPE *a_Src) |
Copies the blocklight data from the specified flat array into the internal representation. More... | |
void | SetBlockTypes (const BLOCKTYPE *a_Src) |
Copies the blocktype data from the specified flat array into the internal representation. More... | |
bool | SetMeta (Vector3i a_RelPos, NIBBLETYPE a_Nibble) |
void | SetMetas (const NIBBLETYPE *a_Src) |
Copies the metadata from the specified flat array into the internal representation. More... | |
void | SetSkyLight (const NIBBLETYPE *a_Src) |
Copies the skylight data from the specified flat array into the internal representation. More... | |
~cChunkData () | |
Static Public Attributes | |
static const size_t | NumSections = (cChunkDef::Height / SectionHeight) |
static const size_t | SectionBlockCount = SectionHeight * cChunkDef::Width * cChunkDef::Width |
static const int | SectionHeight = 16 |
Private Member Functions | |
sChunkSection * | Allocate (void) |
Allocates a new section. More... | |
void | Free (sChunkSection *a_Section) |
Frees the specified section, previously allocated using Allocate(). More... | |
void | ZeroSection (sChunkSection *a_Section) const |
Sets the data in the specified section to their default values. More... | |
Private Attributes | |
cAllocationPool< sChunkSection > & | m_Pool |
sChunkSection * | m_Sections [NumSections] |
Definition at line 19 of file ChunkData.h.
cChunkData::cChunkData | ( | cAllocationPool< sChunkSection > & | a_Pool | ) |
Definition at line 53 of file ChunkData.cpp.
cChunkData::cChunkData | ( | cChunkData && | a_Other | ) |
Definition at line 63 of file ChunkData.cpp.
cChunkData::~cChunkData | ( | ) |
Definition at line 77 of file ChunkData.cpp.
|
private |
Allocates a new section.
Entry-point to custom allocators.
Definition at line 701 of file ChunkData.cpp.
void cChunkData::Assign | ( | const cChunkData & | a_Other | ) |
Copy assign from another cChunkData.
Definition at line 86 of file ChunkData.cpp.
void cChunkData::Assign | ( | cChunkData && | a_Other | ) |
Move assign from another cChunkData.
Definition at line 109 of file ChunkData.cpp.
void cChunkData::Clear | ( | void | ) |
Clears all data.
Definition at line 317 of file ChunkData.cpp.
void cChunkData::CopyBlockLight | ( | NIBBLETYPE * | a_Dest | ) | const |
Copies the block light data into the specified flat array.
Definition at line 385 of file ChunkData.cpp.
void cChunkData::CopyBlockTypes | ( | BLOCKTYPE * | a_Dest, |
size_t | a_Idx = 0 , |
||
size_t | a_Length = cChunkDef::NumBlocks |
||
) | const |
Copies the blocktype data into the specified flat array.
Optionally, only a part of the data is copied, as specified by the a_Idx and a_Length parameters.
Definition at line 333 of file ChunkData.cpp.
void cChunkData::CopyMetas | ( | NIBBLETYPE * | a_Dest | ) | const |
Copies the metadata into the specified flat array.
Definition at line 366 of file ChunkData.cpp.
void cChunkData::CopySkyLight | ( | NIBBLETYPE * | a_Dest | ) | const |
Copies the skylight data into the specified flat array.
Definition at line 404 of file ChunkData.cpp.
void cChunkData::FillBlockLight | ( | NIBBLETYPE | a_Value | ) |
Fills the chunk with the specified block light.
Definition at line 484 of file ChunkData.cpp.
void cChunkData::FillBlockTypes | ( | BLOCKTYPE | a_Value | ) |
Fills the chunk with the specified block.
Definition at line 423 of file ChunkData.cpp.
void cChunkData::FillMetas | ( | NIBBLETYPE | a_Value | ) |
Fills the chunk with the specified meta value.
Definition at line 453 of file ChunkData.cpp.
void cChunkData::FillSkyLight | ( | NIBBLETYPE | a_Value | ) |
Fills the chunk with the specified sky light.
Definition at line 515 of file ChunkData.cpp.
|
private |
Frees the specified section, previously allocated using Allocate().
Note that a_Section may be nullptr.
Definition at line 710 of file ChunkData.cpp.
Definition at line 136 of file ChunkData.cpp.
NIBBLETYPE cChunkData::GetBlockLight | ( | Vector3i | a_RelPos | ) | const |
Definition at line 244 of file ChunkData.cpp.
NIBBLETYPE cChunkData::GetMeta | ( | Vector3i | a_RelPos | ) | const |
Definition at line 187 of file ChunkData.cpp.
const cChunkData::sChunkSection * cChunkData::GetSection | ( | size_t | a_SectionNum | ) | const |
Return a pointer to the chunk section or nullptr if all air.
Definition at line 288 of file ChunkData.cpp.
UInt16 cChunkData::GetSectionBitmask | ( | ) | const |
Returns a bitmask of chunk sections which are currently stored.
Definition at line 302 of file ChunkData.cpp.
NIBBLETYPE cChunkData::GetSkyLight | ( | Vector3i | a_RelPos | ) | const |
Definition at line 266 of file ChunkData.cpp.
UInt32 cChunkData::NumPresentSections | ( | ) | const |
Returns the number of sections present (i.e.
non-air).
Definition at line 684 of file ChunkData.cpp.
|
inline |
Definition at line 39 of file ChunkData.h.
Definition at line 157 of file ChunkData.cpp.
void cChunkData::SetBlockLight | ( | const NIBBLETYPE * | a_Src | ) |
Copies the blocklight data from the specified flat array into the internal representation.
Allocates sectios that are needed for the operation. Allows a_Src to be nullptr, in which case it doesn't do anything.
Definition at line 612 of file ChunkData.cpp.
void cChunkData::SetBlockTypes | ( | const BLOCKTYPE * | a_Src | ) |
Copies the blocktype data from the specified flat array into the internal representation.
Allocates sections that are needed for the operation. Requires that a_Src is a valid pointer.
Definition at line 546 of file ChunkData.cpp.
bool cChunkData::SetMeta | ( | Vector3i | a_RelPos, |
NIBBLETYPE | a_Nibble | ||
) |
Definition at line 209 of file ChunkData.cpp.
void cChunkData::SetMetas | ( | const NIBBLETYPE * | a_Src | ) |
Copies the metadata from the specified flat array into the internal representation.
Allocates sectios that are needed for the operation. Requires that a_Src is a valid pointer.
Definition at line 579 of file ChunkData.cpp.
void cChunkData::SetSkyLight | ( | const NIBBLETYPE * | a_Src | ) |
Copies the skylight data from the specified flat array into the internal representation.
Allocates sectios that are needed for the operation. Allows a_Src to be nullptr, in which case it doesn't do anything.
Definition at line 648 of file ChunkData.cpp.
|
private |
Sets the data in the specified section to their default values.
Definition at line 719 of file ChunkData.cpp.
|
private |
Definition at line 122 of file ChunkData.h.
|
private |
Definition at line 120 of file ChunkData.h.
|
static |
Definition at line 24 of file ChunkData.h.
|
static |
Definition at line 25 of file ChunkData.h.
|
static |
Definition at line 23 of file ChunkData.h.