From 99d63ce7ecc0f382431b0c72aa5e6d2defc62b36 Mon Sep 17 00:00:00 2001 From: notmatthewbeshay <92357869+NotMachow@users.noreply.github.com> Date: Sat, 14 Mar 2026 07:02:16 +1100 Subject: [PATCH] Remove WinAPI small-id types from XUI player flows --- .../Platform/Common/XUI/XUI_InGameInfo.cpp | 10 +++++----- Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.h | 4 +++- .../Platform/Common/XUI/XUI_InGamePlayerOptions.cpp | 6 +++--- Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.cpp | 4 ++-- Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.h | 8 +++++--- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.cpp index 4ccc70b92..c49a82675 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.cpp @@ -37,10 +37,10 @@ HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); } - DWORD playerCount = g_NetworkManager.GetPlayerCount(); + int playerCount = g_NetworkManager.GetPlayerCount(); m_playersCount = 0; - for(DWORD i = 0; i < playerCount; ++i) + for(int i = 0; i < playerCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); @@ -209,7 +209,7 @@ HRESULT CScene_InGameInfo::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* else if(selectedPlayer->IsLocal() != TRUE && selectedPlayer->IsSameSystem(g_NetworkManager.GetHostPlayer()) != TRUE) { // Only ops will hit this, can kick anyone not local and not local to the host - BYTE *smallId = new BYTE(); + std::uint8_t *smallId = new std::uint8_t(); *smallId = m_players[playersList.GetCurSel()]; unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; @@ -520,7 +520,7 @@ HRESULT CScene_InGameInfo::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *(BYTE *)pParam; + std::uint8_t smallId = *static_cast(pParam); delete pParam; if(result==C4JStorage::EMessage_ResultAccept) @@ -534,4 +534,4 @@ int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMes } return 0; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.h b/Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.h index b0802e4c7..96d536a92 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.h +++ b/Minecraft.Client/Platform/Common/XUI/XUI_InGameInfo.h @@ -1,5 +1,7 @@ #pragma once //using namespace std; +#include + #include "../media/xuiscene_ingameinfo.h" #include "XUI_CustomMessages.h" @@ -74,7 +76,7 @@ private: D3DXVECTOR3 m_OriginalPosition; int m_playersCount; - BYTE m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's + std::uint8_t m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's bool m_bIgnoreKeyPresses; void updateTooltips(); diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_InGamePlayerOptions.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_InGamePlayerOptions.cpp index 77359391a..0c7a89edb 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_InGamePlayerOptions.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_InGamePlayerOptions.cpp @@ -300,7 +300,7 @@ HRESULT CScene_InGamePlayerOptions::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINoti if( hObjPressed == m_buttonKick ) { - BYTE *smallId = new BYTE(); + std::uint8_t *smallId = new std::uint8_t(); *smallId = m_networkSmallId; unsigned int uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; @@ -330,7 +330,7 @@ HRESULT CScene_InGamePlayerOptions::OnControlNavigate(XUIMessageControlNavigate int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *(BYTE *)pParam; + std::uint8_t smallId = *static_cast(pParam); delete pParam; if(result==C4JStorage::EMessage_ResultAccept) @@ -496,4 +496,4 @@ void CScene_InGamePlayerOptions::resetCheatCheckboxes() m_checkboxes[eControl_CheatTeleport].SetCheck( isModerator && (Player::getPlayerGamePrivilege(m_playerPrivileges, Player::ePlayerGamePrivilege_CanTeleport) != 0) ); } -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.cpp b/Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.cpp index dacb30cc4..0e60916ee 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.cpp +++ b/Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.cpp @@ -11,7 +11,7 @@ #include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h" #include "XUI_Scene_Win.h" -BYTE CScene_Win::s_winUserIndex = 0; +std::uint8_t CScene_Win::s_winUserIndex = 0; const float CScene_Win::AUTO_SCROLL_SPEED = 1.0f; const float CScene_Win::PLAYER_SCROLL_SPEED = 3.0f; @@ -299,4 +299,4 @@ HRESULT CScene_Win::OnNavForward(XUIMessageNavForward *pNavForwardData, BOOL& bH KillTimer(0); return S_OK; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.h b/Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.h index a498cd316..8cb177623 100644 --- a/Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.h +++ b/Minecraft.Client/Platform/Common/XUI/XUI_Scene_Win.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "../media/xuiscene_Win.h" #include "XUI_CustomMessages.h" @@ -53,6 +55,6 @@ private: void updateNoise(); public: - static BYTE s_winUserIndex; - static void setWinUserIndex(BYTE winUserIndex) { s_winUserIndex = winUserIndex; } -}; \ No newline at end of file + static std::uint8_t s_winUserIndex; + static void setWinUserIndex(std::uint8_t winUserIndex) { s_winUserIndex = winUserIndex; } +};