diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-07 21:56:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:56:03 +0700 |
| commit | a9be52c41a02d207233199e98898fe7483d7e817 (patch) | |
| tree | 71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/Common/XUI/XUI_HelpControls.cpp | |
| parent | 1be5faaea781402e7de06b263eeca4c688b7712c (diff) | |
Project modernization (#630)
* 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
Diffstat (limited to 'Minecraft.Client/Common/XUI/XUI_HelpControls.cpp')
| -rw-r--r-- | Minecraft.Client/Common/XUI/XUI_HelpControls.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp b/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp index e7a8b0ca..3c4e80a2 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp @@ -91,9 +91,9 @@ HRESULT CScene_Controls::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) XuiControlSetText(m_SouthPaw,app.GetString(IDS_SOUTHPAW)); XuiControlSetText(m_InvertLook,app.GetString(IDS_INVERT_LOOK)); - m_iPad=*(int *)pInitData->pvInitData; + m_iPad=*static_cast<int *>(pInitData->pvInitData); // if we're not in the game, we need to use basescene 0 - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); bool bSplitscreen=(app.GetLocalPlayerCount()>1); m_iCurrentTextIndex=0; m_bCreativeMode = !bNotInGame && Minecraft::GetInstance()->localplayers[m_iPad] && Minecraft::GetInstance()->localplayers[m_iPad]->abilities.mayfly; @@ -159,20 +159,20 @@ HRESULT CScene_Controls::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) controlDetailsA[i].vPos.y/=2.0f; } m_FigA[i].SetShow(FALSE); - m_TextPresenterA[i] = NULL; + m_TextPresenterA[i] = nullptr; } // fill out the layouts list VOID *pObj; XuiObjectFromHandle( m_SchemeList, &pObj ); - m_pLayoutList = (CXuiCtrl4JList *)pObj; + m_pLayoutList = static_cast<CXuiCtrl4JList *>(pObj); CXuiCtrl4JList::LIST_ITEM_INFO ListInfo[3]; ZeroMemory(ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO)*3); for(int i=0;i<3;i++) { ListInfo[i].pwszText=m_LayoutNameA[i]; - ListInfo[i].hXuiBrush=NULL; + ListInfo[i].hXuiBrush=nullptr; ListInfo[i].fEnabled=TRUE; m_pLayoutList->AddData(ListInfo[i]); } @@ -325,9 +325,9 @@ void CScene_Controls::PositionText(int iPad,int iTextID, unsigned char ucAction) XuiElementGetScale(hFigGroup,&vScale); // check the width of the control with the text set in it - if(m_TextPresenterA[m_iCurrentTextIndex]==NULL) + if(m_TextPresenterA[m_iCurrentTextIndex]==nullptr) { - HXUIOBJ hObj=NULL; + HXUIOBJ hObj=nullptr; HRESULT hr=XuiControlGetVisual(m_TextA[m_iCurrentTextIndex].m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"Text",&m_TextPresenterA[m_iCurrentTextIndex]); } @@ -452,9 +452,9 @@ void CScene_Controls::PositionTextDirect(int iPad,int iTextID, int iControlDetai XuiElementGetScale(hFigGroup,&vScale); // check the width of the control with the text set in it - if(m_TextPresenterA[m_iCurrentTextIndex]==NULL) + if(m_TextPresenterA[m_iCurrentTextIndex]==nullptr) { - HXUIOBJ hObj=NULL; + HXUIOBJ hObj=nullptr; HRESULT hr=XuiControlGetVisual(m_TextA[m_iCurrentTextIndex].m_hObj,&hObj); hr=XuiElementGetChildById(hObj,L"Text",&m_TextPresenterA[m_iCurrentTextIndex]); } @@ -532,18 +532,18 @@ HRESULT CScene_Controls::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pN if ( hObjPressed == m_InvertLook.m_hObj ) { BOOL bIsChecked = m_InvertLook.IsChecked(); - app.SetGameSettings(m_iPad,eGameSetting_ControlInvertLook,(unsigned char)( bIsChecked ) ); + app.SetGameSettings(m_iPad,eGameSetting_ControlInvertLook,static_cast<unsigned char>(bIsChecked) ); } else if ( hObjPressed == m_SouthPaw.m_hObj ) { BOOL bIsChecked = m_SouthPaw.IsChecked(); - app.SetGameSettings(m_iPad,eGameSetting_ControlSouthPaw,(unsigned char)( bIsChecked ) ); + app.SetGameSettings(m_iPad,eGameSetting_ControlSouthPaw,static_cast<unsigned char>(bIsChecked) ); PositionAllText(m_iPad); } else if( hObjPressed == m_SchemeList) { // check what's been selected - app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,(unsigned char)m_SchemeList.GetCurSel()); + app.SetGameSettings(m_iPad,eGameSetting_ControlScheme,static_cast<unsigned char>(m_SchemeList.GetCurSel())); LPWSTR layoutString = new wchar_t[ 128 ]; swprintf( layoutString, 128, L"%ls : %ls", app.GetString( IDS_CURRENT_LAYOUT ),app.GetString(m_iSchemeTextA[m_SchemeList.GetCurSel()]) ); |
