diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-06 22:18:50 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-06 22:18:50 +0200 |
commit | 1cca9b13b3d320ff767cfc552413265b2ef6e0d6 (patch) | |
tree | c1227f3f4141dbf2f85767a65cb9d2102a9d4010 /source/cFluidSimulator.cpp | |
parent | BlockIDs, ItemIDs and Metas updated, courtesy of Taugeshtu (diff) | |
download | cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.gz cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.bz2 cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.lz cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.xz cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.tar.zst cuberite-1cca9b13b3d320ff767cfc552413265b2ef6e0d6.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cFluidSimulator.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/source/cFluidSimulator.cpp b/source/cFluidSimulator.cpp index c2df9b1f2..38bf55d77 100644 --- a/source/cFluidSimulator.cpp +++ b/source/cFluidSimulator.cpp @@ -1,13 +1,19 @@ #include "Globals.h"
+
+#include <set>
+#include <queue>
+
#include "cFluidSimulator.h"
#include "cWorld.h"
#include "Vector3i.h"
#include "BlockID.h"
#include "Defines.h"
-#include <set>
-#include "cPickup.h"
#include "cItem.h"
-#include <queue>
+#include "cBlockToPickup.h"
+
+
+
+
//#define DEBUG_FLUID
#ifdef DEBUG_FLUID
@@ -17,6 +23,9 @@ #endif
+
+
+
class cFluidSimulator::FluidData
{
public:
@@ -343,14 +352,15 @@ void cFluidSimulator::Simulate( float a_Dt ) {
char DownID = m_World->GetBlock( pos.x, pos.y-1, pos.z );
bool bWashedAwayItem = CanWashAway( DownID );
- if( (IsPassableForFluid(DownID) || bWashedAwayItem)&&!IsStationaryBlock(DownID) ) // free for fluid
+ if( (IsPassableForFluid(DownID) || bWashedAwayItem) && !IsStationaryBlock(DownID) ) // free for fluid
{
if( bWashedAwayItem )
{
- cPickup* Pickup = new cPickup( pos.x * 32 + 16, (pos.y-1) * 32 + 16, pos.z * 32 + 16, cItem( (ENUM_ITEM_ID)DownID, 1, m_World->GetBlockMeta( pos.x, pos.y-1, pos.z ) ) );
- Pickup->Initialize( m_World );
+ cItems Drops;
+ cBlockToPickup::ToPickup(DownID, m_World->GetBlockMeta(pos.x, pos.y - 1, pos.z), E_ITEM_EMPTY, Drops);
+ m_World->SpawnItemPickups(Drops, pos.x, pos.y - 1, pos.z);
}
- if( pos.y > 0 )
+ if (pos.y > 0)
{
m_World->FastSetBlock( pos.x, pos.y-1, pos.z, m_FluidBlock, 8 ); // falling
AddBlock( pos.x, pos.y-1, pos.z );
@@ -374,14 +384,15 @@ void cFluidSimulator::Simulate( float a_Dt ) char BlockID = m_World->GetBlock( p.x, p.y, p.z );
bool bWashedAwayItem = CanWashAway( BlockID );
- if(!IsPassableForFluid(BlockID)) continue;
+ if (!IsPassableForFluid(BlockID)) continue;
- if( !IsAllowedBlock( BlockID ) )
+ if (!IsAllowedBlock(BlockID))
{
- if( bWashedAwayItem )
+ if (bWashedAwayItem)
{
- cPickup* Pickup = new cPickup( p.x * 32 + 16, p.y * 32 + 16, p.z * 32 + 16, cItem( (ENUM_ITEM_ID)BlockID, 1, m_World->GetBlockMeta( p.x, p.y, p.z ) ) );
- Pickup->Initialize( m_World );
+ cItems Drops;
+ cBlockToPickup::ToPickup(DownID, m_World->GetBlockMeta(p.x, p.y, p.z), E_ITEM_EMPTY, Drops);
+ m_World->SpawnItemPickups(Drops, p.x, p.y, p.z);
}
if( p.y == pos.y )
|