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 --- .../Common/UI/UIScene_DLCOffersMenu.cpp | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp') diff --git a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp index c109ed62..5e644803 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -16,12 +16,12 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { m_bProductInfoShown=false; - DLCOffersParam *param=(DLCOffersParam *)initData; + DLCOffersParam *param=static_cast(initData); m_iProductInfoIndex=param->iType; m_iCurrentDLC=0; m_iTotalDLC=0; #if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - m_pvProductInfo=NULL; + m_pvProductInfo=nullptr; #endif m_bAddAllDLCButtons=true; @@ -51,7 +51,7 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void *initData, UILayer * } #ifdef _DURANGO - m_pNoImageFor_DLC = NULL; + m_pNoImageFor_DLC = nullptr; // If we don't yet have this DLC, we need to display a timer m_bDLCRequiredIsRetrieved=false; m_bIgnorePress=true; @@ -103,7 +103,7 @@ void UIScene_DLCOffersMenu::handleTimerComplete(int id) int UIScene_DLCOffersMenu::ExitDLCOffersMenu(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_DLCOffersMenu* pClass = (UIScene_DLCOffersMenu*)pParam; + UIScene_DLCOffersMenu* pClass = static_cast(pParam); #if defined __ORBIS__ || defined __PSVITA__ app.GetCommerce()->HidePsStoreIcon(); @@ -217,7 +217,7 @@ void UIScene_DLCOffersMenu::handleInput(int iPad, int key, bool repeat, bool pre void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) { - switch((int)controlId) + switch(static_cast(controlId)) { case eControl_OffersList: { @@ -261,13 +261,13 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) #endif // __PS3__ #elif defined _XBOX_ONE int iIndex = (int)childId; - StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,NULL,NULL); + StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,nullptr,nullptr); #else - int iIndex = (int)childId; + int iIndex = static_cast(childId); ULONGLONG ullIndexA[1]; ullIndexA[0]=StorageManager.GetOffer(iIndex).qwOfferID; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); #endif } break; @@ -343,10 +343,10 @@ void UIScene_DLCOffersMenu::tick() { m_bAddAllDLCButtons=false; // add the categories to the list box - if(m_pvProductInfo==NULL) + if(m_pvProductInfo==nullptr) { m_pvProductInfo=app.GetProductList(m_iProductInfoIndex); - if(m_pvProductInfo==NULL) + if(m_pvProductInfo==nullptr) { m_iTotalDLC=0; // need to display text to say no downloadable content available yet @@ -690,7 +690,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // Check that this is in the list of known DLC DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.wszProductID); - if(pDLC!=NULL) + if(pDLC!=nullptr) { OrderA[uiDLCCount].uiContentIndex=i; OrderA[uiDLCCount++].uiSortIndex=pDLC->uiSortIndex; @@ -710,7 +710,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // Check that this is in the list of known DLC DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.wszProductID); - if(pDLC==NULL) + if(pDLC==nullptr) { // skip this one app.DebugPrintf("Unknown offer - %ls\n",xOffer.wszOfferName); @@ -736,7 +736,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // find the DLC in the installed packages XCONTENT_DATA *pContentData=StorageManager.GetInstalledDLC(xOffer.wszProductID); - if(pContentData!=NULL) + if(pContentData!=nullptr) { m_buttonListOffers.addItem(wstrTemp,!pContentData->bTrialLicense,OrderA[i].uiContentIndex); } @@ -809,7 +809,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) DLC_INFO *dlc = app.GetDLCInfoForFullOfferID(xOffer.wszOfferName); #endif - if (dlc != NULL) + if (dlc != nullptr) { WCHAR *cString = dlc->wchBanner; @@ -844,7 +844,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) { if(hasRegisteredSubstitutionTexture(cString)==false) { - BYTE *pData=NULL; + BYTE *pData=nullptr; DWORD dwSize=0; app.GetMemFileDetails(cString,&pData,&dwSize); // set the image -- cgit v1.2.3