summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol18x.cpp
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-08-12 17:40:51 +0200
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-08-12 17:40:51 +0200
commitcdcc5fe9a7894af6075865f698e3d014a6f92335 (patch)
treeab1b84a09987f8ebe9d1e8450f36375c0f9bc5db /src/Protocol/Protocol18x.cpp
parentMerge pull request #2425 from cuberite/APIDumpNameChange (diff)
parentFix old style casts and implicit conversions (diff)
downloadcuberite-cdcc5fe9a7894af6075865f698e3d014a6f92335.tar
cuberite-cdcc5fe9a7894af6075865f698e3d014a6f92335.tar.gz
cuberite-cdcc5fe9a7894af6075865f698e3d014a6f92335.tar.bz2
cuberite-cdcc5fe9a7894af6075865f698e3d014a6f92335.tar.lz
cuberite-cdcc5fe9a7894af6075865f698e3d014a6f92335.tar.xz
cuberite-cdcc5fe9a7894af6075865f698e3d014a6f92335.tar.zst
cuberite-cdcc5fe9a7894af6075865f698e3d014a6f92335.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol18x.cpp8
1 files changed, 4 insertions, 4 deletions
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);
}