From 85208b12b77a43ab3b100d07ea219eb857d89db7 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:12:25 +1100 Subject: [PATCH] Keep network player limit as an int constant --- Minecraft.Client/Platform/Xbox/Network/extra.h | 8 ++++++-- Minecraft.World/Platform/x64headers/extraX64.h | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Minecraft.Client/Platform/Xbox/Network/extra.h b/Minecraft.Client/Platform/Xbox/Network/extra.h index d09b18b7f..5965b9736 100644 --- a/Minecraft.Client/Platform/Xbox/Network/extra.h +++ b/Minecraft.Client/Platform/Xbox/Network/extra.h @@ -1,4 +1,8 @@ - #pragma once +#include +#include -const int MINECRAFT_NET_MAX_PLAYERS = 8; +constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; + +static_assert(MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits::max(), + "MINECRAFT_NET_MAX_PLAYERS must fit in the 8-bit network protocol"); diff --git a/Minecraft.World/Platform/x64headers/extraX64.h b/Minecraft.World/Platform/x64headers/extraX64.h index 0dac12ca6..51a7b5275 100644 --- a/Minecraft.World/Platform/x64headers/extraX64.h +++ b/Minecraft.World/Platform/x64headers/extraX64.h @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "../../../Minecraft.Client/Rendering/Models/SkinBox.h" @@ -17,12 +19,15 @@ const int XUSER_INDEX_FOCUS = 254; #ifdef __PSVITA__ const int XUSER_MAX_COUNT = 1; -const int MINECRAFT_NET_MAX_PLAYERS = 4; +constexpr int MINECRAFT_NET_MAX_PLAYERS = 4; #else const int XUSER_MAX_COUNT = 4; -const int MINECRAFT_NET_MAX_PLAYERS = 8; +constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; #endif +static_assert(MINECRAFT_NET_MAX_PLAYERS <= std::numeric_limits::max(), + "MINECRAFT_NET_MAX_PLAYERS must fit in the 8-bit network protocol"); + #ifdef __ORBIS__ #include #include