summaryrefslogtreecommitdiffstats
path: root/src/Simulator/Simulator.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-07-29 21:15:09 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-04 19:15:18 +0200
commitadb86a75dac91a210149fc28b1dbf5225896f66c (patch)
treeb62bcb6cba06726081c598879d84018f7a39c824 /src/Simulator/Simulator.h
parentUse std::queue for the block tick queue (diff)
downloadcuberite-adb86a75dac91a210149fc28b1dbf5225896f66c.tar
cuberite-adb86a75dac91a210149fc28b1dbf5225896f66c.tar.gz
cuberite-adb86a75dac91a210149fc28b1dbf5225896f66c.tar.bz2
cuberite-adb86a75dac91a210149fc28b1dbf5225896f66c.tar.lz
cuberite-adb86a75dac91a210149fc28b1dbf5225896f66c.tar.xz
cuberite-adb86a75dac91a210149fc28b1dbf5225896f66c.tar.zst
cuberite-adb86a75dac91a210149fc28b1dbf5225896f66c.zip
Diffstat (limited to 'src/Simulator/Simulator.h')
-rw-r--r--src/Simulator/Simulator.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/Simulator/Simulator.h b/src/Simulator/Simulator.h
index aacd5f52f..f82b579cb 100644
--- a/src/Simulator/Simulator.h
+++ b/src/Simulator/Simulator.h
@@ -13,9 +13,9 @@ class cCuboid;
Each descendant provides an implementation of what needs to be done on each world tick.
The descendant may choose to do all processing in a single call for the entire world (Simulate())
or do per-chunk calculations (SimulateChunk()).
-Whenever a block is changed, the WakeUp() or WakeUpArea() functions are called to notify all simulators.
-The functions add all affected blocks and all their direct neighbors using the AddBlock() function. The simulator
-may update its internal state based on this call. */
+Whenever a block is changed, the WakeUp() functions are called to notify all simulators by the simulator manager.
+The functions are invoked to add all affected blocks and their direct neighbors using the AddBlock() function.
+The simulator may update its internal state based on this call. */
class cSimulator
{
public:
@@ -27,7 +27,18 @@ public:
virtual ~cSimulator() {}
- virtual void WakeUp(cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block);
+ // Contains our direct adjacents
+ inline static std::array<Vector3i, 6> AdjacentOffsets
+ {
+ {
+ { 1, 0, 0 },
+ { -1, 0, 0 },
+ { 0, 1, 0 },
+ { 0, -1, 0 },
+ { 0, 0, 1 },
+ { 0, 0, -1 },
+ }
+ };
protected: