summaryrefslogtreecommitdiffstats
path: root/source/cClientHandle.cpp
diff options
context:
space:
mode:
authoradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-26 22:52:19 +0200
committeradmin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-26 22:52:19 +0200
commit88270be66928f3b73b73fc1f3b26a74358089223 (patch)
tree736a03b5343df0693638f59b39a9f3599d7d9057 /source/cClientHandle.cpp
parentMoved GAMEMODE declaration to a single place... cPacket.h. Player can't take damage any more but can still sometimes die on spawn. Not sure why. Falling through the void does not kill you yet. (diff)
downloadcuberite-88270be66928f3b73b73fc1f3b26a74358089223.tar
cuberite-88270be66928f3b73b73fc1f3b26a74358089223.tar.gz
cuberite-88270be66928f3b73b73fc1f3b26a74358089223.tar.bz2
cuberite-88270be66928f3b73b73fc1f3b26a74358089223.tar.lz
cuberite-88270be66928f3b73b73fc1f3b26a74358089223.tar.xz
cuberite-88270be66928f3b73b73fc1f3b26a74358089223.tar.zst
cuberite-88270be66928f3b73b73fc1f3b26a74358089223.zip
Diffstat (limited to 'source/cClientHandle.cpp')
-rw-r--r--source/cClientHandle.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index c5c6dbd20..3fef88bfc 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -482,10 +482,10 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
cWorld* World = cRoot::Get()->GetWorld();
char OldBlock = World->GetBlock(PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ);
char MetaData = World->GetBlockMeta(PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ);
- bool bBroken = (PacketData->m_Status == 0x02) || g_BlockOneHitDig[(int)OldBlock] || ( (PacketData->m_Status == 0x00) && (cPacket::GAMEMODE == 1) ); //need to change to check for client's gamemode.
+ bool bBroken = (PacketData->m_Status == 0x02) || g_BlockOneHitDig[(int)OldBlock] || ( (PacketData->m_Status == 0x00) && (cRoot::Get()->GetWorld()->GetGameMode() == 1) ); //need to change to check for client's gamemode.
cItem PickupItem;
- if( bBroken && !(cPacket::GAMEMODE == 1) ) // broken
+ if( bBroken && !(cRoot::Get()->GetWorld()->GetGameMode() == 1) ) // broken
{
ENUM_ITEM_ID PickupID = cBlockToPickup::ToPickup( (ENUM_BLOCK_ID)OldBlock, m_Player->GetInventory().GetEquippedItem().m_ItemID );
PickupItem.m_ItemID = PickupID;
@@ -581,7 +581,7 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
{
cPacket_BlockPlace* PacketData = reinterpret_cast<cPacket_BlockPlace*>(a_Packet);
cItem & Equipped = m_Player->GetInventory().GetEquippedItem();
- if( Equipped.m_ItemID != PacketData->m_ItemType ) // Not valid
+ if( (Equipped.m_ItemID != PacketData->m_ItemType) ) // Not valid
{
LOGWARN("Player %s tried to place a block that was not selected! (could indicate bot)", GetUsername() );
break;
@@ -913,6 +913,7 @@ void cClientHandle::SendLoginResponse()
cPacket_Login LoginResponse;
LoginResponse.m_ProtocolVersion = m_Player->GetUniqueID();
//LoginResponse.m_Username = "";
+ LoginResponse.m_ServerMode = cRoot::Get()->GetWorld()->GetGameMode(); //set gamemode from world.
LoginResponse.m_MapSeed = 0;
LoginResponse.m_Dimension = 0;
Send( LoginResponse );