diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-29 23:02:39 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-29 23:02:39 +0200 |
commit | f1d62b77cd1f9eb31cf508ee5eb54e09b9ca10e5 (patch) | |
tree | c57d967bab26888ae83692ab09cbbc7fabbae6f5 /source/packets/cPacket_Player.cpp | |
parent | Added a check if torch is placed on the bottom face, temporarily fix the assert. (diff) | |
download | cuberite-f1d62b77cd1f9eb31cf508ee5eb54e09b9ca10e5.tar cuberite-f1d62b77cd1f9eb31cf508ee5eb54e09b9ca10e5.tar.gz cuberite-f1d62b77cd1f9eb31cf508ee5eb54e09b9ca10e5.tar.bz2 cuberite-f1d62b77cd1f9eb31cf508ee5eb54e09b9ca10e5.tar.lz cuberite-f1d62b77cd1f9eb31cf508ee5eb54e09b9ca10e5.tar.xz cuberite-f1d62b77cd1f9eb31cf508ee5eb54e09b9ca10e5.tar.zst cuberite-f1d62b77cd1f9eb31cf508ee5eb54e09b9ca10e5.zip |
Diffstat (limited to 'source/packets/cPacket_Player.cpp')
-rw-r--r-- | source/packets/cPacket_Player.cpp | 166 |
1 files changed, 0 insertions, 166 deletions
diff --git a/source/packets/cPacket_Player.cpp b/source/packets/cPacket_Player.cpp deleted file mode 100644 index d0acc17d0..000000000 --- a/source/packets/cPacket_Player.cpp +++ /dev/null @@ -1,166 +0,0 @@ - -// cPacket_Player.cpp - -/* Implements the player-related packets: - - PlayerAbilities (0xca) - - PlayerListItem (0xc9) - - PlayerLook (0x0c) - - PlayerMoveLook (0x0d) - - PlayerPosition (0x0b) -*/ - -#include "Globals.h" - -#include "cPacket_Player.h" -#include "../cPlayer.h" -#include "../cChatColor.h" - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerAbilities: - -int cPacket_PlayerAbilities::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBool, m_Invulnerable, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsFlying, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_CanFly, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_InstaMine, TotalBytes); - return TotalBytes; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerListItem: - -cPacket_PlayerListItem::cPacket_PlayerListItem(const AString & a_PlayerName, bool a_Online, short a_Ping) -{ - m_PacketID = E_PLAYER_LIST_ITEM; - m_PlayerName = a_PlayerName; - m_Online = a_Online; - m_Ping = a_Ping; -} - - - - - -int cPacket_PlayerListItem::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEUTF16String16, m_PlayerName, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_Online, TotalBytes); - HANDLE_PACKET_READ(ReadBEShort, m_Ping, TotalBytes); - return TotalBytes; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerLook: - -cPacket_PlayerLook::cPacket_PlayerLook( cPlayer* a_Player ) -{ - m_PacketID = E_PLAYERLOOK; - m_Rotation = a_Player->GetRotation(); - m_Pitch = a_Player->GetPitch(); - m_IsOnGround = a_Player->IsOnGround(); -} - - - - - -int cPacket_PlayerLook::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEFloat, m_Rotation, TotalBytes); - HANDLE_PACKET_READ(ReadBEFloat, m_Pitch, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsOnGround, TotalBytes); - return TotalBytes; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerMoveLook: - -cPacket_PlayerMoveLook::cPacket_PlayerMoveLook(const cPlayer & a_Player) -{ - m_PacketID = E_PLAYERMOVELOOK; - m_PosX = a_Player.GetPosX(); - m_PosY = a_Player.GetPosY() + 0.03; // Add a small amount so that the player doesn't start inside a block - m_PosZ = a_Player.GetPosZ(); - m_Stance = a_Player.GetStance() + 0.03; // Add a small amount so that the player doesn't start inside a block - m_Rotation = a_Player.GetRotation(); - m_Pitch = a_Player.GetPitch(); - m_IsOnGround = a_Player.IsOnGround(); -} - - - - - -int cPacket_PlayerMoveLook::Parse(cByteBuffer & a_Buffer) -{ - // NOTE that Stance and Y are swapped when sent C->S vs S->C - // This is the C->S case: - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEDouble, m_PosX, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_PosY, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_Stance, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_PosZ, TotalBytes); - HANDLE_PACKET_READ(ReadBEFloat, m_Rotation, TotalBytes); - HANDLE_PACKET_READ(ReadBEFloat, m_Pitch, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsOnGround, TotalBytes); - // LOGD("Recv PML: {%0.2f, %0.2f, %0.2f}, Stance %0.2f, Gnd: %d", m_PosX, m_PosY, m_PosZ, m_Stance, m_IsOnGround ? 1 : 0); - return TotalBytes; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerPosition: - -cPacket_PlayerPosition::cPacket_PlayerPosition(const cPlayer & a_Player) -{ - m_PacketID = E_PLAYERPOS; - - m_PosX = a_Player.GetPosX(); - m_PosY = a_Player.GetPosY(); - m_PosZ = a_Player.GetPosZ(); - m_Stance = a_Player.GetStance(); - m_IsOnGround = a_Player.IsOnGround(); -} - - - - - -int cPacket_PlayerPosition::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEDouble, m_PosX, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_PosY, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_Stance, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_PosZ, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsOnGround, TotalBytes); - // LOGD("Recv PlayerPos: {%0.2f %0.2f %0.2f}, Stance %0.2f, Gnd: %d", m_PosX, m_PosY, m_PosZ, m_Stance, m_IsOnGround ? 1 : 0); - return TotalBytes; -} - - - - |