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  cSimulatorManager(cWorld & a_World);
33 
34  void Simulate(float a_Dt);
35 
36  void SimulateChunk(std::chrono::milliseconds a_DT, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk);
37 
38  /* Called when a single block changes, wakes all simulators up for the block and its face-neighbors. */
39  void WakeUp(Vector3i a_Block, cChunk * a_Chunk);
40 
46  void WakeUpArea(const cCuboid & a_Area);
47 
48  void RegisterSimulator(cSimulator * a_Simulator, int a_Rate); // Takes ownership of the simulator object!
49 
50 protected:
51  typedef std::vector <std::pair<cSimulator *, int> > cSimulators;
52 
54  cSimulators m_Simulators;
55  long long m_Ticks;
56 };
57 
58 
59 
60 
void WakeUp(Vector3i a_Block, cChunk *a_Chunk)
std::vector< std::pair< cSimulator *, int > > cSimulators
Definition: Chunk.h:49
Base class for all block-based physics simulators (such as fluid, fire, falling blocks etc...
Definition: Simulator.h:19
void Simulate(float a_Dt)
Definition: World.h:65
void RegisterSimulator(cSimulator *a_Simulator, int a_Rate)
cSimulatorManager(cWorld &a_World)
Definition: Cuboid.h:9
cSimulators m_Simulators
void WakeUpArea(const cCuboid &a_Area)
Does the same processing as WakeUp, but for all blocks within the specified area. ...
void SimulateChunk(std::chrono::milliseconds a_DT, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk)