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_AbstractContainerMenu.cpp | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp') diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index b8193bac..6b196c1b 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -49,15 +49,15 @@ void UIScene_AbstractContainerMenu::handleDestroy() #endif Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) + if( pMinecraft->localgameModes[m_iPad] != NULL ) { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad]; + if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) - if(pMinecraft->localplayers[m_iPad] != nullptr && pMinecraft->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) + if(pMinecraft->localplayers[m_iPad] != NULL && pMinecraft->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) { pMinecraft->localplayers[m_iPad]->closeContainer(); } @@ -149,8 +149,8 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) m_fPointerMaxX = m_fPanelMaxX + fPointerWidth; m_fPointerMaxY = m_fPanelMaxY + (fPointerHeight/2); -// m_hPointerText=nullptr; -// m_hPointerTextBkg=nullptr; +// m_hPointerText=NULL; +// m_hPointerTextBkg=NULL; // Put the pointer over first item in use row to start with. UIVec2D itemPos; @@ -187,8 +187,8 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) IggyEvent mouseEvent; S32 width, height; m_parentLayer->getRenderDimensions(width, height); - S32 x = m_pointerPos.x*(static_cast(width)/m_movieWidth); - S32 y = m_pointerPos.y*(static_cast(height)/m_movieHeight); + S32 x = m_pointerPos.x*((float)width/m_movieWidth); + S32 y = m_pointerPos.y*((float)height/m_movieHeight); IggyMakeEventMouseMove( &mouseEvent, x, y); IggyEventResult result; @@ -212,8 +212,8 @@ void UIScene_AbstractContainerMenu::tick() S32 width, height; m_parentLayer->getRenderDimensions(width, height); - S32 x = static_cast(m_pointerPos.x * ((float)width / m_movieWidth)); - S32 y = static_cast(m_pointerPos.y * ((float)height / m_movieHeight)); + S32 x = (S32)(m_pointerPos.x * ((float)width / m_movieWidth)); + S32 y = (S32)(m_pointerPos.y * ((float)height / m_movieHeight)); IggyMakeEventMouseMove( &mouseEvent, x, y); @@ -254,7 +254,7 @@ void UIScene_AbstractContainerMenu::render(S32 width, S32 height, C4JRender::eVi void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; shared_ptr item = nullptr; int slotId = -1; @@ -265,7 +265,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg } else { - swscanf(static_cast(region->name),L"slot_%d",&slotId); + swscanf((wchar_t*)region->name,L"slot_%d",&slotId); if (slotId == -1) { app.DebugPrintf("This is not the control we are looking for\n"); @@ -278,7 +278,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg } } - if(item != nullptr) customDrawSlotControl(region,m_iPad,item,m_menu->isValidIngredient(item, slotId)?1.0f:0.5f,item->isFoil(),true); + if(item != NULL) customDrawSlotControl(region,m_iPad,item,m_menu->isValidIngredient(item, slotId)?1.0f:0.5f,item->isFoil(),true); } void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) @@ -337,7 +337,7 @@ Slot *UIScene_AbstractContainerMenu::getSlot(ESceneSection eSection, int iSlot) { Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot ); if(slot) return slot; - else return nullptr; + else return NULL; } bool UIScene_AbstractContainerMenu::isSlotEmpty(ESceneSection eSection, int iSlot) -- cgit v1.2.3