From 28614b922fb77149a54da1a87bebfbc98736f296 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:08:36 -0400 Subject: Modernize project codebase (#906) * 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 * Add safety checks and fix a issue with vector going OOR --- Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp') diff --git a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp index ab1767d4..e88ed08c 100644 --- a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp @@ -52,7 +52,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStor if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack; + DLCTexturePack *pDLCTexPack=static_cast(tPack); DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack(); if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" )) @@ -229,7 +229,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 { // 4J-PB - need to check this user can access the store bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -248,7 +248,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 app.DebugPrintf("Texture Pack - %s\n",pchPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if(pSONYDLCInfo!=NULL) + if(pSONYDLCInfo!=nullptr) { char chName[42]; char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; @@ -300,7 +300,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName((WCHAR *)pDLCPack->getName().c_str()); - StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),NULL,NULL); + StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),nullptr,nullptr); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -336,7 +336,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 // need to allow downloads here, or the player would need to quit the game to let the download of a texture pack happen. This might affect the network traffic, since the download could take all the bandwidth... XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); } } else @@ -352,7 +352,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 int IUIScene_PauseMenu::SaveWorldThreadProc( LPVOID lpParameter ) { - bool bAutosave=(bool)lpParameter; + bool bAutosave=static_cast(lpParameter); if(bAutosave) { app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_AutoSaveGame); @@ -421,7 +421,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) bool saveStats = true; if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession()) { - if(lpParameter != NULL ) + if(lpParameter != nullptr ) { // 4J-PB - check if we have lost connection to Live if(ProfileManager.GetLiveConnectionStatus()!=XONLINE_S_LOGON_CONNECTION_ESTABLISHED ) @@ -522,17 +522,17 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) exitReasonStringId = -1; // 4J - Force a disconnection, this handles the situation that the server has already disconnected - if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(false); - if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(false); - if( pMinecraft->levels[2] != NULL ) pMinecraft->levels[2]->disconnect(false); + if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(false); + if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(false); + if( pMinecraft->levels[2] != nullptr ) pMinecraft->levels[2]->disconnect(false); } else { exitReasonStringId = IDS_EXITING_GAME; pMinecraft->progressRenderer->progressStartNoAbort( IDS_EXITING_GAME ); - if( pMinecraft->levels[0] != NULL ) pMinecraft->levels[0]->disconnect(); - if( pMinecraft->levels[1] != NULL ) pMinecraft->levels[1]->disconnect(); - if( pMinecraft->levels[2] != NULL ) pMinecraft->levels[2]->disconnect(); + if( pMinecraft->levels[0] != nullptr ) pMinecraft->levels[0]->disconnect(); + if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(); + if( pMinecraft->levels[2] != nullptr ) pMinecraft->levels[2]->disconnect(); } // 4J Stu - This only does something if we actually have a server, so don't need to do any other checks @@ -548,7 +548,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) } else { - if(lpParameter != NULL && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) + if(lpParameter != nullptr && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) { switch( app.GetDisconnectReason() ) { @@ -625,7 +625,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) { Sleep(1); } - pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats); + pMinecraft->setLevel(nullptr,exitReasonStringId,nullptr,saveStats); TelemetryManager->Flush(); -- cgit v1.2.3