diff options
| author | void_17 <61356189+void2012@users.noreply.github.com> | 2026-03-06 02:11:18 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-06 02:11:18 +0700 |
| commit | 55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch) | |
| tree | 953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.Client/Common/XUI | |
| parent | 7d6658fe5b3095f35093701b5ab669ffc291e875 (diff) | |
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.Client/Common/XUI')
14 files changed, 223 insertions, 242 deletions
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp index 60c32909..4c615979 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp @@ -15,7 +15,7 @@ HRESULT CXuiCtrl4JList::OnInit(XUIMessageInit *pInitData, BOOL& bHandled) void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFromIndex, int iSortFunction) { // need to allocate memory for the structure and its strings - // and remap the string pointers + // and remap the string pointers DWORD dwBytes=0; DWORD dwLen1=0; DWORD dwLen2=0; @@ -37,7 +37,7 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom ZeroMemory(pItemInfo,dwBytes); XMemCpy( pItemInfo, &ItemInfo, sizeof( LIST_ITEM_INFO ) ); - if(dwLen1!=0) + if(dwLen1!=0) { XMemCpy( &pItemInfo[1], ItemInfo.pwszText, dwLen1 ); pItemInfo->pwszText=(LPCWSTR)&pItemInfo[1]; @@ -68,13 +68,13 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom // added to force a sort order for DLC //pItemInfo->iSortIndex=iSortIndex; - + m_vListData.push_back(pItemInfo); #ifdef _DEBUG int iCount=0; - for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++) + for ( auto it : m_vListData ) { PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it; app.DebugPrintf("%d. ",iCount++); @@ -99,22 +99,10 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom break; case eSortList_Index: sort(m_vListData.begin()+iSortListFromIndex, m_vListData.end(),CXuiCtrl4JList::IndexSortFn); - break; + break; } } LeaveCriticalSection(&m_AccessListData); -// #ifdef _DEBUG -// -// iCount=0; -// for (AUTO_VAR(it, m_vListData.begin()); it != m_vListData.end(); it++) -// { -// PLIST_ITEM_INFO pInfo=(PLIST_ITEM_INFO)*it; -// app.DebugPrintf("After Sort - %d. ",iCount++); -// OutputDebugStringW(pInfo->pwszText); -// app.DebugPrintf(" - %d\n",pInfo->iSortIndex); -// -// } -// #endif InsertItems( 0, 1 ); } @@ -162,13 +150,13 @@ int CXuiCtrl4JList::GetIndexByUserData(int iData) return 0; } -CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(DWORD dw) -{ - return *m_vListData[dw]; +CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(DWORD dw) +{ + return *m_vListData[dw]; } -CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetDataiData(int iData) -{ +CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetDataiData(int iData) +{ LIST_ITEM_INFO info; for(unsigned int i=0;i<m_vListData.size();i++) @@ -180,11 +168,11 @@ CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetDataiData(int iData) } } - return *m_vListData[0]; + return *m_vListData[0]; } -CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(FILETIME *pFileTime) -{ +CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(FILETIME *pFileTime) +{ LIST_ITEM_INFO info; for(unsigned int i=0;i<m_vListData.size();i++) @@ -196,13 +184,13 @@ CXuiCtrl4JList::LIST_ITEM_INFO& CXuiCtrl4JList::GetData(FILETIME *pFileTime) } } - return *m_vListData[0]; + return *m_vListData[0]; } bool CXuiCtrl4JList::TimeSortFn(const void *a, const void *b) { CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a; - CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b; + CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b; if(SaveDetailsA->fTime.dwHighDateTime > SaveDetailsB->fTime.dwHighDateTime) { @@ -229,14 +217,14 @@ bool CXuiCtrl4JList::TimeSortFn(const void *a, const void *b) bool CXuiCtrl4JList::AlphabeticSortFn(const void *a, const void *b) { CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a; - CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b; + CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b; wstring wstr1=SaveDetailsA->pwszText; wstring wstr2=SaveDetailsB->pwszText; if(wstr1.compare(wstr2)<0) { return true; - } + } return false; } @@ -244,14 +232,14 @@ bool CXuiCtrl4JList::AlphabeticSortFn(const void *a, const void *b) bool CXuiCtrl4JList::IndexSortFn(const void *a, const void *b) { CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsA=(CXuiCtrl4JList::LIST_ITEM_INFO *)a; - CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b; + CXuiCtrl4JList::LIST_ITEM_INFO *SaveDetailsB=(CXuiCtrl4JList::LIST_ITEM_INFO *)b; int iA=SaveDetailsA->iSortIndex; int iB=SaveDetailsB->iSortIndex; if(iA>iB) { return true; - } + } return false; } @@ -303,10 +291,10 @@ void CXuiCtrl4JList::UpdateGraphic(FILETIME *pfTime,HXUIBRUSH hXuiBrush ) // Gets called every frame HRESULT CXuiCtrl4JList::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceTextData,BOOL& bHandled) { - if( ( 0 == pGetSourceTextData->iData ) && ( ( pGetSourceTextData->bItemData ) ) ) + if( ( 0 == pGetSourceTextData->iData ) && ( ( pGetSourceTextData->bItemData ) ) ) { EnterCriticalSection(&m_AccessListData); - pGetSourceTextData->szText = + pGetSourceTextData->szText = GetData(pGetSourceTextData->iItem).pwszText; LeaveCriticalSection(&m_AccessListData); bHandled = TRUE; @@ -323,7 +311,7 @@ HRESULT CXuiCtrl4JList::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountD HRESULT CXuiCtrl4JList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourceImageData,BOOL& bHandled) { - if( ( 0 == pGetSourceImageData->iData ) && ( pGetSourceImageData->bItemData ) ) + if( ( 0 == pGetSourceImageData->iData ) && ( pGetSourceImageData->bItemData ) ) { // Check for a brush EnterCriticalSection(&m_AccessListData); @@ -333,7 +321,7 @@ HRESULT CXuiCtrl4JList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourc } else { - pGetSourceImageData->szPath = + pGetSourceImageData->szPath = GetData(pGetSourceImageData->iItem).pwszImage; } LeaveCriticalSection(&m_AccessListData); @@ -347,7 +335,7 @@ HRESULT CXuiCtrl4JList::OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableD if(m_vListData.size()!=0) { EnterCriticalSection(&m_AccessListData); - pGetItemEnableData->bEnabled = + pGetItemEnableData->bEnabled = GetData(pGetItemEnableData->iItem).fEnabled; LeaveCriticalSection(&m_AccessListData); } @@ -356,14 +344,14 @@ HRESULT CXuiCtrl4JList::OnGetItemEnable(XUIMessageGetItemEnable *pGetItemEnableD } -HRESULT CXuiCtrl4JList::SetBorder(DWORD dw,BOOL bShow) -{ +HRESULT CXuiCtrl4JList::SetBorder(DWORD dw,BOOL bShow) +{ CXuiControl Control; HXUIOBJ hVisual,hBorder; GetItemControl(dw,&Control); Control.GetVisual(&hVisual); XuiElementGetChildById(hVisual,L"Border",&hBorder); - return XuiElementSetShow(hBorder,bShow); + return XuiElementSetShow(hBorder,bShow); } void CXuiCtrl4JList::SetSelectionChangedHandle(HXUIOBJ hObj) diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp index dfb9b5ca..6c7876c9 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp @@ -69,7 +69,7 @@ HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText * // Light background and focus background SetEnable(TRUE); } - m_costString = _toString<int>(cost); + m_costString = std::to_wstring(cost); m_lastCost = cost; } if(cost == 0) @@ -79,7 +79,7 @@ HRESULT CXuiCtrlEnchantmentButton::OnGetSourceDataText(XUIMessageGetSourceText * pGetSourceTextData->bDisplay = FALSE; } else - { + { pGetSourceTextData->szText = m_costString.c_str(); pGetSourceTextData->bDisplay = TRUE; } diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp index 702ef15d..60156a0a 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp @@ -70,11 +70,11 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B D3DXMATRIX matrix; xuiControl.GetFullXForm(&matrix); float bwidth,bheight; - xuiControl.GetBounds(&bwidth,&bheight); + xuiControl.GetBounds(&bwidth,&bheight); // Annoyingly, XUI renders everything to a z of 0 so if we want to render anything that needs the z-buffer on top of it, then we need to clear it. // Clear just the region required for this control. - D3DRECT clearRect; + D3DRECT clearRect; clearRect.x1 = (int)(matrix._41) - 2; clearRect.y1 = (int)(matrix._42) - 2; clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2; @@ -124,7 +124,7 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B glColor4f(1, 1, 1, 1); if (cost != 0) { - wstring line = _toString<int>(cost); + wstring line = std::to_wstring(cost); Font *font = pMinecraft->altFont; //int col = 0x685E4A; unsigned int col = m_textColour; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp index 80750deb..0acd250f 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp @@ -145,7 +145,7 @@ void CXuiCtrlMinecraftSkinPreview::CycleNextAnimation() void CXuiCtrlMinecraftSkinPreview::CyclePreviousAnimation() { - m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1); + m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1); if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1); m_swingTime = 0.0f; @@ -253,13 +253,11 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO { // 4J-PB - any additional parts to turn on for this player (skin dependent) //vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts(); - + if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) - { - for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it) + { + for(auto& pModelPart : *m_pvAdditionalModelParts) { - ModelPart *pModelPart=*it; - pModelPart->visible=true; } } @@ -269,11 +267,9 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO // hide the additional parts if(m_pvAdditionalModelParts && m_pvAdditionalModelParts->size()!=0) - { - for(AUTO_VAR(it, m_pvAdditionalModelParts->begin()); it != m_pvAdditionalModelParts->end(); ++it) + { + for(auto& pModelPart : *m_pvAdditionalModelParts) { - ModelPart *pModelPart=*it; - pModelPart->visible=false; } } @@ -344,7 +340,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do float bodyRot = m_yRot; //(mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a); float headRot = m_yRot; //(mob->yRotO + (mob->yRot - mob->yRotO) * a); float headRotx = 0; //(mob->xRotO + (mob->xRot - mob->xRotO) * a); - + //setupPosition(mob, x, y, z); // is equivalent to glTranslatef((float) x, (float) y, (float) z); @@ -515,7 +511,7 @@ bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, int ba Textures *t = Minecraft::GetInstance()->textures; // 4J-PB - no http textures on the xbox, mem textures instead - + //int id = t->loadHttpTexture(urlTexture, backupTexture); int id = t->loadMemTexture(urlTexture, backupTexture); @@ -535,7 +531,7 @@ bool CXuiCtrlMinecraftSkinPreview::bindTexture(const wstring& urlTexture, const Textures *t = Minecraft::GetInstance()->textures; // 4J-PB - no http textures on the xbox, mem textures instead - + //int id = t->loadHttpTexture(urlTexture, backupTexture); int id = t->loadMemTexture(urlTexture, backupTexture); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp index 87abbcd3..f8ceeb69 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp @@ -64,7 +64,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, Cust // 11 bits - auxval // 6 bits - count // 6 bits - scale - pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(pUserDataContainer->m_iPad, (int)(31*pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime); + pData->iDataBitField = MAKE_SLOTDISPLAY_DATA_BITMASK(pUserDataContainer->m_iPad, (int)(31*pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime); } else { @@ -93,7 +93,7 @@ void CXuiCtrlSlotItemCtrlBase::SetUserIndex( HXUIOBJ hObj, int iPad ) XuiElementGetUserData( hObj, &pvUserData ); SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; - + pUserDataContainer->m_iPad = iPad; } @@ -103,7 +103,7 @@ void CXuiCtrlSlotItemCtrlBase::SetAlpha( HXUIOBJ hObj, float fAlpha ) XuiElementGetUserData( hObj, &pvUserData ); SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData; - + pUserDataContainer->m_fAlpha = fAlpha; } @@ -137,16 +137,15 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri wstring desc = L""; vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings); bool firstLine = true; - for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) - { - wstring thisString = *it; + for ( wstring& thisString : *strings ) + { if(!firstLine) { desc.append( L"<br />" ); } else { - firstLine = false; + firstLine = false; wchar_t formatted[256]; eMinecraftColour rarityColour = pUserDataContainer->slot->getItem()->getRarity()->color; int colour = app.GetHTMLColour(rarityColour); @@ -156,7 +155,7 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri colour = app.GetHTMLColour(eTextColor_RenamedItemTitle); } - swprintf(formatted, 256, L"<font color=\"#%08x\">%s</font>",colour,thisString.c_str()); + swprintf(formatted, 256, L"<font color=\"#%08x\">%s</font>",colour,thisString.c_str()); thisString = formatted; } desc.append( thisString ); @@ -221,7 +220,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnKeyDown(HXUIOBJ hObj, XUIMessageInput *pInpu XUIMessage message; XUIMessageInput messageInput; - + XuiMessageInput( &message, &messageInput, XUI_KEYDOWN, pInputData->dwKeyCode, pInputData->wch, pInputData->dwFlags, pInputData->UserIndex ); if (HRESULT_SUCCEEDED(hr)) @@ -358,7 +357,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj // 4J WESTY : Pointer Prototype : Added to support prototype only. // Returns number of items that can still be stacked into this slot. -int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj ) +int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj ) { int iResult = 0; diff --git a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp index 56b41267..6b96a4e3 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp @@ -9,7 +9,7 @@ #include "..\..\Common\GameRules\ConsoleGameRules.h" #include "XUI_DebugItemEditor.h" -#ifdef _DEBUG_MENUS_ENABLED +#ifdef _DEBUG_MENUS_ENABLED HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) { MapChildControls(); @@ -22,13 +22,13 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle if(m_item!=NULL) { - m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil()); + m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil()); m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) ); - m_itemId .SetText( _toString<int>(m_item->id).c_str() ); - m_itemAuxValue .SetText( _toString<int>(m_item->getAuxValue()).c_str() ); - m_itemCount .SetText( _toString<int>(m_item->count).c_str() ); - m_item4JData .SetText( _toString<int>(m_item->get4JData()).c_str() ); + m_itemId .SetText( std::to_wstring(m_item->id).c_str() ); + m_itemAuxValue .SetText( std::to_wstring(m_item->getAuxValue()).c_str() ); + m_itemCount .SetText( std::to_wstring(m_item->count).c_str() ); + m_item4JData .SetText( std::to_wstring(m_item->get4JData()).c_str() ); } m_itemId .SetKeyboardType(C_4JInput::EKeyboardMode_Numeric); @@ -107,7 +107,7 @@ HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot if(!value.empty()) data = _fromString<int>( value ); m_item->set4JData(data); } - + m_icon->SetIcon(m_iPad, m_item->id,m_item->getAuxValue(),m_item->count,10,31,false,m_item->isFoil()); m_itemName.SetText( app.GetString( Item::items[m_item->id]->getDescriptionId(m_item) ) ); diff --git a/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp b/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp index a23e97b7..e6db6a80 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp @@ -28,7 +28,7 @@ #include "..\..\..\Minecraft.World\net.minecraft.commands.common.h" #include "..\..\..\Minecraft.World\ConsoleSaveFileOriginal.h" -#ifdef _DEBUG_MENUS_ENABLED +#ifdef _DEBUG_MENUS_ENABLED HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) { MapChildControls(); @@ -53,7 +53,7 @@ HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) m_enchantmentIds.push_back(ench->id); m_enchantments.SetText( i, app.GetString( ench->getDescriptionId() ) ); } - + m_mobs.InsertItems( 0, 21 ); m_mobs.SetText( m_mobFactories.size(), L"Chicken" ); @@ -98,7 +98,7 @@ HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) m_mobFactories.push_back(eTYPE_BLAZE); m_mobs.SetText( m_mobFactories.size(), L"Magma Cube" ); m_mobFactories.push_back(eTYPE_LAVASLIME); - + Minecraft *pMinecraft = Minecraft::GetInstance(); m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 ); @@ -135,7 +135,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress { nIndex = m_mobs.GetCurSel(); if(nIndex<m_mobFactories.size()) - { + { app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_SpawnMob,(void *)m_mobFactories[nIndex]); } } @@ -171,7 +171,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress HXUIOBJ hScene; HRESULT hr; //const WCHAR XZP_SEPARATOR = L'#'; - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/"); @@ -189,7 +189,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress HXUIOBJ hScene; HRESULT hr; //const WCHAR XZP_SEPARATOR = L'#'; - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/"); @@ -256,7 +256,7 @@ HRESULT CScene_DebugOverlay::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotify if( hObjSource == m_setTime ) { Minecraft *pMinecraft = Minecraft::GetInstance(); - + // Need to set the time on both levels to stop the flickering as the local level // tries to predict the time // Only works if we are on the host machine, but shouldn't break if not @@ -365,11 +365,11 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius) RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map<File, RegionFile *, FileKeyHash, FileKeyEq> &newFileCache, ConsoleSaveFile *saveFile, const wstring &prefix, int chunkX, int chunkZ) // 4J - TODO was synchronized { - File file( prefix + wstring(L"r.") + _toString(chunkX>>5) + L"." + _toString(chunkZ>>5) + L".mcr" ); + File file( prefix + wstring(L"r.") + std::to_wstring(chunkX>>5) + L"." + std::to_wstring(chunkZ>>5) + L".mcr" ); RegionFile *ref = NULL; - AUTO_VAR(it, newFileCache.find(file)); - if( it != newFileCache.end() ) + auto it = newFileCache.find(file); + if( it != newFileCache.end() ) ref = it->second; // 4J Jev, put back in. diff --git a/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp b/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp index 2227e895..f6335191 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp @@ -23,7 +23,7 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled currentPosition = new DebugSetCameraPosition(); currentPosition->player = playerNo; - + Minecraft *pMinecraft = Minecraft::GetInstance(); if (pMinecraft != NULL) { @@ -43,13 +43,13 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled m_yRot.SetKeyboardType(C_4JInput::EKeyboardMode_Full); m_elevation.SetKeyboardType(C_4JInput::EKeyboardMode_Full); - m_camX.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camX).c_str()); - m_camY.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camY + 1.62).c_str()); - m_camZ.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_camZ).c_str()); + m_camX.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camX).c_str()); + m_camY.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camY + 1.62).c_str()); + m_camZ.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_camZ).c_str()); + + m_yRot.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_yRot).c_str()); + m_elevation.SetText((CONST WCHAR *) std::to_wstring(currentPosition->m_elev).c_str()); - m_yRot.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_yRot).c_str()); - m_elevation.SetText((CONST WCHAR *) _toString<double>(currentPosition->m_elev).c_str()); - //fpp = new FreezePlayerParam(); //fpp->player = playerNo; //fpp->freeze = true; @@ -69,7 +69,7 @@ HRESULT CScene_DebugSetCamera::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPre if (hObjPressed == m_teleport) { app.SetXuiServerAction( ProfileManager.GetPrimaryPad(), - eXuiServerAction_SetCameraLocation, + eXuiServerAction_SetCameraLocation, (void *)currentPosition); rfHandled = TRUE; } diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp index 73f25da5..c5e2fe9a 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -42,13 +42,13 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand m_iTexturePacksNotInstalled=0; m_iConfigA=NULL; - + XuiControlSetText(m_LabelNoGames,app.GetString(IDS_NO_GAMES_FOUND)); XuiControlSetText(m_GamesList,app.GetString(IDS_JOIN_GAME)); XuiControlSetText(m_SavesList,app.GetString(IDS_START_GAME)); - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); @@ -64,17 +64,17 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand m_bRetrievingSaveInfo=false; m_bSaveTransferInProgress=false; - + // check for a default custom cloak in the global storage // 4J-PB - changed to a config file // if(ProfileManager.IsSignedInLive( m_iPad )) -// { +// { // app.InstallDefaultCape(); // } m_initData= new JoinMenuInitData(); m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); - + XPARTY_USER_LIST partyList; if((XPartyGetUserList( &partyList ) != XPARTY_E_NOT_IN_PARTY ) && (partyList.dwUserCount>1)) @@ -90,7 +90,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand if(m_bInParty) iLB = IDS_TOOLTIPS_PARTY_GAMES; XuiSetTimer(m_hObj,JOIN_LOAD_ONLINE_TIMER_ID,JOIN_LOAD_ONLINE_TIMER_TIME); - + m_iSaveInfoC=0; VOID *pObj; @@ -110,7 +110,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand { // if we're waiting for DLC to mount, don't fill the save list. The custom message on end of dlc mounting will do that m_bIgnoreInput=false; - + m_iChangingSaveGameInfoIndex = 0; @@ -135,7 +135,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand // saving is disabled, but we should still be able to load from a selected save device ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_CHANGEDEVICE,-1,-1,-1,iLB,IDS_TOOLTIPS_DELETESAVE); - + GetSaveInfo(); } else @@ -153,7 +153,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand // 4J-PB - we need to check that there is enough space left to create a copy of the save (for a rename) bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame(); ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_CHANGEDEVICE,-1,-1,-1,-1,bCanRename?IDS_TOOLTIPS_SAVEOPTIONS:IDS_TOOLTIPS_DELETESAVE); - + GetSaveInfo(); } } @@ -165,7 +165,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand // 4J Stu - Fix for #12530 -TCR 001 BAS Game Stability: Title will crash if the player disconnects while starting a new world and then opts to play the tutorial once they have been returned to the Main Menu. MinecraftServer::resetFlags(); - + // If we're not ignoring input, then we aren't still waiting for the DLC to mount, and can now check for corrupt dlc. Otherwise this will happen when the dlc has finished mounting. if( !m_bIgnoreInput) { @@ -191,7 +191,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand bool bTexturePackAlreadyListed; bool bNeedToGetTPD=false; Minecraft *pMinecraft = Minecraft::GetInstance(); - int texturePacksCount = pMinecraft->skins->getTexturePackCount(); + int texturePacksCount = pMinecraft->skins->getTexturePackCount(); //CXuiCtrl4JList::LIST_ITEM_INFO ListInfo; //HRESULT hr; @@ -267,9 +267,8 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons() int iGeneratorIndex = 0; m_iMashUpButtonsC=0; - for(AUTO_VAR(it, m_generators->begin()); it != m_generators->end(); ++it) - { - LevelGenerationOptions *levelGen = *it; + for (LevelGenerationOptions *levelGen : *m_generators ) + { ListInfo.pwszText = levelGen->getWorldName(); ListInfo.fEnabled = TRUE; ListInfo.iData = iGeneratorIndex++; // used to index into the list of generators @@ -295,7 +294,7 @@ void CScene_MultiGameJoinLoad::AddDefaultButtons() // increment the count of the mash-up pack worlds in the save list m_iMashUpButtonsC++; TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId()); - DWORD dwImageBytes; + DWORD dwImageBytes; PBYTE pbImageData = tp->getPackIcon(dwImageBytes); HXUIBRUSH hXuiBrush; @@ -353,8 +352,8 @@ HRESULT CScene_MultiGameJoinLoad::GetSaveInfo( ) ListInfo.fEnabled=TRUE; ListInfo.iData = -1; m_pSavesList->AddData(ListInfo); - } - m_pSavesList->SetCurSelVisible(0); + } + m_pSavesList->SetCurSelVisible(0); } else { @@ -387,9 +386,9 @@ HRESULT CScene_MultiGameJoinLoad::OnDestroy() { g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL ); - for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it) - { - delete (*it); + for (auto& it : currentSessions ) + { + delete it; } if(m_bSaveTransferInProgress) @@ -419,7 +418,7 @@ int CScene_MultiGameJoinLoad::DeviceRemovedDialogReturned(void *pParam,int iPad, CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; // results switched for this dialog - if(result==C4JStorage::EMessage_ResultDecline) + if(result==C4JStorage::EMessage_ResultDecline) { StorageManager.SetSaveDisabled(true); StorageManager.SetSaveDeviceSelected(ProfileManager.GetPrimaryPad(),false); @@ -462,7 +461,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify //CScene_MultiGameInfo::JoinMenuInitData *initData = new CScene_MultiGameInfo::JoinMenuInitData(); m_initData->iPad = m_iPad; m_initData->selectedSession = currentSessions.at( nIndex ); - + // check that we have the texture pack available // If it's not the default texture pack if(m_initData->selectedSession->data.texturePackParentId!=0) @@ -513,7 +512,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify return S_OK; } } - + m_NetGamesListTimer.SetShow( FALSE ); // Reset the background downloading, in case we changed it by attempting to download a texture pack @@ -536,7 +535,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify CXuiCtrl4JList::LIST_ITEM_INFO info = m_pSavesList->GetData(iIndex); if(iIndex == JOIN_LOAD_CREATE_BUTTON_INDEX) - { + { app.SetTutorialMode( false ); m_NetGamesListTimer.SetShow( FALSE ); @@ -571,7 +570,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify } } else - { + { // check if this is a damaged save if(m_pSavesList->GetData(iIndex).bIsDamaged) { @@ -582,7 +581,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify StorageManager.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, pNotifyPressData->UserIndex,&CScene_MultiGameJoinLoad::DeleteSaveDialogReturned,this, app.GetStringTable()); } else - { + { app.SetTutorialMode( false ); if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { @@ -605,7 +604,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify } } } - + return S_OK; } @@ -632,11 +631,11 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r app.NavigateBack(XUSER_INDEX_ANY); rfHandled = TRUE; - break; + break; case VK_PAD_X: // Change device - // Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage + // Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage // device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes. m_bIgnoreInput=true; StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned,this,true); @@ -657,7 +656,7 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r { // save transfer - make sure they want to overwrite a save that is up there if(ProfileManager.IsSignedInLive( m_iPad )) - { + { // 4J-PB - required for a delete of the save if it's found to be a corrupted save DWORD nIndex = m_pSavesList->GetCurSel(); m_iChangingSaveGameInfoIndex=m_pSavesList->GetData(nIndex).iIndex; @@ -668,13 +667,13 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r ui.RequestMessageBox(IDS_SAVE_TRANSFER_TITLE, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, pInputData->UserIndex,&CScene_MultiGameJoinLoad::SaveTransferDialogReturned,this, app.GetStringTable()); } - } + } break; case VK_PAD_RSHOULDER: if(DoesSavesListHaveFocus()) { m_bIgnoreInput = true; - + int iIndex=m_SavesList.GetCurSel(); m_iChangingSaveGameInfoIndex=m_pSavesList->GetData(iIndex).iIndex; @@ -755,19 +754,19 @@ HRESULT CScene_MultiGameJoinLoad::OnKeyDown(XUIMessageInput* pInputData, BOOL& r } break; } - + return hr; } HRESULT CScene_MultiGameJoinLoad::OnNavReturn(HXUIOBJ hSceneFrom,BOOL& rfHandled) { - + CXuiSceneBase::ShowLogo( DEFAULT_XUI_MENU_USER, TRUE ); // start the texture pack timer again XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME); - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); - + m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); + // re-enable button presses m_bIgnoreInput=false; @@ -812,7 +811,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNavReturn(HXUIOBJ hSceneFrom,BOOL& rfHandled iY = IDS_TOOLTIPS_VIEW_GAMERCARD; } else if(DoesSavesListHaveFocus()) - { + { if(ProfileManager.IsSignedInLive( m_iPad )) { iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE; @@ -901,7 +900,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTransitionStart( XUIMessageTransition *pTran if(pTransition->dwTransType == XUI_TRANSITION_BACKTO) { // Can't call this here because if you back out of the load info screen and then go back in and load a game, it will attempt to use the dlc as it's running a mount of the dlc - + // block input if we're waiting for DLC to install, and wipe the saves list. The end of dlc mounting custom message will fill the list again if(app.StartInstallDLCProcess(m_iPad)==false) { @@ -925,14 +924,14 @@ HRESULT CScene_MultiGameJoinLoad::OnFontRendererChange() // update the tooltips // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should the the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; if( DoesGamesListHaveFocus() ) { iY = IDS_TOOLTIPS_VIEW_GAMERCARD; - } + } else if(DoesSavesListHaveFocus()) - { + { if(ProfileManager.IsSignedInLive( m_iPad )) { iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE; @@ -986,12 +985,12 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifySetFocus(HXUIOBJ hObjSource, XUINotify // update the tooltips // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should the the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; if( DoesGamesListHaveFocus() ) { iY = IDS_TOOLTIPS_VIEW_GAMERCARD; - } + } else if(DoesSavesListHaveFocus()) { if(ProfileManager.IsSignedInLive( m_iPad )) @@ -1118,7 +1117,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesListCallback(LPVOID lpParam) // check this there's no save transfer in progress if(!pClass->m_bSaveTransferInProgress) { - pClass->UpdateGamesList(); + pClass->UpdateGamesList(); } } } @@ -1145,17 +1144,17 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId; pSelectedSession = NULL; - for(AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it) - { - delete (*it); + for (auto& it : currentSessions ) + { + delete it; } currentSessions.clear(); - + m_NetGamesListTimer.SetShow( FALSE ); - + // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should show the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; if( DoesGamesListHaveFocus() ) @@ -1163,7 +1162,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() iY = IDS_TOOLTIPS_VIEW_GAMERCARD; } else if(DoesSavesListHaveFocus()) - { + { if(ProfileManager.IsSignedInLive( m_iPad )) { iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE; @@ -1248,9 +1247,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() unsigned int sessionIndex = 0; m_pGamesList->SetCurSel(0); - for( AUTO_VAR(it, currentSessions.begin()); it < currentSessions.end(); ++it) - { - FriendSessionInfo *sessionInfo = *it; + for ( FriendSessionInfo *sessionInfo : currentSessions ) + { HXUIBRUSH hXuiBrush; CXuiCtrl4JList::LIST_ITEM_INFO ListInfo; @@ -1282,7 +1280,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() // is it in the tpd data ? app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); if(dwImageBytes > 0 && pbImageData) - { + { hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush); m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush); } @@ -1291,7 +1289,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() { pbImageData = tp->getPackIcon(dwImageBytes); if(dwImageBytes > 0 && pbImageData) - { + { hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush); m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush); } @@ -1303,7 +1301,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList() XuiCreateTextureBrushFromMemory(m_DefaultMinecraftIconData,m_DefaultMinecraftIconSize,&hXuiBrush); m_pGamesList->UpdateGraphic(sessionIndex,hXuiBrush); } - + if(memcmp( &selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID) ) == 0) { @@ -1324,14 +1322,14 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear if(m_searches>0) --m_searches; - + if(m_searches==0) { m_NetGamesListTimer.SetShow( FALSE ); - + // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should show the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; if( DoesGamesListHaveFocus() ) @@ -1374,7 +1372,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear } unsigned int startOffset = m_GamesList.GetItemCount(); - //m_GamesList.InsertItems(startOffset,dwNumResults); + //m_GamesList.InsertItems(startOffset,dwNumResults); //m_GamesList.SetEnable(TRUE); //XuiElementSetDisableFocusRecursion( m_GamesList.m_hObj, FALSE); @@ -1390,7 +1388,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear FriendSessionInfo *sessionInfo = NULL; bool foundSession = false; - for(AUTO_VAR(it, friendsSessions.begin()); it < friendsSessions.end(); ++it) + for( auto it = friendsSessions.begin(); it != friendsSessions.end(); ++it) { sessionInfo = *it; if(memcmp( &pSearchResult->info.sessionID, &sessionInfo->sessionId, sizeof(SessionID) ) == 0) @@ -1449,7 +1447,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear #endif } } - + if( m_GamesList.GetItemCount() == 0) { m_LabelNoGames.SetShow( TRUE ); @@ -1537,14 +1535,14 @@ int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue) { // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should show the View Gamercard tooltip - int iRB=-1; + int iRB=-1; int iY = -1; if( pClass->DoesGamesListHaveFocus() ) { iY = IDS_TOOLTIPS_VIEW_GAMERCARD; } else if(pClass->DoesSavesListHaveFocus()) - { + { if(ProfileManager.IsSignedInLive( pClass->m_iPad )) { iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE; @@ -1593,7 +1591,7 @@ int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue) pClass->GetSaveInfo(); } else - { + { ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK,IDS_TOOLTIPS_SELECTDEVICE,iY,-1,-1,iLB,iRB); // clear the saves list pClass->m_pSavesList->RemoveAllData(); @@ -1623,11 +1621,11 @@ int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue) HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) { - // 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly + // 4J-PB - TODO - Don't think we can do this - if a 2nd player signs in here with an offline profile, the signed in LIVE player gets re-logged in, and bMultiplayerAllowed is false briefly switch(pTimer->nId) { - + case JOIN_LOAD_ONLINE_TIMER_ID: { XPARTY_USER_LIST partyList; @@ -1673,7 +1671,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl { } else if(DoesSavesListHaveFocus()) - { + { if(ProfileManager.IsSignedInLive( m_iPad )) { iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE; @@ -1737,7 +1735,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl //CXuiCtrl4JList::LIST_ITEM_INFO ListInfo; // for each iConfig, check if the data is available, and add it to the List, then remove it from the viConfig - + for(int i=0;i<m_iTexturePacksNotInstalled;i++) { if(m_iConfigA[i]!=-1) @@ -1760,7 +1758,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl bool bAllDone=true; for(int i=0;i<m_iTexturePacksNotInstalled;i++) { - if(m_iConfigA[i]!=-1) + if(m_iConfigA[i]!=-1) { bAllDone = false; } @@ -1878,25 +1876,25 @@ int CScene_MultiGameJoinLoad::DeleteSaveDataReturned(void *pParam,bool bSuccess) pClass->m_iSaveInfoC=0; pClass->GetSaveInfo(); } - + pClass->m_bIgnoreInput=false; return 0; } void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen) -{ +{ // Load data from disc //File saveFile( L"Tutorial\\Tutorial" ); //LoadSaveFromDisk(&saveFile); // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); - + StorageManager.ResetSaveData(); // Make our next save default to the name of the level StorageManager.SetSaveTitle(levelGen->getDefaultSaveName().c_str()); - + bool isClientSide = false; bool isPrivate = false; int maxPlayers = MINECRAFT_NET_MAX_PLAYERS; @@ -1918,7 +1916,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen) if(levelGen->requiresTexturePack()) { param->texturePackId = levelGen->getRequiredTexturePackId(); - + Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->skins->selectTexturePackById(param->texturePackId); //pMinecraft->skins->updateUI(); @@ -1939,7 +1937,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen) } void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile) -{ +{ // we'll only be coming in here when the tutorial is loaded now StorageManager.ResetSaveData(); @@ -1952,7 +1950,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile) byteArray ba(fileSize); fis.read(ba); fis.close(); - + bool isClientSide = false; bool isPrivate = false; int maxPlayers = MINECRAFT_NET_MAX_PLAYERS; @@ -1962,7 +1960,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile) isClientSide = false; maxPlayers = 4; } - + app.SetGameHostOption(eGameHostOption_GameType,GameType::CREATIVE->getId()); g_NetworkManager.HostGame(0,isClientSide,isPrivate,maxPlayers,0); @@ -1992,7 +1990,7 @@ int CScene_MultiGameJoinLoad::DeleteSaveDialogReturned(void *pParam,int iPad,C4J { CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; // results switched for this dialog - if(result==C4JStorage::EMessage_ResultDecline) + if(result==C4JStorage::EMessage_ResultDecline) { if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { @@ -2017,7 +2015,7 @@ int CScene_MultiGameJoinLoad::SaveTransferDialogReturned(void *pParam,int iPad,C { CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam; // results switched for this dialog - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { // upload the save @@ -2042,7 +2040,7 @@ int CScene_MultiGameJoinLoad::SaveTransferDialogReturned(void *pParam,int iPad,C int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter ) { CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParameter; - Minecraft *pMinecraft = Minecraft::GetInstance(); + Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->progressRenderer->progressStart(IDS_SAVE_TRANSFER_TITLE); pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_UPLOADING ); @@ -2092,7 +2090,7 @@ int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter StorageManager.GetSaveCacheFileInfo(iIndex,XContentData); StorageManager.GetSaveCacheFileInfo(iIndex,&pbImageData,&dwImageBytes); - // if there is no thumbnail, retrieve the default one from the file. + // if there is no thumbnail, retrieve the default one from the file. // Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save if(pbImageData==NULL) { @@ -2143,7 +2141,7 @@ int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter return 0; } - // change text for completion confirmation + // change text for completion confirmation pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_UPLOADCOMPLETE ); // done @@ -2180,7 +2178,7 @@ void CScene_MultiGameJoinLoad::UploadFile(CScene_MultiGameJoinLoad *pClass, char C4JStorage::TMS_FILETYPE_BINARY, C4JStorage::TMS_UGCTYPE_NONE, filename, - (CHAR *)data, + (CHAR *)data, size, &CScene_MultiGameJoinLoad::TransferComplete,pClass, 0, &CScene_MultiGameJoinLoad::Progress,pClass); @@ -2219,7 +2217,7 @@ bool CScene_MultiGameJoinLoad::WaitForTransferComplete( CScene_MultiGameJoinLoad // cancelled return false; } - Sleep(50); + Sleep(50); // update the progress pMinecraft->progressRenderer->progressStagePercentage((unsigned int)(pClass->m_fProgress*100.0f)); } @@ -2235,7 +2233,7 @@ int CScene_MultiGameJoinLoad::SaveOptionsDialogReturned(void *pParam,int iPad,C4 // results switched for this dialog // EMessage_ResultAccept means cancel - if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) + if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) { if(result==C4JStorage::EMessage_ResultDecline) // rename { @@ -2302,9 +2300,9 @@ int CScene_MultiGameJoinLoad::LoadSaveDataReturned(void *pParam,bool bContinue) UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - StorageManager.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, + StorageManager.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, pClass->m_iPad,&CScene_MultiGameJoinLoad::DeleteSaveDialogReturned,pClass, app.GetStringTable()); - + } return 0; @@ -2366,7 +2364,7 @@ int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet) if(eLoadStatus==C4JStorage::ELoadGame_DeviceRemoved) { - // disable saving + // disable saving StorageManager.SetSaveDisabled(true); StorageManager.SetSaveDeviceSelected(ProfileManager.GetPrimaryPad(),false); UINT uiIDA[1]; @@ -2375,11 +2373,11 @@ int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet) } #else // rename the save - + #endif } else - { + { pClass->m_bIgnoreInput=false; } @@ -2400,7 +2398,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bC StorageManager.GetSaveCacheFileInfo(pClass->m_iChangingSaveGameInfoIndex-pClass->m_iDefaultButtonsC,XContentData); StorageManager.GetSaveCacheFileInfo(pClass->m_iChangingSaveGameInfoIndex-pClass->m_iDefaultButtonsC,&pbImageData,&dwImageBytes); - // if there is no thumbnail, retrieve the default one from the file. + // if there is no thumbnail, retrieve the default one from the file. // Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save if(pbImageData==NULL) { @@ -2456,7 +2454,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4 // Exit with or without saving // Decline means install full version of the texture pack in this dialog - if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultAccept) { // we need to enable background downloading for the DLC XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); @@ -2480,7 +2478,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4 ullIndexA[0]=pDLCInfo->ullOfferID_Trial; StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); } - } + } } pClass->m_bIgnoreInput=false; return 0; @@ -2489,7 +2487,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4 HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCInstalled() { // mounted DLC may have changed - + if(app.StartInstallDLCProcess(m_iPad)==false) { // not doing a mount, so re-enable input @@ -2508,7 +2506,7 @@ HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCInstalled() } HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCMountingComplete() -{ +{ VOID *pObj; XuiObjectFromHandle( m_SavesList, &pObj ); @@ -2534,7 +2532,7 @@ HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCMountingComplete() int iY=-1; if(DoesSavesListHaveFocus()) - { + { if(ProfileManager.IsSignedInLive( m_iPad )) { iY=IDS_TOOLTIPS_UPLOAD_SAVE_FOR_XBOXONE; @@ -2627,7 +2625,7 @@ void CScene_MultiGameJoinLoad::UpdateTooltips() // 4J-PB - we need to check that there is enough space left to create a copy of the save (for a rename) bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame(); - if(bCanRename) + if(bCanRename) { iRB=IDS_TOOLTIPS_SAVEOPTIONS; } @@ -2694,11 +2692,11 @@ bool CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID pParam,int iTotalSave pbCurrentImagePtr=pbImageData+InfoA[i].dwImageOffset; hr=XuiCreateTextureBrushFromMemory(pbCurrentImagePtr,InfoA[i].dwImageBytes,&hXuiBrush); pClass->m_pSavesList->UpdateGraphic(i+pClass->m_iDefaultButtonsC,hXuiBrush ); - } + } else { // we could put in a damaged save icon here - const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string + const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); @@ -2724,7 +2722,7 @@ bool CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID pParam,int iTotalSave // It's possible that the games list is updated but we haven't displayed it yet as we were still waiting on saves list to load // This is to fix a bug where joining a game before the saves list has loaded causes a crash when this callback is called // as the scene no longer exists - pClass->UpdateGamesList(); + pClass->UpdateGamesList(); // Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp index 10369d5e..03e783f4 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp @@ -24,7 +24,7 @@ #include "XUI_Ctrl_SlotItem.h" #include "XUI_Ctrl_SlotItemListItem.h" #include "XUI_Scene_AbstractContainer.h" -#ifdef _DEBUG_MENUS_ENABLED +#ifdef _DEBUG_MENUS_ENABLED #include "XUI_DebugItemEditor.h" #endif @@ -44,14 +44,14 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex) // We may have varying depths of controls here, so base off the pointers parent HXUIOBJ parent; - XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight ); + XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight ); XuiElementGetParent( m_pointerControl->m_hObj, &parent ); m_pointerControl->SetShow(TRUE); - XuiElementGetBounds( parent, &fPanelWidth, &fPanelHeight ); + XuiElementGetBounds( parent, &fPanelWidth, &fPanelHeight ); // Get size of pointer m_fPointerImageOffsetX = floor(fPointerWidth/2.0f); m_fPointerImageOffsetY = floor(fPointerHeight/2.0f); - + m_fPanelMinX = 0.0f; m_fPanelMaxX = fPanelWidth; m_fPanelMinY = 0.0f; @@ -97,13 +97,13 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex) m_pointerPos.x = newPointerPos.x; m_pointerPos.y = newPointerPos.y; -#ifdef USE_POINTER_ACCEL +#ifdef USE_POINTER_ACCEL m_fPointerVelX = 0.0f; m_fPointerVelY = 0.0f; m_fPointerAccelX = 0.0f; m_fPointerAccelY = 0.0f; #endif - + // Add timer to poll controller stick input at 60Hz HRESULT timerResult = SetTimer( POINTER_INPUT_TIMER_ID, ( 1000 / 60 ) ); assert( timerResult == S_OK ); @@ -114,7 +114,7 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex) for ( int iSection = m_eFirstSection; iSection < m_eMaxSection; ++iSection ) { ESceneSection eSection = ( ESceneSection )( iSection ); - + if(!IsSectionSlotList(eSection)) continue; // Get dimensions of this section. @@ -153,7 +153,7 @@ int CXuiSceneAbstractContainer::getSectionRows(ESceneSection eSection) return GetSectionSlotList( eSection )->GetRows(); } -// Adding this so we can turn off the pointer text background, since it flickers on then off at the start of a scene where a tutorial popup is +// Adding this so we can turn off the pointer text background, since it flickers on then off at the start of a scene where a tutorial popup is HRESULT CXuiSceneAbstractContainer::OnTransitionStart( XUIMessageTransition *pTransition, BOOL& bHandled ) { if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK; @@ -327,7 +327,7 @@ HRESULT CXuiSceneAbstractContainer::OnTimer( XUIMessageTimer *pTimer, BOOL& bHan // Update pointer from stick input on timer. if ( pTimer->nId == POINTER_INPUT_TIMER_ID ) { - + onMouseTick(); D3DXVECTOR3 pointerPos; pointerPos.x = m_pointerPos.x; @@ -348,7 +348,7 @@ HRESULT CXuiSceneAbstractContainer::OnTimer( XUIMessageTimer *pTimer, BOOL& bHan hr = handleCustomTimer( pTimer, bHandled ); } return hr; -} +} HRESULT CXuiSceneAbstractContainer::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled) { @@ -388,15 +388,15 @@ void CXuiSceneAbstractContainer::SetPointerText(const wstring &description, vect } bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()); - wstring desc = L"<font size=\"" + _toString<int>(smallPointer ? 12 :14) + L"\">" + description + L"</font>"; + wstring desc = L"<font size=\"" + std::to_wstring(smallPointer ? 12 :14) + L"\">" + description + L"</font>"; XUIRect tempXuiRect, xuiRect; HRESULT hr; xuiRect.right = 0; - for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it) - { - XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials((*it)).c_str(), &tempXuiRect); + for (auto& it : unformattedStrings ) + { + XuiTextPresenterMeasureText(m_hPointerTextMeasurer, parseXMLSpecials(it).c_str(), &tempXuiRect); if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect; } @@ -443,7 +443,7 @@ void CXuiSceneAbstractContainer::adjustPointerForSafeZone() D3DXVECTOR2 baseSceneOrigin; float baseWidth, baseHeight; if(CXuiSceneBase::GetBaseSceneSafeZone( m_iPad, baseSceneOrigin, baseWidth, baseHeight)) - { + { D3DXMATRIX pointerBackgroundMatrix; XuiElementGetFullXForm( m_hPointerTextBkg, &pointerBackgroundMatrix); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp index 04e77e5e..6024b8d6 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp @@ -33,7 +33,7 @@ HRESULT CXuiSceneInventory::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) { if(m_bSplitscreen) { - app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); + app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); } } @@ -57,7 +57,7 @@ HRESULT CXuiSceneInventory::OnInit( XUIMessageInit *pInitData, BOOL &bHandled ) initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_noArgs()); CXuiSceneAbstractContainer::Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack ); - + delete initData; float fWidth; @@ -86,7 +86,7 @@ HRESULT CXuiSceneInventory::OnDestroy() } // 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) + // 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -176,8 +176,8 @@ void CXuiSceneInventory::updateEffectsDisplay() // Fill out details for display D3DXVECTOR3 position; m_hEffectDisplayA[0]->GetPosition(&position); - AUTO_VAR(it, activeEffects->begin()); - for(unsigned int i = 0; i < MAX_EFFECTS; ++i) + auto it = activeEffects->begin(); + for(unsigned int i = 0; i < MAX_EFFECTS; ++i) { if(it != activeEffects->end()) { @@ -185,7 +185,7 @@ void CXuiSceneInventory::updateEffectsDisplay() if(i > 0) position.y -= fNextEffectYOffset; // Stack from the bottom m_hEffectDisplayA[i]->SetPosition(&position); - + MobEffectInstance *effect = *it; MobEffect *mobEffect = MobEffect::effects[effect->getId()]; diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp index fec13460..8738e683 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp @@ -19,11 +19,11 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { MapChildControls(); - + //XuiControlSetText(m_villagerText,app.GetString(IDS_VILLAGER)); XuiControlSetText(m_inventoryLabel,app.GetString(IDS_INVENTORY)); XuiControlSetText(m_requiredLabel,app.GetString(IDS_REQUIRED_ITEMS_FOR_TRADE)); - + Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -36,7 +36,7 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) if(m_bSplitscreen) { - app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); + app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); } if( pMinecraft->localgameModes[m_iPad] != NULL ) @@ -65,7 +65,7 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) // store the slot 0 highlight position m_tradingSelector.GetPosition(&m_vSelectorInitialPos); - + //app.SetRichPresenceContextValue(m_iPad,CONTEXT_GAME_STATE_FORGING); XuiSetTimer(m_hObj,TRADING_UPDATE_TIMER_ID,TRADING_UPDATE_TIMER_TIME); @@ -86,7 +86,7 @@ HRESULT CXuiSceneTrading::OnDestroy() } // 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) + // 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); return S_OK; } @@ -270,15 +270,15 @@ void CXuiSceneTrading::setOfferDescription(const wstring &name, vector<wstring> } bool smallPointer = m_bSplitscreen || (!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()); - wstring desc = L"<font size=\"" + _toString<int>(smallPointer ? 12 :14) + L"\">" + name + L"</font>"; + wstring desc = L"<font size=\"" + std::to_wstring(smallPointer ? 12 :14) + L"\">" + name + L"</font>"; XUIRect tempXuiRect, xuiRect; HRESULT hr; xuiRect.right = 0; - for(AUTO_VAR(it, unformattedStrings.begin()); it != unformattedStrings.end(); ++it) - { - XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, (*it).c_str(), &tempXuiRect); + for (auto& it : unformattedStrings ) + { + XuiTextPresenterMeasureText(m_hOfferInfoTextMeasurer, it.c_str(), &tempXuiRect); if(tempXuiRect.right > xuiRect.right) xuiRect = tempXuiRect; } @@ -299,7 +299,7 @@ void CXuiSceneTrading::setOfferDescription(const wstring &name, vector<wstring> XuiElementSetBounds(m_hOfferInfoText,xuiRect.right+4.0f+4.0f,xuiRect.bottom+4.0f+4.0f); // edge graphics are 8 pixels, text is centred m_offerInfoControl.SetShow(TRUE); - + D3DXVECTOR3 highlightPos, offerInfoPos; float highlightWidth, highlightHeight; m_tradingSelector.GetPosition(&highlightPos); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp index 0f0c678b..19e6b016 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp @@ -20,7 +20,7 @@ const float CScene_Win::PLAYER_SCROLL_SPEED = 3.0f; // Performs initialization tasks - retrieves controls. //---------------------------------------------------------------------------------- HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) -{ +{ m_iPad = *(int *)pInitData->pvInitData; m_bIgnoreInput = false; @@ -194,8 +194,8 @@ void CScene_Win::updateNoise() { Minecraft *pMinecraft = Minecraft::GetInstance(); noiseString = noNoiseString; - - int length = 0; + + size_t length = 0; wchar_t replacements[64]; wstring replaceString = L""; wchar_t randomChar = L'a'; @@ -205,18 +205,18 @@ void CScene_Win::updateNoise() wstring tag = L"{*NOISE*}"; - AUTO_VAR(it, m_noiseLengths.begin()); - int found=(int)noiseString.find_first_of(L"{"); + auto it = m_noiseLengths.begin(); + size_t found = noiseString.find_first_of(L"{"); while (found!=string::npos && it != m_noiseLengths.end() ) { length = *it; ++it; replaceString = L""; - for(int i = 0; i < length; ++i) + for(size_t i = 0; i < length; ++i) { - randomChar = SharedConstants::acceptableLetters[random->nextInt((int)SharedConstants::acceptableLetters.length())]; - + randomChar = SharedConstants::acceptableLetters[random->nextInt(SharedConstants::acceptableLetters.length())]; + wstring randomCharStr = L""; randomCharStr.push_back(randomChar); if(randomChar == L'<') @@ -262,7 +262,7 @@ void CScene_Win::updateNoise() //ib.put(listPos + 256 + random->nextInt(2) + 8 + (darken ? 16 : 0)); //ib.put(listPos + pos + 32); - found=(int)noiseString.find_first_of(L"{",found+1); + found = noiseString.find_first_of(L"{",found+1); } } diff --git a/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp b/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp index 8934350d..0369928b 100644 --- a/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp +++ b/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp @@ -53,7 +53,7 @@ HRESULT CScene_TextEntry::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyVal if(pValueChangedData->nValue==10) { LPCWSTR pText = m_EditText.GetText(); - + if(pText) { wstring wText = pText; @@ -61,7 +61,7 @@ HRESULT CScene_TextEntry::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyVal } app.NavigateBack(m_iPad); - rfHandled = TRUE; + rfHandled = TRUE; } return S_OK; @@ -86,7 +86,7 @@ HRESULT CScene_TextEntry::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled app.NavigateBack(m_iPad); rfHandled = TRUE; - } + } break; case VK_PAD_B: @@ -113,8 +113,8 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText) swscanf_s(wsText.c_str(), L"%s", wchCommand,40); #endif - AUTO_VAR(it, m_CommandSet.find(wchCommand)); - if(it != m_CommandSet.end()) + auto it = m_CommandSet.find(wchCommand); + if(it != m_CommandSet.end()) { // found it @@ -125,7 +125,7 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText) case eCommand_Teleport: { int x,z; - + #ifdef __PS3__ // 4J Stu - The Xbox version uses swscanf_s which isn't available in GCC. swscanf(wsText.c_str(), L"%40s%c%d%c%d", wchCommand,wchSep,&x,wchSep,&z); @@ -146,9 +146,9 @@ HRESULT CScene_TextEntry::InterpretString(wstring &wsText) } break; case eCommand_Give: - { + { int iItem,iCount; - + #ifdef __PS3__ // 4J Stu - The Xbox version uses swscanf_s which isn't available in GCC. swscanf(wsText.c_str(), L"%40s%c%d%c%d", wchCommand,wchSep,&iItem,wchSep,&iCount); |
