Cuberite
A lightweight, fast and extensible game server for Minecraft
SimulatorManager.h
Go to the documentation of this file.
1 
2 // cSimulatorManager.h
3 
4 
5 
6 
7 #pragma once
8 
9 
10 
11 
12 #include "Simulator.h"
13 
14 
15 
16 
17 
18 // fwd: Chunk.h
19 class cChunk;
20 
21 // fwd: World.h
22 class cWorld;
23 
24 
25 
26 
27 
29 {
30 public:
31 
32  cSimulatorManager(cWorld & a_World);
34 
36  void Simulate(float a_Dt);
37 
39  void SimulateChunk(std::chrono::milliseconds a_DT, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk);
40 
41  /* Called when a single block changes, wakes all simulators up for the block and its face-neighbors.
42  The simulator implementation may also decide to wake blocks farther away. */
43  void WakeUp(cChunk & a_Chunk, Vector3i a_Position);
44 
49  void WakeUp(const cCuboid & a_Area);
50 
51  void RegisterSimulator(cSimulator * a_Simulator, int a_Rate); // Takes ownership of the simulator object!
52 
53 protected:
54 
55  typedef std::vector <std::pair<cSimulator *, int> > cSimulators;
56 
59  long long m_Ticks;
60 };
61 
62 
63 
64 
Definition: Chunk.h:36
Definition: Cuboid.h:10
Base class for all block-based physics simulators (such as fluid, fire, falling blocks etc....
Definition: Simulator.h:22
cSimulators m_Simulators
void RegisterSimulator(cSimulator *a_Simulator, int a_Rate)
std::vector< std::pair< cSimulator *, int > > cSimulators
cSimulatorManager(cWorld &a_World)
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 acce...
void Simulate(float a_Dt)
Called in each tick, a_Dt is the time passed since the last tick, in msec.
void WakeUp(cChunk &a_Chunk, Vector3i a_Position)
Definition: World.h:53