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

#include <SimulatorManager.h>

Collaboration diagram for cSimulatorManager:
Collaboration graph
[legend]

Public Member Functions

 cSimulatorManager (cWorld &a_World)
 
void RegisterSimulator (cSimulator *a_Simulator, int a_Rate)
 
void Simulate (float a_Dt)
 Called in each tick, a_Dt is the time passed since the last tick, in msec. More...
 
void SimulateChunk (std::chrono::milliseconds a_DT, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk)
 Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available. More...
 
void WakeUp (cChunk &a_Chunk, Vector3i a_Position)
 
void WakeUp (const cCuboid &a_Area)
 Does the same processing as WakeUp, but for all blocks within the specified area. More...
 
 ~cSimulatorManager ()
 

Protected Types

typedef std::vector< std::pair< cSimulator *, int > > cSimulators
 

Protected Attributes

cSimulators m_Simulators
 
long long m_Ticks
 
cWorldm_World
 

Detailed Description

Definition at line 28 of file SimulatorManager.h.

Member Typedef Documentation

◆ cSimulators

typedef std::vector<std::pair<cSimulator *, int> > cSimulatorManager::cSimulators
protected

Definition at line 55 of file SimulatorManager.h.

Constructor & Destructor Documentation

◆ cSimulatorManager()

cSimulatorManager::cSimulatorManager ( cWorld a_World)

Definition at line 13 of file SimulatorManager.cpp.

◆ ~cSimulatorManager()

cSimulatorManager::~cSimulatorManager ( )

Definition at line 23 of file SimulatorManager.cpp.

Member Function Documentation

◆ RegisterSimulator()

void cSimulatorManager::RegisterSimulator ( cSimulator a_Simulator,
int  a_Rate 
)

Definition at line 153 of file SimulatorManager.cpp.

◆ Simulate()

void cSimulatorManager::Simulate ( float  a_Dt)

Called in each tick, a_Dt is the time passed since the last tick, in msec.

Definition at line 31 of file SimulatorManager.cpp.

◆ SimulateChunk()

void cSimulatorManager::SimulateChunk ( std::chrono::milliseconds  a_DT,
int  a_ChunkX,
int  a_ChunkZ,
cChunk a_Chunk 
)

Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available.

Definition at line 48 of file SimulatorManager.cpp.

◆ WakeUp() [1/2]

void cSimulatorManager::WakeUp ( cChunk a_Chunk,
Vector3i  a_Position 
)

Definition at line 65 of file SimulatorManager.cpp.

◆ WakeUp() [2/2]

void cSimulatorManager::WakeUp ( const cCuboid a_Area)

Does the same processing as WakeUp, but for all blocks within the specified area.

Has better performance than calling WakeUp for each block individually, due to neighbor-checking. All chunks intersected by the area should be valid (outputs a warning if not). Note that, unlike WakeUp(), this call adds blocks not only face-neighboring, but also edge-neighboring and corner-neighboring the specified area.

Definition at line 105 of file SimulatorManager.cpp.

Member Data Documentation

◆ m_Simulators

cSimulators cSimulatorManager::m_Simulators
protected

Definition at line 58 of file SimulatorManager.h.

◆ m_Ticks

long long cSimulatorManager::m_Ticks
protected

Definition at line 59 of file SimulatorManager.h.

◆ m_World

cWorld& cSimulatorManager::m_World
protected

Definition at line 57 of file SimulatorManager.h.


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