diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-14 21:46:40 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-14 21:46:40 +0100 |
commit | eaf973544be0dccdb69796f64977314058fa82b6 (patch) | |
tree | bf240ff031ad627aea23e1ddefb900e40c4968a0 | |
parent | Release 1.5 supported, yay :) (diff) | |
download | cuberite-eaf973544be0dccdb69796f64977314058fa82b6.tar cuberite-eaf973544be0dccdb69796f64977314058fa82b6.tar.gz cuberite-eaf973544be0dccdb69796f64977314058fa82b6.tar.bz2 cuberite-eaf973544be0dccdb69796f64977314058fa82b6.tar.lz cuberite-eaf973544be0dccdb69796f64977314058fa82b6.tar.xz cuberite-eaf973544be0dccdb69796f64977314058fa82b6.tar.zst cuberite-eaf973544be0dccdb69796f64977314058fa82b6.zip |
-rw-r--r-- | VC2008/MCServer.vcproj | 8 | ||||
-rw-r--r-- | source/Simulator/ClassicFluidSimulator.cpp | 572 | ||||
-rw-r--r-- | source/Simulator/ClassicFluidSimulator.h | 50 | ||||
-rw-r--r-- | source/World.cpp | 24 |
4 files changed, 7 insertions, 647 deletions
diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj index b8520b180..515cfb9d7 100644 --- a/VC2008/MCServer.vcproj +++ b/VC2008/MCServer.vcproj @@ -1067,14 +1067,6 @@ Name="Simulator"
>
<File
- RelativePath="..\source\Simulator\ClassicFluidSimulator.cpp"
- >
- </File>
- <File
- RelativePath="..\source\Simulator\ClassicFluidSimulator.h"
- >
- </File>
- <File
RelativePath="..\source\Simulator\DelayedFluidSimulator.cpp"
>
</File>
diff --git a/source/Simulator/ClassicFluidSimulator.cpp b/source/Simulator/ClassicFluidSimulator.cpp deleted file mode 100644 index d96c863c1..000000000 --- a/source/Simulator/ClassicFluidSimulator.cpp +++ /dev/null @@ -1,572 +0,0 @@ -
-// ClassicFluidSimulator.cpp
-
-// Implements the cClassicFluidSimulator class representing the original MCServer's fluid simulator
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "ClassicFluidSimulator.h"
-#include "../World.h"
-#include "../BlockID.h"
-#include "../Defines.h"
-#include "../Item.h"
-#include "../Blocks/BlockHandler.h"
-
-
-
-
-
-
-// #define DEBUG_FLUID
-
-#ifdef DEBUG_FLUID
- #define LOG_FLUID(...) LOGD( __VA_ARGS__ )
-#else
- #define LOG_FLUID(...)
-#endif
-
-
-
-
-
-class cClassicFluidSimulator::FluidData
-{
-public:
- FluidData(cWorld & a_World, cClassicFluidSimulator * a_Simulator )
- : m_ActiveFluid( new std::set < Vector3i >() )
- , m_Simulator (a_Simulator)
- , m_Buffer( new std::set< Vector3i >() )
- , m_World( a_World )
- {
- }
-
-
- ~FluidData()
- {
- delete m_Buffer;
- delete m_ActiveFluid;
- }
-
-
- void UpdateWave(Vector3i a_LeftCorner, Vector3i a_CurBlock)
- {
- Vector3i LevelPoints [] = {
- Vector3i(a_CurBlock.x - 1, a_CurBlock.y, a_CurBlock.z),
- Vector3i(a_CurBlock.x + 1, a_CurBlock.y, a_CurBlock.z),
- Vector3i(a_CurBlock.x, a_CurBlock.y, a_CurBlock.z - 1),
- Vector3i(a_CurBlock.x, a_CurBlock.y, a_CurBlock.z + 1),
- };
-
-
- for (int i = 0; i < 4; i++)
- {
- Vector3i cur = LevelPoints[i];
- switch (m_Relief[cur.x][cur.z])
- {
- case E_HOLE:
- {
- m_StartSide[cur.x][cur.z] = m_StartSide[a_CurBlock.x][a_CurBlock.z];
- m_CurResult|=m_StartSide[cur.x][cur.z];
- m_NearestHole = m_WayLength[a_CurBlock.x][a_CurBlock.z] + 1;
- LOG_FLUID("Hole found: %d \t curResult: %d", int(m_StartSide[cur.x][cur.z]), int(m_CurResult) );
- LOG_FLUID("Coordinates: (%d, %d)", cur.x, cur.z);
- break;
- }
-
- case E_BLOCK:
- {
- break;
- }
-
- case E_PLAIN:
- {
- if (m_WayLength[cur.x][cur.z] > m_WayLength[a_CurBlock.x][a_CurBlock.z] + 1)
- {
- m_WayLength[cur.x][cur.z] = m_WayLength[a_CurBlock.x][a_CurBlock.z] + 1;
- m_StartSide[cur.x][cur.z] = m_StartSide[a_CurBlock.x][a_CurBlock.z];
- m_WaveQueue.push(cur);
- }
- else if(m_WayLength[cur.x][cur.z] == m_WayLength[a_CurBlock.x][a_CurBlock.z] + 1)
- {
- m_StartSide[cur.x][cur.z] |= m_StartSide[a_CurBlock.x][a_CurBlock.z];
- }
- LOG_FLUID("Plain step: (%d, %d) from %d", cur.x, cur.z, m_StartSide[cur.x][cur.z]);
- break;
- }
- }
- }
- }
-
-
- std::vector< Vector3i > GetLowestPoints(int a_BlockX, int a_BlockY, int a_BlockZ)
- {
- std::vector< Vector3i > Points; // result
-
- Vector3i CornerGlobal(a_BlockX - AREA_WIDTH / 2, a_BlockY, a_BlockZ - AREA_WIDTH / 2);
-
- // TODO: Rewrite without relief, get blocks directly in algorithm
- for (int x = 0; x < AREA_WIDTH; x++)
- {
- for (int z = 0; z < AREA_WIDTH; z++)
- {
- BLOCKTYPE UpperBlock = m_World.GetBlock(CornerGlobal.x + x, CornerGlobal.y, CornerGlobal.z + z);
- BLOCKTYPE DownBlock = m_World.GetBlock(CornerGlobal.x + x, CornerGlobal.y - 1, CornerGlobal.z + z);
-
- if (m_Simulator->IsSolidBlock(UpperBlock) || (m_Simulator->IsStationaryFluidBlock(UpperBlock)))
- {
- m_Relief[x][z] = E_BLOCK;
- }
- else if (m_Simulator->IsSolidBlock(DownBlock))
- {
- m_Relief[x][z] = E_PLAIN;
- }
- else
- {
- m_Relief[x][z] = E_HOLE;
- }
- m_WayLength[x][z] = 255;
- m_StartSide[x][z] = E_SIDE_NONE;
- }
- LOG_FLUID("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t", m_Relief[x][0], m_Relief[x][1], m_Relief[x][2], m_Relief[x][3], m_Relief[x][4], m_Relief[x][5], m_Relief[x][6], m_Relief[x][7], m_Relief[x][8], m_Relief[x][9], m_Relief[x][10]);
- }
-
- m_NearestHole = 5;
- m_CurResult = 0;
- while (!m_WaveQueue.empty()) m_WaveQueue.pop(); // _X 2012_10_13: WTF? why not use m_WaveQueue.clear() ?
-
- int left = AREA_WIDTH / 2 - 1;
- int right = AREA_WIDTH / 2 + 1;
- int center = AREA_WIDTH / 2;
-
- Vector3i r(right, 0, center); // right block
- Vector3i l(left, 0, center); // left block
- Vector3i f(center, 0, right); // front block
- Vector3i b(center, 0, left); // back block
- Vector3i c(center, 0, center); // center block
-
- m_WayLength[c.x][c.z] = 0;
-
- Vector3i Nearest[] = {r, l, f, b};
- unsigned char Sides[] = {E_SIDE_RIGHT, E_SIDE_LEFT, E_SIDE_FRONT, E_SIDE_BACK};
-
- for (int i = 0; i < 4; i++)
- {
- Vector3i cur = Nearest[i];
- switch (m_Relief[cur.x][cur.z])
- {
- case E_HOLE:
- {
- m_StartSide[cur.x][cur.z] = Sides[i];
- m_CurResult |= m_StartSide[cur.x][cur.z];
- m_NearestHole = 1;
- LOG_FLUID("Hole found: %d \t curResult: %d", int(Sides[i]), int(m_CurResult) );
- break;
- }
-
- case E_BLOCK:
- {
- break;
- }
-
- case E_PLAIN:
- {
- m_WaveQueue.push(cur);
- m_StartSide[cur.x][cur.z] = Sides[i];
- m_WayLength[cur.x][cur.z] = 1;
- LOG_FLUID("Plain found: %d", int(Sides[i]));
- break;
- }
- }
- }
-
- Vector3i curBlock;
-
- bool bContinue = !m_WaveQueue.empty();
-
- if (!m_WaveQueue.empty())
- {
- curBlock = m_WaveQueue.front();
- bContinue = (m_WayLength[curBlock.x][curBlock.z] < m_NearestHole);
- }
-
- while (bContinue)
- {
- LOG_FLUID("while iteration" );
- curBlock = m_WaveQueue.front();
- UpdateWave(CornerGlobal, curBlock);
- m_WaveQueue.pop();
-
- bContinue = ( (!m_WaveQueue.empty()) && (m_WayLength[m_WaveQueue.front().x][m_WaveQueue.front().z] < m_NearestHole) );
- }
-
- if (m_CurResult & E_SIDE_LEFT) Points.push_back(Vector3i(a_BlockX - 1, a_BlockY, a_BlockZ));
- if (m_CurResult & E_SIDE_RIGHT) Points.push_back(Vector3i(a_BlockX + 1, a_BlockY, a_BlockZ));
- if (m_CurResult & E_SIDE_FRONT) Points.push_back(Vector3i(a_BlockX, a_BlockY, a_BlockZ + 1));
- if (m_CurResult & E_SIDE_BACK) Points.push_back(Vector3i(a_BlockX, a_BlockY, a_BlockZ - 1));
-
- if (Points.empty())
- {
- Vector3i LevelPoints [] = {
- Vector3i(a_BlockX - 1, a_BlockY, a_BlockZ),
- Vector3i(a_BlockX + 1, a_BlockY, a_BlockZ),
- Vector3i(a_BlockX, a_BlockY, a_BlockZ - 1),
- Vector3i(a_BlockX, a_BlockY, a_BlockZ + 1),
- };
- for (int i = 0; i < 4; ++i)
- {
- char Block = m_World.GetBlock(LevelPoints[i].x, a_BlockY, LevelPoints[i].z);
- if (m_Simulator->IsPassableForFluid(Block))
- {
- Points.push_back(LevelPoints[i]);
- }
- }
- }
-
- return Points;
- }
-
- std::set< Vector3i > * m_ActiveFluid;
- std::set< Vector3i > * m_Buffer;
- cWorld & m_World;
- cClassicFluidSimulator * m_Simulator;
-
- const static int AREA_WIDTH = 11;
-
- const static unsigned char E_SIDE_RIGHT = 0x10;
- const static unsigned char E_SIDE_LEFT = 0x20;
- const static unsigned char E_SIDE_FRONT = 0x40;
- const static unsigned char E_SIDE_BACK = 0x80;
- const static unsigned char E_SIDE_NONE = 0x00;
-
- enum eRelief
- {
- E_HOLE = 0,
- E_PLAIN = 1,
- E_BLOCK = 2
- };
-
- eRelief m_Relief[AREA_WIDTH][AREA_WIDTH];
- unsigned char m_WayLength[AREA_WIDTH][AREA_WIDTH];
- unsigned char m_StartSide[AREA_WIDTH][AREA_WIDTH];
-
- std::queue<Vector3i> m_WaveQueue;
-
- int m_NearestHole;
- unsigned char m_CurResult;
-};
-
-
-
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// cClassicFluidSimulator:
-
-cClassicFluidSimulator::cClassicFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_MaxHeight, NIBBLETYPE a_Falloff) :
- cFluidSimulator(a_World, a_Fluid, a_StationaryFluid),
- m_Data(NULL),
- m_MaxHeight(a_MaxHeight),
- m_Falloff(a_Falloff)
-{
- m_Data = new FluidData(a_World, this);
-}
-
-
-
-
-
-cClassicFluidSimulator::~cClassicFluidSimulator()
-{
- delete m_Data;
-}
-
-
-
-
-
-void cClassicFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk)
-{
- // TODO: This can be optimized
- BLOCKTYPE BlockType = m_World.GetBlock(a_BlockX, a_BlockY, a_BlockZ);
- if (!IsAllowedBlock(BlockType)) // This should save very much time because it doesn´t have to iterate through all blocks
- {
- return;
- }
-
- std::set< Vector3i > & ActiveFluid = *m_Data->m_ActiveFluid;
- ActiveFluid.insert(Vector3i(a_BlockX, a_BlockY, a_BlockZ));
-}
-
-
-
-
-
-NIBBLETYPE cClassicFluidSimulator::GetHighestLevelAround(int a_BlockX, int a_BlockY, int a_BlockZ)
-{
- NIBBLETYPE Max = m_MaxHeight + m_Falloff;
-
-#define __HIGHLEVEL_CHECK__( x, y, z ) \
- if (IsAllowedBlock(m_World.GetBlock( x, y, z ) ) ) \
- { \
- NIBBLETYPE Meta; \
- if ((Meta = m_World.GetBlockMeta( x, y, z ) ) < Max ) Max = Meta; \
- else if (Meta == m_MaxHeight + m_Falloff) Max = 0; \
- if (Max == 0) return 0; \
- }
-
- __HIGHLEVEL_CHECK__(a_BlockX - 1, a_BlockY, a_BlockZ );
- __HIGHLEVEL_CHECK__(a_BlockX + 1, a_BlockY, a_BlockZ );
- __HIGHLEVEL_CHECK__(a_BlockX, a_BlockY, a_BlockZ - 1);
- __HIGHLEVEL_CHECK__(a_BlockX, a_BlockY, a_BlockZ + 1);
-
- return Max;
-}
-
-
-
-
-
-void cClassicFluidSimulator::Simulate(float a_Dt)
-{
- m_Timer += a_Dt;
-
- if (m_Data->m_ActiveFluid->empty()) // Nothing to do if there is no active fluid ;) saves very little time ;D
- {
- return;
- }
-
- std::swap( m_Data->m_ActiveFluid, m_Data->m_Buffer ); // Swap so blocks can be added to empty ActiveFluid array
- m_Data->m_ActiveFluid->clear();
-
- std::set< Vector3i > & FluidBlocks = *m_Data->m_Buffer;
- for( std::set< Vector3i >::iterator itr = FluidBlocks.begin(); itr != FluidBlocks.end(); ++itr )
- {
- const Vector3i & pos = *itr;
-
- if(UniqueSituation(pos))
- {
- continue;
- }
-
- char BlockID = m_World.GetBlock( pos.x, pos.y, pos.z );
- if( IsAllowedBlock( BlockID ) ) // only care about own fluid
- {
- bool bIsFed = false;
- NIBBLETYPE Meta = m_World.GetBlockMeta( pos.x, pos.y, pos.z );
- NIBBLETYPE Feed = Meta;
- if (BlockID == m_StationaryFluidBlock) Meta = 0;
- if (Meta == 8 ) // Falling fluid
- {
- if (IsAllowedBlock( m_World.GetBlock(pos.x, pos.y+1, pos.z) ) ) // Block above is fluid
- {
- bIsFed = true;
- Meta = 0; // Make it a full block
- }
- }
- else if (Meta < m_Falloff) // It's a full block, so it's always fed
- {
- bIsFed = true;
- }
- else
- {
- if ((Feed = GetHighestLevelAround( pos.x, pos.y, pos.z )) < Meta)
- bIsFed = true;
- }
-
-
- if( bIsFed )
- {
- char DownID = m_World.GetBlock(pos.x, pos.y - 1, pos.z);
- bool bWashedAwayItem = CanWashAway(DownID);
- if ((IsPassableForFluid(DownID) || bWashedAwayItem) && !IsStationaryFluidBlock(DownID) ) // free for fluid
- {
- if (bWashedAwayItem)
- {
- cBlockHandler * Handler = BlockHandler(DownID);
- if (Handler->DoesDropOnUnsuitable())
- {
- Handler->DropBlock(&m_World, NULL, pos.x, pos.y - 1, pos.z);
- }
- }
- if (pos.y > 0)
- {
- m_World.SetBlock(pos.x, pos.y - 1, pos.z, m_FluidBlock, 8); // falling
- ApplyUniqueToNearest(pos - Vector3i(0, 1, 0));
- }
- }
- if (IsSolidBlock(DownID) || (BlockID == m_StationaryFluidBlock)) // Not falling
- {
- if (Feed + m_Falloff < Meta)
- {
- m_World.SetBlock(pos.x, pos.y, pos.z, m_FluidBlock, Feed + m_Falloff);
- ApplyUniqueToNearest(pos);
- }
- else if ((Meta < m_MaxHeight ) || (BlockID == m_StationaryFluidBlock)) // max is the lowest, so it cannot spread
- {
- std::vector< Vector3i > Points = m_Data->GetLowestPoints( pos.x, pos.y, pos.z );
- for( std::vector< Vector3i >::iterator itr = Points.begin(); itr != Points.end(); ++itr )
- {
- Vector3i & p = *itr;
- char BlockID = m_World.GetBlock( p.x, p.y, p.z );
- bool bWashedAwayItem = CanWashAway( BlockID );
-
- if (!IsPassableForFluid(BlockID)) continue;
-
- if (!IsAllowedBlock(BlockID))
- {
- if (bWashedAwayItem)
- {
- cBlockHandler * Handler = BlockHandler(DownID);
- if (Handler->DoesDropOnUnsuitable())
- {
- Handler->DropBlock(&m_World, NULL, p.x, p.y, p.z);
- }
- }
-
- if (p.y == pos.y)
- {
- m_World.SetBlock(p.x, p.y, p.z, m_FluidBlock, Meta + m_Falloff);
- }
- else
- {
- m_World.SetBlock(p.x, p.y, p.z, m_FluidBlock, 8);
- }
- ApplyUniqueToNearest(p);
- }
- else // it's fluid
- {
- NIBBLETYPE PointMeta = m_World.GetBlockMeta(p.x, p.y, p.z);
- if (PointMeta > Meta + m_Falloff)
- {
- // TODO: AddBlock(p.x, p.y, p.z);
- ApplyUniqueToNearest(p);
- }
- }
- }
- }
- }
- }
- else // not fed
- {
- m_World.SetBlock(pos.x, pos.y, pos.z, E_BLOCK_AIR, 0);
- }
- }
- }
-}
-
-
-
-
-
-bool cClassicFluidSimulator::UniqueSituation(Vector3i a_Pos)
-{
- bool result = false;
-
- char BlockId = m_World.GetBlock( a_Pos.x, a_Pos.y, a_Pos.z );
- char Meta = m_World.GetBlockMeta( a_Pos.x, a_Pos.y, a_Pos.z );
-
- if(IsBlockWater(BlockId))
- {
-
- char UpperBlock = m_World.GetBlock( a_Pos.x, a_Pos.y + 1, a_Pos.z );
- if(IsBlockLava(UpperBlock))
- {
- m_World.SetBlock(a_Pos.x, a_Pos.y, a_Pos.z, E_BLOCK_STONE, 0);
- }
-
-
- if(BlockId != E_BLOCK_STATIONARY_WATER)
- {
- char DownBlockId = m_World.GetBlock( a_Pos.x, a_Pos.y-1, a_Pos.z );
- if(IsSolidBlock(DownBlockId))
- {
- Vector3i LevelPoints [] = {
- Vector3i( a_Pos.x-1, a_Pos.y, a_Pos.z ),
- Vector3i( a_Pos.x+1, a_Pos.y, a_Pos.z ),
- Vector3i( a_Pos.x, a_Pos.y, a_Pos.z-1 ),
- Vector3i( a_Pos.x, a_Pos.y, a_Pos.z+1 ),
- };
- int SourceBlocksCount = 0;
- for(int i=0; i<4; i++)
- {
- if (m_World.GetBlock(LevelPoints[i].x, LevelPoints[i].y, LevelPoints[i].z)==E_BLOCK_STATIONARY_WATER)
- {
- SourceBlocksCount++;
- }
- }
- if(SourceBlocksCount>=2)
- {
- m_World.SetBlock(a_Pos.x, a_Pos.y, a_Pos.z, E_BLOCK_STATIONARY_WATER, 0);
- }
- }
-
- }
- }
-
- if(IsBlockLava(BlockId))
- {
- bool bWater = false;
-
- char UpperBlock = m_World.GetBlock( a_Pos.x, a_Pos.y + 1, a_Pos.z );
- if (IsBlockWater(UpperBlock))
- {
- bWater = true;
- }
- else
- {
- Vector3i LevelPoints [] = {
- Vector3i( a_Pos.x-1, a_Pos.y, a_Pos.z ),
- Vector3i( a_Pos.x+1, a_Pos.y, a_Pos.z ),
- Vector3i( a_Pos.x, a_Pos.y, a_Pos.z-1 ),
- Vector3i( a_Pos.x, a_Pos.y, a_Pos.z+1 ),
- };
-
- for(int i=0; i<4; i++)
- {
- if (IsBlockWater(m_World.GetBlock(LevelPoints[i].x, LevelPoints[i].y, LevelPoints[i].z)))
- {
- bWater = true;
- }
- }
- }
-
-
- if (bWater)
- {
- if (BlockId == E_BLOCK_STATIONARY_LAVA)
- {
- m_World.SetBlock(a_Pos.x, a_Pos.y, a_Pos.z, E_BLOCK_OBSIDIAN, 0);
- }
- else if (Meta<m_MaxHeight)
- {
- m_World.SetBlock(a_Pos.x, a_Pos.y, a_Pos.z, E_BLOCK_COBBLESTONE, 0);
- }
- }
- }
-
- return result;
-}
-
-
-
-
-
-void cClassicFluidSimulator::ApplyUniqueToNearest(Vector3i a_Pos)
-{
- Vector3i NearPoints [] = {
- Vector3i( a_Pos.x-1, a_Pos.y, a_Pos.z ),
- Vector3i( a_Pos.x+1, a_Pos.y, a_Pos.z ),
- Vector3i( a_Pos.x, a_Pos.y, a_Pos.z-1 ),
- Vector3i( a_Pos.x, a_Pos.y, a_Pos.z+1 ),
- Vector3i( a_Pos.x, a_Pos.y-1, a_Pos.z )
- };
-
- for (int i = 0; i < ARRAYCOUNT(NearPoints); i++)
- {
- UniqueSituation(NearPoints[i]);
- }
-}
-
-
-
-
diff --git a/source/Simulator/ClassicFluidSimulator.h b/source/Simulator/ClassicFluidSimulator.h deleted file mode 100644 index 330946bff..000000000 --- a/source/Simulator/ClassicFluidSimulator.h +++ /dev/null @@ -1,50 +0,0 @@ -
-// ClassicFluidSimulator.h
-
-// Interfaces to the cClassicFluidSimulator class representing the original MCServer's fluid simulator
-
-
-
-
-
-#pragma once
-
-#include "FluidSimulator.h"
-
-
-
-
-
-class cClassicFluidSimulator :
- public cFluidSimulator
-{
-public:
- cClassicFluidSimulator(cWorld & a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_MaxHeight, NIBBLETYPE a_Falloff);
- ~cClassicFluidSimulator();
-
- // cSimulator overrides:
- virtual void Simulate(float a_Dt) override;
- virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override;
-
-protected:
- NIBBLETYPE GetHighestLevelAround(int a_BlockX, int a_BlockY, int a_BlockZ);
-
- /// Applies special rules such as generation of water between sources, returns false if it is necessary to apply general rules
- bool UniqueSituation(Vector3i a_Pos);
-
- void ApplyUniqueToNearest(Vector3i a_Pos);
-
- float m_Timer;
-
- // fwd: ClassicFluidSimulator.cpp
- class FluidData;
-
- FluidData * m_Data;
-
- NIBBLETYPE m_MaxHeight;
- NIBBLETYPE m_Falloff;
-} ;
-
-
-
-
diff --git a/source/World.cpp b/source/World.cpp index 81aa2e6f7..a42e16dc1 100644 --- a/source/World.cpp +++ b/source/World.cpp @@ -15,7 +15,6 @@ // Simulators: #include "Simulator/SimulatorManager.h" -#include "Simulator/ClassicFluidSimulator.h" #include "Simulator/FloodyFluidSimulator.h" #include "Simulator/FluidSimulator.h" #include "Simulator/FireSimulator.h" @@ -2239,14 +2238,7 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c cFluidSimulator * res = NULL; bool IsWater = (strcmp(a_FluidName, "Water") == 0); // Used for defaults int Rate = 1; - if (NoCaseCompare(SimulatorName, "floody") == 0) - { - int Falloff = a_IniFile.GetValueSetI(SimulatorSectionName, "Falloff", IsWater ? 1 : 2); - int TickDelay = a_IniFile.GetValueSetI(SimulatorSectionName, "TickDelay", IsWater ? 5 : 30); - int NumNeighborsForSource = a_IniFile.GetValueSetI(SimulatorSectionName, "NumNeighborsForSource", IsWater ? 2 : -1); - res = new cFloodyFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource); - } - else if ( + if ( (NoCaseCompare(SimulatorName, "vaporize") == 0) || (NoCaseCompare(SimulatorName, "vaporise") == 0) ) @@ -2264,17 +2256,15 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c } else { - if (NoCaseCompare(SimulatorName, "classic") != 0) + if (NoCaseCompare(SimulatorName, "floody") != 0) { // The simulator name doesn't match anything we have, issue a warning: - LOGWARNING("%s [Physics]:%s specifies an unknown simulator, using the default \"Classic\".", GetIniFileName().c_str(), SimulatorNameKey.c_str()); + LOGWARNING("%s [Physics]:%s specifies an unknown simulator, using the default \"Floody\".", GetIniFileName().c_str(), SimulatorNameKey.c_str()); } - int DefaultFalloff = IsWater ? 1 : 2; - int DefaultMaxHeight = IsWater ? 7 : 6; - int Falloff = a_IniFile.GetValueSetI(SimulatorSectionName, "Falloff", DefaultFalloff); - int MaxHeight = a_IniFile.GetValueSetI(SimulatorSectionName, "MaxHeight", DefaultMaxHeight); - res = new cClassicFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, MaxHeight, Falloff); - Rate = IsWater ? 6 : 12; + int Falloff = a_IniFile.GetValueSetI(SimulatorSectionName, "Falloff", IsWater ? 1 : 2); + int TickDelay = a_IniFile.GetValueSetI(SimulatorSectionName, "TickDelay", IsWater ? 5 : 30); + int NumNeighborsForSource = a_IniFile.GetValueSetI(SimulatorSectionName, "NumNeighborsForSource", IsWater ? 2 : -1); + res = new cFloodyFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource); } m_SimulatorManager->RegisterSimulator(res, Rate); |