Possibly decoupled IncrementalRedstoneSimulator from the rest of the server
THis wil hopefully allow for unit testing
This commit is contained in:
@@ -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;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user