diff options
author | Matti Hänninen <matti@mjhanninen.com> | 2015-08-05 00:24:59 +0200 |
---|---|---|
committer | Matti Hänninen <matti@mjhanninen.com> | 2015-08-12 15:51:38 +0200 |
commit | b20294604c5a64a39b3c5f4491b653e4cf2a3c20 (patch) | |
tree | ab1b84a09987f8ebe9d1e8450f36375c0f9bc5db /src/Protocol | |
parent | Merge pull request #2425 from cuberite/APIDumpNameChange (diff) | |
download | cuberite-b20294604c5a64a39b3c5f4491b653e4cf2a3c20.tar cuberite-b20294604c5a64a39b3c5f4491b653e4cf2a3c20.tar.gz cuberite-b20294604c5a64a39b3c5f4491b653e4cf2a3c20.tar.bz2 cuberite-b20294604c5a64a39b3c5f4491b653e4cf2a3c20.tar.lz cuberite-b20294604c5a64a39b3c5f4491b653e4cf2a3c20.tar.xz cuberite-b20294604c5a64a39b3c5f4491b653e4cf2a3c20.tar.zst cuberite-b20294604c5a64a39b3c5f4491b653e4cf2a3c20.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 4 | ||||
-rw-r--r-- | src/Protocol/Protocol18x.cpp | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 003530c67..3ac656d47 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -652,7 +652,7 @@ void cProtocol172::SendKeepAlive(UInt32 a_PingID) } cPacketizer Pkt(*this, 0x00); // Keep Alive packet - Pkt.WriteBEInt32(static_cast<Int32>(a_PingID)); + Pkt.WriteBEUInt32(a_PingID); } @@ -2144,7 +2144,7 @@ void cProtocol172::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) void cProtocol172::HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) { - HANDLE_READ(a_ByteBuffer, ReadBEInt32, Int32, KeepAliveID); + HANDLE_READ(a_ByteBuffer, ReadBEUInt32, UInt32, KeepAliveID); m_Client->HandleKeepAlive(KeepAliveID); } diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index bd38d25d8..da5c451db 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -649,7 +649,7 @@ void cProtocol180::SendLogin(const cPlayer & a_Player, const cWorld & a_World) Pkt.WriteBEUInt8(static_cast<UInt8>(a_Player.GetEffectiveGameMode()) | (Server->IsHardcore() ? 0x08 : 0)); // Hardcore flag bit 4 Pkt.WriteBEInt8(static_cast<Int8>(a_World.GetDimension())); Pkt.WriteBEUInt8(2); // TODO: Difficulty (set to Normal) - Pkt.WriteBEUInt8(Clamp<UInt8>(Server->GetMaxPlayers(), 0, 255)); + Pkt.WriteBEUInt8(static_cast<UInt8>(Clamp<int>(Server->GetMaxPlayers(), 0, 255))); Pkt.WriteString("default"); // Level type - wtf? Pkt.WriteBool(false); // Reduced Debug Info - wtf? } @@ -2197,7 +2197,7 @@ void cProtocol180::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffe m_Client->Kick("Hacked client"); return; } - if (ntohl(DecryptedNonce[0]) != (unsigned)(uintptr_t)this) // Cannot convert to c++ casts + if (ntohl(DecryptedNonce[0]) != static_cast<unsigned>(reinterpret_cast<uintptr_t>(this))) { LOGD("Bad nonce value"); m_Client->Kick("Hacked client"); @@ -2247,7 +2247,7 @@ void cProtocol180::HandlePacketLoginStart(cByteBuffer & a_ByteBuffer) Pkt.WriteVarInt32(static_cast<UInt32>(PubKeyDer.size())); Pkt.WriteBuf(PubKeyDer.data(), PubKeyDer.size()); Pkt.WriteVarInt32(4); - Pkt.WriteBEInt32((int)(intptr_t)this); // Using 'this' as the cryptographic nonce, so that we don't have to generate one each time :) Cannot convert to c++ casts + Pkt.WriteBEInt32(static_cast<int>(reinterpret_cast<intptr_t>(this))); // Using 'this' as the cryptographic nonce, so that we don't have to generate one each time :) m_Client->SetUsername(Username); return; } @@ -2406,7 +2406,7 @@ void cProtocol180::HandlePacketEntityAction(cByteBuffer & a_ByteBuffer) void cProtocol180::HandlePacketKeepAlive(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, KeepAliveID); - m_Client->HandleKeepAlive(static_cast<Int32>(KeepAliveID)); + m_Client->HandleKeepAlive(KeepAliveID); } |