diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-07 16:13:43 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-07 16:13:43 +0200 |
commit | 0224a4f7fc17400dd100a2333c7bbf9c898426c4 (patch) | |
tree | 5b909dc5b57a6859334591e0c5295547d8e9061f /source/Protocol | |
parent | Improved function names for protocol packet sending; alpha-sorted the function lists (diff) | |
download | cuberite-0224a4f7fc17400dd100a2333c7bbf9c898426c4.tar cuberite-0224a4f7fc17400dd100a2333c7bbf9c898426c4.tar.gz cuberite-0224a4f7fc17400dd100a2333c7bbf9c898426c4.tar.bz2 cuberite-0224a4f7fc17400dd100a2333c7bbf9c898426c4.tar.lz cuberite-0224a4f7fc17400dd100a2333c7bbf9c898426c4.tar.xz cuberite-0224a4f7fc17400dd100a2333c7bbf9c898426c4.tar.zst cuberite-0224a4f7fc17400dd100a2333c7bbf9c898426c4.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Protocol/Protocol16x.cpp | 27 | ||||
-rw-r--r-- | source/Protocol/Protocol16x.h | 11 |
2 files changed, 23 insertions, 15 deletions
diff --git a/source/Protocol/Protocol16x.cpp b/source/Protocol/Protocol16x.cpp index d7237b47a..a4572977d 100644 --- a/source/Protocol/Protocol16x.cpp +++ b/source/Protocol/Protocol16x.cpp @@ -74,7 +74,7 @@ void cProtocol161::SendAttachEntity(const cEntity & a_Entity, const cEntity * a_ void cProtocol161::SendChat(const AString & a_Message)
{
- super::SendChat(Printf("{\"text\":\"%s\"}", a_Message.c_str()));
+ super::SendChat(Printf("{\"text\":\"%s\"}", EscapeString(a_Message).c_str()));
}
@@ -83,15 +83,7 @@ void cProtocol161::SendChat(const AString & a_Message) void cProtocol161::SendGameMode(eGameMode a_GameMode)
{
super::SendGameMode(a_GameMode);
-
- // Also send the EntityProperties packet specifying the movementSpeed:
- cCSLock Lock(m_CSPacket);
- WriteByte(PACKET_ENTITY_PROPERTIES);
- WriteInt(m_Client->GetPlayer()->GetUniqueID());
- WriteInt(1);
- WriteString("generic.movementSpeed");
- WriteDouble(0.1);
- Flush();
+ SendPlayerMaxSpeed();
}
@@ -112,6 +104,21 @@ void cProtocol161::SendHealth(void) +void cProtocol161::SendPlayerMaxSpeed(void)
+{
+ cCSLock Lock(m_CSPacket);
+ WriteByte(PACKET_ENTITY_PROPERTIES);
+ WriteInt(m_Client->GetPlayer()->GetUniqueID());
+ WriteInt(1);
+ WriteString("generic.movementSpeed");
+ WriteDouble(m_Client->GetPlayer()->GetMaxSpeed());
+ Flush();
+}
+
+
+
+
+
void cProtocol161::SendWindowOpen(char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots)
{
if (a_WindowType < 0)
diff --git a/source/Protocol/Protocol16x.h b/source/Protocol/Protocol16x.h index b3d051a14..a357fc05f 100644 --- a/source/Protocol/Protocol16x.h +++ b/source/Protocol/Protocol16x.h @@ -29,11 +29,12 @@ public: cProtocol161(cClientHandle * a_Client);
// cProtocol150 overrides:
- virtual void SendAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) override;
- virtual void SendChat (const AString & a_Message) override;
- virtual void SendGameMode (eGameMode a_GameMode) override;
- virtual void SendHealth (void) override;
- virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
+ virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override;
+ virtual void SendChat (const AString & a_Message) override;
+ virtual void SendGameMode (eGameMode a_GameMode) override;
+ virtual void SendHealth (void) override;
+ virtual void SendPlayerMaxSpeed(void) override;
+ virtual void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots) override;
virtual int ParseEntityAction (void) override;
virtual int ParsePlayerAbilities(void) override;
|