From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: Revert "Project modernization (#630)" This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817. --- .../Common/UI/UIScene_InGamePlayerOptionsMenu.cpp | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp') diff --git a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index 57937543..db9c1d4d 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -6,6 +6,7 @@ #include "..\..\ClientConnection.h" #include "..\..\..\Minecraft.World\net.minecraft.network.packet.h" + #define CHECKBOXES_TIMER_ID 0 #define CHECKBOXES_TIMER_TIME 100 @@ -16,21 +17,21 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void m_bShouldNavBack = false; - InGamePlayerOptionsInitData *initData = static_cast(_initData); + InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)_initData; m_networkSmallId = initData->networkSmallId; m_playerPrivileges = initData->playerPrivileges; INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if(editingPlayer != nullptr) + if(editingPlayer != NULL) { m_labelGamertag.init(editingPlayer->GetDisplayName()); } bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; - m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer); + m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer); if( m_editingSelf || trustPlayers || editingPlayer->IsHost()) { @@ -240,7 +241,7 @@ void UIScene_InGamePlayerOptionsMenu::handleReload() bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; - m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer); + m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer); if( m_editingSelf || trustPlayers || editingPlayer->IsHost()) { @@ -371,7 +372,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat else { INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if(!trustPlayers && (editingPlayer != nullptr && !editingPlayer->IsHost() ) ) + if(!trustPlayers && (editingPlayer != NULL && !editingPlayer->IsHost() ) ) { Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotMine,!m_checkboxes[eControl_BuildAndMine].IsChecked()); Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotBuild,!m_checkboxes[eControl_BuildAndMine].IsChecked()); @@ -404,7 +405,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat shared_ptr player = pMinecraft->localplayers[m_iPad]; if(player->connection) { - player->connection->send(std::make_shared(m_networkSmallId, -1, m_playerPrivileges)); + player->connection->send( shared_ptr( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) ); } } navigateBack(); @@ -427,7 +428,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Kick: { @@ -445,7 +446,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - BYTE smallId = *static_cast(pParam); + BYTE smallId = *(BYTE *)pParam; delete pParam; if(result==C4JStorage::EMessage_ResultAccept) @@ -454,7 +455,7 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4 shared_ptr localPlayer = pMinecraft->localplayers[iPad]; if(localPlayer->connection) { - localPlayer->connection->send(std::make_shared(smallId)); + localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); } // Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game. @@ -469,12 +470,12 @@ int UIScene_InGamePlayerOptionsMenu::KickPlayerReturned(void *pParam,int iPad,C4 void UIScene_InGamePlayerOptionsMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { app.DebugPrintf("UIScene_InGamePlayerOptionsMenu::OnPlayerChanged"); - UIScene_InGamePlayerOptionsMenu *scene = static_cast(callbackParam); + UIScene_InGamePlayerOptionsMenu *scene = (UIScene_InGamePlayerOptionsMenu *)callbackParam; - UIScene_InGameInfoMenu *infoScene = static_cast(scene->getBackScene()); - if(infoScene != nullptr) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving); + UIScene_InGameInfoMenu *infoScene = (UIScene_InGameInfoMenu *)scene->getBackScene(); + if(infoScene != NULL) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving); - if(leaving && pPlayer != nullptr && pPlayer->GetSmallId() == scene->m_networkSmallId) + if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId) { scene->m_bShouldNavBack = true; } @@ -496,7 +497,7 @@ void UIScene_InGamePlayerOptionsMenu::resetCheatCheckboxes() void UIScene_InGamePlayerOptionsMenu::handleCheckboxToggled(F64 controlId, bool selected) { - switch(static_cast(controlId)) + switch((int)controlId) { case eControl_Op: // flag that the moderator state has changed -- cgit v1.2.3