summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/Protocol')
-rw-r--r--src/Protocol/Protocol.h2
-rw-r--r--src/Protocol/Protocol125.cpp4
-rw-r--r--src/Protocol/Protocol125.h2
-rw-r--r--src/Protocol/Protocol17x.cpp18
-rw-r--r--src/Protocol/Protocol17x.h2
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp4
-rw-r--r--src/Protocol/ProtocolRecognizer.h2
7 files changed, 15 insertions, 19 deletions
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 9d8183361..ff6541aeb 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -79,7 +79,7 @@ public:
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) = 0;
virtual void SendPickupSpawn (const cPickup & a_Pickup) = 0;
virtual void SendPlayerAbilities (void) = 0;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) = 0;
+ virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) = 0;
virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) = 0;
virtual void SendPlayerMaxSpeed (void) = 0; ///< Informs the client of the maximum player speed (1.6.1+)
virtual void SendPlayerMoveLook (void) = 0;
diff --git a/src/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp
index b1dd17ea1..9334e6f2d 100644
--- a/src/Protocol/Protocol125.cpp
+++ b/src/Protocol/Protocol125.cpp
@@ -578,11 +578,11 @@ void cProtocol125::SendPickupSpawn(const cPickup & a_Pickup)
-void cProtocol125::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation)
+void cProtocol125::SendEntityAnimation(const cEntity & a_Entity, char a_Animation)
{
cCSLock Lock(m_CSPacket);
WriteByte(PACKET_ANIMATION);
- WriteInt (a_Player.GetUniqueID());
+ WriteInt (a_Entity.GetUniqueID());
WriteByte(a_Animation);
Flush();
}
diff --git a/src/Protocol/Protocol125.h b/src/Protocol/Protocol125.h
index 5a9218f5b..32efef4e8 100644
--- a/src/Protocol/Protocol125.h
+++ b/src/Protocol/Protocol125.h
@@ -55,7 +55,7 @@ public:
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override {} // This protocol doesn't support such message
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
+ virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 5f5864f2a..75983e9a3 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -489,10 +489,10 @@ void cProtocol172::SendPlayerAbilities(void)
-void cProtocol172::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation)
+void cProtocol172::SendEntityAnimation(const cEntity & a_Entity, char a_Animation)
{
cPacketizer Pkt(*this, 0x0b); // Animation packet
- Pkt.WriteVarInt(a_Player.GetUniqueID());
+ Pkt.WriteVarInt(a_Entity.GetUniqueID());
Pkt.WriteChar(a_Animation);
}
@@ -664,7 +664,7 @@ void cProtocol172::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock)
Pkt.WriteFPInt(a_FallingBlock.GetPosZ());
Pkt.WriteByteAngle(a_FallingBlock.GetYaw());
Pkt.WriteByteAngle(a_FallingBlock.GetPitch());
- Pkt.WriteInt(((int)a_FallingBlock.GetBlockType()) | (((int)a_FallingBlock.GetBlockMeta()) << 12));
+ Pkt.WriteInt(((int)a_FallingBlock.GetBlockType()) | (((int)a_FallingBlock.GetBlockMeta()) << 16)); // Or 0x10
Pkt.WriteShort((short)(a_FallingBlock.GetSpeedX() * 400));
Pkt.WriteShort((short)(a_FallingBlock.GetSpeedY() * 400));
Pkt.WriteShort((short)(a_FallingBlock.GetSpeedZ() * 400));
@@ -744,17 +744,13 @@ void cProtocol172::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleTyp
void cProtocol172::SendTabCompletionResults(const AStringVector & a_Results)
{
- AString Results;
- Results.reserve(500); // Make a moderate reservation to avoid excessive reallocations
+ cPacketizer Pkt(*this, 0x3a); // Tab-Complete packet
+ Pkt.WriteVarInt(a_Results.size());
+
for (AStringVector::const_iterator itr = a_Results.begin(), end = a_Results.end(); itr != end; ++itr)
{
- Results.append(*itr);
- Results.push_back(0);
+ Pkt.WriteString(*itr);
}
-
- cPacketizer Pkt(*this, 0x3a); // Tab-Complete packet
- Pkt.WriteVarInt(a_Results.size());
- Pkt.WriteString(Results);
}
diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h
index 9c1eaa99a..9a189ab24 100644
--- a/src/Protocol/Protocol17x.h
+++ b/src/Protocol/Protocol17x.h
@@ -64,7 +64,7 @@ public:
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
+ virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index 489149d74..683700d37 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -396,10 +396,10 @@ void cProtocolRecognizer::SendPlayerAbilities(void)
-void cProtocolRecognizer::SendPlayerAnimation(const cPlayer & a_Player, char a_Animation)
+void cProtocolRecognizer::SendEntityAnimation(const cEntity & a_Entity, char a_Animation)
{
ASSERT(m_Protocol != NULL);
- m_Protocol->SendPlayerAnimation(a_Player, a_Animation);
+ m_Protocol->SendEntityAnimation(a_Entity, a_Animation);
}
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h
index 9ca0c1c88..83fc23c22 100644
--- a/src/Protocol/ProtocolRecognizer.h
+++ b/src/Protocol/ProtocolRecognizer.h
@@ -90,7 +90,7 @@ public:
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendPickupSpawn (const cPickup & a_Pickup) override;
virtual void SendPlayerAbilities (void) override;
- virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override;
+ virtual void SendEntityAnimation (const cEntity & a_Entity, char a_Animation) override;
virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override;
virtual void SendPlayerMaxSpeed (void) override;
virtual void SendPlayerMoveLook (void) override;