From 4ce0c5a983bbb82a0a8091ad735c6ec494c912e2 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 21 Feb 2013 21:55:36 +0000 Subject: Moved the Speed member into cEntity class instead of its descendants. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1222 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol/Protocol.h | 2 +- source/Protocol/Protocol125.cpp | 10 +++++----- source/Protocol/Protocol125.h | 2 +- source/Protocol/Protocol14x.cpp | 9 +++++---- source/Protocol/Protocol14x.h | 2 +- source/Protocol/ProtocolRecognizer.cpp | 4 ++-- source/Protocol/ProtocolRecognizer.h | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-) (limited to 'source/Protocol') diff --git a/source/Protocol/Protocol.h b/source/Protocol/Protocol.h index ab35adbb5..876ab51f5 100644 --- a/source/Protocol/Protocol.h +++ b/source/Protocol/Protocol.h @@ -83,7 +83,7 @@ public: virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0; virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) = 0; virtual void SendSpawnMob (const cMonster & a_Mob) = 0; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ, Byte a_Yaw, Byte a_Pitch) = 0; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) = 0; virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) = 0; virtual void SendTeleportEntity (const cEntity & a_Entity) = 0; virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) = 0; diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp index d45ea8837..4fef5623e 100644 --- a/source/Protocol/Protocol125.cpp +++ b/source/Protocol/Protocol125.cpp @@ -618,7 +618,7 @@ void cProtocol125::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_Src void cProtocol125::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) { // This protocol version implements falling blocks using the spawn object / vehicle packet: - SendSpawnObject(a_FallingBlock, 70, a_FallingBlock.GetBlockType(), 0, 0, 0, 0, 0); + SendSpawnObject(a_FallingBlock, 70, a_FallingBlock.GetBlockType(), 0, 0); } @@ -644,7 +644,7 @@ void cProtocol125::SendSpawnMob(const cMonster & a_Mob) -void cProtocol125::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ, Byte a_Yaw, Byte a_Pitch) +void cProtocol125::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) { UNUSED(a_Yaw); UNUSED(a_Pitch); @@ -659,9 +659,9 @@ void cProtocol125::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, WriteInt (a_ObjectData); if (a_ObjectData != 0) { - WriteShort(a_SpeedX); - WriteShort(a_SpeedY); - WriteShort(a_SpeedZ); + WriteShort((short)a_Entity.GetSpeedX()); + WriteShort((short)a_Entity.GetSpeedY()); + WriteShort((short)a_Entity.GetSpeedZ()); } Flush(); } diff --git a/source/Protocol/Protocol125.h b/source/Protocol/Protocol125.h index 47923235b..ad50c5796 100644 --- a/source/Protocol/Protocol125.h +++ b/source/Protocol/Protocol125.h @@ -60,7 +60,7 @@ public: virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; virtual void SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ, Byte a_Yaw, Byte a_Pitch) override; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) override; virtual void SendTeleportEntity (const cEntity & a_Entity) override; virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; diff --git a/source/Protocol/Protocol14x.cpp b/source/Protocol/Protocol14x.cpp index b70d6e0aa..d19768c5c 100644 --- a/source/Protocol/Protocol14x.cpp +++ b/source/Protocol/Protocol14x.cpp @@ -210,7 +210,7 @@ void cProtocol146::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) -void cProtocol146::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ, Byte a_Yaw, Byte a_Pitch) +void cProtocol146::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) { cCSLock Lock(m_CSPacket); WriteByte(PACKET_SPAWN_OBJECT); @@ -222,9 +222,10 @@ void cProtocol146::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, WriteInt (a_ObjectData); if (a_ObjectData != 0) { - WriteShort(a_SpeedX); - WriteShort(a_SpeedY); - WriteShort(a_SpeedZ); + // TODO: Proper speed units + WriteShort((short)a_Entity.GetSpeedX()); + WriteShort((short)a_Entity.GetSpeedY()); + WriteShort((short)a_Entity.GetSpeedZ()); WriteByte(a_Yaw); WriteByte(a_Pitch); } diff --git a/source/Protocol/Protocol14x.h b/source/Protocol/Protocol14x.h index 383544f8f..a9ff14d84 100644 --- a/source/Protocol/Protocol14x.h +++ b/source/Protocol/Protocol14x.h @@ -54,7 +54,7 @@ public: virtual void SendPickupSpawn (const cPickup & a_Pickup) override; virtual void SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) override; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ, Byte a_Yaw, Byte a_Pitch) override; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) override; } ; diff --git a/source/Protocol/ProtocolRecognizer.cpp b/source/Protocol/ProtocolRecognizer.cpp index 0d26cdbd3..ccce8890d 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/source/Protocol/ProtocolRecognizer.cpp @@ -426,10 +426,10 @@ void cProtocolRecognizer::SendSpawnMob(const cMonster & a_Mob) -void cProtocolRecognizer::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ, Byte a_Yaw, Byte a_Pitch) +void cProtocolRecognizer::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) { ASSERT(m_Protocol != NULL); - m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData, a_SpeedX, a_SpeedY, a_SpeedZ, a_Yaw, a_Pitch); + m_Protocol->SendSpawnObject(a_Entity, a_ObjectType, a_ObjectData, a_Yaw, a_Pitch); } diff --git a/source/Protocol/ProtocolRecognizer.h b/source/Protocol/ProtocolRecognizer.h index f638b08d8..fdced8bbe 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/source/Protocol/ProtocolRecognizer.h @@ -85,7 +85,7 @@ public: virtual void SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; virtual void SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, short a_SpeedX, short a_SpeedY, short a_SpeedZ, Byte a_Yaw, Byte a_Pitch) override; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType) override; virtual void SendTeleportEntity (const cEntity & a_Entity) override; virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; -- cgit v1.2.3