aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/UpdateGameRuleProgressPacket.cpp
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-16 21:44:26 -0500
committerGitHub <noreply@github.com>2026-03-16 21:44:26 -0500
commitce739f6045ec72127491286ea3f3f21e537c1b55 (patch)
treef33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.World/UpdateGameRuleProgressPacket.cpp
parent255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff)
parent5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.World/UpdateGameRuleProgressPacket.cpp')
-rw-r--r--Minecraft.World/UpdateGameRuleProgressPacket.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/Minecraft.World/UpdateGameRuleProgressPacket.cpp b/Minecraft.World/UpdateGameRuleProgressPacket.cpp
index 9459ed2b..5bb1b301 100644
--- a/Minecraft.World/UpdateGameRuleProgressPacket.cpp
+++ b/Minecraft.World/UpdateGameRuleProgressPacket.cpp
@@ -5,13 +5,9 @@
-UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket()
+// UpdateGameRuleProgressPacket() default constructor
+UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket() : m_icon(0), m_auxValue(0), m_dataTag(0)
{
- m_messageId = L"";
- m_icon = -1;
- m_auxValue = 0;
- m_definitionType = ConsoleGameRules::eGameRuleType_LevelRules;
- m_dataTag = 0;
}
UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket(ConsoleGameRules::EGameRuleType definitionType, const wstring &messageId, int icon, int auxValue, int dataTag, void *data, int dataLength)
@@ -22,7 +18,7 @@ UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket(ConsoleGameRules::EGa
m_auxValue = auxValue;
m_dataTag = dataTag;
- if(dataLength > 0)
+ if (dataLength > 0 && dataLength <= 65536)
{
m_data = byteArray(dataLength);
memcpy(m_data.data,data,dataLength);
@@ -35,7 +31,7 @@ UpdateGameRuleProgressPacket::UpdateGameRuleProgressPacket(ConsoleGameRules::EGa
void UpdateGameRuleProgressPacket::read(DataInputStream *dis) //throws IOException
{
- m_definitionType = (ConsoleGameRules::EGameRuleType)dis->readInt();
+ m_definitionType = static_cast<ConsoleGameRules::EGameRuleType>(dis->readInt());
m_messageId = readUtf(dis,64);
m_icon = dis->readInt();
m_auxValue = dis->readByte();
@@ -71,5 +67,5 @@ void UpdateGameRuleProgressPacket::handle(PacketListener *listener)
int UpdateGameRuleProgressPacket::getEstimatedSize()
{
- return (int)m_messageId.length() + 4 + m_data.length;
+ return static_cast<int>(m_messageId.length()) + 4 + m_data.length;
} \ No newline at end of file