aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/LoginPacket.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.World/LoginPacket.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
Project modernization (#630)
* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.World/LoginPacket.cpp')
-rw-r--r--Minecraft.World/LoginPacket.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Minecraft.World/LoginPacket.cpp b/Minecraft.World/LoginPacket.cpp
index 44ed62b3..79cdfbae 100644
--- a/Minecraft.World/LoginPacket.cpp
+++ b/Minecraft.World/LoginPacket.cpp
@@ -30,7 +30,7 @@ LoginPacket::LoginPacket()
m_playerCapeId = 0;
m_isGuest = false;
m_newSeaLevel = false;
- m_pLevelType = NULL;
+ m_pLevelType = nullptr;
m_uiGamePrivileges = 0;
m_xzSize = LEVEL_MAX_WIDTH;
m_hellScale = HELL_LEVEL_MAX_SCALE;
@@ -59,7 +59,7 @@ LoginPacket::LoginPacket(const wstring& userName, int clientVersion, PlayerUID o
m_playerCapeId = capeId;
m_isGuest = isGuest;
m_newSeaLevel = false;
- m_pLevelType = NULL;
+ m_pLevelType = nullptr;
m_uiGamePrivileges = 0;
m_xzSize = LEVEL_MAX_WIDTH;
m_hellScale = HELL_LEVEL_MAX_SCALE;
@@ -100,7 +100,7 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException
userName = readUtf(dis, Player::MAX_NAME_LENGTH);
wstring typeName = readUtf(dis, 16);
m_pLevelType = LevelType::getLevelType(typeName);
- if (m_pLevelType == NULL)
+ if (m_pLevelType == nullptr)
{
m_pLevelType = LevelType::lvl_normal;
}
@@ -135,7 +135,7 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeInt(clientVersion);
writeUtf(userName, dos);
- if (m_pLevelType == NULL)
+ if (m_pLevelType == nullptr)
{
writeUtf(L"", dos);
}
@@ -174,10 +174,10 @@ void LoginPacket::handle(PacketListener *listener)
int LoginPacket::getEstimatedSize()
{
int length=0;
- if (m_pLevelType != NULL)
+ if (m_pLevelType != nullptr)
{
- length = (int)m_pLevelType->getGeneratorName().length();
+ length = static_cast<int>(m_pLevelType->getGeneratorName().length());
}
- return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(int64_t) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int));
+ return static_cast<int>(sizeof(int) + userName.length() + 4 + 6 + sizeof(int64_t) + sizeof(char) + sizeof(int) + (2 * sizeof(PlayerUID)) + 1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int));
}