1
0

Possibly decoupled IncrementalRedstoneSimulator from the rest of the server

THis wil hopefully allow for unit testing
This commit is contained in:
Tycho
2014-09-11 17:48:21 +01:00
parent c8b41e9b2b
commit 0b044e1c83
22 changed files with 2404 additions and 2340 deletions

View File

@@ -8,17 +8,12 @@
class cWorld;
class cChunk;
template <class ChunkType, class WorldType>
class cSimulator
{
public:
cSimulator(cWorld & a_World);
cSimulator(WorldType & a_World);
virtual ~cSimulator();
/// Called in each tick, a_Dt is the time passed since the last tick, in msec
@@ -26,7 +21,7 @@ public:
/// 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
virtual void SimulateChunk(float a_Dt, int a_ChunkX,
int a_ChunkZ, cChunk * a_Chunk)
int a_ChunkZ, ChunkType * a_Chunk)
{
UNUSED(a_Dt);
UNUSED(a_ChunkX);
@@ -35,7 +30,7 @@ public:
}
/// Called when a block changes
virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk);
virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, ChunkType * a_Chunk);
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) = 0;
@@ -43,9 +38,9 @@ protected:
friend class cChunk; // Calls AddBlock() in its WakeUpSimulators() function, to speed things up
/// Called to simulate a new block
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) = 0;
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, ChunkType * a_Chunk) = 0;
cWorld & m_World;
WorldType & m_World;
} ;