1
0

DelayedFluidSimulator: optimized block storage for large amounts of blocks.

Speeds up chunk generation by 15 %. Expected to speed up fluid simulation, unmeasured.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1293 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-03-20 20:45:52 +00:00
parent f8ae3e6f62
commit e8aa03f8df
2 changed files with 62 additions and 20 deletions

View File

@@ -19,13 +19,26 @@ class cDelayedFluidSimulatorChunkData :
public cFluidSimulatorData
{
public:
class cSlot
{
public:
/// Returns true if the specified block is stored
bool HasBlock(int a_RelX, int a_RelY, int a_RelZ);
/// Adds the specified block unless already present; returns true if added, false if the block was already present
bool Add(int a_RelX, int a_RelY, int a_RelZ);
/** Array of block containers, each item stores blocks for one Z coord
Int param is the block index (for faster duplicate comparison in Add())
*/
cCoordWithIntVector m_Blocks[16];
} ;
cDelayedFluidSimulatorChunkData(int a_TickDelay);
virtual ~cDelayedFluidSimulatorChunkData();
/** Slots, one for each delay tick, each containing the blocks to simulate; relative coords.
Int param is the block index (for faster duplicate comparison in cDelayedFluidSimulator::AddBlock())
*/
cCoordWithIntVector * m_Slots;
/// Slots, one for each delay tick, each containing the blocks to simulate
cSlot * m_Slots;
} ;