Permalink
Browse files

Dropped support for <1.7.x

  • Loading branch information...
tigerw committed Sep 27, 2014
1 parent 305778f commit 72c087cfd335b015139cb73ae78f74105d855cf0
View
@@ -1741,20 +1741,6 @@ void cClientHandle::HandleRespawn(void)
void cClientHandle::HandleDisconnect(const AString & a_Reason)
{
LOGD("Received d/c packet from %s with reason \"%s\"", m_Username.c_str(), a_Reason.c_str());
cRoot::Get()->GetPluginManager()->CallHookDisconnect(*this, a_Reason);
m_HasSentDC = true;
Destroy();
}
void cClientHandle::HandleKeepAlive(int a_KeepAliveID)
{
if (a_KeepAliveID == m_PingID)
View
@@ -239,7 +239,6 @@ class cClientHandle : // tolua_export
void HandleAnimation (char a_Animation);
void HandleChat (const AString & a_Message);
void HandleCreativeInventory(short a_SlotNum, const cItem & a_HeldItem);
void HandleDisconnect (const AString & a_Reason);
void HandleEntityCrouch (int a_EntityID, bool a_IsCrouching);
void HandleEntityLeaveBed (int a_EntityID);
void HandleEntitySprinting (int a_EntityID, bool a_IsSprinting);
@@ -8,11 +8,6 @@ SET (SRCS
Authenticator.cpp
ChunkDataSerializer.cpp
MojangAPI.cpp
Protocol125.cpp
Protocol132.cpp
Protocol14x.cpp
Protocol15x.cpp
Protocol16x.cpp
Protocol17x.cpp
Protocol18x.cpp
ProtocolRecognizer.cpp)
@@ -22,11 +17,6 @@ SET (HDRS
ChunkDataSerializer.h
MojangAPI.h
Protocol.h
Protocol125.h
Protocol132.h
Protocol14x.h
Protocol15x.h
Protocol16x.h
Protocol17x.h
Protocol18x.h
ProtocolRecognizer.h)
View
@@ -138,108 +138,9 @@ class cProtocol
protected:
cClientHandle * m_Client;
cCriticalSection m_CSPacket; // Each SendXYZ() function must acquire this CS in order to send the whole packet at once
/// A generic data-sending routine, all outgoing packet data needs to be routed through this so that descendants may override it
virtual void SendData(const char * a_Data, size_t a_Size) = 0;
/// Called after writing each packet, enables descendants to flush their buffers
virtual void Flush(void) {}
// Helpers for writing partial packet data, write using SendData()
void WriteByte(Byte a_Value)
{
SendData((const char *)&a_Value, 1);
}
void WriteChar(char a_Value)
{
SendData(&a_Value, 1);
}
void WriteShort(short a_Value)
{
u_short Value = htons((u_short)a_Value);
SendData((const char *)&Value, 2);
}
/*
void WriteShort(unsigned short a_Value)
{
a_Value = htons(a_Value);
SendData((const char *)&a_Value, 2);
}
*/
void WriteInt(int a_Value)
{
u_long Value = htonl((u_long)a_Value);
SendData((const char *)&Value, 4);
}
void WriteUInt(unsigned int a_Value)
{
a_Value = htonl(a_Value);
SendData((const char *)&a_Value, 4);
}
void WriteInt64 (Int64 a_Value)
{
UInt64 Value = HostToNetwork8(&a_Value);
SendData((const char *)&Value, 8);
}
void WriteFloat (float a_Value)
{
UInt32 val = HostToNetwork4(&a_Value);
SendData((const char *)&val, 4);
}
void WriteDouble(double a_Value)
{
UInt64 val = HostToNetwork8(&a_Value);
SendData((const char *)&val, 8);
}
void WriteString(const AString & a_Value)
{
AString UTF16;
UTF8ToRawBEUTF16(a_Value.c_str(), a_Value.length(), UTF16);
WriteShort((short)(UTF16.size() / 2));
SendData(UTF16.data(), UTF16.size());
}
void WriteBool(bool a_Value)
{
WriteByte(a_Value ? 1 : 0);
}
void WriteVectorI(const Vector3i & a_Vector)
{
WriteInt(a_Vector.x);
WriteInt(a_Vector.y);
WriteInt(a_Vector.z);
}
void WriteVarInt(UInt32 a_Value)
{
// A 32-bit integer can be encoded by at most 5 bytes:
unsigned char b[5];
size_t idx = 0;
do
{
b[idx] = (a_Value & 0x7f) | ((a_Value > 0x7f) ? 0x80 : 0x00);
a_Value = a_Value >> 7;
idx++;
} while (a_Value > 0);
SendData((const char *)b, idx);
}
void WriteVarUTF8String(const AString & a_String)
{
WriteVarInt((UInt32)a_String.size());
SendData(a_String.data(), a_String.size());
}
} ;
Oops, something went wrong.

1 comment on commit 72c087c

@bearbin

This comment has been minimized.

Show comment
Hide comment
@bearbin

bearbin Sep 27, 2014

Member

Yay!

Member

bearbin commented on 72c087c Sep 27, 2014

Yay!

Please sign in to comment.