summaryrefslogtreecommitdiffstats
path: root/source/packets
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-24 09:58:26 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-24 09:58:26 +0200
commite92b9e7ecbdf2918aab59d4eeb7bb5966430b264 (patch)
tree1a998d44e5faab91c54ea8517dd9fa02b3732ef7 /source/packets
parentAdded plugin name to deprecation messages (diff)
downloadcuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.gz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.bz2
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.lz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.xz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.zst
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.zip
Diffstat (limited to 'source/packets')
-rw-r--r--source/packets/cPacket_PickupSpawn.cpp26
-rw-r--r--source/packets/cPacket_PickupSpawn.h35
-rw-r--r--source/packets/cPacket_SpawnMob.cpp12
-rw-r--r--source/packets/cPacket_SpawnMob.h24
-rw-r--r--source/packets/cPacket_UpdateSign.h2
5 files changed, 46 insertions, 53 deletions
diff --git a/source/packets/cPacket_PickupSpawn.cpp b/source/packets/cPacket_PickupSpawn.cpp
index 0a858ba76..1d937cd6c 100644
--- a/source/packets/cPacket_PickupSpawn.cpp
+++ b/source/packets/cPacket_PickupSpawn.cpp
@@ -10,16 +10,16 @@
int cPacket_PickupSpawn::Parse(cByteBuffer & a_Buffer)
{
int TotalBytes = 0;
- HANDLE_PACKET_READ(ReadBEInt, m_UniqueID, TotalBytes);
- HANDLE_PACKET_READ(ReadBEShort, m_Item, TotalBytes);
- HANDLE_PACKET_READ(ReadChar, m_Count, TotalBytes);
- HANDLE_PACKET_READ(ReadBEShort, m_Health, TotalBytes);
- HANDLE_PACKET_READ(ReadBEInt, m_PosX, TotalBytes);
- HANDLE_PACKET_READ(ReadBEInt, m_PosY, TotalBytes);
- HANDLE_PACKET_READ(ReadBEInt, m_PosZ, TotalBytes);
- HANDLE_PACKET_READ(ReadChar, m_Rotation, TotalBytes);
- HANDLE_PACKET_READ(ReadChar, m_Pitch, TotalBytes);
- HANDLE_PACKET_READ(ReadChar, m_Roll, TotalBytes);
+ HANDLE_PACKET_READ(ReadBEInt, m_UniqueID, TotalBytes);
+ HANDLE_PACKET_READ(ReadBEShort, m_ItemType, TotalBytes);
+ HANDLE_PACKET_READ(ReadChar, m_ItemCount, TotalBytes);
+ HANDLE_PACKET_READ(ReadBEShort, m_ItemDamage, TotalBytes);
+ HANDLE_PACKET_READ(ReadBEInt, m_PosX, TotalBytes);
+ HANDLE_PACKET_READ(ReadBEInt, m_PosY, TotalBytes);
+ HANDLE_PACKET_READ(ReadBEInt, m_PosZ, TotalBytes);
+ HANDLE_PACKET_READ(ReadChar, m_Rotation, TotalBytes);
+ HANDLE_PACKET_READ(ReadChar, m_Pitch, TotalBytes);
+ HANDLE_PACKET_READ(ReadChar, m_Roll, TotalBytes);
return TotalBytes;
}
@@ -31,9 +31,9 @@ void cPacket_PickupSpawn::Serialize(AString & a_Data) const
{
AppendByte (a_Data, m_PacketID);
AppendInteger(a_Data, m_UniqueID);
- AppendShort (a_Data, m_Item);
- AppendByte (a_Data, m_Count);
- AppendShort (a_Data, m_Health);
+ AppendShort (a_Data, m_ItemType);
+ AppendByte (a_Data, m_ItemCount);
+ AppendShort (a_Data, m_ItemDamage);
AppendInteger(a_Data, m_PosX);
AppendInteger(a_Data, m_PosY);
AppendInteger(a_Data, m_PosZ);
diff --git a/source/packets/cPacket_PickupSpawn.h b/source/packets/cPacket_PickupSpawn.h
index ea004b730..91bbba65e 100644
--- a/source/packets/cPacket_PickupSpawn.h
+++ b/source/packets/cPacket_PickupSpawn.h
@@ -12,33 +12,34 @@ class cPacket_PickupSpawn : public cPacket
public:
cPacket_PickupSpawn()
: m_UniqueID( 0 )
- , m_Item( 0 )
- , m_Count( 0 )
- , m_Health( 0 )
+ , m_ItemType( 0 )
+ , m_ItemCount( 0 )
+ , m_ItemDamage( 0 )
, m_PosX( 0 )
, m_PosY( 0 )
, m_PosZ( 0 )
, m_Rotation( 0 )
, m_Pitch( 0 )
, m_Roll( 0 )
- { m_PacketID = E_PICKUP_SPAWN; }
+ {
+ m_PacketID = E_PICKUP_SPAWN;
+ }
+
virtual cPacket* Clone() const { return new cPacket_PickupSpawn(*this); }
- virtual int Parse(cByteBuffer & a_Buffer) override;
+ virtual int Parse(cByteBuffer & a_Buffer) override;
virtual void Serialize(AString & a_Data) const override;
- int m_UniqueID;
- short m_Item;
- char m_Count;
- short m_Health;
- int m_PosX;
- int m_PosY;
- int m_PosZ;
- char m_Rotation;
- char m_Pitch;
- char m_Roll;
-
- static const unsigned int c_Size = 1 + 4 + 2 + 1 + 2 + 4 + 4 + 4 + 1 + 1 + 1;
+ int m_UniqueID;
+ short m_ItemType;
+ char m_ItemCount;
+ short m_ItemDamage;
+ int m_PosX;
+ int m_PosY;
+ int m_PosZ;
+ char m_Rotation;
+ char m_Pitch;
+ char m_Roll;
};
diff --git a/source/packets/cPacket_SpawnMob.cpp b/source/packets/cPacket_SpawnMob.cpp
index 47339c7e0..e00952561 100644
--- a/source/packets/cPacket_SpawnMob.cpp
+++ b/source/packets/cPacket_SpawnMob.cpp
@@ -11,7 +11,6 @@
cPacket_SpawnMob::~cPacket_SpawnMob()
{
if( m_MetaData ) delete [] m_MetaData;
- delete m_Pos;
}
@@ -21,7 +20,6 @@ cPacket_SpawnMob::~cPacket_SpawnMob()
cPacket_SpawnMob::cPacket_SpawnMob()
: m_UniqueID( 0 )
, m_Type( 0 )
- , m_Pos( new Vector3i() )
, m_Yaw( 0 )
, m_Pitch( 0 )
, m_MetaDataSize( 0 )
@@ -37,12 +35,10 @@ cPacket_SpawnMob::cPacket_SpawnMob()
cPacket_SpawnMob::cPacket_SpawnMob( const cPacket_SpawnMob & a_Clone )
{
- m_Pos = new Vector3i();
-
m_PacketID = E_SPAWN_MOB;
m_UniqueID = a_Clone.m_UniqueID;
m_Type = a_Clone.m_Type;
- *m_Pos = *a_Clone.m_Pos;
+ m_Pos = a_Clone.m_Pos;
m_Yaw = a_Clone.m_Yaw;
m_Pitch = a_Clone.m_Pitch;
m_HeadYaw = a_Clone.m_HeadYaw;
@@ -61,9 +57,9 @@ void cPacket_SpawnMob::Serialize(AString & a_Data) const
AppendByte (a_Data, m_PacketID);
AppendInteger (a_Data, m_UniqueID);
AppendByte (a_Data, m_Type);
- AppendInteger (a_Data, m_Pos->x);
- AppendInteger (a_Data, m_Pos->y);
- AppendInteger (a_Data, m_Pos->z);
+ AppendInteger (a_Data, m_Pos.x);
+ AppendInteger (a_Data, m_Pos.y);
+ AppendInteger (a_Data, m_Pos.z);
AppendByte (a_Data, m_Yaw);
AppendByte (a_Data, m_Pitch);
AppendByte (a_Data, m_HeadYaw);
diff --git a/source/packets/cPacket_SpawnMob.h b/source/packets/cPacket_SpawnMob.h
index bc7fbe235..9661da771 100644
--- a/source/packets/cPacket_SpawnMob.h
+++ b/source/packets/cPacket_SpawnMob.h
@@ -2,18 +2,14 @@
#pragma once
#include "cPacket.h"
+#include "../Vector3i.h"
-class Vector3i;
-
-
-
-
-
-class cPacket_SpawnMob : public cPacket
+class cPacket_SpawnMob :
+ public cPacket
{
public:
cPacket_SpawnMob();
@@ -23,15 +19,15 @@ public:
virtual void Serialize(AString & a_Data) const override;
- int m_UniqueID;
- char m_Type;
- Vector3i* m_Pos;
- char m_Yaw;
- char m_Pitch;
- char m_HeadYaw;
+ int m_UniqueID;
+ char m_Type;
+ Vector3i m_Pos;
+ char m_Yaw;
+ char m_Pitch;
+ char m_HeadYaw;
unsigned int m_MetaDataSize;
- char * m_MetaData;
+ char * m_MetaData;
};
diff --git a/source/packets/cPacket_UpdateSign.h b/source/packets/cPacket_UpdateSign.h
index 110ae8253..0704a926a 100644
--- a/source/packets/cPacket_UpdateSign.h
+++ b/source/packets/cPacket_UpdateSign.h
@@ -18,7 +18,7 @@ public:
m_PacketID = E_UPDATE_SIGN;
}
- virtual cPacket * Clone() const { return new cPacket_UpdateSign( *this ); }
+ virtual cPacket * Clone() const { return new cPacket_UpdateSign( *this); }
virtual int Parse(cByteBuffer & a_Buffer) override;
virtual void Serialize(AString & a_Data) const override;