diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-05 22:45:45 +0100 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-05 22:50:18 +0100 |
commit | ca6ef58b1ee8521e4b940ee4883dee714960e413 (patch) | |
tree | 8532add455224b07c07a759e3d906f50c0695888 /src/Simulator | |
parent | Merge pull request #2972 from marvinkopf/PlayerAutoComplete (diff) | |
download | cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2 cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip |
Diffstat (limited to 'src/Simulator')
-rw-r--r-- | src/Simulator/DelayedFluidSimulator.cpp | 10 | ||||
-rw-r--r-- | src/Simulator/DelayedFluidSimulator.h | 16 | ||||
-rw-r--r-- | src/Simulator/FireSimulator.cpp | 22 | ||||
-rw-r--r-- | src/Simulator/FireSimulator.h | 14 | ||||
-rw-r--r-- | src/Simulator/FloodyFluidSimulator.cpp | 18 | ||||
-rw-r--r-- | src/Simulator/FloodyFluidSimulator.h | 10 | ||||
-rw-r--r-- | src/Simulator/FluidSimulator.cpp | 6 | ||||
-rw-r--r-- | src/Simulator/FluidSimulator.h | 16 | ||||
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.h | 4 | ||||
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h | 2 | ||||
-rw-r--r-- | src/Simulator/NoopFluidSimulator.h | 2 | ||||
-rw-r--r-- | src/Simulator/NoopRedstoneSimulator.h | 2 | ||||
-rw-r--r-- | src/Simulator/SandSimulator.cpp | 10 | ||||
-rw-r--r-- | src/Simulator/SandSimulator.h | 16 | ||||
-rw-r--r-- | src/Simulator/Simulator.h | 6 | ||||
-rw-r--r-- | src/Simulator/SimulatorManager.h | 6 | ||||
-rw-r--r-- | src/Simulator/VanillaFluidSimulator.h | 4 | ||||
-rw-r--r-- | src/Simulator/VaporizeFluidSimulator.h | 2 |
18 files changed, 83 insertions, 83 deletions
diff --git a/src/Simulator/DelayedFluidSimulator.cpp b/src/Simulator/DelayedFluidSimulator.cpp index e0da3ff61..d21e8dc6d 100644 --- a/src/Simulator/DelayedFluidSimulator.cpp +++ b/src/Simulator/DelayedFluidSimulator.cpp @@ -21,7 +21,7 @@ bool cDelayedFluidSimulatorChunkData::cSlot::Add(int a_RelX, int a_RelY, int a_R { ASSERT(a_RelZ >= 0); ASSERT(a_RelZ < static_cast<int>(ARRAYCOUNT(m_Blocks))); - + cCoordWithIntVector & Blocks = m_Blocks[a_RelZ]; int Index = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); for (cCoordWithIntVector::const_iterator itr = Blocks.begin(), end = Blocks.end(); itr != end; ++itr) @@ -85,12 +85,12 @@ void cDelayedFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, // Not inside the world (may happen when rclk with a full bucket - the client sends Y = -1) return; } - + if ((a_Chunk == nullptr) || !a_Chunk->IsValid()) { return; } - + int RelX = a_BlockX - a_Chunk->GetPosX() * cChunkDef::Width; int RelZ = a_BlockZ - a_Chunk->GetPosZ() * cChunkDef::Width; BLOCKTYPE BlockType = a_Chunk->GetBlock(RelX, a_BlockY, RelZ); @@ -102,7 +102,7 @@ void cDelayedFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, auto ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData(); cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw); cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_AddSlotNum]; - + // Add, if not already present: if (!Slot.Add(RelX, a_BlockY, RelZ)) { @@ -135,7 +135,7 @@ void cDelayedFluidSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a auto ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData(); cDelayedFluidSimulatorChunkData * ChunkData = static_cast<cDelayedFluidSimulatorChunkData *>(ChunkDataRaw); cDelayedFluidSimulatorChunkData::cSlot & Slot = ChunkData->m_Slots[m_SimSlotNum]; - + // Simulate all the blocks in the scheduled slot: for (size_t i = 0; i < ARRAYCOUNT(Slot.m_Blocks); i++) { diff --git a/src/Simulator/DelayedFluidSimulator.h b/src/Simulator/DelayedFluidSimulator.h index 05f70e2fd..62efb717e 100644 --- a/src/Simulator/DelayedFluidSimulator.h +++ b/src/Simulator/DelayedFluidSimulator.h @@ -24,19 +24,19 @@ public: 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 */ cSlot * m_Slots; } ; @@ -52,25 +52,25 @@ class cDelayedFluidSimulator : public: cDelayedFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, int a_TickDelay); - + // cSimulator overrides: virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override; virtual void Simulate(float a_Dt) override; virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override; virtual cFluidSimulatorData * CreateChunkData(void) override { return new cDelayedFluidSimulatorChunkData(m_TickDelay); } - + protected: int m_TickDelay; // Count of the m_Slots array in each ChunkData int m_AddSlotNum; // Index into m_Slots[] where to add new blocks in each ChunkData int m_SimSlotNum; // Index into m_Slots[] where to simulate blocks in each ChunkData - + int m_TotalBlocks; // Statistics only: the total number of blocks currently queued /* Slots: | 0 | 1 | ... | m_AddSlotNum | m_SimSlotNum | ... | m_TickDelay - 1 | | 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. */ virtual void SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) = 0; } ; diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index b1d36d526..5fc19ae15 100644 --- a/src/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp @@ -120,7 +120,7 @@ void cFireSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, ++itr; continue; } - + // Burn out the fire one step by increasing the meta: /* FLOG("FS: Fire at {%d, %d, %d} is stepping", @@ -224,7 +224,7 @@ void cFireSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * { return; } - + int RelX = a_BlockX - a_Chunk->GetPosX() * cChunkDef::Width; int RelZ = a_BlockZ - a_Chunk->GetPosZ() * cChunkDef::Width; BLOCKTYPE BlockType = a_Chunk->GetBlock(RelX, a_BlockY, RelZ); @@ -232,7 +232,7 @@ void cFireSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * { return; } - + // Check for duplicates: cFireSimulatorChunkData & ChunkData = a_Chunk->GetFireSimulatorData(); for (cCoordWithIntList::iterator itr = ChunkData.begin(), end = ChunkData.end(); itr != end; ++itr) @@ -269,7 +269,7 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in } IsBlockBelowSolid = cBlockInfo::IsSolid(BlockBelow); } - + for (size_t i = 0; i < ARRAYCOUNT(gCrossCoords); i++) { BLOCKTYPE BlockType; @@ -307,7 +307,7 @@ void cFireSimulator::TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int return; } */ - + for (int x = a_RelX - 1; x <= a_RelX + 1; x++) { for (int z = a_RelZ - 1; z <= a_RelZ + 1; z++) @@ -316,12 +316,12 @@ void cFireSimulator::TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int { // No need to check the coords for equality with the parent block, // it cannot catch fire anyway (because it's not an air block) - + if (m_World.GetTickRandomNumber(MAX_CHANCE_FLAMMABILITY) > m_Flammability) { continue; } - + // Start the fire in the neighbor {x, y, z} /* FLOG("FS: Trying to start fire at {%d, %d, %d}.", @@ -332,12 +332,12 @@ void cFireSimulator::TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int { int a_PosX = x + a_Chunk->GetPosX() * cChunkDef::Width; int a_PosZ = z + a_Chunk->GetPosZ() * cChunkDef::Width; - + if (cRoot::Get()->GetPluginManager()->CallHookBlockSpread(m_World, a_PosX, y, a_PosZ, ssFireSpread)) { return; } - + FLOG("FS: Starting new fire at {%d, %d, %d}.", a_PosX, y, a_PosZ); a_Chunk->UnboundedRelSetBlock(x, y, z, E_BLOCK_FIRE, 0); } @@ -406,13 +406,13 @@ bool cFireSimulator::CanStartFireInBlock(cChunk * a_NearChunk, int a_RelX, int a // The chunk is not accessible return false; } - + if (BlockType != E_BLOCK_AIR) { // Only an air block can be replaced by a fire block return false; } - + for (size_t i = 0; i < ARRAYCOUNT(gNeighborCoords); i++) { if (!a_NearChunk->UnboundedRelGetBlock(a_RelX + gNeighborCoords[i].x, a_RelY + gNeighborCoords[i].y, a_RelZ + gNeighborCoords[i].z, BlockType, BlockMeta)) diff --git a/src/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h index a59c66de5..bda02cbf7 100644 --- a/src/Simulator/FireSimulator.h +++ b/src/Simulator/FireSimulator.h @@ -39,22 +39,22 @@ protected: /** 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 */ 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 */ 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 */ void TrySpreadFire(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ); - + /** 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! diff --git a/src/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp index 518357f0b..afa54b2ad 100644 --- a/src/Simulator/FloodyFluidSimulator.cpp +++ b/src/Simulator/FloodyFluidSimulator.cpp @@ -54,7 +54,7 @@ void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_Re a_Chunk->GetBlock(a_RelX, a_RelY, a_RelZ), a_Chunk->GetMeta(a_RelX, a_RelY, a_RelZ) ); - + BLOCKTYPE MyBlock; NIBBLETYPE MyMeta; a_Chunk->GetBlockTypeMeta(a_RelX, a_RelY, a_RelZ, MyBlock, MyMeta); @@ -108,7 +108,7 @@ void cFloodyFluidSimulator::SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_Re { SpreadXZ(a_Chunk, a_RelX, a_RelY, a_RelZ, NewMeta); } - + // If source creation is on, check for it here: if ( (m_NumNeighborsForSource > 0) && // Source creation is on @@ -189,7 +189,7 @@ bool cFloodyFluidSimulator::CheckTributaries(cChunk * a_Chunk, int a_RelX, int a } } // for i - Coords[] } // if not fed from above - + // Block is not fed, decrease by m_Falloff levels: if (a_MyMeta >= 8) { @@ -231,11 +231,11 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i const int BlockX = a_NearChunk->GetPosX() * cChunkDef::Width + a_RelX; const int BlockZ = a_NearChunk->GetPosZ() * cChunkDef::Width + a_RelZ; - + BLOCKTYPE BlockType; NIBBLETYPE BlockMeta; a_NearChunk->GetBlockTypeMeta(a_RelX, a_RelY, a_RelZ, BlockType, BlockMeta); - + if (IsAllowedBlock(BlockType)) { if ((BlockMeta == a_NewMeta) || IsHigherMeta(BlockMeta, a_NewMeta)) @@ -295,13 +295,13 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i { ASSERT(!"Unknown fluid!"); } - + if (!IsPassableForFluid(BlockType)) { // Can't spread there return; } - + // Wash away the block there, if possible: if (CanWashAway(BlockType)) { @@ -337,7 +337,7 @@ void cFloodyFluidSimulator::SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, i bool cFloodyFluidSimulator::CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) { FLOG(" Checking neighbors for source creation"); - + static const Vector3i NeighborCoords[] = { Vector3i(-1, 0, 0), @@ -345,7 +345,7 @@ bool cFloodyFluidSimulator::CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX Vector3i( 0, 0, -1), Vector3i( 0, 0, 1), } ; - + int NumNeeded = m_NumNeighborsForSource; for (size_t i = 0; i < ARRAYCOUNT(NeighborCoords); i++) { diff --git a/src/Simulator/FloodyFluidSimulator.h b/src/Simulator/FloodyFluidSimulator.h index 44ac05ab3..7d6d81655 100644 --- a/src/Simulator/FloodyFluidSimulator.h +++ b/src/Simulator/FloodyFluidSimulator.h @@ -27,23 +27,23 @@ class cFloodyFluidSimulator : public cDelayedFluidSimulator { typedef cDelayedFluidSimulator super; - + public: cFloodyFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_Falloff, int a_TickDelay, int a_NumNeighborsForSource); - + protected: NIBBLETYPE m_Falloff; int m_NumNeighborsForSource; - + // cDelayedFluidSimulator overrides: virtual void SimulateBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override; - + /** Checks tributaries, if not fed, decreases the block's level and returns true. */ bool CheckTributaries(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_MyMeta); /** Spreads into the specified block, if the blocktype there allows. a_Area is for checking. */ void SpreadToNeighbor(cChunk * a_NearChunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta); - + /** Checks if there are enough neighbors to create a source at the coords specified; turns into source and returns true if so. */ bool CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ); diff --git a/src/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp index d2ca22775..10e4fee21 100644 --- a/src/Simulator/FluidSimulator.cpp +++ b/src/Simulator/FluidSimulator.cpp @@ -97,7 +97,7 @@ bool cFluidSimulator::IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2) // Falling fluid is higher than anything, including self return true; } - + if (a_Meta2 == 0) { // Second block is a source and first block isn't @@ -108,7 +108,7 @@ bool cFluidSimulator::IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2) // Second block is falling and the first one is neither a source nor falling return false; } - + // All special cases have been handled, now it's just a raw comparison: return (a_Meta1 < a_Meta2); } @@ -177,7 +177,7 @@ Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a LowestPoint = 9; // This always dominates X = Pos->x; Z = Pos->z; - + } delete Pos; Pos = nullptr; diff --git a/src/Simulator/FluidSimulator.h b/src/Simulator/FluidSimulator.h index 87a1361f1..4d5590e54 100644 --- a/src/Simulator/FluidSimulator.h +++ b/src/Simulator/FluidSimulator.h @@ -39,31 +39,31 @@ class cFluidSimulator : public cSimulator { typedef cSimulator super; - + public: cFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid); // 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) */ 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. */ virtual cFluidSimulatorData * CreateChunkData(void) { return nullptr; } - + bool IsFluidBlock (BLOCKTYPE a_BlockType) const { return (a_BlockType == m_FluidBlock); } bool IsStationaryFluidBlock(BLOCKTYPE a_BlockType) const { return (a_BlockType == m_StationaryFluidBlock); } bool IsAnyFluidBlock (BLOCKTYPE a_BlockType) const { return ((a_BlockType == m_FluidBlock) || (a_BlockType == m_StationaryFluidBlock)); } - + static bool CanWashAway(BLOCKTYPE a_BlockType); - + 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. */ bool IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2); - + protected: BLOCKTYPE m_FluidBlock; // The fluid block type that needs simulating BLOCKTYPE m_StationaryFluidBlock; // The fluid block type that indicates no simulation is needed diff --git a/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.h b/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.h index a43a6e49b..673d50e49 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.h +++ b/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.h @@ -17,7 +17,7 @@ public: super(a_World) { } - + virtual void Simulate(float a_dt) override; virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override {} @@ -161,7 +161,7 @@ public: static std::unique_ptr<cRedstoneHandler> CreateComponent(cWorld & a_World, BLOCKTYPE a_BlockType, cIncrementalRedstoneSimulatorChunkData * a_Data); private: - + // oh yea its crazy time cIncrementalRedstoneSimulatorChunkData m_Data; } ; diff --git a/src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h b/src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h index d472d2dfb..382a1c311 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h @@ -122,7 +122,7 @@ public: m_World.SetBlockMeta(a_Position, Meta); return GetAdjustedRelatives(a_Position, GetRelativeAdjacents()); } - + return {}; } diff --git a/src/Simulator/NoopFluidSimulator.h b/src/Simulator/NoopFluidSimulator.h index 9fe2f9040..a237e960b 100644 --- a/src/Simulator/NoopFluidSimulator.h +++ b/src/Simulator/NoopFluidSimulator.h @@ -19,7 +19,7 @@ class cNoopFluidSimulator : public cFluidSimulator { typedef cFluidSimulator super; - + public: cNoopFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid) : super(a_World, a_Fluid, a_StationaryFluid) diff --git a/src/Simulator/NoopRedstoneSimulator.h b/src/Simulator/NoopRedstoneSimulator.h index 34c8627d2..a5d9e9448 100644 --- a/src/Simulator/NoopRedstoneSimulator.h +++ b/src/Simulator/NoopRedstoneSimulator.h @@ -34,7 +34,7 @@ public: UNUSED(a_BlockZ); UNUSED(a_Chunk); } - + virtual cRedstoneSimulatorChunkData * CreateChunkData() override { return nullptr; diff --git a/src/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp index 2ced0cb83..d3773ee41 100644 --- a/src/Simulator/SandSimulator.cpp +++ b/src/Simulator/SandSimulator.cpp @@ -251,7 +251,7 @@ void cSandSimulator::FinishFalling( ) { ASSERT(a_BlockY < cChunkDef::Height); - + BLOCKTYPE CurrentBlockType = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); if ((a_FallingBlockType == E_BLOCK_ANVIL) || IsReplacedOnRematerialization(CurrentBlockType)) { @@ -263,7 +263,7 @@ void cSandSimulator::FinishFalling( } return; } - + // Create a pickup instead: cItems Pickups; Pickups.Add(static_cast<ENUM_ITEM_ID>(a_FallingBlockType), 1, a_FallingBlockMeta); @@ -286,7 +286,7 @@ void cSandSimulator::DoInstantFall(cChunk * a_Chunk, int a_RelX, int a_RelY, int NIBBLETYPE FallingBlockMeta; a_Chunk->GetBlockTypeMeta(a_RelX, a_RelY, a_RelZ, FallingBlockType, FallingBlockMeta); a_Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_AIR, 0); - + // Search for a place to put it: for (int y = a_RelY - 1; y >= 0; y--) { @@ -307,14 +307,14 @@ void cSandSimulator::DoInstantFall(cChunk * a_Chunk, int a_RelX, int a_RelY, int // Can fall further down continue; } - + // Finish the fall at the found bottom: int BlockX = a_RelX + a_Chunk->GetPosX() * cChunkDef::Width; int BlockZ = a_RelZ + a_Chunk->GetPosZ() * cChunkDef::Width; FinishFalling(&m_World, BlockX, BlockY, BlockZ, FallingBlockType, FallingBlockMeta); return; } - + // The block just "fell off the world" without leaving a trace } diff --git a/src/Simulator/SandSimulator.h b/src/Simulator/SandSimulator.h index 68ba718bd..cda26775e 100644 --- a/src/Simulator/SandSimulator.h +++ b/src/Simulator/SandSimulator.h @@ -32,19 +32,19 @@ public: virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used 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 */ static bool CanStartFallingThrough(BLOCKTYPE a_BlockType); - + /** 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) */ static bool IsReplacedOnRematerialization(BLOCKTYPE a_BlockType); - + /** 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, @@ -56,11 +56,11 @@ public: protected: bool m_IsInstantFall; // If set to true, blocks don't fall using cFallingBlock entity, but instantly instead - + int m_TotalBlocks; // Total number of blocks currently in the queue for simulating - + 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 */ 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 421960083..b0e3b16f4 100644 --- a/src/Simulator/Simulator.h +++ b/src/Simulator/Simulator.h @@ -22,7 +22,7 @@ public: /** 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 */ virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) { @@ -31,7 +31,7 @@ public: UNUSED(a_ChunkZ); UNUSED(a_Chunk); } - + /** Called when a block changes */ virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk); @@ -39,7 +39,7 @@ public: 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; diff --git a/src/Simulator/SimulatorManager.h b/src/Simulator/SimulatorManager.h index b96f6ca84..e6ad68bf3 100644 --- a/src/Simulator/SimulatorManager.h +++ b/src/Simulator/SimulatorManager.h @@ -32,16 +32,16 @@ public: ~cSimulatorManager(); void Simulate(float a_Dt); - + void SimulateChunk(std::chrono::milliseconds a_DT, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk); - + void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk); void RegisterSimulator(cSimulator * a_Simulator, int a_Rate); // Takes ownership of the simulator object! protected: typedef std::vector <std::pair<cSimulator *, int> > cSimulators; - + cWorld & m_World; cSimulators m_Simulators; long long m_Ticks; diff --git a/src/Simulator/VanillaFluidSimulator.h b/src/Simulator/VanillaFluidSimulator.h index 89a56ca14..3f8c45128 100644 --- a/src/Simulator/VanillaFluidSimulator.h +++ b/src/Simulator/VanillaFluidSimulator.h @@ -24,10 +24,10 @@ class cVanillaFluidSimulator : public cFloodyFluidSimulator { typedef cFloodyFluidSimulator super; - + public: cVanillaFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_Falloff, int a_TickDelay, int a_NumNeighborsForSource); - + protected: // cFloodyFluidSimulator overrides: virtual void SpreadXZ(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta) override; diff --git a/src/Simulator/VaporizeFluidSimulator.h b/src/Simulator/VaporizeFluidSimulator.h index c8eb7802b..8076972a8 100644 --- a/src/Simulator/VaporizeFluidSimulator.h +++ b/src/Simulator/VaporizeFluidSimulator.h @@ -20,7 +20,7 @@ class cVaporizeFluidSimulator : public cFluidSimulator { typedef cFluidSimulator super; - + public: cVaporizeFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid); |