summaryrefslogtreecommitdiffstats
path: root/src/Simulator
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-07-31 16:49:10 +0200
committerMattes D <github@xoft.cz>2015-07-31 16:49:10 +0200
commit6e4122e551eeb41d3e950b363dd837d5586fe560 (patch)
treeb5ee221d8a8e63c7d3b7868da1db19bf717a6ffd /src/Simulator
parentMerge pull request #2400 from cuberite/OffloadBadChunks (diff)
downloadcuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.gz
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.bz2
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.lz
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.xz
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.zst
cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.zip
Diffstat (limited to 'src/Simulator')
-rw-r--r--src/Simulator/DelayedFluidSimulator.h14
-rw-r--r--src/Simulator/FireSimulator.h19
-rw-r--r--src/Simulator/FluidSimulator.h9
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.h5
-rw-r--r--src/Simulator/SandSimulator.h31
-rw-r--r--src/Simulator/Simulator.h8
6 files changed, 46 insertions, 40 deletions
diff --git a/src/Simulator/DelayedFluidSimulator.h b/src/Simulator/DelayedFluidSimulator.h
index e3182812d..05f70e2fd 100644
--- a/src/Simulator/DelayedFluidSimulator.h
+++ b/src/Simulator/DelayedFluidSimulator.h
@@ -22,10 +22,10 @@ public:
class cSlot
{
public:
- /// Returns true if the specified block is stored
+ /** 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
+ /** 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
@@ -37,7 +37,7 @@ public:
cDelayedFluidSimulatorChunkData(int a_TickDelay);
virtual ~cDelayedFluidSimulatorChunkData();
- /// Slots, one for each delay tick, each containing the blocks to simulate
+ /** Slots, one for each delay tick, each containing the blocks to simulate */
cSlot * m_Slots;
} ;
@@ -67,13 +67,11 @@ protected:
int m_TotalBlocks; // Statistics only: the total number of blocks currently queued
- /*
- Slots:
+ /* Slots:
| 0 | 1 | ... | m_AddSlotNum | m_SimSlotNum | ... | m_TickDelay - 1 |
- | adding blocks here ^ | ^ simulating here
- */
+ | adding blocks here ^ | ^ simulating here */
- /// Called from SimulateChunk() to simulate each block in one slot of blocks. Descendants override this method to provide custom simulation.
+ /** Called from SimulateChunk() to simulate each block in one slot of blocks. Descendants override this method to provide custom simulation. */
virtual void SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) = 0;
} ;
diff --git a/src/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h
index a40e29565..a59c66de5 100644
--- a/src/Simulator/FireSimulator.h
+++ b/src/Simulator/FireSimulator.h
@@ -31,35 +31,34 @@ public:
static bool DoesBurnForever(BLOCKTYPE a_BlockType);
protected:
- /// Time (in msec) that a fire block takes to burn with a fuel block into the next step
+ /** Time (in msec) that a fire block takes to burn with a fuel block into the next step */
unsigned m_BurnStepTimeFuel;
- /// Time (in msec) that a fire block takes to burn without a fuel block into the next step
+ /** Time (in msec) that a fire block takes to burn without a fuel block into the next step */
unsigned m_BurnStepTimeNonfuel;
- /// Chance [0..100000] of an adjacent fuel to catch fire on each tick
+ /** Chance [0..100000] of an adjacent fuel to catch fire on each tick */
int m_Flammability;
- /// Chance [0..100000] of a fuel burning out being replaced by a new fire block instead of an air block
+ /** Chance [0..100000] of a fuel burning out being replaced by a new fire block instead of an air block */
int m_ReplaceFuelChance;
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
- /// Returns the time [msec] after which the specified fire block is stepped again; based on surrounding fuels
+ /** Returns the time [msec] after which the specified fire block is stepped again; based on surrounding fuels */
int GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
- /// Tries to spread fire to a neighborhood of the specified block
+ /** Tries to spread fire to a neighborhood of the specified block */
void TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
- /// Removes all burnable blocks neighboring the specified block
+ /** Removes all burnable blocks neighboring the specified block */
void RemoveFuelNeighbors(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
/** Returns true if a fire can be started in the specified block,
that is, it is an air block and has fuel next to it.
Note that a_NearChunk may be a chunk neighbor to the block specified!
- The coords are relative to a_NearChunk but not necessarily in it.
- */
+ The coords are relative to a_NearChunk but not necessarily in it. */
bool CanStartFireInBlock(cChunk * a_NearChunk, int a_RelX, int a_RelY, int a_RelZ);
} ;
@@ -67,7 +66,7 @@ protected:
-/// Stores individual fire blocks in the chunk; the int data is used as the time [msec] the fire takes to step to another stage (blockmeta++)
+/** Stores individual fire blocks in the chunk; the int data is used as the time [msec] the fire takes to step to another stage (blockmeta++) */
typedef cCoordWithIntList cFireSimulatorChunkData;
diff --git a/src/Simulator/FluidSimulator.h b/src/Simulator/FluidSimulator.h
index 6d2c6a679..87a1361f1 100644
--- a/src/Simulator/FluidSimulator.h
+++ b/src/Simulator/FluidSimulator.h
@@ -24,8 +24,7 @@ enum Direction
/** This is a base class for all fluid simulator data classes.
-Needed so that cChunk can properly delete instances of fluid simulator data, no matter what simulator it's using
-*/
+Needed so that cChunk can properly delete instances of fluid simulator data, no matter what simulator it's using. */
class cFluidSimulatorData
{
public:
@@ -47,10 +46,10 @@ public:
// cSimulator overrides:
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
- /// Gets the flowing direction. If a_Over is true also the block over the current block affects the direction (standard)
+ /** Gets the flowing direction. If a_Over is true also the block over the current block affects the direction (standard) */
virtual Direction GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a_Over = true);
- /// Creates a ChunkData object for the simulator to use. The simulator returns the correct object type.
+ /** Creates a ChunkData object for the simulator to use. The simulator returns the correct object type. */
virtual cFluidSimulatorData * CreateChunkData(void) { return nullptr; }
bool IsFluidBlock (BLOCKTYPE a_BlockType) const { return (a_BlockType == m_FluidBlock); }
@@ -62,7 +61,7 @@ public:
bool IsSolidBlock (BLOCKTYPE a_BlockType);
bool IsPassableForFluid(BLOCKTYPE a_BlockType);
- /// Returns true if a_Meta1 is a higher fluid than a_Meta2. Takes source blocks into account.
+ /** Returns true if a_Meta1 is a higher fluid than a_Meta2. Takes source blocks into account. */
bool IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2);
protected:
diff --git a/src/Simulator/IncrementalRedstoneSimulator.h b/src/Simulator/IncrementalRedstoneSimulator.h
index 394250800..429bc6785 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.h
+++ b/src/Simulator/IncrementalRedstoneSimulator.h
@@ -71,12 +71,11 @@ private:
bool ShouldPowerOn; // What happens when the delay time is fulfilled?
};
+ /** Per-chunk data for the simulator, specified individual chunks to simulate */
class cIncrementalRedstoneSimulatorChunkData :
public cRedstoneSimulatorChunkData
{
public:
- /// Per-chunk data for the simulator, specified individual chunks to simulate
-
/** test */
std::unordered_map<Vector3i, std::pair<BLOCKTYPE, bool>, VectorHasher<int>> m_ChunkData;
std::vector<sPoweredBlocks> m_PoweredBlocks;
@@ -241,7 +240,7 @@ private:
The only diffence between this and a normal AreCoordsPowered is that this function checks for a wire powering another wire */
static unsigned char IsWirePowered(Vector3i a_RelBlockPosition, cChunk * a_Chunk);
- /** Handles delayed updates to repeaters **/
+ /** Handles delayed updates to repeaters */
void HandleRedstoneRepeaterDelays(void);
/** Returns if lever metadata marks it as emitting power */
diff --git a/src/Simulator/SandSimulator.h b/src/Simulator/SandSimulator.h
index 8fff659ed..68ba718bd 100644
--- a/src/Simulator/SandSimulator.h
+++ b/src/Simulator/SandSimulator.h
@@ -3,13 +3,25 @@
#include "Simulator.h"
-/// Per-chunk data for the simulator, specified individual chunks to simulate; Data is not used
+
+
+
+
+// fwd:
+class cChunk;
+
+
+
+
+
+/** Per-chunk data for the simulator, specified individual chunks to simulate; Data is not used */
typedef cCoordWithIntList cSandSimulatorChunkData;
-#include "Chunk.h"
-/// Despite the class name, this simulator takes care of all blocks that fall when suspended in the air.
+
+
+/** Despite the class name, this simulator takes care of all blocks that fall when suspended in the air. */
class cSandSimulator :
public cSimulator
{
@@ -21,23 +33,22 @@ public:
virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override;
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
- /// Returns true if a falling-able block can start falling through the specified block type
+ /** Returns true if a falling-able block can start falling through the specified block type */
static bool CanStartFallingThrough(BLOCKTYPE a_BlockType);
- /// Returns true if an already-falling block can pass through the specified block type (e. g. torch)
+ /** Returns true if an already-falling block can pass through the specified block type (e. g. torch) */
static bool CanContinueFallThrough(BLOCKTYPE a_BlockType);
- /// Returns true if the falling block rematerializing will replace the specified block type (e. g. tall grass)
+ /** Returns true if the falling block rematerializing will replace the specified block type (e. g. tall grass) */
static bool IsReplacedOnRematerialization(BLOCKTYPE a_BlockType);
- /// Returns true if the specified block breaks falling blocks while they fall through it (e. g. halfslabs)
+ /** Returns true if the specified block breaks falling blocks while they fall through it (e. g. halfslabs) */
static bool DoesBreakFallingThrough(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
/** Called when a block finishes falling at the specified coords, either by insta-fall,
or through cFallingBlock entity.
It either rematerializes the block (a_FallingBlockType) at the specified coords, or creates a pickup,
- based on the block currently present in the world at the dest specified coords
- */
+ based on the block currently present in the world at the dest specified coords. */
static void FinishFalling(
cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ,
BLOCKTYPE a_FallingBlockType, NIBBLETYPE a_FallingBlockMeta
@@ -50,7 +61,7 @@ protected:
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
- /// Performs the instant fall of the block - removes it from top, Finishes it at the bottom
+ /** Performs the instant fall of the block - removes it from top, Finishes it at the bottom */
void DoInstantFall(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
};
diff --git a/src/Simulator/Simulator.h b/src/Simulator/Simulator.h
index c8066edfd..421960083 100644
--- a/src/Simulator/Simulator.h
+++ b/src/Simulator/Simulator.h
@@ -20,10 +20,10 @@ public:
virtual ~cSimulator() {}
- /// Called in each tick, a_Dt is the time passed since the last tick, in msec
+ /** Called in each tick, a_Dt is the time passed since the last tick, in msec */
virtual void Simulate(float a_Dt) = 0;
- /// 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
+ /** 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(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk)
{
UNUSED(a_Dt);
@@ -32,7 +32,7 @@ public:
UNUSED(a_Chunk);
}
- /// Called when a block changes
+ /** Called when a block changes */
virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk);
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) = 0;
@@ -40,7 +40,7 @@ public:
protected:
friend class cChunk; // Calls AddBlock() in its WakeUpSimulators() function, to speed things up
- /// Called to simulate a new block
+ /** Called to simulate a new block */
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) = 0;
cWorld & m_World;