diff options
Diffstat (limited to '')
-rw-r--r-- | source/ClientHandle.cpp | 8 | ||||
-rw-r--r-- | source/ClientHandle.h | 1 | ||||
-rw-r--r-- | source/Defines.h | 8 | ||||
-rw-r--r-- | source/FallingBlock.cpp | 64 | ||||
-rw-r--r-- | source/FallingBlock.h | 44 | ||||
-rw-r--r-- | source/FireSimulator.cpp | 8 | ||||
-rw-r--r-- | source/FireSimulator.h | 12 | ||||
-rw-r--r-- | source/FluidSimulator.cpp | 8 | ||||
-rw-r--r-- | source/FluidSimulator.h | 14 | ||||
-rw-r--r-- | source/LavaSimulator.cpp | 2 | ||||
-rw-r--r-- | source/LavaSimulator.h | 2 | ||||
-rw-r--r-- | source/Protocol/Protocol.h | 1 | ||||
-rw-r--r-- | source/Protocol/Protocol125.cpp | 25 | ||||
-rw-r--r-- | source/Protocol/Protocol125.h | 1 | ||||
-rw-r--r-- | source/Protocol/ProtocolRecognizer.cpp | 10 | ||||
-rw-r--r-- | source/Protocol/ProtocolRecognizer.h | 1 | ||||
-rw-r--r-- | source/RedstoneSimulator.h | 6 | ||||
-rw-r--r-- | source/SandSimulator.cpp | 45 | ||||
-rw-r--r-- | source/SandSimulator.h | 9 | ||||
-rw-r--r-- | source/Simulator.h | 2 | ||||
-rw-r--r-- | source/WaterSimulator.cpp | 2 | ||||
-rw-r--r-- | source/WaterSimulator.h | 2 | ||||
-rw-r--r-- | source/WebAdmin.h | 2 |
23 files changed, 221 insertions, 56 deletions
diff --git a/source/ClientHandle.cpp b/source/ClientHandle.cpp index 8d2ea359d..8ac773d48 100644 --- a/source/ClientHandle.cpp +++ b/source/ClientHandle.cpp @@ -1483,6 +1483,14 @@ void cClientHandle::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Blo +void cClientHandle::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) +{ + m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData, a_SpeedX, a_SpeedY, a_SpeedZ); +} + + + + void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) { diff --git a/source/ClientHandle.h b/source/ClientHandle.h index 94f132ea0..5469a5ca5 100644 --- a/source/ClientHandle.h +++ b/source/ClientHandle.h @@ -118,6 +118,7 @@ public: void SendWindowClose (char a_WindowID); void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots); void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ); + void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ); const AString & GetUsername(void) const; //tolua_export diff --git a/source/Defines.h b/source/Defines.h index a5b70a1a5..8ad71475b 100644 --- a/source/Defines.h +++ b/source/Defines.h @@ -81,7 +81,7 @@ inline bool IsValidItem( int a_ItemID ) //tolua_export -inline bool IsBlockWater(char a_BlockID) +inline bool IsBlockWater(BLOCKTYPE a_BlockID) { return (a_BlockID == E_BLOCK_WATER || a_BlockID == E_BLOCK_STATIONARY_WATER); } @@ -90,18 +90,18 @@ inline bool IsBlockWater(char a_BlockID) -inline bool IsBlockLava(char a_BlockID) +inline bool IsBlockLava(BLOCKTYPE a_BlockID) { return (a_BlockID == E_BLOCK_LAVA || a_BlockID == E_BLOCK_STATIONARY_LAVA); } -inline bool IsBlockLiquid(char a_BlockID) +inline bool IsBlockLiquid(BLOCKTYPE a_BlockID) { return IsBlockWater(a_BlockID) || IsBlockLava(a_BlockID); } -inline bool IsBlockTypeOfDirt(char a_BlockID) +inline bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockID) { switch (a_BlockID) { diff --git a/source/FallingBlock.cpp b/source/FallingBlock.cpp new file mode 100644 index 000000000..1ed9cd5ed --- /dev/null +++ b/source/FallingBlock.cpp @@ -0,0 +1,64 @@ +#include "Globals.h"
+
+#include "FallingBlock.h"
+#include "World.h"
+#include "ClientHandle.h"
+
+
+CLASS_DEFINITION( cFallingBlock, cEntity )
+
+
+cFallingBlock::cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType)
+ : super( a_BlockPosition.x + 0.5f, a_BlockPosition.y + 0.5f, a_BlockPosition.z + 0.5f )
+ , m_BlockType( a_BlockType )
+ , m_OriginalPosition( a_BlockPosition )
+ , m_SpeedY( 0 )
+{
+}
+
+
+
+
+
+cFallingBlock::~cFallingBlock()
+{
+}
+
+
+
+
+
+void cFallingBlock::Initialize(cWorld * a_World)
+{
+ super::Initialize( a_World );
+ a_World->BroadcastSpawn(*this);
+}
+
+
+
+
+
+void cFallingBlock::SpawnOn(cClientHandle & a_ClientHandle)
+{
+ a_ClientHandle.SendSpawnObject(*this, 70, m_BlockType, 0, 0, 0);
+}
+
+
+
+
+
+void cFallingBlock::Tick(float a_Dt)
+{
+ float MilliDt = a_Dt * 0.001f;
+ m_SpeedY -= MilliDt * 9.8f;
+ m_Pos.y += m_SpeedY * MilliDt;
+
+ //GetWorld()->BroadcastTeleportEntity(*this); // Testing position
+
+ Vector3i BlockPos( m_OriginalPosition.x, (int)(m_Pos.y-0.5), m_OriginalPosition.z );
+ if( !IsPassable( GetWorld()->GetBlock( BlockPos ) ) )
+ {
+ Destroy();
+ GetWorld()->SetBlock( BlockPos.x, BlockPos.y+1, BlockPos.z, m_BlockType, 0 );
+ }
+}
\ No newline at end of file diff --git a/source/FallingBlock.h b/source/FallingBlock.h new file mode 100644 index 000000000..08e3302e1 --- /dev/null +++ b/source/FallingBlock.h @@ -0,0 +1,44 @@ +
+#pragma once
+
+#include "Entity.h"
+#include "Defines.h"
+
+
+
+
+class cPlayer;
+class cItem;
+
+
+
+
+
+
+class cFallingBlock : public cEntity
+{
+ typedef cEntity super;
+public:
+ CLASS_PROTOTYPE();
+
+ cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType);
+ ~cFallingBlock();
+
+ virtual void Initialize(cWorld * a_World) override;
+ virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
+ virtual void Tick(float a_Dt) override;
+private:
+ BLOCKTYPE m_BlockType;
+ Vector3i m_OriginalPosition;
+
+ float m_SpeedY;
+
+ static bool IsPassable( BLOCKTYPE a_BlockType )
+ {
+ return a_BlockType == E_BLOCK_AIR || IsBlockLiquid( a_BlockType );
+ }
+};
+
+
+
+
diff --git a/source/FireSimulator.cpp b/source/FireSimulator.cpp index 9a08524ef..662c4f2d0 100644 --- a/source/FireSimulator.cpp +++ b/source/FireSimulator.cpp @@ -48,7 +48,7 @@ void cFireSimulator::Simulate( float a_Dt ) } -bool cFireSimulator::IsAllowedBlock( char a_BlockID ) +bool cFireSimulator::IsAllowedBlock( BLOCKTYPE a_BlockID ) { return a_BlockID == E_BLOCK_FIRE || IsBlockLava(a_BlockID); @@ -78,12 +78,12 @@ void cFireSimulator::_AddBlock(int a_X, int a_Y, int a_Z) } -bool cFireSimulator::IsForeverBurnable( char a_BlockID ) +bool cFireSimulator::IsForeverBurnable( BLOCKTYPE a_BlockID ) { return a_BlockID == E_BLOCK_BLOODSTONE; } -bool cFireSimulator::IsBurnable( char a_BlockID ) +bool cFireSimulator::IsBurnable( BLOCKTYPE a_BlockID ) { return a_BlockID == E_BLOCK_PLANKS || a_BlockID == E_BLOCK_LEAVES @@ -95,7 +95,7 @@ bool cFireSimulator::IsBurnable( char a_BlockID ) || a_BlockID == E_BLOCK_VINES; } -bool cFireSimulator::FiresForever( char a_BlockID ) +bool cFireSimulator::FiresForever( BLOCKTYPE a_BlockID ) { return a_BlockID != E_BLOCK_FIRE; } diff --git a/source/FireSimulator.h b/source/FireSimulator.h index 863fa9835..f879585ab 100644 --- a/source/FireSimulator.h +++ b/source/FireSimulator.h @@ -21,16 +21,16 @@ public: cFireSimulator( cWorld* a_World ); ~cFireSimulator(); - virtual void Simulate( float a_Dt ); + virtual void Simulate( float a_Dt ) override; - virtual bool IsAllowedBlock( char a_BlockID ); + virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override; - virtual bool IsBurnable( char a_BlockID ); - virtual bool IsForeverBurnable( char a_BlockID ); - virtual bool FiresForever( char a_BlockID ); + virtual bool IsBurnable( BLOCKTYPE a_BlockID ); + virtual bool IsForeverBurnable( BLOCKTYPE a_BlockID ); + virtual bool FiresForever( BLOCKTYPE a_BlockID ); protected: - virtual void AddBlock(int a_X, int a_Y, int a_Z); + virtual void AddBlock(int a_X, int a_Y, int a_Z) override; virtual void _AddBlock(int a_X, int a_Y, int a_Z); virtual bool BurnBlockAround(int a_X, int a_Y, int a_Z); virtual bool BurnBlock(int a_X, int a_Y, int a_Z); diff --git a/source/FluidSimulator.cpp b/source/FluidSimulator.cpp index d8007b9bf..8cbe5054e 100644 --- a/source/FluidSimulator.cpp +++ b/source/FluidSimulator.cpp @@ -436,7 +436,7 @@ void cFluidSimulator::Simulate( float a_Dt ) -bool cFluidSimulator::IsPassableForFluid(char a_BlockID) +bool cFluidSimulator::IsPassableForFluid(BLOCKTYPE a_BlockID) { return a_BlockID == E_BLOCK_AIR || a_BlockID == E_BLOCK_FIRE @@ -448,7 +448,7 @@ bool cFluidSimulator::IsPassableForFluid(char a_BlockID) -bool cFluidSimulator::IsStationaryBlock (char a_BlockID) +bool cFluidSimulator::IsStationaryBlock (BLOCKTYPE a_BlockID) { return a_BlockID == m_StationaryFluidBlock; } @@ -457,7 +457,7 @@ bool cFluidSimulator::IsStationaryBlock (char a_BlockID) -bool cFluidSimulator::CanWashAway( char a_BlockID ) +bool cFluidSimulator::CanWashAway( BLOCKTYPE a_BlockID ) { switch( a_BlockID ) { @@ -476,7 +476,7 @@ bool cFluidSimulator::CanWashAway( char a_BlockID ) -bool cFluidSimulator::IsSolidBlock( char a_BlockID ) +bool cFluidSimulator::IsSolidBlock( BLOCKTYPE a_BlockID ) { return !(a_BlockID == E_BLOCK_AIR || a_BlockID == E_BLOCK_FIRE diff --git a/source/FluidSimulator.h b/source/FluidSimulator.h index 1ec254595..20d86b1b8 100644 --- a/source/FluidSimulator.h +++ b/source/FluidSimulator.h @@ -29,11 +29,11 @@ public: //Gets the flowing direction. if a_Over is true also the block over the current block affects the direction (standard) Direction GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a_Over = true); - virtual bool IsAllowedBlock( char a_BlockID ) = 0; - virtual bool IsStationaryBlock( char a_BlockID); - virtual bool IsPassableForFluid( char a_BlockID ); - bool CanWashAway( char a_BlockID ); - bool IsSolidBlock(char a_BlockID); + virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) = 0; + virtual bool IsStationaryBlock( BLOCKTYPE a_BlockID); + virtual bool IsPassableForFluid( BLOCKTYPE a_BlockID ); + bool CanWashAway( BLOCKTYPE a_BlockID ); + bool IsSolidBlock(BLOCKTYPE a_BlockID); protected: virtual void AddBlock( int a_X, int a_Y, int a_Z); char GetHighestLevelAround( int a_X, int a_Y, int a_Z ); @@ -47,8 +47,8 @@ protected: FluidData* m_Data; //Customize - char m_FluidBlock; - char m_StationaryFluidBlock; + BLOCKTYPE m_FluidBlock; + BLOCKTYPE m_StationaryFluidBlock; char m_MaxHeight; char m_FlowReduction; diff --git a/source/LavaSimulator.cpp b/source/LavaSimulator.cpp index 15cf5591c..4c3636f09 100644 --- a/source/LavaSimulator.cpp +++ b/source/LavaSimulator.cpp @@ -14,7 +14,7 @@ cLavaSimulator::cLavaSimulator(cWorld *a_World) } -bool cLavaSimulator::IsAllowedBlock(char a_BlockID) +bool cLavaSimulator::IsAllowedBlock(BLOCKTYPE a_BlockID) { return IsBlockLava(a_BlockID); }
\ No newline at end of file diff --git a/source/LavaSimulator.h b/source/LavaSimulator.h index 3a9159f1c..43831ca17 100644 --- a/source/LavaSimulator.h +++ b/source/LavaSimulator.h @@ -6,7 +6,7 @@ class cLavaSimulator : public cFluidSimulator public: cLavaSimulator( cWorld* a_World ); - virtual bool IsAllowedBlock( char a_BlockID ); + virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override; };
\ No newline at end of file diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h index c187387c1..c98f2729b 100644 --- a/source/Protocol/Protocol.h +++ b/source/Protocol/Protocol.h @@ -85,6 +85,7 @@ public: virtual void SendWindowClose (char a_WindowID) = 0;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) = 0;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) = 0;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) = 0;
/// Returns the ServerID used for authentication through session.minecraft.net
virtual AString GetAuthServerID(void) = 0;
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index bec6a19b6..53b9b55db 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -52,7 +52,7 @@ enum PACKET_PLAYER_SPAWN = 0x14,
PACKET_PICKUP_SPAWN = 0x15,
PACKET_COLLECT_PICKUP = 0x16,
- PACKET_ADD_VEHICLE = 0x17,
+ PACKET_SPAWN_OBJECT = 0x17,
PACKET_SPAWN_MOB = 0x18,
PACKET_DESTROY_ENTITY = 0x1d,
PACKET_ENTITY = 0x1e,
@@ -794,6 +794,29 @@ void cProtocol125::SendUseBed(const cEntity & a_Entity, int a_BlockX, int a_Bloc +void cProtocol125::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ)
+{
+ cCSLock Lock(m_CSPacket);
+ WriteByte(PACKET_SPAWN_OBJECT);
+ WriteInt (a_Entity.GetUniqueID());
+ WriteByte(a_ObjectType);
+ WriteInt ((int)(a_Entity.GetPosX() * 32));
+ WriteInt ((int)(a_Entity.GetPosY() * 32));
+ WriteInt ((int)(a_Entity.GetPosZ() * 32));
+ WriteInt (a_ObjectData);
+ if( a_ObjectData != 0 )
+ {
+ WriteShort( a_SpeedX );
+ WriteShort( a_SpeedY );
+ WriteShort( a_SpeedZ );
+ }
+ Flush();
+}
+
+
+
+
+
AString cProtocol125::GetAuthServerID(void)
{
// http://wiki.vg/wiki/index.php?title=Session&oldid=2262
diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h index 84dfa7a72..898a53008 100644 --- a/source/Protocol/Protocol125.h +++ b/source/Protocol/Protocol125.h @@ -69,6 +69,7 @@ public: virtual void SendWindowClose (char a_WindowID) override;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) override;
virtual AString GetAuthServerID(void) override;
diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index edd34b7dc..3d71c95ee 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -495,6 +495,16 @@ void cProtocolRecognizer::SendUseBed(const cEntity & a_Entity, int a_BlockX, int +void cProtocolRecognizer::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ)
+{
+ ASSERT(m_Protocol != NULL);
+ m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData, a_SpeedX, a_SpeedY, a_SpeedZ);
+}
+
+
+
+
+
AString cProtocolRecognizer::GetAuthServerID(void)
{
ASSERT(m_Protocol != NULL);
diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index 2e2f5a9e9..a5099367a 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -80,6 +80,7 @@ public: virtual void SendWindowClose (char a_WindowID) override;
virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override;
+ virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ) override;
virtual AString GetAuthServerID(void) override;
diff --git a/source/RedstoneSimulator.h b/source/RedstoneSimulator.h index 3a845bf6b..13f716cec 100644 --- a/source/RedstoneSimulator.h +++ b/source/RedstoneSimulator.h @@ -10,10 +10,10 @@ public: cRedstoneSimulator( cWorld* a_World ); ~cRedstoneSimulator(); - virtual void Simulate( float a_Dt ); - virtual bool IsAllowedBlock( char a_BlockID ) { return true; } + virtual void Simulate( float a_Dt ) override; + virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override { return true; } - virtual void WakeUp( int a_X, int a_Y, int a_Z ); + virtual void WakeUp( int a_X, int a_Y, int a_Z ) override; enum eRedstoneDirection { diff --git a/source/SandSimulator.cpp b/source/SandSimulator.cpp index 1dd9d3d88..f8cfdad37 100644 --- a/source/SandSimulator.cpp +++ b/source/SandSimulator.cpp @@ -6,7 +6,7 @@ #include "Vector3i.h" #include "BlockID.h" #include "Defines.h" - +#include "FallingBlock.h" @@ -19,12 +19,20 @@ cSandSimulator::cSandSimulator( cWorld* a_World ) } + + + + cSandSimulator::~cSandSimulator() { delete m_Buffer; delete m_Blocks; } + + + + void cSandSimulator::Simulate( float a_Dt ) { m_Buffer->clear(); @@ -33,31 +41,39 @@ void cSandSimulator::Simulate( float a_Dt ) for( BlockList::iterator itr = m_Buffer->begin(); itr != m_Buffer->end(); ++itr ) { Vector3i Pos = *itr; - char BlockID = m_World->GetBlock(Pos.x, Pos.y, Pos.z); + BLOCKTYPE BlockID = m_World->GetBlock(Pos.x, Pos.y, Pos.z); if(!IsAllowedBlock(BlockID)) continue; - char BottomBlock = m_World->GetBlock( Pos.x, Pos.y - 1, Pos.z ); + BLOCKTYPE BottomBlock = m_World->GetBlock( Pos.x, Pos.y - 1, Pos.z ); if( IsPassable(BottomBlock) ) { - m_World->SetBlock( Pos.x, Pos.y, Pos.z, E_BLOCK_AIR, 0 ); - m_World->SetBlock( Pos.x, Pos.y - 1, Pos.z, BlockID, 0 ); + cFallingBlock * FallingBlock = new cFallingBlock( Pos, BlockID ); + FallingBlock->Initialize( m_World ); + m_World->SetBlock( Pos.x, Pos.y, Pos.z, E_BLOCK_AIR, 0 ); } } } -bool cSandSimulator::IsAllowedBlock( char a_BlockID ) + + + +bool cSandSimulator::IsAllowedBlock( BLOCKTYPE a_BlockID ) { return a_BlockID == E_BLOCK_SAND || a_BlockID == E_BLOCK_GRAVEL; } + + + + void cSandSimulator::AddBlock(int a_X, int a_Y, int a_Z) { - if(!IsAllowedBlock(m_World->GetBlock(a_X, a_Y, a_Z))) //This should save very much time because it doesn´t have to iterate through all blocks + if(!IsAllowedBlock(m_World->GetBlock(a_X, a_Y, a_Z))) return; Vector3i Block(a_X, a_Y, a_Z); @@ -71,21 +87,16 @@ void cSandSimulator::AddBlock(int a_X, int a_Y, int a_Z) } m_Blocks->push_back(Block); - } -bool cSandSimulator::IsPassable( char a_BlockID ) + + + + +bool cSandSimulator::IsPassable( BLOCKTYPE a_BlockID ) { return a_BlockID == E_BLOCK_AIR || IsBlockWater(a_BlockID) || IsBlockLava(a_BlockID) || a_BlockID == E_BLOCK_FIRE; - -} - -void cSandSimulator::WakeUp( int a_X, int a_Y, int a_Z ) -{ - //Nothing else needs to be simulated :D (Bugs not included :s) - AddBlock( a_X, a_Y+1, a_Z ); - AddBlock( a_X, a_Y, a_Z ); } diff --git a/source/SandSimulator.h b/source/SandSimulator.h index 6dbac1974..37db2d40f 100644 --- a/source/SandSimulator.h +++ b/source/SandSimulator.h @@ -21,14 +21,13 @@ public: cSandSimulator( cWorld* a_World ); ~cSandSimulator(); - virtual void Simulate( float a_Dt ); - virtual void WakeUp( int a_X, int a_Y, int a_Z ); + virtual void Simulate( float a_Dt ) override; - virtual bool IsAllowedBlock( char a_BlockID ); - virtual bool IsPassable( char a_BlockID ); + virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override; + virtual bool IsPassable( BLOCKTYPE a_BlockID ); protected: - virtual void AddBlock(int a_X, int a_Y, int a_Z); + virtual void AddBlock(int a_X, int a_Y, int a_Z) override; typedef std::list <Vector3i> BlockList; BlockList * m_Blocks; diff --git a/source/Simulator.h b/source/Simulator.h index 158e74b99..af823b00b 100644 --- a/source/Simulator.h +++ b/source/Simulator.h @@ -11,7 +11,7 @@ public: virtual void Simulate( float a_Dt ) = 0; virtual void WakeUp( int a_X, int a_Y, int a_Z ); - virtual bool IsAllowedBlock( char a_BlockID ) = 0; + virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) = 0; protected: virtual void AddBlock(int a_X, int a_Y, int a_Z) = 0; diff --git a/source/WaterSimulator.cpp b/source/WaterSimulator.cpp index 48389ccd4..66acaea6a 100644 --- a/source/WaterSimulator.cpp +++ b/source/WaterSimulator.cpp @@ -15,7 +15,7 @@ cWaterSimulator::cWaterSimulator(cWorld *a_World) } -bool cWaterSimulator::IsAllowedBlock(char a_BlockID) +bool cWaterSimulator::IsAllowedBlock(BLOCKTYPE a_BlockID) { return IsBlockWater(a_BlockID); } diff --git a/source/WaterSimulator.h b/source/WaterSimulator.h index aa81a74f6..04a208368 100644 --- a/source/WaterSimulator.h +++ b/source/WaterSimulator.h @@ -6,6 +6,6 @@ class cWaterSimulator : public cFluidSimulator public: cWaterSimulator( cWorld* a_World ); - virtual bool IsAllowedBlock( char a_BlockID ); + virtual bool IsAllowedBlock( BLOCKTYPE a_BlockID ) override; };
\ No newline at end of file diff --git a/source/WebAdmin.h b/source/WebAdmin.h index f50de3f64..8e2d4147b 100644 --- a/source/WebAdmin.h +++ b/source/WebAdmin.h @@ -43,6 +43,8 @@ public: PluginList GetPlugins() { return m_Plugins; } static void Request_Handler(webserver::http_request* r); + + int GetPort() { return m_Port; } private: #ifdef _WIN32 |