From 9b9a37e5070a4553b0945ea4b770cf75c375bec5 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 19 Apr 2013 08:21:39 +0000 Subject: Fixed Linux compilation, slight code cleanup git-svn-id: http://mc-server.googlecode.com/svn/trunk@1396 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol/Protocol.h | 2 +- source/Protocol/Protocol125.cpp | 21 +++++++++------------ source/Protocol/Protocol125.h | 2 +- source/Protocol/ProtocolRecognizer.cpp | 4 ++-- source/Protocol/ProtocolRecognizer.h | 2 +- 5 files changed, 14 insertions(+), 17 deletions(-) (limited to 'source/Protocol') diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h index 48d32384c..91017dbaf 100644 --- a/source/Protocol/Protocol.h +++ b/source/Protocol/Protocol.h @@ -67,7 +67,7 @@ public: virtual void SendEntRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) = 0; virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0; virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) = 0; - virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iList a_BlocksAffected, float a_PlayerMotionX, float a_PlayerMotionY, float a_PlayerMotionZ) = 0; + virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iArray a_BlocksAffected, const Vector3d & a_PlayerMotion) = 0; virtual void SendGameMode (eGameMode a_GameMode) = 0; virtual void SendHealth (void) = 0; virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) = 0; diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index e588bc595..184bd1d30 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -352,7 +352,7 @@ void cProtocol125::SendEntityStatus(const cEntity & a_Entity, char a_Status) -void cProtocol125::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iList a_BlocksAffected, float a_PlayerMotionX, float a_PlayerMotionY, float a_PlayerMotionZ) +void cProtocol125::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iArray a_BlocksAffected, const Vector3d & a_PlayerMotion) { cCSLock Lock(m_CSPacket); WriteByte(PACKET_EXPLOSION); @@ -360,19 +360,16 @@ void cProtocol125::SendExplosion(double a_BlockX, double a_BlockY, double a_Bloc WriteDouble (a_BlockY); WriteDouble (a_BlockZ); WriteFloat (a_Radius); - WriteInt (a_BlocksAffected.size());//it should be a_RecordCount - /*WriteByte (0); //It should be the record - WriteByte (0); - WriteByte (0);*/ - for (cVector3iList::iterator itr = a_BlocksAffected.begin(); itr != a_BlocksAffected.end(); ++itr) + WriteInt (a_BlocksAffected.size()); + for (cVector3iArray::const_iterator itr = a_BlocksAffected.begin(); itr != a_BlocksAffected.end(); ++itr) { - WriteByte ((Byte)((*itr)->x - a_BlockX)); - WriteByte ((Byte)((*itr)->y - a_BlockY)); - WriteByte ((Byte)((*itr)->z - a_BlockZ)); + WriteByte ((Byte)(itr->x - a_BlockX)); + WriteByte ((Byte)(itr->y - a_BlockY)); + WriteByte ((Byte)(itr->z - a_BlockZ)); } - WriteFloat (a_PlayerMotionX); - WriteFloat (a_PlayerMotionY); - WriteFloat (a_PlayerMotionZ); + WriteFloat ((float)a_PlayerMotion.x); + WriteFloat ((float)a_PlayerMotion.y); + WriteFloat ((float)a_PlayerMotion.z); Flush(); } diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h index 1cf03357d..b7c5ff424 100644 --- a/source/Protocol/Protocol125.h +++ b/source/Protocol/Protocol125.h @@ -44,7 +44,7 @@ public: virtual void SendEntRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override; - virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iList a_BlocksAffected, float a_PlayerMotionX, float a_PlayerMotionY, float a_PlayerMotionZ) override; + virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iArray a_BlocksAffected, const Vector3d & a_PlayerMotion) override; virtual void SendGameMode (eGameMode a_GameMode) override; virtual void SendHealth (void) override; virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) override; diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index ea60dafae..cae267524 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -266,10 +266,10 @@ void cProtocolRecognizer::SendEntityStatus(const cEntity & a_Entity, char a_Stat -void cProtocolRecognizer::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iList a_BlocksAffected, float a_PlayerMotionX, float a_PlayerMotionY, float a_PlayerMotionZ) +void cProtocolRecognizer::SendExplosion(double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iArray a_BlocksAffected, const Vector3d & a_PlayerMotion) { ASSERT(m_Protocol != NULL); - m_Protocol->SendExplosion(a_BlockX,a_BlockY,a_BlockZ,a_Radius, a_BlocksAffected, a_PlayerMotionX, a_PlayerMotionY,a_PlayerMotionZ); + m_Protocol->SendExplosion(a_BlockX,a_BlockY,a_BlockZ,a_Radius, a_BlocksAffected, a_PlayerMotion); } diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index f897f1804..1d301394c 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -71,7 +71,7 @@ public: virtual void SendEntRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override; - virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iList a_BlocksAffected, float a_PlayerMotionX, float a_PlayerMotionY, float a_PlayerMotionZ) override; + virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, cVector3iArray a_BlocksAffected, const Vector3d & a_PlayerMotion) override; virtual void SendGameMode (eGameMode a_GameMode) override; virtual void SendHealth (void) override; virtual void SendInventoryProgress (char a_WindowID, short a_Progressbar, short a_Value) override; -- cgit v1.2.3