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

Generates and lights the spawn area of the world. More...

#include <SpawnPrepare.h>

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

Classes

struct  sMakeSharedTag
 Private tag allows public constructors that can only be used with private access. More...
 

Public Member Functions

 cSpawnPrepare (cWorld &a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance, int a_FirstIdx, sMakeSharedTag)
 

Static Public Member Functions

static void PrepareChunks (cWorld &a_World, int a_SpawnChunkX, int a_SpawnChunkZ, int a_PrepareDistance)
 

Protected Member Functions

void DecodeChunkCoords (int a_Idx, int &a_ChunkX, int &a_ChunkZ)
 Decodes the index into chunk coords. More...
 
void PreparedChunkCallback (int a_ChunkX, int a_ChunkZ)
 

Protected Attributes

cEvent m_EvtFinished
 Event used to signal that the preparation is finished. More...
 
int m_LastReportChunkCount
 Number of chunks prepared when the last progress report was emitted. More...
 
std::chrono::steady_clock::time_point m_LastReportTime
 The timestamp of the last progress report emitted. More...
 
int m_MaxIdx
 The maximum index of the prepared chunks. More...
 
int m_NextIdx
 The index of the next chunk to be queued in the lighting thread. More...
 
std::atomic< int > m_NumPrepared
 Total number of chunks already finished preparing. More...
 
int m_PrepareDistance
 
int m_SpawnChunkX
 
int m_SpawnChunkZ
 
cWorldm_World
 

Friends

class cSpawnPrepareCallback
 

Detailed Description

Generates and lights the spawn area of the world.

Runs as a separate thread.

Definition at line 9 of file SpawnPrepare.h.

Constructor & Destructor Documentation

◆ cSpawnPrepare()

cSpawnPrepare::cSpawnPrepare ( cWorld a_World,
int  a_SpawnChunkX,
int  a_SpawnChunkZ,
int  a_PrepareDistance,
int  a_FirstIdx,
sMakeSharedTag   
)

Definition at line 34 of file SpawnPrepare.cpp.

Member Function Documentation

◆ DecodeChunkCoords()

void cSpawnPrepare::DecodeChunkCoords ( int  a_Idx,
int &  a_ChunkX,
int &  a_ChunkZ 
)
protected

Decodes the index into chunk coords.

Provides the specific chunk ordering.

Definition at line 76 of file SpawnPrepare.cpp.

◆ PrepareChunks()

void cSpawnPrepare::PrepareChunks ( cWorld a_World,
int  a_SpawnChunkX,
int  a_SpawnChunkZ,
int  a_PrepareDistance 
)
static

Definition at line 51 of file SpawnPrepare.cpp.

◆ PreparedChunkCallback()

void cSpawnPrepare::PreparedChunkCallback ( int  a_ChunkX,
int  a_ChunkZ 
)
protected

Definition at line 94 of file SpawnPrepare.cpp.

Friends And Related Function Documentation

◆ cSpawnPrepareCallback

friend class cSpawnPrepareCallback
friend

Definition at line 49 of file SpawnPrepare.h.

Member Data Documentation

◆ m_EvtFinished

cEvent cSpawnPrepare::m_EvtFinished
protected

Event used to signal that the preparation is finished.

Definition at line 36 of file SpawnPrepare.h.

◆ m_LastReportChunkCount

int cSpawnPrepare::m_LastReportChunkCount
protected

Number of chunks prepared when the last progress report was emitted.

Definition at line 42 of file SpawnPrepare.h.

◆ m_LastReportTime

std::chrono::steady_clock::time_point cSpawnPrepare::m_LastReportTime
protected

The timestamp of the last progress report emitted.

Definition at line 39 of file SpawnPrepare.h.

◆ m_MaxIdx

int cSpawnPrepare::m_MaxIdx
protected

The maximum index of the prepared chunks.

Queueing stops when m_NextIdx reaches this number.

Definition at line 30 of file SpawnPrepare.h.

◆ m_NextIdx

int cSpawnPrepare::m_NextIdx
protected

The index of the next chunk to be queued in the lighting thread.

Definition at line 27 of file SpawnPrepare.h.

◆ m_NumPrepared

std::atomic<int> cSpawnPrepare::m_NumPrepared
protected

Total number of chunks already finished preparing.

Preparation finishes when this number reaches m_MaxIdx.

Definition at line 33 of file SpawnPrepare.h.

◆ m_PrepareDistance

int cSpawnPrepare::m_PrepareDistance
protected

Definition at line 24 of file SpawnPrepare.h.

◆ m_SpawnChunkX

int cSpawnPrepare::m_SpawnChunkX
protected

Definition at line 22 of file SpawnPrepare.h.

◆ m_SpawnChunkZ

int cSpawnPrepare::m_SpawnChunkZ
protected

Definition at line 23 of file SpawnPrepare.h.

◆ m_World

cWorld& cSpawnPrepare::m_World
protected

Definition at line 21 of file SpawnPrepare.h.


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