aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/XUI
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-16 21:44:26 -0500
committerGitHub <noreply@github.com>2026-03-16 21:44:26 -0500
commitce739f6045ec72127491286ea3f3f21e537c1b55 (patch)
treef33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.Client/Common/XUI
parent255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff)
parent5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Common/XUI')
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Chat.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp10
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp2
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp16
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp8
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp14
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp26
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp22
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp16
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp36
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp58
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp10
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp64
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h2
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp8
-rw-r--r--Minecraft.Client/Common/XUI/XUI_CustomMessages.h6
-rw-r--r--Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp76
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Death.cpp8
-rw-r--r--Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp14
-rw-r--r--Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp42
-rw-r--r--Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp14
-rw-r--r--Minecraft.Client/Common/XUI/XUI_DebugTips.cpp2
-rw-r--r--Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp14
-rw-r--r--Minecraft.Client/Common/XUI/XUI_HUD.cpp68
-rw-r--r--Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp12
-rw-r--r--Minecraft.Client/Common/XUI/XUI_HelpControls.cpp24
-rw-r--r--Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp6
-rw-r--r--Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp18
-rw-r--r--Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp12
-rw-r--r--Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp6
-rw-r--r--Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp28
-rw-r--r--Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp64
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp116
-rw-r--r--Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp104
-rw-r--r--Minecraft.Client/Common/XUI/XUI_MainMenu.cpp34
-rw-r--r--Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp172
-rw-r--r--Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp20
-rw-r--r--Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp140
-rw-r--r--Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp4
-rw-r--r--Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp2
-rw-r--r--Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp68
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Reinstall.cpp10
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp8
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp24
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp225
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp14
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp18
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp40
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp14
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp14
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp20
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp22
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp16
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp14
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp16
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp8
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp12
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp12
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp12
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp12
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp12
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SignEntry.cpp6
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp68
-rw-r--r--Minecraft.Client/Common/XUI/XUI_SocialPost.cpp8
-rw-r--r--Minecraft.Client/Common/XUI/XUI_Teleport.cpp10
-rw-r--r--Minecraft.Client/Common/XUI/XUI_TextEntry.cpp2
-rw-r--r--Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp38
-rw-r--r--Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp2
-rw-r--r--Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp44
-rw-r--r--Minecraft.Client/Common/XUI/XUI_debug.cpp10
77 files changed, 1054 insertions, 1055 deletions
diff --git a/Minecraft.Client/Common/XUI/XUI_Chat.cpp b/Minecraft.Client/Common/XUI/XUI_Chat.cpp
index 3e3faa77..64005621 100644
--- a/Minecraft.Client/Common/XUI/XUI_Chat.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Chat.cpp
@@ -5,7 +5,7 @@
HRESULT CScene_Chat::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
MapChildControls();
@@ -37,7 +37,7 @@ HRESULT CScene_Chat::OnTimer( XUIMessageTimer *pXUIMessageTimer, BOOL &bHandled)
m_Labels[i].SetOpacity(0);
}
}
- if(pMinecraft->localplayers[m_iPad]!= NULL)
+ if(pMinecraft->localplayers[m_iPad]!= nullptr)
{
m_Jukebox.SetText( pGui->getJukeboxMessage(m_iPad).c_str() );
m_Jukebox.SetOpacity( pGui->getJukeboxOpacity(m_iPad) );
diff --git a/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp b/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp
index 9a82a7b3..5ae736a3 100644
--- a/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp
@@ -12,7 +12,7 @@
//----------------------------------------------------------------------------------
HRESULT CScene_ConnectingProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- ConnectionProgressParams *param = (ConnectionProgressParams *)pInitData->pvInitData;
+ ConnectionProgressParams *param = static_cast<ConnectionProgressParams *>(pInitData->pvInitData);
m_iPad = param->iPad;
MapChildControls();
@@ -203,7 +203,7 @@ HRESULT CScene_ConnectingProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHand
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
#ifdef _XBOX
- StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
#endif
exitReasonStringId = -1;
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp
index cc3afeca..576b7557 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JEdit.cpp
@@ -10,7 +10,7 @@ HRESULT CXuiCtrl4JEdit::OnInit(XUIMessageInit* pInitData, BOOL& rfHandled)
// set a limit for the text box
m_uTextLimit=XUI_4JEDIT_MAX_CHARS-1;
XuiEditSetTextLimit(m_hObj,m_uTextLimit);
- // Find the text limit. (Add one for NULL terminator)
+ // Find the text limit. (Add one for nullptr terminator)
//m_uTextLimit = min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS);
ZeroMemory( wchText , sizeof(WCHAR)*(m_uTextLimit+1) );
@@ -127,7 +127,7 @@ HRESULT CXuiCtrl4JEdit::OnChar(XUIMessageChar* pInputData, BOOL& rfHandled)
XuiSendMessage( hBaseObj, &xuiMsg );
rfHandled = TRUE;
- SendNotifyValueChanged((int)pInputData->wch);
+ SendNotifyValueChanged(static_cast<int>(pInputData->wch));
return hr;
}
@@ -145,7 +145,7 @@ HRESULT CXuiCtrl4JEdit::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
if( pThis->m_bReadOnly ) return hr;
- // Find the text limit. (Add one for NULL terminator)
+ // Find the text limit. (Add one for nullptr terminator)
//m_uTextLimit = min( XuiEditGetTextLimit(m_hObj) + 1, XUI_4JEDIT_MAX_CHARS);
if((((pInputData->dwKeyCode == VK_PAD_A) && (pInputData->wch == 0)) || (pInputData->dwKeyCode == VK_PAD_START)) && !(pInputData->dwFlags & XUI_INPUT_FLAG_REPEAT))
@@ -185,14 +185,14 @@ HRESULT CXuiCtrl4JEdit::SendNotifyValueChanged(int iValue)
int CXuiCtrl4JEdit::KeyboardReturned(void *pParam,bool bSet)
{
- CXuiCtrl4JEdit* pClass = (CXuiCtrl4JEdit*)pParam;
+ CXuiCtrl4JEdit* pClass = static_cast<CXuiCtrl4JEdit *>(pParam);
HRESULT hr = S_OK;
if(bSet)
{
pClass->SetText(pClass->wchText);
// need to move the caret to the end of the newly set text
- XuiEditSetCaretPosition(pClass->m_hObj, (int)wcsnlen(pClass->wchText, 50));
+ XuiEditSetCaretPosition(pClass->m_hObj, static_cast<int>(wcsnlen(pClass->wchText, 50)));
pClass->SendNotifyValueChanged(10); // 10 for a return
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp
index 8895b60e..a4ff8d37 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp
@@ -3,7 +3,7 @@
HRESULT CXuiCtrl4JIcon::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
{
- m_hBrush=NULL;
+ m_hBrush=nullptr;
return S_OK;
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp
index 4c615979..7523c523 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JList.cpp
@@ -7,7 +7,7 @@ HRESULT CXuiCtrl4JList::OnInit(XUIMessageInit *pInitData, BOOL& bHandled)
{
InitializeCriticalSection(&m_AccessListData);
- m_hSelectionChangedHandlerObj = NULL;
+ m_hSelectionChangedHandlerObj = nullptr;
return S_OK;
}
@@ -22,13 +22,13 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
if(ItemInfo.pwszText)
{
- dwLen1=(int)wcslen(ItemInfo.pwszText)*sizeof(WCHAR);
+ dwLen1=static_cast<int>(wcslen(ItemInfo.pwszText))*sizeof(WCHAR);
dwBytes+=dwLen1+sizeof(WCHAR);
}
if(ItemInfo.pwszImage)
{
- dwLen2=(int)(wcslen(ItemInfo.pwszImage))*sizeof(WCHAR);
+ dwLen2=static_cast<int>(wcslen(ItemInfo.pwszImage))*sizeof(WCHAR);
dwBytes+=dwLen2+sizeof(WCHAR);
}
@@ -59,11 +59,11 @@ void CXuiCtrl4JList::AddData( const LIST_ITEM_INFO& ItemInfo , int iSortListFrom
// need to remember the original index of this addition before it gets sorted - this will get used to load the game
if(iSortListFromIndex!=-1)
{
- pItemInfo->iIndex=(int)m_vListData.size()-iSortListFromIndex;
+ pItemInfo->iIndex=static_cast<int>(m_vListData.size())-iSortListFromIndex;
}
else
{
- pItemInfo->iIndex=(int)m_vListData.size();
+ pItemInfo->iIndex=static_cast<int>(m_vListData.size());
}
// added to force a sort order for DLC
@@ -110,7 +110,7 @@ void CXuiCtrl4JList::RemoveAllData( )
{
EnterCriticalSection(&m_AccessListData);
- int iSize=(int)m_vListData.size();
+ int iSize=static_cast<int>(m_vListData.size());
for(int i=0;i<iSize;i++)
{
LIST_ITEM_INFO *pBack = m_vListData.back();
@@ -304,7 +304,7 @@ HRESULT CXuiCtrl4JList::OnGetSourceDataText(XUIMessageGetSourceText *pGetSourceT
HRESULT CXuiCtrl4JList::OnGetItemCountAll(XUIMessageGetItemCount *pGetItemCountData,BOOL& bHandled)
{
- pGetItemCountData->cItems = (int)m_vListData.size();
+ pGetItemCountData->cItems = static_cast<int>(m_vListData.size());
bHandled = TRUE;
return S_OK;
}
@@ -315,7 +315,7 @@ HRESULT CXuiCtrl4JList::OnGetSourceDataImage(XUIMessageGetSourceImage *pGetSourc
{
// Check for a brush
EnterCriticalSection(&m_AccessListData);
- if(GetData(pGetSourceImageData->iItem).hXuiBrush!=NULL)
+ if(GetData(pGetSourceImageData->iItem).hXuiBrush!=nullptr)
{
pGetSourceImageData->hBrush=GetData(pGetSourceImageData->iItem).hXuiBrush;
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp
index 074b7300..e74b92b4 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp
@@ -10,9 +10,9 @@ int CXuiCtrlBrewProgress::GetValue()
void* pvUserData;
this->GetUserData( &pvUserData );
- if( pvUserData != NULL )
+ if( pvUserData != nullptr )
{
- BrewingStandTileEntity *pBrewingStandTileEntity = (BrewingStandTileEntity *)pvUserData;
+ BrewingStandTileEntity *pBrewingStandTileEntity = static_cast<BrewingStandTileEntity *>(pvUserData);
return pBrewingStandTileEntity->getBrewTime();
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp
index cc5d996f..48a130c4 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp
@@ -8,9 +8,9 @@ int CXuiCtrlBubblesProgress::GetValue()
void* pvUserData;
this->GetUserData( &pvUserData );
- if( pvUserData != NULL )
+ if( pvUserData != nullptr )
{
- BrewingStandTileEntity *pBrewingStandTileEntity = (BrewingStandTileEntity *)pvUserData;
+ BrewingStandTileEntity *pBrewingStandTileEntity = static_cast<BrewingStandTileEntity *>(pvUserData);
int value = 0;
int bubbleStep = (pBrewingStandTileEntity->getBrewTime() / 2) % 7;
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp
index 8e514094..5a1a3674 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp
@@ -10,9 +10,9 @@ int CXuiCtrlBurnProgress::GetValue()
void* pvUserData;
this->GetUserData( &pvUserData );
- if( pvUserData != NULL )
+ if( pvUserData != nullptr )
{
- FurnaceTileEntity *pFurnaceTileEntity = (FurnaceTileEntity *)pvUserData;
+ FurnaceTileEntity *pFurnaceTileEntity = static_cast<FurnaceTileEntity *>(pvUserData);
// TODO This param is a magic number in Java but we should really define it somewhere with a name
// I think it is the number of states of the progress display (ie the max value)
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp
index 82b6c3ed..46bcc983 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp
@@ -11,7 +11,7 @@
CXuiCtrlCraftIngredientSlot::CXuiCtrlCraftIngredientSlot()
{
m_iID=0;
- m_Desc=NULL;
+ m_Desc=nullptr;
m_isFoil = false;
m_isDirty = false;
m_item = nullptr;
@@ -29,7 +29,7 @@ HRESULT CXuiCtrlCraftIngredientSlot::OnInit(XUIMessageInit* pInitData, BOOL& rfH
//-----------------------------------------------------------------------------
HRESULT CXuiCtrlCraftIngredientSlot::OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled)
{
- if( m_iID != 0 || m_item != NULL )
+ if( m_iID != 0 || m_item != nullptr )
{
pData->item = m_item;
pData->iItemBitField = MAKE_SLOTDISPLAY_ITEM_BITMASK(m_iID,m_iAuxVal,m_isFoil);
@@ -94,7 +94,7 @@ void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCo
void CXuiCtrlCraftIngredientSlot::SetIcon(int iPad, shared_ptr<ItemInstance> item, int iScale, unsigned int uiAlpha,bool bDecorations, BOOL bShow)
{
- if(item == NULL) SetIcon(iPad, 0,0,0,0,0,false,false,bShow);
+ if(item == nullptr) SetIcon(iPad, 0,0,0,0,0,false,false,bShow);
else
{
m_item = item;
@@ -118,6 +118,6 @@ void CXuiCtrlCraftIngredientSlot::SetDescription(LPCWSTR Desc)
hr=GetVisual(&hObj);
XuiElementGetChildById(hObj,L"text_name",&hObjChild);
XuiControlSetText(hObjChild,Desc);
- XuiElementSetShow(hObjChild,Desc==NULL?FALSE:TRUE);
+ XuiElementSetShow(hObjChild,Desc==nullptr?FALSE:TRUE);
m_Desc=Desc;
} \ No newline at end of file
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp
index 6c7876c9..9a312287 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp
@@ -15,10 +15,10 @@ HRESULT CXuiCtrlEnchantmentButton::OnInit(XUIMessageInit* pInitData, BOOL& rfHan
Minecraft *pMinecraft=Minecraft::GetInstance();
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
- m_fScreenWidth=(float)pMinecraft->width_phys;
- m_fRawWidth=(float)ssc.rawWidth;
- m_fScreenHeight=(float)pMinecraft->height_phys;
- m_fRawHeight=(float)ssc.rawHeight;
+ m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
+ m_fRawWidth=static_cast<float>(ssc.rawWidth);
+ m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
+ m_fRawHeight=static_cast<float>(ssc.rawHeight);
HXUIOBJ parent = m_hObj;
HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiSceneEnchant" );
@@ -28,13 +28,13 @@ HRESULT CXuiCtrlEnchantmentButton::OnInit(XUIMessageInit* pInitData, BOOL& rfHan
{
XuiElementGetParent(parent,&parent);
currentClass = XuiGetObjectClass( parent );
- } while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
+ } while (parent != nullptr && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
- assert( parent != NULL );
+ assert( parent != nullptr );
VOID *pObj;
XuiObjectFromHandle( parent, &pObj );
- m_containerScene = (CXuiSceneEnchant *)pObj;
+ m_containerScene = static_cast<CXuiSceneEnchant *>(pObj);
m_index = 0;
m_lastCost = 0;
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp
index 8a56a0ea..a83b7811 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp
@@ -30,12 +30,12 @@ CXuiCtrlEnchantmentBook::CXuiCtrlEnchantmentBook() :
Minecraft *pMinecraft=Minecraft::GetInstance();
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
- m_fScreenWidth=(float)pMinecraft->width_phys;
- m_fRawWidth=(float)ssc.rawWidth;
- m_fScreenHeight=(float)pMinecraft->height_phys;
- m_fRawHeight=(float)ssc.rawHeight;
+ m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
+ m_fRawWidth=static_cast<float>(ssc.rawWidth);
+ m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
+ m_fRawHeight=static_cast<float>(ssc.rawHeight);
- model = NULL;
+ model = nullptr;
time = 0;
flip = oFlip = flipT = flipA = 0.0f;
@@ -44,7 +44,7 @@ CXuiCtrlEnchantmentBook::CXuiCtrlEnchantmentBook() :
CXuiCtrlEnchantmentBook::~CXuiCtrlEnchantmentBook()
{
- //if(model != NULL) delete model;
+ //if(model != nullptr) delete model;
}
//-----------------------------------------------------------------------------
@@ -60,13 +60,13 @@ HRESULT CXuiCtrlEnchantmentBook::OnInit(XUIMessageInit* pInitData, BOOL& rfHandl
{
XuiElementGetParent(parent,&parent);
currentClass = XuiGetObjectClass( parent );
- } while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
+ } while (parent != nullptr && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
- assert( parent != NULL );
+ assert( parent != nullptr );
VOID *pObj;
XuiObjectFromHandle( parent, &pObj );
- m_containerScene = (CXuiSceneEnchant *)pObj;
+ m_containerScene = static_cast<CXuiSceneEnchant *>(pObj);
last = nullptr;
@@ -166,12 +166,12 @@ HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &b
glEnable(GL_CULL_FACE);
- if(model == NULL)
+ if(model == nullptr)
{
// Share the model the the EnchantTableRenderer
EnchantTableRenderer *etr = (EnchantTableRenderer*)TileEntityRenderDispatcher::instance->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY);
- if(etr != NULL)
+ if(etr != nullptr)
{
model = etr->bookModel;
}
@@ -181,7 +181,7 @@ HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &b
}
}
- model->render(NULL, 0, ff1, ff2, o, 0, 1 / 16.0f,true);
+ model->render(nullptr, 0, ff1, ff2, o, 0, 1 / 16.0f,true);
glDisable(GL_CULL_FACE);
glPopMatrix();
@@ -281,7 +281,7 @@ HRESULT CXuiCtrlEnchantmentBook::OnRender(XUIMessageRender *pRenderData, BOOL &b
//
// glEnable(GL_RESCALE_NORMAL);
//
-// model.render(NULL, 0, ff1, ff2, o, 0, 1 / 16.0f,true);
+// model.render(nullptr, 0, ff1, ff2, o, 0, 1 / 16.0f,true);
//
// glDisable(GL_RESCALE_NORMAL);
// Lighting::turnOff();
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp
index 60156a0a..ecb6132d 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp
@@ -25,10 +25,10 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnInit(XUIMessageInit* pInitData, BOOL& r
Minecraft *pMinecraft=Minecraft::GetInstance();
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
- m_fScreenWidth=(float)pMinecraft->width_phys;
- m_fRawWidth=(float)ssc.rawWidth;
- m_fScreenHeight=(float)pMinecraft->height_phys;
- m_fRawHeight=(float)ssc.rawHeight;
+ m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
+ m_fRawWidth=static_cast<float>(ssc.rawWidth);
+ m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
+ m_fRawHeight=static_cast<float>(ssc.rawHeight);
HXUIOBJ parent = m_hObj;
HXUICLASS hcInventoryClass = XuiFindClass( L"CXuiCtrlEnchantmentButton" );
@@ -38,13 +38,13 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnInit(XUIMessageInit* pInitData, BOOL& r
{
XuiElementGetParent(parent,&parent);
currentClass = XuiGetObjectClass( parent );
- } while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
+ } while (parent != nullptr && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
- assert( parent != NULL );
+ assert( parent != nullptr );
VOID *pObj;
XuiObjectFromHandle( parent, &pObj );
- m_parentControl = (CXuiCtrlEnchantmentButton *)pObj;
+ m_parentControl = static_cast<CXuiCtrlEnchantmentButton *>(pObj);
m_lastCost = 0;
m_enchantmentString = L"";
@@ -75,10 +75,10 @@ HRESULT CXuiCtrlEnchantmentButtonText::OnRender(XUIMessageRender *pRenderData, B
// 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;
- clearRect.x1 = (int)(matrix._41) - 2;
- clearRect.y1 = (int)(matrix._42) - 2;
- clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2;
- clearRect.y2 = (int)(matrix._42 + ( bheight * matrix._22 )) + 2;
+ clearRect.x1 = static_cast<int>(matrix._41) - 2;
+ clearRect.y1 = static_cast<int>(matrix._42) - 2;
+ clearRect.x2 = static_cast<int>(matrix._41 + (bwidth * matrix._11)) + 2;
+ clearRect.y2 = static_cast<int>(matrix._42 + (bheight * matrix._22)) + 2;
RenderManager.Clear(GL_DEPTH_BUFFER_BIT, &clearRect);
// glClear(GL_DEPTH_BUFFER_BIT);
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp
index b125af39..3d55db19 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp
@@ -10,9 +10,9 @@ int CXuiCtrlFireProgress::GetValue()
void* pvUserData;
this->GetUserData( &pvUserData );
- if( pvUserData != NULL )
+ if( pvUserData != nullptr )
{
- FurnaceTileEntity *pFurnaceTileEntity = (FurnaceTileEntity *)pvUserData;
+ FurnaceTileEntity *pFurnaceTileEntity = static_cast<FurnaceTileEntity *>(pvUserData);
// TODO This param is a magic number in Java but we should really define it somewhere with a name
// I think it is the number of states of the progress display (ie the max value)
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp
index 02ee7c93..98ff1c26 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp
@@ -22,10 +22,10 @@ CXuiCtrlMinecraftPlayer::CXuiCtrlMinecraftPlayer() :
Minecraft *pMinecraft=Minecraft::GetInstance();
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
- m_fScreenWidth=(float)pMinecraft->width_phys;
- m_fRawWidth=(float)ssc.rawWidth;
- m_fScreenHeight=(float)pMinecraft->height_phys;
- m_fRawHeight=(float)ssc.rawHeight;
+ m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
+ m_fRawWidth=static_cast<float>(ssc.rawWidth);
+ m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
+ m_fRawHeight=static_cast<float>(ssc.rawHeight);
}
//-----------------------------------------------------------------------------
@@ -41,13 +41,13 @@ HRESULT CXuiCtrlMinecraftPlayer::OnInit(XUIMessageInit* pInitData, BOOL& rfHandl
{
XuiElementGetParent(parent,&parent);
currentClass = XuiGetObjectClass( parent );
- } while (parent != NULL && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
+ } while (parent != nullptr && !XuiClassDerivesFrom( currentClass, hcInventoryClass ) );
- assert( parent != NULL );
+ assert( parent != nullptr );
VOID *pObj;
XuiObjectFromHandle( parent, &pObj );
- m_containerScene = (CXuiSceneInventory *)pObj;
+ m_containerScene = static_cast<CXuiSceneInventory *>(pObj);
m_iPad = m_containerScene->getPad();
@@ -116,7 +116,7 @@ HRESULT CXuiCtrlMinecraftPlayer::OnRender(XUIMessageRender *pRenderData, BOOL &b
//
// for(int i=0;i<XUSER_MAX_COUNT;i++)
// {
-// if(pMinecraft->localplayers[i] != NULL)
+// if(pMinecraft->localplayers[i] != nullptr)
// {
// iPlayerC++;
// }
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp
index 0acd250f..1fa44d3f 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp
@@ -30,10 +30,10 @@ CXuiCtrlMinecraftSkinPreview::CXuiCtrlMinecraftSkinPreview() :
Minecraft *pMinecraft=Minecraft::GetInstance();
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
- m_fScreenWidth=(float)pMinecraft->width_phys;
- m_fRawWidth=(float)ssc.rawWidth;
- m_fScreenHeight=(float)pMinecraft->height_phys;
- m_fRawHeight=(float)ssc.rawHeight;
+ m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
+ m_fRawWidth=static_cast<float>(ssc.rawWidth);
+ m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
+ m_fRawHeight=static_cast<float>(ssc.rawHeight);
m_customTextureUrl = L"default";
m_backupTexture = TN_MOB_CHAR;
@@ -62,7 +62,7 @@ CXuiCtrlMinecraftSkinPreview::CXuiCtrlMinecraftSkinPreview() :
m_fOriginalRotation = 0.0f;
m_framesAnimatingRotation = 0;
m_bAnimatingToFacing = false;
- m_pvAdditionalModelParts=NULL;
+ m_pvAdditionalModelParts=nullptr;
m_uiAnimOverrideBitmask=0L;
}
@@ -137,7 +137,7 @@ void CXuiCtrlMinecraftSkinPreview::SetFacing(ESkinPreviewFacing facing, bool bAn
void CXuiCtrlMinecraftSkinPreview::CycleNextAnimation()
{
- m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation + 1);
+ m_currentAnimation = static_cast<ESkinPreviewAnimations>(m_currentAnimation + 1);
if(m_currentAnimation >= e_SkinPreviewAnimation_Count) m_currentAnimation = e_SkinPreviewAnimation_Walking;
m_swingTime = 0.0f;
@@ -145,8 +145,8 @@ void CXuiCtrlMinecraftSkinPreview::CycleNextAnimation()
void CXuiCtrlMinecraftSkinPreview::CyclePreviousAnimation()
{
- m_currentAnimation = (ESkinPreviewAnimations)(m_currentAnimation - 1);
- if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = (ESkinPreviewAnimations)(e_SkinPreviewAnimation_Count - 1);
+ m_currentAnimation = static_cast<ESkinPreviewAnimations>(m_currentAnimation - 1);
+ if(m_currentAnimation < e_SkinPreviewAnimation_Walking) m_currentAnimation = static_cast<ESkinPreviewAnimations>(e_SkinPreviewAnimation_Count - 1);
m_swingTime = 0.0f;
}
@@ -241,7 +241,7 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
Lighting::turnOn();
//glRotatef(-45 - 90, 0, 1, 0);
- glRotatef(-(float)m_xRot, 1, 0, 0);
+ glRotatef(-static_cast<float>(m_xRot), 1, 0, 0);
// 4J Stu - Turning on hideGui while we do this stops the name rendering in split-screen
bool wasHidingGui = pMinecraft->options->hideGui;
@@ -249,7 +249,7 @@ HRESULT CXuiCtrlMinecraftSkinPreview::OnRender(XUIMessageRender *pRenderData, BO
//EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1);
EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER);
- if (renderer != NULL)
+ if (renderer != nullptr)
{
// 4J-PB - any additional parts to turn on for this player (skin dependent)
//vector<ModelPart *> *pAdditionalModelParts=mob->GetAdditionalModelParts();
@@ -294,12 +294,12 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do
glPushMatrix();
glDisable(GL_CULL_FACE);
- HumanoidModel *model = (HumanoidModel *)renderer->getModel();
+ HumanoidModel *model = static_cast<HumanoidModel *>(renderer->getModel());
//getAttackAnim(mob, a);
- //if (armor != NULL) armor->attackTime = model->attackTime;
+ //if (armor != nullptr) armor->attackTime = model->attackTime;
//model->riding = mob->isRiding();
- //if (armor != NULL) armor->riding = model->riding;
+ //if (armor != nullptr) armor->riding = model->riding;
// 4J Stu - Remember to reset these values once the rendering is done if you add another one
model->attackTime = 0;
@@ -329,7 +329,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do
{
m_swingTime = 0;
}
- model->attackTime = m_swingTime / (float) (Player::SWING_DURATION * 3);
+ model->attackTime = m_swingTime / static_cast<float>(Player::SWING_DURATION * 3);
break;
default:
break;
@@ -343,7 +343,7 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do
//setupPosition(mob, x, y, z);
// is equivalent to
- glTranslatef((float) x, (float) y, (float) z);
+ glTranslatef(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z));
//float bob = getBob(mob, a);
#ifdef SKIN_PREVIEW_BOB_ANIM
@@ -415,11 +415,11 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do
double xa = sin(yr * PI / 180);
double za = -cos(yr * PI / 180);
- float flap = (float) yd * 10;
+ float flap = static_cast<float>(yd) * 10;
if (flap < -6) flap = -6;
if (flap > 32) flap = 32;
- float lean = (float) (xd * xa + zd * za) * 100;
- float lean2 = (float) (xd * za - zd * xa) * 100;
+ float lean = static_cast<float>(xd * xa + zd * za) * 100;
+ float lean2 = static_cast<float>(xd * za - zd * xa) * 100;
if (lean < 0) lean = 0;
//float pow = 1;//mob->oBob + (bob - mob->oBob) * a;
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp
index 84273eb5..9b64dbcb 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp
@@ -40,7 +40,7 @@ LPCWSTR CXuiCtrlMinecraftSlot::xzpIcons[15]=
//-----------------------------------------------------------------------------
CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() :
- //m_hBrush(NULL),
+ //m_hBrush(nullptr),
m_bDirty(FALSE),
m_iPassThroughDataAssociation(0),
m_iPassThroughIdAssociation(0),
@@ -60,10 +60,10 @@ CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() :
Minecraft *pMinecraft=Minecraft::GetInstance();
- if(pMinecraft != NULL)
+ if(pMinecraft != nullptr)
{
- m_fScreenWidth=(float)pMinecraft->width_phys;
- m_fScreenHeight=(float)pMinecraft->height_phys;
+ m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
+ m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
m_bScreenWidthSetup = true;
}
}
@@ -109,14 +109,14 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData,
pData->szPath = MsgGetSlotItem.szPath;
pData->bDirty = MsgGetSlotItem.bDirty;
- if(MsgGetSlotItem.item != NULL)
+ if(MsgGetSlotItem.item != nullptr)
{
m_item = MsgGetSlotItem.item;
m_iID = m_item->id;
m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
- m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
+ m_fAlpha = static_cast<float>(GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
- m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
+ m_fScale = static_cast<float>(GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
}
else
{
@@ -128,10 +128,10 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData,
// 4J Stu - Some parent controls may overide this, others will leave it as what we passed in
m_iPad = GET_SLOTDISPLAY_USERINDEX_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
- m_fAlpha = ((float)GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
+ m_fAlpha = static_cast<float>(GET_SLOTDISPLAY_ALPHA_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/31.0f;
m_bDecorations = GET_SLOTDISPLAY_DECORATIONS_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
m_iCount = GET_SLOTDISPLAY_COUNT_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
- m_fScale = ((float)GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
+ m_fScale = static_cast<float>(GET_SLOTDISPLAY_SCALE_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField))/10.0f;
m_popTime = GET_SLOTDISPLAY_POPTIME_FROM_DATA_BITMASK(MsgGetSlotItem.iDataBitField);
m_iAuxVal = GET_SLOTDISPLAY_AUXVAL_FROM_ITEM_BITMASK(MsgGetSlotItem.iItemBitField);
@@ -145,7 +145,7 @@ HRESULT CXuiCtrlMinecraftSlot::OnGetSourceImage(XUIMessageGetSourceImage* pData,
pData->szPath = xzpIcons[m_iID-32000];
}
- if(m_item != NULL && (m_item->id != m_iID || m_item->getAuxValue() != m_iAuxVal || m_item->GetCount() != m_iCount) ) m_item = nullptr;
+ if(m_item != nullptr && (m_item->id != m_iID || m_item->getAuxValue() != m_iAuxVal || m_item->GetCount() != m_iCount) ) m_item = nullptr;
}
@@ -184,11 +184,11 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
hr = XuiSendMessage(m_hObj, &Message);
// We cannot have an Item with id 0
- if(m_item != NULL || (m_iID > 0 && m_iID<32000) )
+ if(m_item != nullptr || (m_iID > 0 && m_iID<32000) )
{
HXUIDC hDC = pRenderData->hDC;
CXuiControl xuiControl(m_hObj);
- if(m_item == NULL) m_item = shared_ptr<ItemInstance>( new ItemInstance(m_iID, m_iCount, m_iAuxVal) );
+ if(m_item == nullptr) m_item = std::make_shared<ItemInstance>(m_iID, m_iCount, m_iAuxVal);
// build and render with the game call
@@ -217,18 +217,18 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
// 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;
- clearRect.x1 = (int)(matrix._41) - 2;
- clearRect.y1 = (int)(matrix._42) - 2;
- clearRect.x2 = (int)(matrix._41 + ( bwidth * matrix._11 )) + 2;
- clearRect.y2 = (int)(matrix._42 + ( bheight * matrix._22 )) + 2;
+ clearRect.x1 = static_cast<int>(matrix._41) - 2;
+ clearRect.y1 = static_cast<int>(matrix._42) - 2;
+ clearRect.x2 = static_cast<int>(matrix._41 + (bwidth * matrix._11)) + 2;
+ clearRect.y2 = static_cast<int>(matrix._42 + (bheight * matrix._22)) + 2;
if(!m_bScreenWidthSetup)
{
Minecraft *pMinecraft=Minecraft::GetInstance();
- if(pMinecraft != NULL)
+ if(pMinecraft != nullptr)
{
- m_fScreenWidth=(float)pMinecraft->width_phys;
- m_fScreenHeight=(float)pMinecraft->height_phys;
+ m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
+ m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
m_bScreenWidthSetup = true;
}
}
@@ -261,14 +261,14 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
if (pop > 0)
{
glPushMatrix();
- float squeeze = 1 + pop / (float) Inventory::POP_TIME_DURATION;
+ float squeeze = 1 + pop / static_cast<float>(Inventory::POP_TIME_DURATION);
float sx = x;
float sy = y;
float sxoffs = 8 * scaleX;
float syoffs = 12 * scaleY;
- glTranslatef((float)(sx + sxoffs), (float)(sy + syoffs), 0);
+ glTranslatef(static_cast<float>(sx + sxoffs), static_cast<float>(sy + syoffs), 0);
glScalef(1 / squeeze, (squeeze + 1) / 2, 1);
- glTranslatef((float)-(sx + sxoffs), (float)-(sy + syoffs), 0);
+ glTranslatef(static_cast<float>(-(sx + sxoffs)), static_cast<float>(-(sy + syoffs)), 0);
}
m_pItemRenderer->renderAndDecorateItem(pMinecraft->font, pMinecraft->textures, m_item, x, y,scaleX,scaleY,m_fAlpha,m_isFoil,false);
@@ -284,15 +284,15 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa
{
glPushMatrix();
glScalef(scaleX, scaleY, 1.0f);
- int iX= (int)(0.5f+((float)x)/scaleX);
- int iY= (int)(0.5f+((float)y)/scaleY);
+ int iX= static_cast<int>(0.5f + ((float)x) / scaleX);
+ int iY= static_cast<int>(0.5f + ((float)y) / scaleY);
m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, iX, iY, m_fAlpha);
glPopMatrix();
}
else
{
- m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, (int)x, (int)y, m_fAlpha);
+ m_pItemRenderer->renderGuiItemDecorations(pMinecraft->font, pMinecraft->textures, m_item, static_cast<int>(x), static_cast<int>(y), m_fAlpha);
}
}
@@ -329,9 +329,9 @@ void CXuiCtrlMinecraftSlot::SetIcon(int iPad, int iId,int iAuxVal, int iCount, i
m_iAuxVal = 0;
m_iCount=iCount;
- m_fScale = (float)(iScale)/10.0f;
+ m_fScale = static_cast<float>(iScale)/10.0f;
//m_uiAlpha=uiAlpha;
- m_fAlpha =((float)(uiAlpha)) / 255.0f;
+ m_fAlpha =static_cast<float>(uiAlpha) / 255.0f;
m_bDecorations = bDecorations;
// mif(bDecorations) m_iDecorations=1;
// else m_iDecorations=0;
@@ -348,8 +348,8 @@ void CXuiCtrlMinecraftSlot::SetIcon(int iPad, shared_ptr<ItemInstance> item, int
m_item = item;
m_isFoil = item->isFoil();
m_iPad = iPad;
- m_fScale = (float)(iScale)/10.0f;
- m_fAlpha =((float)(uiAlpha)) / 31;
+ m_fScale = static_cast<float>(iScale)/10.0f;
+ m_fAlpha =static_cast<float>(uiAlpha) / 31;
m_bDecorations = bDecorations;
m_bDirty = TRUE;
XuiElementSetShow(m_hObj,bShow);
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp
index 23b22573..6a76980d 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp
@@ -38,9 +38,9 @@ HRESULT CXuiCtrlMobEffect::OnGetSourceDataText(XUIMessageGetSourceText *pGetSour
pGetSourceTextData->szText = m_name.c_str();
pGetSourceTextData->bDisplay = TRUE;
- if(FAILED(PlayVisualRange(iconFrameNames[m_icon],NULL,iconFrameNames[m_icon])))
+ if(FAILED(PlayVisualRange(iconFrameNames[m_icon],nullptr,iconFrameNames[m_icon])))
{
- PlayVisualRange(L"Normal",NULL,L"Normal");
+ PlayVisualRange(L"Normal",nullptr,L"Normal");
}
bHandled = TRUE;
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp
index a4e9f6be..18995854 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp
@@ -10,11 +10,11 @@ HRESULT CXuiCtrlSliderWrapper::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
XuiElementGetChildById(m_hObj,L"FocusSink",&hObjChild);
XuiObjectFromHandle( hObjChild, &pObj );
- m_pFocusSink = (CXuiControl *)pObj;
+ m_pFocusSink = static_cast<CXuiControl *>(pObj);
XuiElementGetChildById(m_hObj,L"XuiSlider",&hObjChild);
XuiObjectFromHandle( hObjChild, &pObj );
- m_pSlider = (CXuiSlider *)pObj;
+ m_pSlider = static_cast<CXuiSlider *>(pObj);
m_sliderActive = false;
m_bDisplayVal=true;
@@ -119,7 +119,7 @@ HRESULT CXuiCtrlSliderWrapper::SetValueDisplay( BOOL bShow )
hr=XuiControlGetVisual(pThis->m_pSlider->m_hObj,&hVisual);
hr=XuiElementGetChildById(hVisual,L"Text_Value",&hText);
- if(hText!=NULL)
+ if(hText!=nullptr)
{
XuiElementSetShow(hText,bShow);
}
@@ -132,7 +132,7 @@ LPCWSTR CXuiCtrlSliderWrapper::GetText( )
CXuiCtrlSliderWrapper *pThis;
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
if (FAILED(hr))
- return NULL;
+ return nullptr;
return pThis->m_pSlider->GetText();
//return S_OK;
}
@@ -159,7 +159,7 @@ HXUIOBJ CXuiCtrlSliderWrapper::GetSlider()
CXuiCtrlSliderWrapper *pThis;
HRESULT hr = XuiObjectFromHandle(m_hObj, (void **) &pThis);
if (FAILED(hr))
- return NULL;
+ return nullptr;
return pThis->m_pSlider->m_hObj;
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp
index f8ceeb69..8a45d6fc 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp
@@ -12,7 +12,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnInit( HXUIOBJ hObj, XUIMessageInit* pInitDat
{
HRESULT hr = S_OK;
SlotControlUserDataContainer* pvUserData = new SlotControlUserDataContainer();
- hr = XuiElementSetUserData(hObj, (void *)pvUserData );
+ hr = XuiElementSetUserData(hObj, static_cast<void *>(pvUserData) );
// 4J WESTY : Pointer Prototype : Added to support prototype only.
m_bSkipDefaultNavigation = false;
@@ -26,7 +26,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnDestroy( HXUIOBJ hObj )
void* pvUserData;
hr = XuiElementGetUserData( hObj, &pvUserData );
- if( pvUserData != NULL )
+ if( pvUserData != nullptr )
{
delete pvUserData;
}
@@ -41,19 +41,19 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, Cust
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
- if( pUserDataContainer->slot != NULL )
+ if( pUserDataContainer->slot != nullptr )
{
item = pUserDataContainer->slot->getItem();
}
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
- if(player != NULL) item = player->inventory->getCarried();
+ if(player != nullptr) item = player->inventory->getCarried();
}
- if( item != NULL )
+ if( item != nullptr )
{
pData->item = item;
pData->iItemBitField = MAKE_SLOTDISPLAY_ITEM_BITMASK(item->id,item->getAuxValue(),item->isFoil());
@@ -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, static_cast<int>(31 * pUserDataContainer->m_fAlpha),true,item->GetCount(),7,item->popTime);
}
else
{
@@ -82,7 +82,7 @@ void CXuiCtrlSlotItemCtrlBase::SetSlot( HXUIOBJ hObj, Slot* slot )
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
pUserDataContainer->slot = slot;
}
@@ -92,7 +92,7 @@ void CXuiCtrlSlotItemCtrlBase::SetUserIndex( HXUIOBJ hObj, int iPad )
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
pUserDataContainer->m_iPad = iPad;
}
@@ -102,7 +102,7 @@ void CXuiCtrlSlotItemCtrlBase::SetAlpha( HXUIOBJ hObj, float fAlpha )
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
pUserDataContainer->m_fAlpha = fAlpha;
}
@@ -111,16 +111,16 @@ bool CXuiCtrlSlotItemCtrlBase::isEmpty( HXUIOBJ hObj )
{
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
- if(pUserDataContainer->slot != NULL)
+ if(pUserDataContainer->slot != nullptr)
{
return !pUserDataContainer->slot->hasItem();
}
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
- if(player != NULL) return player->inventory->getCarried() == NULL;
+ if(player != nullptr) return player->inventory->getCarried() == nullptr;
}
return true;
@@ -130,9 +130,9 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri
{
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
- if(pUserDataContainer->slot != NULL)
+ if(pUserDataContainer->slot != nullptr)
{
wstring desc = L"";
vector<wstring> *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings);
@@ -167,10 +167,10 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector<wstri
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
- if(player != NULL)
+ if(player != nullptr)
{
shared_ptr<ItemInstance> item = player->inventory->getCarried();
- if(item != NULL) return app.GetString( item->getDescriptionId() );
+ if(item != nullptr) return app.GetString( item->getDescriptionId() );
}
}
@@ -181,16 +181,16 @@ shared_ptr<ItemInstance> CXuiCtrlSlotItemCtrlBase::getItemInstance( HXUIOBJ hObj
{
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
- if(pUserDataContainer->slot != NULL)
+ if(pUserDataContainer->slot != nullptr)
{
return pUserDataContainer->slot->getItem();
}
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
- if(player != NULL) return player->inventory->getCarried();
+ if(player != nullptr) return player->inventory->getCarried();
}
return nullptr;
@@ -200,7 +200,7 @@ Slot *CXuiCtrlSlotItemCtrlBase::getSlot( HXUIOBJ hObj )
{
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
return pUserDataContainer->slot;
}
@@ -254,11 +254,11 @@ int CXuiCtrlSlotItemCtrlBase::GetObjectCount( HXUIOBJ hObj )
{
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
int iCount = 0;
- if(pUserDataContainer->slot != NULL)
+ if(pUserDataContainer->slot != nullptr)
{
if ( pUserDataContainer->slot->hasItem() )
{
@@ -268,7 +268,7 @@ int CXuiCtrlSlotItemCtrlBase::GetObjectCount( HXUIOBJ hObj )
else if(pUserDataContainer->m_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] );
- if(player != NULL && player->inventory->getCarried() != NULL)
+ if(player != nullptr && player->inventory->getCarried() != nullptr)
{
iCount = player->inventory->getCarried()->count;
}
@@ -294,9 +294,9 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj
// Get the info on this item.
void* pvThisUserData;
XuiElementGetUserData( hThisObj, &pvThisUserData );
- SlotControlUserDataContainer* pThisUserDataContainer = (SlotControlUserDataContainer*)pvThisUserData;
+ SlotControlUserDataContainer* pThisUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvThisUserData);
- if(pThisUserDataContainer->slot != NULL)
+ if(pThisUserDataContainer->slot != nullptr)
{
if ( pThisUserDataContainer->slot->hasItem() )
{
@@ -309,7 +309,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj
else if(pThisUserDataContainer->m_iPad >= 0 && pThisUserDataContainer->m_iPad < XUSER_MAX_COUNT)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pThisUserDataContainer->m_iPad] );
- if(player != NULL && player->inventory->getCarried() != NULL)
+ if(player != nullptr && player->inventory->getCarried() != nullptr)
{
iThisID = player->inventory->getCarried()->id;
iThisAux = player->inventory->getCarried()->getAuxValue();
@@ -322,9 +322,9 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj
// Get the info on other item.
void* pvOtherUserData;
XuiElementGetUserData( hOtherObj, &pvOtherUserData );
- SlotControlUserDataContainer* pOtherUserDataContainer = (SlotControlUserDataContainer*)pvOtherUserData;
+ SlotControlUserDataContainer* pOtherUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvOtherUserData);
- if(pOtherUserDataContainer->slot != NULL)
+ if(pOtherUserDataContainer->slot != nullptr)
{
if ( pOtherUserDataContainer->slot->hasItem() )
{
@@ -336,7 +336,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj
else if(pOtherUserDataContainer->m_iPad >= 0 && pOtherUserDataContainer->m_iPad < XUSER_MAX_COUNT)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>( Minecraft::GetInstance()->localplayers[pOtherUserDataContainer->m_iPad] );
- if(player != NULL && player->inventory->getCarried() != NULL)
+ if(player != nullptr && player->inventory->getCarried() != nullptr)
{
iOtherID = player->inventory->getCarried()->id;
iOtherAux = player->inventory->getCarried()->getAuxValue();
@@ -363,13 +363,13 @@ int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj )
void* pvUserData;
XuiElementGetUserData( hObj, &pvUserData );
- SlotControlUserDataContainer* pUserDataContainer = (SlotControlUserDataContainer*)pvUserData;
+ SlotControlUserDataContainer* pUserDataContainer = static_cast<SlotControlUserDataContainer *>(pvUserData);
int iCount = 0;
int iMaxStackSize = 0;
bool bStackable = false;
- if(pUserDataContainer->slot != NULL)
+ if(pUserDataContainer->slot != nullptr)
{
if ( pUserDataContainer->slot->hasItem() )
{
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h
index 2fd21749..ac237ac9 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h
@@ -9,7 +9,7 @@ class ItemInstance;
class SlotControlUserDataContainer
{
public:
- SlotControlUserDataContainer() : slot( NULL ), hProgressBar( NULL ), m_iPad( -1 ), m_fAlpha(1.0f) {};
+ SlotControlUserDataContainer() : slot( nullptr ), hProgressBar( nullptr ), m_iPad( -1 ), m_fAlpha(1.0f) {};
Slot* slot;
HXUIOBJ hProgressBar;
float m_fAlpha;
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp
index 7e51c885..a34f2a7e 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotList.cpp
@@ -103,7 +103,7 @@ void CXuiCtrlSlotList::SetData(int m_iPad, AbstractContainerMenu* menu, int rows
slotControl->SetUserIndex( slotControl->m_hObj, m_iPad );
- slotControl = NULL;
+ slotControl = nullptr;
}
}
@@ -226,6 +226,6 @@ void CXuiCtrlSlotList::GetCXuiCtrlSlotItem(int itemIndex, CXuiCtrlSlotItemListIt
HXUIOBJ itemControl = this->GetItemControl(itemIndex);
VOID *pObj;
XuiObjectFromHandle( itemControl, &pObj );
- *CXuiCtrlSlotItem = (CXuiCtrlSlotItemListItem *)pObj;
+ *CXuiCtrlSlotItem = static_cast<CXuiCtrlSlotItemListItem *>(pObj);
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp
index 2e971710..874edc6f 100644
--- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SplashPulser.cpp
@@ -20,10 +20,10 @@ CXuiCtrlSplashPulser::CXuiCtrlSplashPulser() :
Minecraft *pMinecraft=Minecraft::GetInstance();
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys, pMinecraft->height_phys);
- m_fScreenWidth=(float)pMinecraft->width_phys;
- m_fRawWidth=(float)ssc.rawWidth;
- m_fScreenHeight=(float)pMinecraft->height_phys;
- m_fRawHeight=(float)ssc.rawHeight;
+ m_fScreenWidth=static_cast<float>(pMinecraft->width_phys);
+ m_fRawWidth=static_cast<float>(ssc.rawWidth);
+ m_fScreenHeight=static_cast<float>(pMinecraft->height_phys);
+ m_fRawHeight=static_cast<float>(ssc.rawHeight);
}
//-----------------------------------------------------------------------------
diff --git a/Minecraft.Client/Common/XUI/XUI_CustomMessages.h b/Minecraft.Client/Common/XUI/XUI_CustomMessages.h
index 888f8ad0..e16f891c 100644
--- a/Minecraft.Client/Common/XUI/XUI_CustomMessages.h
+++ b/Minecraft.Client/Common/XUI/XUI_CustomMessages.h
@@ -39,11 +39,11 @@ CustomMessage_GetSlotItem_Struct;
static __declspec(noinline) void CustomMessage_GetSlotItem(XUIMessage *pMsg, CustomMessage_GetSlotItem_Struct* pData, int iDataBitField, int iItemBitField)
{
XuiMessage(pMsg,XM_GETSLOTITEM_MESSAGE);
- _XuiMessageExtra(pMsg,(XUIMessageData*) pData, sizeof(*pData));
+ _XuiMessageExtra(pMsg,static_cast<XUIMessageData *>(pData), sizeof(*pData));
pData->item = nullptr;
pData->iDataBitField = iDataBitField;
pData->iItemBitField = iItemBitField;
- pData->szPath = NULL;
+ pData->szPath = nullptr;
pData->bDirty = false;
}
@@ -68,7 +68,7 @@ CustomMessage_Splitscreenplayer_Struct;
static __declspec(noinline) void CustomMessage_Splitscreenplayer(XUIMessage *pMsg, CustomMessage_Splitscreenplayer_Struct* pData, bool bJoining)
{
XuiMessage(pMsg,XM_SPLITSCREENPLAYER_MESSAGE);
- _XuiMessageExtra(pMsg,(XUIMessageData*) pData, sizeof(*pData));
+ _XuiMessageExtra(pMsg,static_cast<XUIMessageData *>(pData), sizeof(*pData));
pData->bJoining = bJoining;
}
diff --git a/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp b/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp
index bd05ca14..c5150249 100644
--- a/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp
@@ -24,7 +24,7 @@
HRESULT CScene_DLCMain::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- iPad = *(int *) pInitData->pvInitData;
+ iPad = *static_cast<int *>(pInitData->pvInitData);
MapChildControls();
@@ -39,7 +39,7 @@ HRESULT CScene_DLCMain::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
VOID *pObj;
XuiObjectFromHandle( xList, &pObj );
- list = (CXuiCtrl4JList *) pObj;
+ list = static_cast<CXuiCtrl4JList *>(pObj);
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK );
@@ -162,7 +162,7 @@ HRESULT CScene_DLCMain::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNo
param->iType = iIndex;
// promote the DLC content request type
- app.AddDLCRequest((eDLCMarketplaceType)iIndex, true);
+ app.AddDLCRequest(static_cast<eDLCMarketplaceType>(iIndex), true);
app.NavigateToScene(iPad,eUIScene_DLCOffersMenu, param);
}
return S_OK;
@@ -182,14 +182,14 @@ HRESULT CScene_DLCMain::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
//----------------------------------------------------------------------------------
HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- DLCOffersParam *param = (DLCOffersParam *) pInitData->pvInitData;
+ DLCOffersParam *param = static_cast<DLCOffersParam *>(pInitData->pvInitData);
m_iPad = param->iPad;
m_iType = param->iType;
m_iOfferC = app.GetDLCOffersCount();
m_bIsFemale = false;
- m_pNoImageFor_DLC=NULL;
+ m_pNoImageFor_DLC=nullptr;
bNoDLCToDisplay=true;
- //hCostText=NULL;
+ //hCostText=nullptr;
// 4J JEV: Deleting this here seems simpler.
@@ -203,10 +203,10 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
HRESULT hRes;
- hRes=XAvatarInitialize(XAVATAR_COORDINATE_SYSTEM_LEFT_HANDED,0,0,0,NULL);
+ hRes=XAvatarInitialize(XAVATAR_COORDINATE_SYSTEM_LEFT_HANDED,0,0,0,nullptr);
// get the avatar gender
- hRes=XAvatarGetMetadataLocalUser(m_iPad,&AvatarMetadata,NULL);
+ hRes=XAvatarGetMetadataLocalUser(m_iPad,&AvatarMetadata,nullptr);
m_bIsFemale= (XAVATAR_BODY_TYPE_FEMALE == XAvatarMetadataGetBodyType(&AvatarMetadata));
// shutdown the avatar system
@@ -223,10 +223,10 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
m_bIgnorePress=true;
VOID *pObj;
- m_hXuiBrush=NULL;
+ m_hXuiBrush=nullptr;
XuiObjectFromHandle( m_List, &pObj );
- m_pOffersList = (CXuiCtrl4JList *)pObj;
+ m_pOffersList = static_cast<CXuiCtrl4JList *>(pObj);
m_bAllDLCContentRetrieved=false;
XuiElementInitUserFocus(m_hObj,ProfileManager.GetPrimaryPad(),TRUE);
@@ -242,7 +242,7 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
// Is the DLC we're looking for available?
if(!m_bDLCRequiredIsRetrieved)
{
- if(app.DLCContentRetrieved((eDLCMarketplaceType)m_iType))
+ if(app.DLCContentRetrieved(static_cast<eDLCMarketplaceType>(m_iType)))
{
m_bDLCRequiredIsRetrieved=true;
@@ -259,13 +259,13 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
{
- CXuiCtrl4JList::LIST_ITEM_INFO *pListInfo=NULL;
+ CXuiCtrl4JList::LIST_ITEM_INFO *pListInfo=nullptr;
//XMARKETPLACE_CONTENTOFFER_INFO xOffer;
XMARKETPLACE_CURRENCY_CONTENTOFFER_INFO xOffer;
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
WCHAR szResourceLocator[ LOCATOR_SIZE ];
ZeroMemory(szResourceLocator,sizeof(WCHAR)*LOCATOR_SIZE);
- const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
+ const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
int iCount=0;
if(bUpdateOnly) // Just update the info on the current list
@@ -275,13 +275,13 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
xOffer = StorageManager.GetOffer(i);
// Check that this is in the list of known DLC
DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.qwOfferID);
- if(pDLC==NULL)
+ if(pDLC==nullptr)
{
// try the trial version
pDLC=app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID);
}
- if(pDLC==NULL)
+ if(pDLC==nullptr)
{
// skip this one
#ifdef _DEBUG
@@ -301,7 +301,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
// can't trust the offer type - partnernet is giving avatar items the CONTENT type
//if(Offer.dwOfferType==app.GetDLCContentType((eDLCContentType)m_iType))
- if(pDLC->eDLCType==(eDLCContentType)m_iType)
+ if(pDLC->eDLCType==static_cast<eDLCContentType>(m_iType))
{
if(xOffer.fUserHasPurchased)
{
@@ -343,13 +343,13 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
// Check that this is in the list of known DLC
DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.qwOfferID);
- if(pDLC==NULL)
+ if(pDLC==nullptr)
{
// try the trial version
pDLC=app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID);
}
- if(pDLC==NULL)
+ if(pDLC==nullptr)
{
// skip this one
#ifdef _DEBUG
@@ -362,7 +362,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
// can't trust the offer type - partnernet is giving avatar items the CONTENT type
//if(Offer.dwOfferType==app.GetDLCContentType((eDLCContentType)m_iType))
- if(pDLC->eDLCType==(eDLCContentType)m_iType)
+ if(pDLC->eDLCType==static_cast<eDLCContentType>(m_iType))
{
wstring wstrTemp=xOffer.wszOfferName;
@@ -395,7 +395,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
// store the offer index
pListInfo[iCount].iData=i;
- pListInfo[iCount].iSortIndex=(int)pDLC->uiSortIndex;
+ pListInfo[iCount].iSortIndex=static_cast<int>(pDLC->uiSortIndex);
#ifdef _DEBUG
app.DebugPrintf("Adding ");
OutputDebugStringW(pListInfo[iCount].pwszText);
@@ -447,9 +447,9 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
m_pOffersList->SetCurSelVisible(0);
DLC_INFO *dlc = app.GetDLCInfoForFullOfferID(xOffer.qwOfferID);
- if (dlc != NULL)
+ if (dlc != nullptr)
{
- BYTE *pData=NULL;
+ BYTE *pData=nullptr;
UINT uiSize=0;
DWORD dwSize=0;
@@ -460,7 +460,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
if(iIndex!=-1)
{
// it's in the xzp
- if(m_hXuiBrush!=NULL)
+ if(m_hXuiBrush!=nullptr)
{
XuiDestroyBrush(m_hXuiBrush);
// clear the TMS XZP vector memory
@@ -480,7 +480,7 @@ HRESULT CScene_DLCOffers::GetDLCInfo( int iOfferC, bool bUpdateOnly )
}
else
{
- if(m_hXuiBrush!=NULL)
+ if(m_hXuiBrush!=nullptr)
{
XuiDestroyBrush(m_hXuiBrush);
// clear the TMS XZP vector memory
@@ -568,7 +568,7 @@ HRESULT CScene_DLCOffers::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* p
// if it's already been purchased, we need to let the user download it anyway
{
ullIndexA[0]=StorageManager.GetOffer(ItemInfo.iData).qwOfferID;
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
}
}
@@ -662,7 +662,7 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha
// reset the image monitor, but not for the first selection
if(pNotifySelChangedData->iOldItem!=-1)
{
- m_pNoImageFor_DLC=NULL;
+ m_pNoImageFor_DLC=nullptr;
}
if (m_List.TreeHasFocus())// && offerIndexes.size() > index)
@@ -695,14 +695,14 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha
m_PriceTag.SetText(xOffer.wszCurrencyPrice);
DLC_INFO *dlc = app.GetDLCInfoForTrialOfferID(xOffer.qwOfferID);
- if(dlc==NULL)
+ if(dlc==nullptr)
{
dlc = app.GetDLCInfoForFullOfferID(xOffer.qwOfferID);
}
- if (dlc != NULL)
+ if (dlc != nullptr)
{
- BYTE *pImage=NULL;
+ BYTE *pImage=nullptr;
UINT uiSize=0;
DWORD dwSize=0;
@@ -713,7 +713,7 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha
if(iIndex!=-1)
{
// it's in the xzp
- if(m_hXuiBrush!=NULL)
+ if(m_hXuiBrush!=nullptr)
{
XuiDestroyBrush(m_hXuiBrush);
// clear the TMS XZP vector memory
@@ -737,7 +737,7 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha
}
else
{
- if(m_hXuiBrush!=NULL)
+ if(m_hXuiBrush!=nullptr)
{
XuiDestroyBrush(m_hXuiBrush);
// clear the TMS XZP vector memory
@@ -750,13 +750,13 @@ HRESULT CScene_DLCOffers::OnNotifySelChanged(HXUIOBJ hObjSource, XUINotifySelCha
}
else
{
- if(m_hXuiBrush!=NULL)
+ if(m_hXuiBrush!=nullptr)
{
XuiDestroyBrush(m_hXuiBrush);
// clear the TMS XZP vector memory
//app.FreeLocalTMSFiles();
- m_hXuiBrush=NULL;
+ m_hXuiBrush=nullptr;
}
}
@@ -791,7 +791,7 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
// Is the DLC we're looking for available?
if(!m_bDLCRequiredIsRetrieved)
{
- if(app.DLCContentRetrieved((eDLCMarketplaceType)m_iType))
+ if(app.DLCContentRetrieved(static_cast<eDLCMarketplaceType>(m_iType)))
{
m_bDLCRequiredIsRetrieved=true;
@@ -802,7 +802,7 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
}
// Check for any TMS image we're waiting for
- if(m_pNoImageFor_DLC!=NULL)
+ if(m_pNoImageFor_DLC!=nullptr)
{
// Is it present now?
WCHAR *cString = m_pNoImageFor_DLC->wchBanner;
@@ -811,10 +811,10 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
if(bPresent)
{
- BYTE *pImage=NULL;
+ BYTE *pImage=nullptr;
DWORD dwSize=0;
- if(m_hXuiBrush!=NULL)
+ if(m_hXuiBrush!=nullptr)
{
XuiDestroyBrush(m_hXuiBrush);
// clear the TMS XZP vector memory
@@ -822,7 +822,7 @@ HRESULT CScene_DLCOffers::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
}
app.GetMemFileDetails(cString,&pImage,&dwSize);
XuiCreateTextureBrushFromMemory(pImage,dwSize,&m_hXuiBrush);
- m_pNoImageFor_DLC=NULL;
+ m_pNoImageFor_DLC=nullptr;
}
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Death.cpp b/Minecraft.Client/Common/XUI/XUI_Death.cpp
index 83275c14..1788ceff 100644
--- a/Minecraft.Client/Common/XUI/XUI_Death.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Death.cpp
@@ -26,7 +26,7 @@
//----------------------------------------------------------------------------------
HRESULT CScene_Death::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
m_bIgnoreInput = false;
@@ -59,7 +59,7 @@ HRESULT CScene_Death::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotifySelChange
XuiSetLocale( Languages[curSel].pszLanguagePath );
// Apply the locale to the main scene.
- XuiApplyLocale( m_hObj, NULL );
+ XuiApplyLocale( m_hObj, nullptr );
// Update the text for the current value.
m_Value.SetText( m_List.GetText( curSel ) );*/
@@ -105,9 +105,9 @@ HRESULT CScene_Death::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pNoti
if(pNotifyPressData->UserIndex==ProfileManager.GetPrimaryPad())
{
int playTime = -1;
- if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL )
+ if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr )
{
- playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer();
+ playTime = static_cast<int>(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer());
}
TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Failed);
diff --git a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
index 6b96a4e3..d8c06ae1 100644
--- a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp
@@ -14,13 +14,13 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle
{
MapChildControls();
- ItemEditorInput *initData = (ItemEditorInput *)pInitData->pvInitData;
+ ItemEditorInput *initData = static_cast<ItemEditorInput *>(pInitData->pvInitData);
m_iPad = initData->iPad;
m_slot = initData->slot;
m_menu = initData->menu;
- if(m_slot != NULL) m_item = m_slot->getItem();
+ if(m_slot != nullptr) m_item = m_slot->getItem();
- if(m_item!=NULL)
+ if(m_item!=nullptr)
{
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) ) );
@@ -54,13 +54,13 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH
case VK_PAD_START:
case VK_PAD_BACK:
// We need to send a packet to the server to update it's representation of this item
- if(m_slot != NULL && m_menu != NULL)
+ if(m_slot != nullptr && m_menu != nullptr)
{
m_slot->set(m_item);
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
- if(player != NULL && player->connection) player->connection->send( shared_ptr<ContainerSetSlotPacket>( new ContainerSetSlotPacket(m_menu->containerId, m_slot->index, m_item) ) );
+ if(player != nullptr && player->connection) player->connection->send(std::make_shared<ContainerSetSlotPacket>(m_menu->containerId, m_slot->index, m_item));
}
// kill the crafting xui
app.NavigateBack(m_iPad);
@@ -76,7 +76,7 @@ HRESULT CScene_DebugItemEditor::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfH
HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyValueChanged *pNotifyValueChangedData, BOOL &bHandled)
{
- if(m_item == NULL) m_item = shared_ptr<ItemInstance>( new ItemInstance(0,1,0) );
+ if(m_item == nullptr) m_item = std::make_shared<ItemInstance>(0, 1, 0);
if(hObjSource == m_itemId)
{
int id = 0;
@@ -84,7 +84,7 @@ HRESULT CScene_DebugItemEditor::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot
if(!value.empty()) id = _fromString<int>( value );
// TODO Proper validation of the valid item ids
- if(id > 0 && Item::items[id] != NULL) m_item->id = id;
+ if(id > 0 && Item::items[id] != nullptr) m_item->id = id;
}
else if(hObjSource == m_itemAuxValue)
{
diff --git a/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp b/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp
index e6db6a80..338eb853 100644
--- a/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_DebugOverlay.cpp
@@ -37,7 +37,7 @@ HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
for(unsigned int i = 0; i < Item::items.length; ++i)
{
- if(Item::items[i] != NULL)
+ if(Item::items[i] != nullptr)
{
//m_items.InsertItems(m_items.GetItemCount(),1);
m_itemIds.push_back(i);
@@ -102,7 +102,7 @@ HRESULT CScene_DebugOverlay::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
Minecraft *pMinecraft = Minecraft::GetInstance();
m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 );
- m_setFov.SetValue( (int)pMinecraft->gameRenderer->GetFovVal());
+ m_setFov.SetValue( static_cast<int>(pMinecraft->gameRenderer->GetFovVal()));
XuiSetTimer(m_hObj,0,DEBUG_OVERLAY_UPDATE_TIME_PERIOD);
@@ -148,7 +148,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress
/*else if( hObjPressed == m_saveToDisc ) // 4J-JEV: Doesn't look like we use this debug option anymore.
{
#ifndef _CONTENT_PACKAGE
- pMinecraft->level->save(true, NULL);
+ pMinecraft->level->save(true, nullptr);
int radius;
m_chunkRadius.GetValue(&radius);
@@ -166,7 +166,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress
{
#ifndef _CONTENT_PACKAGE
// load from the .xzp file
- const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
+ const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
HXUIOBJ hScene;
HRESULT hr;
@@ -175,7 +175,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress
WCHAR szResourceLocator[ LOCATOR_SIZE ];
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
- hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugCreateSchematic,false, false), NULL, &hScene);
+ hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugCreateSchematic,false, false), nullptr, &hScene);
this->NavigateForward(hScene);
//app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic);
#endif
@@ -184,7 +184,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress
{
#ifndef _CONTENT_PACKAGE
// load from the .xzp file
- const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
+ const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
HXUIOBJ hScene;
HRESULT hr;
@@ -193,7 +193,7 @@ HRESULT CScene_DebugOverlay::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress
WCHAR szResourceLocator[ LOCATOR_SIZE ];
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
- hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugSetCamera, false, false), NULL, &hScene);
+ hr = XuiSceneCreate(szResourceLocator,app.GetSceneName(eUIScene_DebugSetCamera, false, false), nullptr, &hScene);
this->NavigateForward(hScene);
//app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic);
#endif
@@ -266,7 +266,7 @@ HRESULT CScene_DebugOverlay::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotify
if( hObjSource == m_setFov )
{
Minecraft *pMinecraft = Minecraft::GetInstance();
- pMinecraft->gameRenderer->SetFovVal((float)pNotifyValueChangedData->nValue);
+ pMinecraft->gameRenderer->SetFovVal(static_cast<float>(pNotifyValueChangedData->nValue));
}
return S_OK;
}
@@ -274,10 +274,10 @@ HRESULT CScene_DebugOverlay::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotify
HRESULT CScene_DebugOverlay::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
{
Minecraft *pMinecraft = Minecraft::GetInstance();
- if(pMinecraft->level != NULL)
+ if(pMinecraft->level != nullptr)
{
m_setTime.SetValue( pMinecraft->level->getLevelData()->getTime() % 24000 );
- m_setFov.SetValue( (int)pMinecraft->gameRenderer->GetFovVal());
+ m_setFov.SetValue( static_cast<int>(pMinecraft->gameRenderer->GetFovVal()));
}
return S_OK;
}
@@ -286,9 +286,9 @@ void CScene_DebugOverlay::SetSpawnToPlayerPos()
{
Minecraft *pMinecraft = Minecraft::GetInstance();
- pMinecraft->level->getLevelData()->setXSpawn((int)pMinecraft->player->x);
- pMinecraft->level->getLevelData()->setYSpawn((int)pMinecraft->player->y);
- pMinecraft->level->getLevelData()->setZSpawn((int)pMinecraft->player->z);
+ pMinecraft->level->getLevelData()->setXSpawn(static_cast<int>(pMinecraft->player->x));
+ pMinecraft->level->getLevelData()->setYSpawn(static_cast<int>(pMinecraft->player->y));
+ pMinecraft->level->getLevelData()->setZSpawn(static_cast<int>(pMinecraft->player->z));
}
#ifndef _CONTENT_PACKAGE
@@ -301,14 +301,14 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius)
ConsoleSaveFile *currentSave = pMinecraft->level->getLevelStorage()->getSaveFile();
// With a size of 0 but a value in the data pointer we should create a new save
- ConsoleSaveFileOriginal newSave( currentSave->getFilename(), NULL, 0, true );
+ ConsoleSaveFileOriginal newSave( currentSave->getFilename(), nullptr, 0, true );
// TODO Make this only happen for the new save
//SetSpawnToPlayerPos();
FileEntry *origFileEntry = currentSave->createFile( wstring( L"level.dat" ) );
byteArray levelData( origFileEntry->getFileSize() );
DWORD bytesRead;
- currentSave->setFilePointer(origFileEntry,0,NULL,FILE_BEGIN);
+ currentSave->setFilePointer(origFileEntry,0,nullptr,FILE_BEGIN);
currentSave->readFile(
origFileEntry,
levelData.data, // data buffer
@@ -331,10 +331,10 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius)
{
for(int zPos = playerChunkZ - chunkRadius; zPos < playerChunkZ + chunkRadius; ++zPos)
{
- CompoundTag *chunkData=NULL;
+ CompoundTag *chunkData=nullptr;
DataInputStream *is = RegionFileCache::getChunkDataInputStream(currentSave, L"", xPos, zPos);
- if (is != NULL)
+ if (is != nullptr)
{
chunkData = NbtIo::read((DataInput *)is);
is->deleteChildStream();
@@ -342,7 +342,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius)
}
app.DebugPrintf("Processing chunk (%d, %d)\n", xPos, zPos);
DataOutputStream *os = getChunkDataOutputStream(newFileCache, &newSave, L"", xPos, zPos);
- if(os != NULL)
+ if(os != nullptr)
{
NbtIo::write(chunkData, os);
os->close();
@@ -352,7 +352,7 @@ void CScene_DebugOverlay::SaveLimitedFile(int chunkRadius)
os->deleteChildStream();
delete os;
}
- if(chunkData != NULL)
+ if(chunkData != nullptr)
{
delete chunkData;
}
@@ -367,13 +367,13 @@ RegionFile *CScene_DebugOverlay::getRegionFile(unordered_map<File, RegionFile *,
{
File file( prefix + wstring(L"r.") + std::to_wstring(chunkX>>5) + L"." + std::to_wstring(chunkZ>>5) + L".mcr" );
- RegionFile *ref = NULL;
+ RegionFile *ref = nullptr;
auto it = newFileCache.find(file);
if( it != newFileCache.end() )
ref = it->second;
// 4J Jev, put back in.
- if (ref != NULL)
+ if (ref != nullptr)
{
return ref;
}
diff --git a/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp b/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp
index f6335191..fb6339ce 100644
--- a/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_DebugSetCamera.cpp
@@ -25,7 +25,7 @@ HRESULT CScene_DebugSetCamera::OnInit( XUIMessageInit *pInitData, BOOL &bHandled
currentPosition->player = playerNo;
Minecraft *pMinecraft = Minecraft::GetInstance();
- if (pMinecraft != NULL)
+ if (pMinecraft != nullptr)
{
Vec3 *vec = pMinecraft->localplayers[playerNo]->getPos(1.0);
@@ -43,12 +43,12 @@ 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 *) 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_camX.SetText(static_cast<const WCHAR *>(std::to_wstring(currentPosition->m_camX).c_str()));
+ m_camY.SetText(static_cast<const WCHAR *>(std::to_wstring(currentPosition->m_camY + 1.62).c_str()));
+ m_camZ.SetText(static_cast<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(static_cast<const WCHAR *>(std::to_wstring(currentPosition->m_yRot).c_str()));
+ m_elevation.SetText(static_cast<const WCHAR *>(std::to_wstring(currentPosition->m_elev).c_str()));
//fpp = new FreezePlayerParam();
//fpp->player = playerNo;
@@ -94,7 +94,7 @@ HRESULT CScene_DebugSetCamera::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHa
NavigateBack();
//delete currentPosition;
- //currentPosition = NULL;
+ //currentPosition = nullptr;
rfHandled = TRUE;
break;
diff --git a/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp b/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp
index aaa3b06f..e8091bcb 100644
--- a/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_DebugTips.cpp
@@ -9,7 +9,7 @@
//----------------------------------------------------------------------------------
HRESULT CScene_DebugTips::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
m_bIgnoreInput = false;
diff --git a/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp b/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp
index f66c0d70..cc235915 100644
--- a/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp
@@ -18,7 +18,7 @@ HRESULT CScene_FullscreenProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHan
m_buttonConfirm.SetText( app.GetString( IDS_CONFIRM_OK ) );
- LoadingInputParams *params = (LoadingInputParams *)pInitData->pvInitData;
+ LoadingInputParams *params = static_cast<LoadingInputParams *>(pInitData->pvInitData);
m_CompletionData = params->completionData;
m_iPad=params->completionData->iPad;
@@ -67,10 +67,10 @@ HRESULT CScene_FullscreenProgress::OnInit( XUIMessageInit* pInitData, BOOL& bHan
// The framework calls this handler when the object is to be destroyed.
HRESULT CScene_FullscreenProgress::OnDestroy()
{
- if( thread != NULL && thread != INVALID_HANDLE_VALUE )
+ if( thread != nullptr && thread != INVALID_HANDLE_VALUE )
delete thread;
- if( m_CompletionData != NULL )
+ if( m_CompletionData != nullptr )
delete m_CompletionData;
return S_OK;
@@ -86,7 +86,7 @@ HRESULT CScene_FullscreenProgress::OnKeyDown(XUIMessageInput* pInputData, BOOL&
case VK_PAD_B:
case VK_ESCAPE:
// 4J-JEV: Fix for Xbox360 #162749 - TU17: Save Upload: Content: UI: Player is presented with non-functional Tooltips after the Upload Save For Xbox One is completed.
- if( m_cancelFunc != NULL && !m_threadCompleted )
+ if( m_cancelFunc != nullptr && !m_threadCompleted )
{
m_cancelFunc( m_cancelFuncParam );
m_bWasCancelled=true;
@@ -201,7 +201,7 @@ HRESULT CScene_FullscreenProgress::OnTransitionStart( XUIMessageTransition *pTra
HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
{
int code = thread->GetExitCode();
- DWORD exitcode = *((DWORD *)&code);
+ DWORD exitcode = *static_cast<DWORD *>(&code);
//app.DebugPrintf("CScene_FullscreenProgress Timer %d\n",pTimer->nId);
@@ -244,7 +244,7 @@ HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHand
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_CONNECTION_LOST_SERVER, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
app.NavigateToHomeMenu();
ui.UpdatePlayerBasePositions();
@@ -292,7 +292,7 @@ HRESULT CScene_FullscreenProgress::OnTimer( XUIMessageTimer *pTimer, BOOL& bHand
CXuiSceneBase::ShowOtherPlayersBaseScene(iPad, true);
// This just allows it to be shown
Minecraft *pMinecraft = Minecraft::GetInstance();
- if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true);
+ if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true);
ui.UpdatePlayerBasePositions();
}
break;
diff --git a/Minecraft.Client/Common/XUI/XUI_HUD.cpp b/Minecraft.Client/Common/XUI/XUI_HUD.cpp
index 286f06a7..e188cbf6 100644
--- a/Minecraft.Client/Common/XUI/XUI_HUD.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_HUD.cpp
@@ -10,7 +10,7 @@
HRESULT CXuiSceneHud::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
MapChildControls();
@@ -33,7 +33,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHa
HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
{
Minecraft *pMinecraft = Minecraft::GetInstance();
- if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return S_OK;
+ if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return S_OK;
++m_tickCount;
@@ -145,7 +145,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer())
{
int xpNeededForNextLevel = pMinecraft->localplayers[m_iPad]->getXpNeededForNextLevel();
- int progress = (int)(pMinecraft->localplayers[m_iPad]->experienceProgress *xpNeededForNextLevel);
+ int progress = static_cast<int>(pMinecraft->localplayers[m_iPad]->experienceProgress * xpNeededForNextLevel);
m_ExperienceProgress.SetShow(TRUE);
m_ExperienceProgress.SetRange(0,xpNeededForNextLevel);
@@ -196,11 +196,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Full
if(bHasPoison)
{
- m_healthIcon[icon].PlayVisualRange(L"FullPoisonFlash",NULL,L"FullPoisonFlash");
+ m_healthIcon[icon].PlayVisualRange(L"FullPoisonFlash",nullptr,L"FullPoisonFlash");
}
else
{
- m_healthIcon[icon].PlayVisualRange(L"FullFlash",NULL,L"FullFlash");
+ m_healthIcon[icon].PlayVisualRange(L"FullFlash",nullptr,L"FullFlash");
}
}
else if (icon * 2 + 1 == iLastHealth || icon * 2 + 1 == iHealth)
@@ -208,17 +208,17 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Half
if(bHasPoison)
{
- m_healthIcon[icon].PlayVisualRange(L"HalfPoisonFlash",NULL,L"HalfPoisonFlash");
+ m_healthIcon[icon].PlayVisualRange(L"HalfPoisonFlash",nullptr,L"HalfPoisonFlash");
}
else
{
- m_healthIcon[icon].PlayVisualRange(L"HalfFlash",NULL,L"HalfFlash");
+ m_healthIcon[icon].PlayVisualRange(L"HalfFlash",nullptr,L"HalfFlash");
}
}
else
{
// Empty
- m_healthIcon[icon].PlayVisualRange(L"NormalFlash",NULL,L"NormalFlash");
+ m_healthIcon[icon].PlayVisualRange(L"NormalFlash",nullptr,L"NormalFlash");
}
}
else
@@ -228,11 +228,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Full
if(bHasPoison)
{
- m_healthIcon[icon].PlayVisualRange(L"FullPoison",NULL,L"FullPoison");
+ m_healthIcon[icon].PlayVisualRange(L"FullPoison",nullptr,L"FullPoison");
}
else
{
- m_healthIcon[icon].PlayVisualRange(L"Full",NULL,L"Full");
+ m_healthIcon[icon].PlayVisualRange(L"Full",nullptr,L"Full");
}
}
else if (icon * 2 + 1 == iHealth)
@@ -240,24 +240,24 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Half
if(bHasPoison)
{
- m_healthIcon[icon].PlayVisualRange(L"HalfPoison",NULL,L"HalfPoison");
+ m_healthIcon[icon].PlayVisualRange(L"HalfPoison",nullptr,L"HalfPoison");
}
else
{
- m_healthIcon[icon].PlayVisualRange(L"Half",NULL,L"Half");
+ m_healthIcon[icon].PlayVisualRange(L"Half",nullptr,L"Half");
}
}
else
{
// Empty
- m_healthIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal");
+ m_healthIcon[icon].PlayVisualRange(L"Normal",nullptr,L"Normal");
}
}
float yo = 0;
if (iHealth <= 4)
{
- yo = (float)m_random.nextInt(2) * (iGuiScale+1);
+ yo = static_cast<float>(m_random.nextInt(2)) * (iGuiScale+1);
}
if (icon == heartOffsetIndex)
{
@@ -288,11 +288,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Full
if(hasHungerEffect)
{
- m_foodIcon[icon].PlayVisualRange(L"FullPoisonFlash",NULL,L"FullPoisonFlash");
+ m_foodIcon[icon].PlayVisualRange(L"FullPoisonFlash",nullptr,L"FullPoisonFlash");
}
else
{
- m_foodIcon[icon].PlayVisualRange(L"FullFlash",NULL,L"FullFlash");
+ m_foodIcon[icon].PlayVisualRange(L"FullFlash",nullptr,L"FullFlash");
}
}
else if (icon * 2 + 1 == oldFood || icon * 2 + 1 == food)
@@ -300,17 +300,17 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Half
if(hasHungerEffect)
{
- m_foodIcon[icon].PlayVisualRange(L"HalfPoisonFlash",NULL,L"HalfPoisonFlash");
+ m_foodIcon[icon].PlayVisualRange(L"HalfPoisonFlash",nullptr,L"HalfPoisonFlash");
}
else
{
- m_foodIcon[icon].PlayVisualRange(L"HalfFlash",NULL,L"HalfFlash");
+ m_foodIcon[icon].PlayVisualRange(L"HalfFlash",nullptr,L"HalfFlash");
}
}
else
{
// Empty
- m_foodIcon[icon].PlayVisualRange(L"NormalFlash",NULL,L"NormalFlash");
+ m_foodIcon[icon].PlayVisualRange(L"NormalFlash",nullptr,L"NormalFlash");
}
}
else
@@ -320,11 +320,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Full
if(hasHungerEffect)
{
- m_foodIcon[icon].PlayVisualRange(L"FullPoison",NULL,L"FullPoison");
+ m_foodIcon[icon].PlayVisualRange(L"FullPoison",nullptr,L"FullPoison");
}
else
{
- m_foodIcon[icon].PlayVisualRange(L"Full",NULL,L"Full");
+ m_foodIcon[icon].PlayVisualRange(L"Full",nullptr,L"Full");
}
}
else if (icon * 2 + 1 == food)
@@ -332,11 +332,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Half
if(hasHungerEffect)
{
- m_foodIcon[icon].PlayVisualRange(L"HalfPoison",NULL,L"HalfPoison");
+ m_foodIcon[icon].PlayVisualRange(L"HalfPoison",nullptr,L"HalfPoison");
}
else
{
- m_foodIcon[icon].PlayVisualRange(L"Half",NULL,L"Half");
+ m_foodIcon[icon].PlayVisualRange(L"Half",nullptr,L"Half");
}
}
else
@@ -344,11 +344,11 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
// Empty
if(hasHungerEffect)
{
- m_foodIcon[icon].PlayVisualRange(L"NormalPoison",NULL,L"NormalPoison");
+ m_foodIcon[icon].PlayVisualRange(L"NormalPoison",nullptr,L"NormalPoison");
}
else
{
- m_foodIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal");
+ m_foodIcon[icon].PlayVisualRange(L"Normal",nullptr,L"Normal");
}
}
}
@@ -359,7 +359,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
{
if ((m_tickCount % (food * 3 + 1)) == 0)
{
- yo = (float)(m_random.nextInt(3) - 1) * (iGuiScale+1);
+ yo = static_cast<float>(m_random.nextInt(3) - 1) * (iGuiScale+1);
}
}
@@ -377,9 +377,9 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
m_armourGroup.SetShow(TRUE);
for (int icon = 0; icon < 10; icon++)
{
- if (icon * 2 + 1 < armor) m_armourIcon[icon].PlayVisualRange(L"Full",NULL,L"Full");
- else if (icon * 2 + 1 == armor) m_armourIcon[icon].PlayVisualRange(L"Half",NULL,L"Half");
- else if (icon * 2 + 1 > armor) m_armourIcon[icon].PlayVisualRange(L"Normal",NULL,L"Normal");
+ if (icon * 2 + 1 < armor) m_armourIcon[icon].PlayVisualRange(L"Full",nullptr,L"Full");
+ else if (icon * 2 + 1 == armor) m_armourIcon[icon].PlayVisualRange(L"Half",nullptr,L"Half");
+ else if (icon * 2 + 1 > armor) m_armourIcon[icon].PlayVisualRange(L"Normal",nullptr,L"Normal");
}
}
else
@@ -391,20 +391,20 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene()
if (pMinecraft->localplayers[m_iPad]->isUnderLiquid(Material::water))
{
m_airGroup.SetShow(TRUE);
- int count = (int) ceil((pMinecraft->localplayers[m_iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY);
- int extra = (int) ceil((pMinecraft->localplayers[m_iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY) - count;
+ int count = static_cast<int>(ceil((pMinecraft->localplayers[m_iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY));
+ int extra = static_cast<int>(ceil((pMinecraft->localplayers[m_iPad]->getAirSupply()) * 10.0f / Player::TOTAL_AIR_SUPPLY)) - count;
for (int icon = 0; icon < 10; icon++)
{
// Air bubbles
if (icon < count)
{
m_airIcon[icon].SetShow(TRUE);
- m_airIcon[icon].PlayVisualRange(L"Bubble",NULL,L"Bubble");
+ m_airIcon[icon].PlayVisualRange(L"Bubble",nullptr,L"Bubble");
}
else if(icon < count + extra)
{
m_airIcon[icon].SetShow(TRUE);
- m_airIcon[icon].PlayVisualRange(L"Pop",NULL,L"Pop");
+ m_airIcon[icon].PlayVisualRange(L"Pop",nullptr,L"Pop");
}
else m_airIcon[icon].SetShow(FALSE);
}
@@ -428,7 +428,7 @@ HRESULT CXuiSceneHud::OnCustomMessage_DLCInstalled()
{
// mounted DLC may have changed
bool bPauseMenuDisplayed=false;
- bool bInGame=(Minecraft::GetInstance()->level!=NULL);
+ bool bInGame=(Minecraft::GetInstance()->level!=nullptr);
// ignore this if we have menus up - they'll deal with it
for(int i=0;i<XUSER_MAX_COUNT;i++)
{
diff --git a/Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp b/Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp
index 9ba49e9d..f33d1d91 100644
--- a/Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_HelpAndOptions.cpp
@@ -12,8 +12,8 @@
//----------------------------------------------------------------------------------
HRESULT CScene_HelpAndOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
MapChildControls();
XuiControlSetText(m_Buttons[BUTTON_HAO_CHANGESKIN],app.GetString(IDS_CHANGE_SKIN));
@@ -140,7 +140,7 @@ HRESULT CScene_HelpAndOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
/*HRESULT CScene_HelpAndOptions::OnTMSDLCFileRetrieved( )
{
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
m_Timer.SetShow(FALSE);
m_bIgnoreInput=false;
@@ -253,7 +253,7 @@ HRESULT CScene_HelpAndOptions::OnControlNavigate(XUIMessageControlNavigate *pCon
{
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -344,7 +344,7 @@ HRESULT CScene_HelpAndOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHa
HRESULT CScene_HelpAndOptions::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
{
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
if(bNotInGame)
{
@@ -414,7 +414,7 @@ HRESULT CScene_HelpAndOptions::OnTransitionStart( XUIMessageTransition *pTransit
// 4J-PB - Going to resize buttons if the text is too big to fit on any of them (Br-pt problem with the length of Unlock Full Game)
XUIRect xuiRect;
- HXUIOBJ visual=NULL;
+ HXUIOBJ visual=nullptr;
HXUIOBJ text;
float fMaxTextLen=0.0f;
float fTextVisualLen;
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()]) );
diff --git a/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp b/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp
index 4a6ce55f..c0584e94 100644
--- a/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp
@@ -386,12 +386,12 @@ static const int gs_aNumTextElements[ eNumTextTypes ] =
//----------------------------------------------------------------------------------
HRESULT CScene_Credits::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- int iPad = *(int *)pInitData->pvInitData;
+ int iPad = *static_cast<int *>(pInitData->pvInitData);
MapChildControls();
// if we're not in the game, we need to use basescene 0
- if(Minecraft::GetInstance()->level==NULL)
+ if(Minecraft::GetInstance()->level==nullptr)
{
iPad=0;
}
@@ -441,7 +441,7 @@ HRESULT CScene_Credits::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
VOID* pTextObj;
XuiObjectFromHandle( text, &pTextObj );
- m_aTextTypes[ i ].m_appTextElements[ j ] = (CXuiControl *)pTextObj;
+ m_aTextTypes[ i ].m_appTextElements[ j ] = static_cast<CXuiControl *>(pTextObj);
m_aTextTypes[ i ].m_appTextElements[ j ]->SetShow( false );
}
}
diff --git a/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp b/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp
index 5c750d03..cd9e962d 100644
--- a/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp
@@ -39,12 +39,12 @@ static SHowToPlayPageDef gs_aPageDefs[ eHowToPlay_NumPages ] =
HRESULT CScene_HowToPlay::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
// Extract pad and required page from init data. We just put the data into the pointer rather than using it as an address.
- size_t uiInitData = ( size_t )( pInitData->pvInitData );
+ size_t uiInitData = static_cast<size_t>(pInitData->pvInitData);
- m_iPad = ( int )( ( short )( uiInitData & 0xFFFF ) );
- EHowToPlayPage eStartPage = ( EHowToPlayPage )( ( uiInitData >> 16 ) & 0xFFF ); // Ignores MSB which is set to 1!
+ m_iPad = static_cast<int>((short)(uiInitData & 0xFFFF));
+ EHowToPlayPage eStartPage = static_cast<EHowToPlayPage>((uiInitData >> 16) & 0xFFF); // Ignores MSB which is set to 1!
- TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, (ETelemetry_HowToPlay_SubMenuId)eStartPage);
+ TelemetryManager->RecordMenuShown(m_iPad, eUIScene_HowToPlay, static_cast<ETelemetry_HowToPlay_SubMenuId>(eStartPage));
MapChildControls();
@@ -116,10 +116,10 @@ HRESULT CScene_HowToPlay::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled
case VK_PAD_A:
{
// Next page
- int iNextPage = ( int )( m_eCurrPage ) + 1;
+ int iNextPage = static_cast<int>(m_eCurrPage) + 1;
if ( iNextPage != eHowToPlay_NumPages )
{
- StartPage( ( EHowToPlayPage )( iNextPage ) );
+ StartPage( static_cast<EHowToPlayPage>(iNextPage) );
CXuiSceneBase::PlayUISFX(eSFX_Press);
}
rfHandled = TRUE;
@@ -128,10 +128,10 @@ HRESULT CScene_HowToPlay::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled
case VK_PAD_X:
{
// Next page
- int iPrevPage = ( int )( m_eCurrPage ) - 1;
+ int iPrevPage = static_cast<int>(m_eCurrPage) - 1;
if ( iPrevPage >= 0 )
{
- StartPage( ( EHowToPlayPage )( iPrevPage ) );
+ StartPage( static_cast<EHowToPlayPage>(iPrevPage) );
CXuiSceneBase::PlayUISFX(eSFX_Press);
}
rfHandled = TRUE;
@@ -146,7 +146,7 @@ void CScene_HowToPlay::StartPage( EHowToPlayPage ePage )
{
int iBaseSceneUser;
// if we're not in the game, we need to use basescene 0
- if(Minecraft::GetInstance()->level==NULL)
+ if(Minecraft::GetInstance()->level==nullptr)
{
iBaseSceneUser=DEFAULT_XUI_MENU_USER;
}
diff --git a/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp b/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp
index 14046f20..a99921e0 100644
--- a/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp
@@ -65,11 +65,11 @@ unsigned int CScene_HowToPlayMenu::m_uiHTPSceneA[]=
//----------------------------------------------------------------------------------
HRESULT CScene_HowToPlayMenu::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- 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_ButtonList=NULL;
+ m_ButtonList=nullptr;
//MapChildControls();
@@ -131,7 +131,7 @@ HRESULT CScene_HowToPlayMenu::OnGetSourceDataText(XUIMessageGetSourceText *pGetS
{
if( pGetSourceTextData->bItemData )
{
- if( pGetSourceTextData->iItem < (int)eHTPButton_Max )
+ if( pGetSourceTextData->iItem < static_cast<int>(eHTPButton_Max) )
{
pGetSourceTextData->szText = app.GetString(m_uiHTPButtonNameA[pGetSourceTextData->iItem]);//m_Buttons[pGetSourceTextData->iItem].GetText();
pGetSourceTextData->bDisplay = TRUE;
@@ -173,7 +173,7 @@ HRESULT CScene_HowToPlayMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPres
// 4J-PB - now using a list for all resolutions
//if((!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) || app.GetLocalPlayerCount()>1)
{
- if(hObjPressed==m_ButtonList && m_ButtonList.TreeHasFocus() && (m_ButtonList.GetItemCount() > 0) && (m_ButtonList.GetCurSel() < (int)eHTPButton_Max) )
+ if(hObjPressed==m_ButtonList && m_ButtonList.TreeHasFocus() && (m_ButtonList.GetItemCount() > 0) && (m_ButtonList.GetCurSel() < static_cast<int>(eHTPButton_Max)) )
{
uiButtonCounter=m_ButtonList.GetCurSel();
}
@@ -186,7 +186,7 @@ HRESULT CScene_HowToPlayMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPres
// Determine which button was pressed,
// and call the appropriate function.
- uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[uiButtonCounter] << 16 ) | ( short )( m_iPad ) );
+ uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[uiButtonCounter] << 16 ) | static_cast<short>(m_iPad) );
if(app.GetLocalPlayerCount()>1)
{
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_HowToPlay, ( void* )( uiInitData ) );
diff --git a/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp b/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp
index f0561745..5030a792 100644
--- a/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp
@@ -12,7 +12,7 @@
//----------------------------------------------------------------------------------
HRESULT CScene_InGameHostOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
MapChildControls();
@@ -76,9 +76,9 @@ HRESULT CScene_InGameHostOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& r
{
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
- if(player != NULL && player->connection)
+ if(player != nullptr && player->connection)
{
- player->connection->send( shared_ptr<ServerSettingsChangedPacket>( new ServerSettingsChangedPacket( ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions) ) );
+ player->connection->send(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, hostOptions));
}
}
diff --git a/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp b/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp
index 4839013c..35e08339 100644
--- a/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp
@@ -25,7 +25,7 @@
HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
m_bIgnoreKeyPresses=true;
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
MapChildControls();
@@ -44,7 +44,7 @@ HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i );
- if( player != NULL )
+ if( player != nullptr )
{
m_players[i] = player->GetSmallId();
++m_playersCount;
@@ -55,7 +55,7 @@ HRESULT CScene_InGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
INetworkPlayer *thisPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad );
m_isHostPlayer = false;
- if(thisPlayer != NULL) m_isHostPlayer = thisPlayer->IsHost() == TRUE;
+ if(thisPlayer != nullptr) m_isHostPlayer = thisPlayer->IsHost() == TRUE;
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad];
@@ -140,9 +140,9 @@ HRESULT CScene_InGameInfo::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle
if(playersList.TreeHasFocus() && (playersList.GetItemCount() > 0) && (playersList.GetCurSel() < m_playersCount) )
{
INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[playersList.GetCurSel()]);
- if( player != NULL )
+ if( player != nullptr )
{
- PlayerUID xuid = ((NetworkPlayerXbox *)player)->GetUID();
+ PlayerUID xuid = static_cast<NetworkPlayerXbox *>(player)->GetUID();
if( xuid != INVALID_XUID )
hr = XShowGamerCardUI(pInputData->UserIndex, xuid);
}
@@ -189,7 +189,7 @@ HRESULT CScene_InGameInfo::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress*
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
bool trust = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
- if( isOp && selectedPlayer != NULL && playersList.TreeHasFocus() && (playersList.GetItemCount() > 0) && (playersList.GetCurSel() < m_playersCount) )
+ if( isOp && selectedPlayer != nullptr && playersList.TreeHasFocus() && (playersList.GetItemCount() > 0) && (playersList.GetCurSel() < m_playersCount) )
{
bool editingHost = selectedPlayer->IsHost();
if( (cheats && (m_isHostPlayer || !editingHost ) )
@@ -268,7 +268,7 @@ HRESULT CScene_InGameInfo::OnNotifySetFocus( HXUIOBJ hObjSource, XUINotifyFocus
void CScene_InGameInfo::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving)
{
- CScene_InGameInfo *scene = (CScene_InGameInfo *)callbackParam;
+ CScene_InGameInfo *scene = static_cast<CScene_InGameInfo *>(callbackParam);
bool playerFound = false;
for(int i = 0; i < scene->m_playersCount; ++i)
@@ -311,7 +311,7 @@ HRESULT CScene_InGameInfo::OnGetSourceDataText(XUIMessageGetSourceText *pGetSour
if( pGetSourceTextData->iItem < m_playersCount )
{
INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId( m_players[pGetSourceTextData->iItem] );
- if( player != NULL )
+ if( player != nullptr )
{
#ifndef _CONTENT_PACKAGE
if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards)))
@@ -397,7 +397,7 @@ HRESULT CScene_InGameInfo::OnGetSourceDataText(XUIMessageGetSourceText *pGetSour
hr=XuiElementGetChildById(hVisual,L"VoiceGroup",&hVoiceIcon);
playFrame = -1;
- if(player != NULL && player->HasVoice() )
+ if(player != nullptr && player->HasVoice() )
{
if( player->IsMutedByLocalUser(m_iPad) )
{
@@ -477,7 +477,7 @@ void CScene_InGameInfo::updateTooltips()
{
keyA = IDS_TOOLTIPS_SELECT;
}
- else if( selectedPlayer != NULL)
+ else if( selectedPlayer != nullptr)
{
bool editingHost = selectedPlayer->IsHost();
if( (cheats && (m_isHostPlayer || !editingHost ) ) || (!trust && (m_isHostPlayer || !editingHost))
@@ -499,7 +499,7 @@ void CScene_InGameInfo::updateTooltips()
if(!m_gameOptionsButton.HasFocus())
{
// if the player is me, then view gamer profile
- if(selectedPlayer != NULL && selectedPlayer->IsLocal() && selectedPlayer->GetUserIndex()==m_iPad)
+ if(selectedPlayer != nullptr && selectedPlayer->IsLocal() && selectedPlayer->GetUserIndex()==m_iPad)
{
ikeyY = IDS_TOOLTIPS_VIEW_GAMERPROFILE;
}
@@ -520,16 +520,16 @@ HRESULT CScene_InGameInfo::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL
int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- BYTE smallId = *(BYTE *)pParam;
+ BYTE smallId = *static_cast<BYTE *>(pParam);
delete pParam;
if(result==C4JStorage::EMessage_ResultAccept)
{
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
- if(localPlayer != NULL && localPlayer->connection)
+ if(localPlayer != nullptr && localPlayer->connection)
{
- localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
+ localPlayer->connection->send(std::make_shared<KickPlayerPacket>(smallId));
}
}
diff --git a/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp b/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp
index 156cd092..4ab2a54a 100644
--- a/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp
@@ -16,9 +16,9 @@
//----------------------------------------------------------------------------------
HRESULT CScene_InGamePlayerOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
- InGamePlayerOptionsInitData *initData = (InGamePlayerOptionsInitData *)pInitData->pvInitData;
+ InGamePlayerOptionsInitData *initData = static_cast<InGamePlayerOptionsInitData *>(pInitData->pvInitData);
m_iPad = initData->iPad;
m_networkSmallId = initData->networkSmallId;
m_playerPrivileges = initData->playerPrivileges;
@@ -32,14 +32,14 @@ HRESULT CScene_InGamePlayerOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHa
INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad );
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
- if(editingPlayer != NULL)
+ if(editingPlayer != nullptr)
{
m_Gamertag.SetText(editingPlayer->GetOnlineName());
}
bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0;
bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0;
- m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer);
+ m_editingSelf = (localPlayer != nullptr && localPlayer == editingPlayer);
if( m_editingSelf || trustPlayers || editingPlayer->IsHost())
{
@@ -247,7 +247,7 @@ HRESULT CScene_InGamePlayerOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL&
else
{
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
- if(!trustPlayers && (editingPlayer != NULL && !editingPlayer->IsHost() ) )
+ if(!trustPlayers && (editingPlayer != nullptr && !editingPlayer->IsHost() ) )
{
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotMine,!m_checkboxes[eControl_BuildAndMine].IsChecked());
Player::setPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CannotBuild,!m_checkboxes[eControl_BuildAndMine].IsChecked());
@@ -278,9 +278,9 @@ HRESULT CScene_InGamePlayerOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL&
// Send update settings packet to server
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
- if(player != NULL && player->connection)
+ if(player != nullptr && player->connection)
{
- player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( m_networkSmallId, -1, m_playerPrivileges) ) );
+ player->connection->send(std::make_shared<PlayerInfoPacket>(m_networkSmallId, -1, m_playerPrivileges));
}
}
@@ -320,7 +320,7 @@ HRESULT CScene_InGamePlayerOptions::OnControlNavigate(XUIMessageControlNavigate
{
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -330,16 +330,16 @@ HRESULT CScene_InGamePlayerOptions::OnControlNavigate(XUIMessageControlNavigate
int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- BYTE smallId = *(BYTE *)pParam;
+ BYTE smallId = *static_cast<BYTE *>(pParam);
delete pParam;
if(result==C4JStorage::EMessage_ResultAccept)
{
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[iPad];
- if(localPlayer != NULL && localPlayer->connection)
+ if(localPlayer != nullptr && localPlayer->connection)
{
- localPlayer->connection->send( shared_ptr<KickPlayerPacket>( new KickPlayerPacket(smallId) ) );
+ localPlayer->connection->send(std::make_shared<KickPlayerPacket>(smallId));
}
// Fix for #61494 - [CRASH]: TU7: Code: Multiplayer: Title may crash while kicking a player from an online game.
@@ -353,16 +353,16 @@ int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStor
void CScene_InGamePlayerOptions::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving)
{
- CScene_InGamePlayerOptions *scene = (CScene_InGamePlayerOptions *)callbackParam;
+ CScene_InGamePlayerOptions *scene = static_cast<CScene_InGamePlayerOptions *>(callbackParam);
HXUIOBJ hBackScene = scene->GetBackScene();
CScene_InGameInfo* infoScene;
VOID *pObj;
XuiObjectFromHandle( hBackScene, &pObj );
- infoScene = (CScene_InGameInfo *)pObj;
- if(infoScene != NULL) CScene_InGameInfo::OnPlayerChanged(infoScene,pPlayer,leaving);
+ infoScene = static_cast<CScene_InGameInfo *>(pObj);
+ if(infoScene != nullptr) CScene_InGameInfo::OnPlayerChanged(infoScene,pPlayer,leaving);
- if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId)
+ if(leaving && pPlayer != nullptr && pPlayer->GetSmallId() == scene->m_networkSmallId)
{
app.NavigateBack(scene->m_iPad);
}
@@ -373,59 +373,59 @@ HRESULT CScene_InGamePlayerOptions::OnTransitionStart( XUIMessageTransition *pTr
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
{
INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId);
- if(editingPlayer != NULL)
+ if(editingPlayer != nullptr)
{
short colourIndex = app.GetPlayerColour( m_networkSmallId );
switch(colourIndex)
{
case 1:
- m_Icon.PlayVisualRange(L"P1",NULL,L"P1");
+ m_Icon.PlayVisualRange(L"P1",nullptr,L"P1");
break;
case 2:
- m_Icon.PlayVisualRange(L"P2",NULL,L"P2");
+ m_Icon.PlayVisualRange(L"P2",nullptr,L"P2");
break;
case 3:
- m_Icon.PlayVisualRange(L"P3",NULL,L"P3");
+ m_Icon.PlayVisualRange(L"P3",nullptr,L"P3");
break;
case 4:
- m_Icon.PlayVisualRange(L"P4",NULL,L"P4");
+ m_Icon.PlayVisualRange(L"P4",nullptr,L"P4");
break;
case 5:
- m_Icon.PlayVisualRange(L"P5",NULL,L"P5");
+ m_Icon.PlayVisualRange(L"P5",nullptr,L"P5");
break;
case 6:
- m_Icon.PlayVisualRange(L"P6",NULL,L"P6");
+ m_Icon.PlayVisualRange(L"P6",nullptr,L"P6");
break;
case 7:
- m_Icon.PlayVisualRange(L"P7",NULL,L"P7");
+ m_Icon.PlayVisualRange(L"P7",nullptr,L"P7");
break;
case 8:
- m_Icon.PlayVisualRange(L"P8",NULL,L"P8");
+ m_Icon.PlayVisualRange(L"P8",nullptr,L"P8");
break;
case 9:
- m_Icon.PlayVisualRange(L"P9",NULL,L"P9");
+ m_Icon.PlayVisualRange(L"P9",nullptr,L"P9");
break;
case 10:
- m_Icon.PlayVisualRange(L"P10",NULL,L"P10");
+ m_Icon.PlayVisualRange(L"P10",nullptr,L"P10");
break;
case 11:
- m_Icon.PlayVisualRange(L"P11",NULL,L"P11");
+ m_Icon.PlayVisualRange(L"P11",nullptr,L"P11");
break;
case 12:
- m_Icon.PlayVisualRange(L"P12",NULL,L"P12");
+ m_Icon.PlayVisualRange(L"P12",nullptr,L"P12");
break;
case 13:
- m_Icon.PlayVisualRange(L"P13",NULL,L"P13");
+ m_Icon.PlayVisualRange(L"P13",nullptr,L"P13");
break;
case 14:
- m_Icon.PlayVisualRange(L"P14",NULL,L"P14");
+ m_Icon.PlayVisualRange(L"P14",nullptr,L"P14");
break;
case 15:
- m_Icon.PlayVisualRange(L"P15",NULL,L"P15");
+ m_Icon.PlayVisualRange(L"P15",nullptr,L"P15");
break;
case 0:
default:
- m_Icon.PlayVisualRange(L"P0",NULL,L"P0");
+ m_Icon.PlayVisualRange(L"P0",nullptr,L"P0");
break;
};
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp b/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp
index 428b3e88..7fde530b 100644
--- a/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Leaderboards.cpp
@@ -33,9 +33,9 @@ LPCWSTR CScene_Leaderboards::m_TextColumnNameA[7]=
// if the value is greater than 511, it's an xzp icon that needs displayed, rather than the game icon
const int CScene_Leaderboards::TitleIcons[CScene_Leaderboards::NUM_LEADERBOARDS][7] =
{
- { XZP_ICON_WALKED, XZP_ICON_FALLEN, Item::minecart_Id, Item::boat_Id, NULL },
+ { XZP_ICON_WALKED, XZP_ICON_FALLEN, Item::minecart_Id, Item::boat_Id, nullptr },
{ Tile::dirt_Id, Tile::stoneBrick_Id, Tile::sand_Id, Tile::rock_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id },
- { Item::egg_Id, Item::wheat_Id, Tile::mushroom1_Id, Tile::reeds_Id, Item::milk_Id, Tile::pumpkin_Id, NULL },
+ { Item::egg_Id, Item::wheat_Id, Tile::mushroom1_Id, Tile::reeds_Id, Item::milk_Id, Tile::pumpkin_Id, nullptr },
{ XZP_ICON_ZOMBIE, XZP_ICON_SKELETON, XZP_ICON_CREEPER, XZP_ICON_SPIDER, XZP_ICON_SPIDERJOCKEY, XZP_ICON_ZOMBIEPIGMAN, XZP_ICON_SLIME },
};
@@ -43,44 +43,44 @@ const int CScene_Leaderboards::LEADERBOARD_HEADERS[CScene_Leaderboards::NUM_LEAD
{ SPASTRING_LB_TRAVELLING_PEACEFUL_NAME, SPASTRING_LB_TRAVELLING_EASY_NAME, SPASTRING_LB_TRAVELLING_NORMAL_NAME, SPASTRING_LB_TRAVELLING_HARD_NAME },
{ SPASTRING_LB_MINING_BLOCKS_PEACEFUL_NAME, SPASTRING_LB_MINING_BLOCKS_EASY_NAME, SPASTRING_LB_MINING_BLOCKS_NORMAL_NAME, SPASTRING_LB_MINING_BLOCKS_HARD_NAME },
{ SPASTRING_LB_FARMING_PEACEFUL_NAME, SPASTRING_LB_FARMING_EASY_NAME, SPASTRING_LB_FARMING_NORMAL_NAME, SPASTRING_LB_FARMING_HARD_NAME },
- { NULL, SPASTRING_LB_KILLS_EASY_NAME, SPASTRING_LB_KILLS_NORMAL_NAME, SPASTRING_LB_KILLS_HARD_NAME },
+ { nullptr, SPASTRING_LB_KILLS_EASY_NAME, SPASTRING_LB_KILLS_NORMAL_NAME, SPASTRING_LB_KILLS_HARD_NAME },
};
const CScene_Leaderboards::LeaderboardDescriptor CScene_Leaderboards::LEADERBOARD_DESCRIPTORS[CScene_Leaderboards::NUM_LEADERBOARDS][4] = {
{
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_PEACEFUL, 4, STATS_COLUMN_TRAVELLING_PEACEFUL_WALKED, STATS_COLUMN_TRAVELLING_PEACEFUL_FALLEN, STATS_COLUMN_TRAVELLING_PEACEFUL_MINECART, STATS_COLUMN_TRAVELLING_PEACEFUL_BOAT, NULL, NULL, NULL,NULL),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_EASY, 4, STATS_COLUMN_TRAVELLING_EASY_WALKED, STATS_COLUMN_TRAVELLING_EASY_FALLEN, STATS_COLUMN_TRAVELLING_EASY_MINECART, STATS_COLUMN_TRAVELLING_EASY_BOAT, NULL, NULL, NULL,NULL),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_NORMAL, 4, STATS_COLUMN_TRAVELLING_NORMAL_WALKED, STATS_COLUMN_TRAVELLING_NORMAL_FALLEN, STATS_COLUMN_TRAVELLING_NORMAL_MINECART, STATS_COLUMN_TRAVELLING_NORMAL_BOAT, NULL, NULL, NULL,NULL),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_HARD, 4, STATS_COLUMN_TRAVELLING_HARD_WALKED, STATS_COLUMN_TRAVELLING_HARD_FALLEN, STATS_COLUMN_TRAVELLING_HARD_MINECART, STATS_COLUMN_TRAVELLING_HARD_BOAT, NULL, NULL, NULL,NULL),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_PEACEFUL, 4, STATS_COLUMN_TRAVELLING_PEACEFUL_WALKED, STATS_COLUMN_TRAVELLING_PEACEFUL_FALLEN, STATS_COLUMN_TRAVELLING_PEACEFUL_MINECART, STATS_COLUMN_TRAVELLING_PEACEFUL_BOAT, nullptr, nullptr, nullptr,nullptr),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_EASY, 4, STATS_COLUMN_TRAVELLING_EASY_WALKED, STATS_COLUMN_TRAVELLING_EASY_FALLEN, STATS_COLUMN_TRAVELLING_EASY_MINECART, STATS_COLUMN_TRAVELLING_EASY_BOAT, nullptr, nullptr, nullptr,nullptr),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_NORMAL, 4, STATS_COLUMN_TRAVELLING_NORMAL_WALKED, STATS_COLUMN_TRAVELLING_NORMAL_FALLEN, STATS_COLUMN_TRAVELLING_NORMAL_MINECART, STATS_COLUMN_TRAVELLING_NORMAL_BOAT, nullptr, nullptr, nullptr,nullptr),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_TRAVELLING_HARD, 4, STATS_COLUMN_TRAVELLING_HARD_WALKED, STATS_COLUMN_TRAVELLING_HARD_FALLEN, STATS_COLUMN_TRAVELLING_HARD_MINECART, STATS_COLUMN_TRAVELLING_HARD_BOAT, nullptr, nullptr, nullptr,nullptr),
},
{
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_PEACEFUL, 7, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_DIRT, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_STONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_SAND, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_CLAY, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_OBSIDIAN,NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_EASY, 7, STATS_COLUMN_MINING_BLOCKS_EASY_DIRT, STATS_COLUMN_MINING_BLOCKS_EASY_STONE, STATS_COLUMN_MINING_BLOCKS_EASY_SAND, STATS_COLUMN_MINING_BLOCKS_EASY_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_EASY_GRAVEL, STATS_COLUMN_MINING_BLOCKS_EASY_CLAY, STATS_COLUMN_MINING_BLOCKS_EASY_OBSIDIAN,NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_NORMAL, 7, STATS_COLUMN_MINING_BLOCKS_NORMAL_DIRT, STATS_COLUMN_MINING_BLOCKS_NORMAL_STONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_SAND, STATS_COLUMN_MINING_BLOCKS_NORMAL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_NORMAL_CLAY, STATS_COLUMN_MINING_BLOCKS_NORMAL_OBSIDIAN,NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_HARD, 7, STATS_COLUMN_MINING_BLOCKS_HARD_DIRT, STATS_COLUMN_MINING_BLOCKS_HARD_STONE, STATS_COLUMN_MINING_BLOCKS_HARD_SAND, STATS_COLUMN_MINING_BLOCKS_HARD_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_HARD_GRAVEL, STATS_COLUMN_MINING_BLOCKS_HARD_CLAY, STATS_COLUMN_MINING_BLOCKS_HARD_OBSIDIAN,NULL ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_PEACEFUL, 7, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_DIRT, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_STONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_SAND, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_CLAY, STATS_COLUMN_MINING_BLOCKS_PEACEFUL_OBSIDIAN,nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_EASY, 7, STATS_COLUMN_MINING_BLOCKS_EASY_DIRT, STATS_COLUMN_MINING_BLOCKS_EASY_STONE, STATS_COLUMN_MINING_BLOCKS_EASY_SAND, STATS_COLUMN_MINING_BLOCKS_EASY_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_EASY_GRAVEL, STATS_COLUMN_MINING_BLOCKS_EASY_CLAY, STATS_COLUMN_MINING_BLOCKS_EASY_OBSIDIAN,nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_NORMAL, 7, STATS_COLUMN_MINING_BLOCKS_NORMAL_DIRT, STATS_COLUMN_MINING_BLOCKS_NORMAL_STONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_SAND, STATS_COLUMN_MINING_BLOCKS_NORMAL_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_NORMAL_GRAVEL, STATS_COLUMN_MINING_BLOCKS_NORMAL_CLAY, STATS_COLUMN_MINING_BLOCKS_NORMAL_OBSIDIAN,nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_MINING_BLOCKS_HARD, 7, STATS_COLUMN_MINING_BLOCKS_HARD_DIRT, STATS_COLUMN_MINING_BLOCKS_HARD_STONE, STATS_COLUMN_MINING_BLOCKS_HARD_SAND, STATS_COLUMN_MINING_BLOCKS_HARD_COBBLESTONE, STATS_COLUMN_MINING_BLOCKS_HARD_GRAVEL, STATS_COLUMN_MINING_BLOCKS_HARD_CLAY, STATS_COLUMN_MINING_BLOCKS_HARD_OBSIDIAN,nullptr ),
},
{
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_PEACEFUL, 6, STATS_COLUMN_FARMING_PEACEFUL_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_PEACEFUL_MUSHROOMS, STATS_COLUMN_FARMING_PEACEFUL_SUGARCANE, STATS_COLUMN_FARMING_PEACEFUL_MILK, STATS_COLUMN_FARMING_PEACEFUL_PUMPKINS, NULL,NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_EASY, 6, STATS_COLUMN_FARMING_EASY_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_EASY_MUSHROOMS, STATS_COLUMN_FARMING_EASY_SUGARCANE, STATS_COLUMN_FARMING_EASY_MILK, STATS_COLUMN_FARMING_EASY_PUMPKINS, NULL,NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_NORMAL, 6, STATS_COLUMN_FARMING_NORMAL_EGGS, STATS_COLUMN_FARMING_NORMAL_WHEAT, STATS_COLUMN_FARMING_NORMAL_MUSHROOMS, STATS_COLUMN_FARMING_NORMAL_SUGARCANE, STATS_COLUMN_FARMING_NORMAL_MILK, STATS_COLUMN_FARMING_NORMAL_PUMPKINS, NULL,NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_HARD, 6, STATS_COLUMN_FARMING_HARD_EGGS, STATS_COLUMN_FARMING_HARD_WHEAT, STATS_COLUMN_FARMING_HARD_MUSHROOMS, STATS_COLUMN_FARMING_HARD_SUGARCANE, STATS_COLUMN_FARMING_HARD_MILK, STATS_COLUMN_FARMING_HARD_PUMPKINS, NULL,NULL ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_PEACEFUL, 6, STATS_COLUMN_FARMING_PEACEFUL_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_PEACEFUL_MUSHROOMS, STATS_COLUMN_FARMING_PEACEFUL_SUGARCANE, STATS_COLUMN_FARMING_PEACEFUL_MILK, STATS_COLUMN_FARMING_PEACEFUL_PUMPKINS, nullptr,nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_EASY, 6, STATS_COLUMN_FARMING_EASY_EGGS, STATS_COLUMN_FARMING_PEACEFUL_WHEAT, STATS_COLUMN_FARMING_EASY_MUSHROOMS, STATS_COLUMN_FARMING_EASY_SUGARCANE, STATS_COLUMN_FARMING_EASY_MILK, STATS_COLUMN_FARMING_EASY_PUMPKINS, nullptr,nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_NORMAL, 6, STATS_COLUMN_FARMING_NORMAL_EGGS, STATS_COLUMN_FARMING_NORMAL_WHEAT, STATS_COLUMN_FARMING_NORMAL_MUSHROOMS, STATS_COLUMN_FARMING_NORMAL_SUGARCANE, STATS_COLUMN_FARMING_NORMAL_MILK, STATS_COLUMN_FARMING_NORMAL_PUMPKINS, nullptr,nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_FARMING_HARD, 6, STATS_COLUMN_FARMING_HARD_EGGS, STATS_COLUMN_FARMING_HARD_WHEAT, STATS_COLUMN_FARMING_HARD_MUSHROOMS, STATS_COLUMN_FARMING_HARD_SUGARCANE, STATS_COLUMN_FARMING_HARD_MILK, STATS_COLUMN_FARMING_HARD_PUMPKINS, nullptr,nullptr ),
},
{
- CScene_Leaderboards::LeaderboardDescriptor( NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_EASY, 7, STATS_COLUMN_KILLS_EASY_ZOMBIES, STATS_COLUMN_KILLS_EASY_SKELETONS, STATS_COLUMN_KILLS_EASY_CREEPERS, STATS_COLUMN_KILLS_EASY_SPIDERS, STATS_COLUMN_KILLS_EASY_SPIDERJOCKEYS, STATS_COLUMN_KILLS_EASY_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_EASY_SLIME,NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_NORMAL, 7, STATS_COLUMN_KILLS_NORMAL_ZOMBIES, STATS_COLUMN_KILLS_NORMAL_SKELETONS, STATS_COLUMN_KILLS_NORMAL_CREEPERS, STATS_COLUMN_KILLS_NORMAL_SPIDERS, STATS_COLUMN_KILLS_NORMAL_SPIDERJOCKEYS, STATS_COLUMN_KILLS_NORMAL_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_NORMAL_SLIME,NULL ),
- CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_HARD, 7, STATS_COLUMN_KILLS_HARD_ZOMBIES, STATS_COLUMN_KILLS_HARD_SKELETONS, STATS_COLUMN_KILLS_HARD_CREEPERS, STATS_COLUMN_KILLS_HARD_SPIDERS, STATS_COLUMN_KILLS_HARD_SPIDERJOCKEYS, STATS_COLUMN_KILLS_HARD_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_HARD_SLIME,NULL ),
+ CScene_Leaderboards::LeaderboardDescriptor( nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_EASY, 7, STATS_COLUMN_KILLS_EASY_ZOMBIES, STATS_COLUMN_KILLS_EASY_SKELETONS, STATS_COLUMN_KILLS_EASY_CREEPERS, STATS_COLUMN_KILLS_EASY_SPIDERS, STATS_COLUMN_KILLS_EASY_SPIDERJOCKEYS, STATS_COLUMN_KILLS_EASY_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_EASY_SLIME,nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_NORMAL, 7, STATS_COLUMN_KILLS_NORMAL_ZOMBIES, STATS_COLUMN_KILLS_NORMAL_SKELETONS, STATS_COLUMN_KILLS_NORMAL_CREEPERS, STATS_COLUMN_KILLS_NORMAL_SPIDERS, STATS_COLUMN_KILLS_NORMAL_SPIDERJOCKEYS, STATS_COLUMN_KILLS_NORMAL_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_NORMAL_SLIME,nullptr ),
+ CScene_Leaderboards::LeaderboardDescriptor( STATS_VIEW_KILLS_HARD, 7, STATS_COLUMN_KILLS_HARD_ZOMBIES, STATS_COLUMN_KILLS_HARD_SKELETONS, STATS_COLUMN_KILLS_HARD_CREEPERS, STATS_COLUMN_KILLS_HARD_SPIDERS, STATS_COLUMN_KILLS_HARD_SPIDERJOCKEYS, STATS_COLUMN_KILLS_HARD_ZOMBIEPIGMEN, STATS_COLUMN_KILLS_HARD_SLIME,nullptr ),
},
};
HRESULT CScene_Leaderboards::OnInit(XUIMessageInit *pInitData, BOOL &bHandled)
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
MapChildControls();
m_bReady=false;
// if we're not in the game, we need to use basescene 0
- if(Minecraft::GetInstance()->level==NULL)
+ if(Minecraft::GetInstance()->level==nullptr)
{
m_iPad=DEFAULT_XUI_MENU_USER;
}
@@ -90,9 +90,9 @@ HRESULT CScene_Leaderboards::OnInit(XUIMessageInit *pInitData, BOOL &bHandled)
ui.SetTooltips(m_iPad,-1, IDS_TOOLTIPS_BACK, IDS_TOOLTIPS_CHANGE_FILTER, -1);
CXuiSceneBase::ShowLogo( m_iPad, FALSE );
- m_friends = NULL;
+ m_friends = nullptr;
m_numFriends = 0;
- m_filteredFriends = NULL;
+ m_filteredFriends = nullptr;
m_numFilteredFriends = 0;
m_newTop = m_newSel = -1;
@@ -124,10 +124,10 @@ HRESULT CScene_Leaderboards::OnInit(XUIMessageInit *pInitData, BOOL &bHandled)
// title icons
for(int i=0;i<7;i++)
{
- m_pHTitleIconSlots[i]=NULL;
+ m_pHTitleIconSlots[i]=nullptr;
m_fTitleIconXPositions[i]=0.0f;
m_fTextXPositions[i]=0.0f;
- m_hTextEntryA[i]=NULL;
+ m_hTextEntryA[i]=nullptr;
}
@@ -143,13 +143,13 @@ void CScene_Leaderboards::Reposition(int iNumber)
D3DXVECTOR3 vPos;
fIconSize=(m_fTitleIconXPositions[6]-m_fTitleIconXPositions[0])/6.0f;
- fNewIconIncrement=(fIconSize*7.0f)/(float)iNumber;
+ fNewIconIncrement=(fIconSize*7.0f)/static_cast<float>(iNumber);
// reposition the title icons based on the number there are
for(int i=0;i<iNumber;i++)
{
m_pHTitleIconSlots[i]->GetPosition(&vPos);
- vPos.x=m_fTitleIconXPositions[0]+(((float)i)*fNewIconIncrement)+(fNewIconIncrement-fIconSize)/2.0f;
+ vPos.x=m_fTitleIconXPositions[0]+(static_cast<float>(i)*fNewIconIncrement)+(fNewIconIncrement-fIconSize)/2.0f;
m_pHTitleIconSlots[i]->SetPosition(&vPos);
}
}
@@ -161,14 +161,14 @@ void CScene_Leaderboards::RepositionText(int iNumber)
D3DXVECTOR3 vPos;
fTextSize=(m_fTextXPositions[6]-m_fTextXPositions[0])/6.0f;
- fNewTextIncrement=(fTextSize*7.0f)/(float)iNumber;
+ fNewTextIncrement=(fTextSize*7.0f)/static_cast<float>(iNumber);
// reposition the title icons based on the number there are
for(int i=0;i<iNumber;i++)
{
// and reposition the text
XuiElementGetPosition(m_hTextEntryA[i],&vPos);
- vPos.x=m_fTextXPositions[0]+(((float)i)*fNewTextIncrement);
+ vPos.x=m_fTextXPositions[0]+(static_cast<float>(i)*fNewTextIncrement);
XuiElementSetPosition(m_hTextEntryA[i],&vPos);
// and change the size
float fWidth,fHeight;
@@ -190,10 +190,10 @@ HRESULT CScene_Leaderboards::OnDestroy()
Sleep( 10 );
}
- if( m_friends != NULL )
+ if( m_friends != nullptr )
delete [] m_friends;
- if( m_filteredFriends != NULL )
+ if( m_filteredFriends != nullptr )
delete [] m_filteredFriends;
return S_OK;
@@ -222,7 +222,7 @@ void CScene_Leaderboards::UpdateTooltips()
int iTooltipGamerCardOrProfile=-1;
if( m_leaderboard.m_currentEntryCount > 0 )
{
- unsigned int selection = (unsigned int)m_listGamers.GetCurSel();
+ unsigned int selection = static_cast<unsigned int>(m_listGamers.GetCurSel());
// if the selected user is me, don't show Send Friend Request, and show the gamer profile, not the gamer card
@@ -368,7 +368,7 @@ HRESULT CScene_Leaderboards::OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandl
else
{
m_newTop = m_listGamers.GetTopItem() + 10;
- if( m_newTop+10 > (int)m_leaderboard.m_totalEntryCount )
+ if( m_newTop+10 > static_cast<int>(m_leaderboard.m_totalEntryCount) )
{
m_newTop = m_leaderboard.m_totalEntryCount - 10;
if( m_newTop < 0 )
@@ -426,7 +426,7 @@ HRESULT CScene_Leaderboards::OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandl
//Show gamercard
if( m_leaderboard.m_currentEntryCount > 0 )
{
- unsigned int selection = (unsigned int)m_listGamers.GetCurSel();
+ unsigned int selection = static_cast<unsigned int>(m_listGamers.GetCurSel());
if( selection >= m_leaderboard.m_entryStartIndex-1 &&
selection < (m_leaderboard.m_entryStartIndex+m_leaderboard.m_currentEntryCount-1) )
{
@@ -448,7 +448,7 @@ HRESULT CScene_Leaderboards::OnKeyDown(XUIMessageInput* pInputData, BOOL& bHandl
{
if( m_leaderboard.m_currentEntryCount > 0 )
{
- unsigned int selection = (unsigned int)m_listGamers.GetCurSel();
+ unsigned int selection = static_cast<unsigned int>(m_listGamers.GetCurSel());
if( selection >= m_leaderboard.m_entryStartIndex-1 &&
selection < (m_leaderboard.m_entryStartIndex+m_leaderboard.m_currentEntryCount-1) )
{
@@ -511,7 +511,7 @@ void CScene_Leaderboards::GetFriends()
m_friends,
resultsSize,
&numFriends,
- NULL );
+ nullptr );
if( ret != ERROR_SUCCESS )
numFriends = 0;
@@ -547,7 +547,7 @@ void CScene_Leaderboards::ReadStats(int startIndex)
}
else
{
- m_newEntryIndex = (unsigned int)startIndex;
+ m_newEntryIndex = static_cast<unsigned int>(startIndex);
m_newReadSize = min((int)READ_SIZE, (int)m_leaderboard.m_totalEntryCount-(startIndex-1));
}
@@ -574,20 +574,20 @@ void CScene_Leaderboards::ReadStats(int startIndex)
{
case LeaderboardManager::eFM_TopRank:
LeaderboardManager::Instance()->ReadStats_TopRank( this,
- m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard,
+ m_currentDifficulty, static_cast<LeaderboardManager::EStatsType>(m_currentLeaderboard),
m_newEntryIndex, m_newReadSize
);
break;
case LeaderboardManager::eFM_MyScore:
LeaderboardManager::Instance()->ReadStats_MyScore( this,
- m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard,
+ m_currentDifficulty, static_cast<LeaderboardManager::EStatsType>(m_currentLeaderboard),
INVALID_XUID/*ignored*/,
m_newReadSize
);
break;
case LeaderboardManager::eFM_Friends:
LeaderboardManager::Instance()->ReadStats_Friends( this,
- m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard,
+ m_currentDifficulty, static_cast<LeaderboardManager::EStatsType>(m_currentLeaderboard),
INVALID_XUID /*ignored*/,
0 /*ignored*/, 0 /*ignored*/
);
@@ -660,7 +660,7 @@ bool CScene_Leaderboards::RetrieveStats()
else
{
m_leaderboard.m_entries[entryIndex].m_columns[i] = UINT_MAX;
- swprintf(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%.1fkm", ((float)m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f);
+ swprintf(m_leaderboard.m_entries[entryIndex].m_wcColumns[i], 12, L"%.1fkm", static_cast<float>(m_leaderboard.m_entries[entryIndex].m_columns[i])/100.f/1000.f);
}
}
@@ -675,7 +675,7 @@ bool CScene_Leaderboards::RetrieveStats()
return true;
}
- //assert( LeaderboardManager::Instance()->GetStats() != NULL );
+ //assert( LeaderboardManager::Instance()->GetStats() != nullptr );
//PXUSER_STATS_READ_RESULTS stats = LeaderboardManager::Instance()->GetStats();
//if( m_currentFilter == LeaderboardManager::eFM_Friends ) LeaderboardManager::Instance()->SortFriendStats();
@@ -822,7 +822,7 @@ HRESULT CScene_Leaderboards::OnGetSourceDataText(XUIMessageGetSourceText *pGetSo
int readIndex = m_leaderboard.m_entryStartIndex - READ_SIZE;
if( readIndex <= 0 )
readIndex = 1;
- assert( readIndex >= 1 && readIndex <= (int)m_leaderboard.m_totalEntryCount );
+ assert( readIndex >= 1 && readIndex <= static_cast<int>(m_leaderboard.m_totalEntryCount));
ReadStats(readIndex);
}
}
@@ -831,7 +831,7 @@ HRESULT CScene_Leaderboards::OnGetSourceDataText(XUIMessageGetSourceText *pGetSo
if( LeaderboardManager::Instance()->isIdle() )
{
int readIndex = m_leaderboard.m_entryStartIndex + m_leaderboard.m_currentEntryCount;
- assert( readIndex >= 1 && readIndex <= (int)m_leaderboard.m_totalEntryCount );
+ assert( readIndex >= 1 && readIndex <= static_cast<int>(m_leaderboard.m_totalEntryCount));
ReadStats(readIndex);
}
}
@@ -850,7 +850,7 @@ HRESULT CScene_Leaderboards::OnGetSourceDataText(XUIMessageGetSourceText *pGetSo
}
else if( pGetSourceTextData->iData >= 3 && pGetSourceTextData->iData <= 9 )
{
- if( m_leaderboard.m_numColumns <= (unsigned int)(pGetSourceTextData->iData-3) )
+ if( m_leaderboard.m_numColumns <= static_cast<unsigned int>(pGetSourceTextData->iData - 3) )
pGetSourceTextData->szText = L"";
else
pGetSourceTextData->szText = m_leaderboard.m_entries[index].m_wcColumns[pGetSourceTextData->iData-3];
@@ -898,11 +898,11 @@ HRESULT CScene_Leaderboards::OnGetSourceDataImage(XUIMessageGetSourceImage* pGet
void CScene_Leaderboards::PopulateLeaderboard(bool noResults)
{
HRESULT hr;
- HXUIOBJ visual=NULL;
- HXUIOBJ hTemp=NULL;
+ HXUIOBJ visual=nullptr;
+ HXUIOBJ hTemp=nullptr;
hr=XuiControlGetVisual(m_listGamers.m_hObj,&visual);
- if(m_pHTitleIconSlots[0]==NULL)
+ if(m_pHTitleIconSlots[0]==nullptr)
{
VOID *pObj;
HXUIOBJ button;
@@ -914,7 +914,7 @@ void CScene_Leaderboards::PopulateLeaderboard(bool noResults)
hr=XuiElementGetChildById(visual,m_TitleIconNameA[i],&button);
XuiObjectFromHandle( button, &pObj );
- m_pHTitleIconSlots[i] = (CXuiCtrlCraftIngredientSlot *)pObj;
+ m_pHTitleIconSlots[i] = static_cast<CXuiCtrlCraftIngredientSlot *>(pObj);
// store the default position, since we'll be repositioning these depending on how many are valid for each board
m_pHTitleIconSlots[i]->GetPosition(&vPos);
@@ -964,7 +964,7 @@ void CScene_Leaderboards::PopulateLeaderboard(bool noResults)
// Really only the newly updated rows need changed, but this shouldn't cause any performance issues
for(DWORD i = m_leaderboard.m_entryStartIndex - 1; i < (m_leaderboard.m_entryStartIndex - 1) + m_leaderboard.m_currentEntryCount; ++i)
{
- HXUIOBJ visual=NULL;
+ HXUIOBJ visual=nullptr;
HXUIOBJ button;
D3DXVECTOR3 vPos;
// 4J-PB - fix for #13768 - Leaderboards: Player scores appear misaligned when viewed under the "My Score" leaderboard filter
@@ -1088,24 +1088,24 @@ void CScene_Leaderboards::CopyLeaderboardEntry(PXUSER_STATS_ROW statsRow, Leader
else if(iDigitC<8)
{
// km with a .X
- swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", ((float)leaderboardEntry->m_columns[i])/1000.f);
+ swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.1fkm", static_cast<float>(leaderboardEntry->m_columns[i])/1000.f);
#ifdef _DEBUG
- app.DebugPrintf("Display - %.1fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f);
+ app.DebugPrintf("Display - %.1fkm\n", static_cast<float>(leaderboardEntry->m_columns[i])/1000.f);
#endif
}
else
{
// bigger than that, so no decimal point
- swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", ((float)leaderboardEntry->m_columns[i])/1000.f);
+ swprintf_s(leaderboardEntry->m_wcColumns[i], 12, L"%.0fkm", static_cast<float>(leaderboardEntry->m_columns[i])/1000.f);
#ifdef _DEBUG
- app.DebugPrintf("Display - %.0fkm\n", ((float)leaderboardEntry->m_columns[i])/1000.f);
+ app.DebugPrintf("Display - %.0fkm\n", static_cast<float>(leaderboardEntry->m_columns[i])/1000.f);
#endif
}
}
}
//Is the player
- if( statsRow->xuid == ((XboxLeaderboardManager*)LeaderboardManager::Instance())->GetMyXUID() )
+ if( statsRow->xuid == static_cast<XboxLeaderboardManager *>(LeaderboardManager::Instance())->GetMyXUID() )
{
leaderboardEntry->m_bPlayer = true;
leaderboardEntry->m_bOnline = false;
@@ -1150,7 +1150,7 @@ void CScene_Leaderboards::SetLeaderboardHeader()
WCHAR buffer[40];
DWORD bufferLength = 40;
- DWORD ret = XResourceGetString(LEADERBOARD_HEADERS[m_currentLeaderboard][m_currentDifficulty], buffer, &bufferLength, NULL);
+ DWORD ret = XResourceGetString(LEADERBOARD_HEADERS[m_currentLeaderboard][m_currentDifficulty], buffer, &bufferLength, nullptr);
if( ret == ERROR_SUCCESS )
m_textLeaderboard.SetText(buffer);
@@ -1184,8 +1184,8 @@ void CScene_Leaderboards::ClearLeaderboardTitlebar()
m_pHTitleIconSlots[i]->SetShow(FALSE);
}
- HXUIOBJ visual=NULL;
- HXUIOBJ hTemp=NULL;
+ HXUIOBJ visual=nullptr;
+ HXUIOBJ hTemp=nullptr;
HRESULT hr;
hr=XuiControlGetVisual(m_listGamers.m_hObj,&visual);
diff --git a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp
index 7f32ff89..e1295795 100644
--- a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp
@@ -42,14 +42,14 @@ int CScene_LoadGameSettings::m_iDifficultyTitleSettingA[4]=
HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_hXuiBrush = NULL;
+ m_hXuiBrush = nullptr;
m_bSetup = false;
m_texturePackDescDisplayed = false;
- m_iConfigA=NULL;
+ m_iConfigA=nullptr;
WCHAR TempString[256];
- m_params = (LoadMenuInitData *)pInitData->pvInitData;
+ m_params = static_cast<LoadMenuInitData *>(pInitData->pvInitData);
m_MoreOptionsParams.bGenerateOptions=FALSE;
m_MoreOptionsParams.bPVP = TRUE;
@@ -146,7 +146,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl
else
{
// set the save icon
- PBYTE pbImageData=NULL;
+ PBYTE pbImageData=nullptr;
DWORD dwImageBytes=0;
StorageManager.GetSaveCacheFileInfo(m_params->iSaveGameInfoIndex,m_XContentData);
@@ -156,13 +156,13 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl
// Don't delete the image data after creating the xuibrush, since we'll use it in the rename of the save
bool bHostOptionsRead = false;
unsigned int uiHostOptions = 0;
- if(pbImageData==NULL)
+ if(pbImageData==nullptr)
{
- DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&m_XContentData,NULL,&dwImageBytes,NULL);
+ DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&m_XContentData,nullptr,&dwImageBytes,nullptr);
if(dwResult==ERROR_SUCCESS)
{
pbImageData = new BYTE[dwImageBytes];
- XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&m_XContentData,pbImageData,&dwImageBytes,NULL);
+ XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&m_XContentData,pbImageData,&dwImageBytes,nullptr);
XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&m_hXuiBrush);
}
}
@@ -175,9 +175,9 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl
// #ifdef _DEBUG
// // dump out the thumbnail
-// HANDLE hThumbnail = CreateFile("GAME:\\thumbnail.png", GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL);
+// HANDLE hThumbnail = CreateFile("GAME:\\thumbnail.png", GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, nullptr);
// DWORD dwBytes;
-// WriteFile(hThumbnail,pbImageData,dwImageBytes,&dwBytes,NULL);
+// WriteFile(hThumbnail,pbImageData,dwImageBytes,&dwBytes,nullptr);
// XCloseHandle(hThumbnail);
// #endif
@@ -276,7 +276,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl
if(dwImageBytes > 0 && pbImageData)
{
ListInfo.fEnabled = TRUE;
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tp);
if(pDLCTexPack)
{
int id=pDLCTexPack->getDLCParentPackId();
@@ -310,7 +310,7 @@ HRESULT CScene_LoadGameSettings::OnInit( XUIMessageInit* pInitData, BOOL& bHandl
// 4J-PB - there may be texture packs we don't have, so use the info from TMS for this
- DLC_INFO *pDLCInfo=NULL;
+ DLC_INFO *pDLCInfo=nullptr;
// first pass - look to see if there are any that are not in the list
bool bTexturePackAlreadyListed;
@@ -376,7 +376,7 @@ HRESULT CScene_LoadGameSettings::OnControlNavigate(XUIMessageControlNavigate *pC
{
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -411,7 +411,7 @@ HRESULT CScene_LoadGameSettings::LaunchGame(void)
// inform them that leaderboard writes and achievements will be disabled
//StorageManager.RequestMessageBox(IDS_TITLE_START_GAME, IDS_CONFIRM_START_SAVEDINCREATIVE_CONTINUE, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::ConfirmLoadReturned,this,app.GetStringTable());
- if(m_levelGen != NULL)
+ if(m_levelGen != nullptr)
{
LoadLevelGen(m_levelGen);
}
@@ -445,7 +445,7 @@ HRESULT CScene_LoadGameSettings::LaunchGame(void)
}
else
{
- if(m_levelGen != NULL)
+ if(m_levelGen != nullptr)
{
LoadLevelGen(m_levelGen);
}
@@ -469,7 +469,7 @@ HRESULT CScene_LoadGameSettings::LaunchGame(void)
int CScene_LoadGameSettings::CheckResetNetherReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam;
+ CScene_LoadGameSettings* pClass = static_cast<CScene_LoadGameSettings *>(pParam);
// results switched for this dialog
if(result==C4JStorage::EMessage_ResultDecline)
@@ -503,7 +503,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyP
// texture pack hasn't been set yet, so check what it will be
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
- if(pTexturePack==NULL)
+ if(pTexturePack==nullptr)
{
// They've selected a texture pack they don't have yet
// upsell
@@ -572,7 +572,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyP
// texture pack hasn't been set yet, so check what it will be
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
- if(pTexturePack==NULL)
+ if(pTexturePack==nullptr)
{
// DLC corrupt, so use the default textures
m_MoreOptionsParams.dwTexturePack=0;
@@ -600,7 +600,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyP
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_pDLCPack->getPurchaseOfferId());
ULONGLONG ullOfferID_Full;
- if(pDLCInfo!=NULL)
+ if(pDLCInfo!=nullptr)
{
ullOfferID_Full=pDLCInfo->ullOfferID_Full;
}
@@ -703,11 +703,11 @@ HRESULT CScene_LoadGameSettings::OnFontRendererChange()
int CScene_LoadGameSettings::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam;
+ CScene_LoadGameSettings* pClass = static_cast<CScene_LoadGameSettings *>(pParam);
if(result==C4JStorage::EMessage_ResultAccept)
{
- if(pClass->m_levelGen != NULL)
+ if(pClass->m_levelGen != nullptr)
{
pClass->LoadLevelGen(pClass->m_levelGen);
}
@@ -784,14 +784,14 @@ HRESULT CScene_LoadGameSettings::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandle
if(m_iConfigA[i]!=-1)
{
DWORD dwBytes=0;
- PBYTE pbData=NULL;
+ PBYTE pbData=nullptr;
app.GetTPD(m_iConfigA[i],&pbData,&dwBytes);
ZeroMemory(&ListInfo,sizeof(CXuiCtrl4JList::LIST_ITEM_INFO));
if(dwBytes > 0 && pbData)
{
DWORD dwImageBytes=0;
- PBYTE pbImageData=NULL;
+ PBYTE pbImageData=nullptr;
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
ListInfo.fEnabled = TRUE;
@@ -840,7 +840,7 @@ int CScene_LoadGameSettings::Progress(void *pParam,float fProgress)
int CScene_LoadGameSettings::LoadSaveDataReturned(void *pParam,bool bContinue)
{
- CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam;
+ CScene_LoadGameSettings* pClass = static_cast<CScene_LoadGameSettings *>(pParam);
if(bContinue==true)
{
@@ -868,7 +868,7 @@ int CScene_LoadGameSettings::LoadSaveDataReturned(void *pParam,bool bContinue)
pClass->m_bIgnoreInput=false;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
else
{
@@ -903,7 +903,7 @@ int CScene_LoadGameSettings::LoadSaveDataReturned(void *pParam,bool bContinue)
int CScene_LoadGameSettings::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam;
+ CScene_LoadGameSettings* pClass = static_cast<CScene_LoadGameSettings *>(pParam);
// results switched for this dialog
if(result==C4JStorage::EMessage_ResultDecline)
@@ -921,7 +921,7 @@ int CScene_LoadGameSettings::DeleteSaveDialogReturned(void *pParam,int iPad,C4JS
int CScene_LoadGameSettings::DeleteSaveDataReturned(void *pParam,bool bSuccess)
{
- CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam;
+ CScene_LoadGameSettings* pClass = static_cast<CScene_LoadGameSettings *>(pParam);
app.SetCorruptSaveDeleted(true);
app.NavigateBack(pClass->m_iPad);
@@ -951,7 +951,7 @@ void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass,
NetworkGameInitData *param = new NetworkGameInitData();
param->seed = 0;
- param->saveData = NULL;
+ param->saveData = nullptr;
param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack;
Minecraft *pMinecraft = Minecraft::GetInstance();
@@ -983,7 +983,7 @@ void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass,
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
- loadingParams->lpParam = (LPVOID)param;
+ loadingParams->lpParam = static_cast<LPVOID>(param);
// Reset the autosave timer
app.SetAutosaveTimerTime();
@@ -1000,7 +1000,7 @@ void CScene_LoadGameSettings::StartGameFromSave(CScene_LoadGameSettings* pClass,
int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad)
{
- CScene_LoadGameSettings* pClass = (CScene_LoadGameSettings*)pParam;
+ CScene_LoadGameSettings* pClass = static_cast<CScene_LoadGameSettings *>(pParam);
if(bContinue==true)
{
@@ -1036,7 +1036,7 @@ int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinu
//pClass->m_bAbortSearch=false;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
else
{
@@ -1045,7 +1045,7 @@ int CScene_LoadGameSettings::StartGame_SignInReturned(void *pParam,bool bContinu
//pClass->m_bAbortSearch=false;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
}
else
@@ -1082,7 +1082,7 @@ HRESULT CScene_LoadGameSettings::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINo
if(hObjSource==m_SliderDifficulty.GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pNotifyValueChanged->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue]));
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue]));
m_SliderDifficulty.SetText(TempString);
}
return S_OK;
@@ -1150,7 +1150,7 @@ HRESULT CScene_LoadGameSettings::OnTransitionEnd( XUIMessageTransition *pTransit
int CScene_LoadGameSettings::UnlockTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_LoadGameSettings* pScene = (CScene_LoadGameSettings*)pParam;
+ CScene_LoadGameSettings* pScene = static_cast<CScene_LoadGameSettings *>(pParam);
if(result==C4JStorage::EMessage_ResultAccept)
{
@@ -1159,7 +1159,7 @@ int CScene_LoadGameSettings::UnlockTexturePackReturned(void *pParam,int iPad,C4J
ULONGLONG ullIndexA[1];
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId());
- if(pDLCInfo!=NULL)
+ if(pDLCInfo!=nullptr)
{
ullIndexA[0]=pDLCInfo->ullOfferID_Full;
}
@@ -1168,7 +1168,7 @@ int CScene_LoadGameSettings::UnlockTexturePackReturned(void *pParam,int iPad,C4J
ullIndexA[0]=pScene->m_pDLCPack->getPurchaseOfferId();
}
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
// the license change coming in when the offer has been installed will cause this scene to refresh
}
@@ -1238,11 +1238,11 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index)
int iTexPackId=m_pTexturePacksList->GetData(index).iData;
TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(iTexPackId);
- if(tp==NULL)
+ if(tp==nullptr)
{
// this is probably a texture pack icon added from TMS
DWORD dwBytes=0,dwFileBytes=0;
- PBYTE pbData=NULL,pbFileData=NULL;
+ PBYTE pbData=nullptr,pbFileData=nullptr;
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
// get the current index of the list, and then get the data
@@ -1272,7 +1272,7 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index)
}
else
{
- m_texturePackComparison->UseBrush(NULL);
+ m_texturePackComparison->UseBrush(nullptr);
}
}
else
@@ -1290,7 +1290,7 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index)
}
else
{
- m_texturePackIcon->UseBrush(NULL);
+ m_texturePackIcon->UseBrush(nullptr);
}
pbImageData = tp->getPackComparison(dwImageBytes);
@@ -1302,7 +1302,7 @@ void CScene_LoadGameSettings::UpdateTexturePackDescription(int index)
}
else
{
- m_texturePackComparison->UseBrush(NULL);
+ m_texturePackComparison->UseBrush(nullptr);
}
}
}
@@ -1311,8 +1311,8 @@ void CScene_LoadGameSettings::ClearTexturePackDescription()
{
m_texturePackTitle.SetText(L" ");
m_texturePackDescription.SetText(L" ");
- m_texturePackComparison->UseBrush(NULL);
- m_texturePackIcon->UseBrush(NULL);
+ m_texturePackComparison->UseBrush(nullptr);
+ m_texturePackIcon->UseBrush(nullptr);
}
void CScene_LoadGameSettings::UpdateCurrentTexturePack()
@@ -1322,7 +1322,7 @@ void CScene_LoadGameSettings::UpdateCurrentTexturePack()
TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(iTexPackId);
// if the texture pack is null, you don't have it yet
- if(tp==NULL)
+ if(tp==nullptr)
{
// Upsell
@@ -1416,7 +1416,7 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen)
m_bIgnoreInput=false;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
return;
}
}
@@ -1438,7 +1438,7 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen)
NetworkGameInitData *param = new NetworkGameInitData();
param->seed = 0;
- param->saveData = NULL;
+ param->saveData = nullptr;
param->levelGen = levelGen;
if(levelGen->requiresTexturePack())
@@ -1482,7 +1482,7 @@ void CScene_LoadGameSettings::LoadLevelGen(LevelGenerationOptions *levelGen)
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
- loadingParams->lpParam = (LPVOID)param;
+ loadingParams->lpParam = static_cast<LPVOID>(param);
// Reset the autosave timer
app.SetAutosaveTimerTime();
@@ -1540,7 +1540,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete()
ListInfo.fEnabled = TRUE;
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tp);
if(pDLCTexPack)
{
int id=pDLCTexPack->getDLCParentPackId();
@@ -1566,7 +1566,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete()
m_iTexturePacksNotInstalled=0;
// 4J-PB - there may be texture packs we don't have, so use the info from TMS for this
- DLC_INFO *pDLCInfo=NULL;
+ DLC_INFO *pDLCInfo=nullptr;
// first pass - look to see if there are any that are not in the list
bool bTexturePackAlreadyListed;
@@ -1599,7 +1599,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete()
// add a TMS request for them
app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n");
app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData);
- if(m_iConfigA!=NULL)
+ if(m_iConfigA!=nullptr)
{
delete m_iConfigA;
}
@@ -1635,7 +1635,7 @@ HRESULT CScene_LoadGameSettings::OnCustomMessage_DLCMountingComplete()
int CScene_LoadGameSettings::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_LoadGameSettings *pClass = (CScene_LoadGameSettings *)pParam;
+ CScene_LoadGameSettings *pClass = static_cast<CScene_LoadGameSettings *>(pParam);
#ifdef _XBOX
pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel();
// Exit with or without saving
@@ -1655,7 +1655,7 @@ int CScene_LoadGameSettings::TexturePackDialogReturned(void *pParam,int iPad,C4J
if( result==C4JStorage::EMessage_ResultAccept ) // Full version
{
ullIndexA[0]=ullOfferID_Full;
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
}
else // trial version
@@ -1665,7 +1665,7 @@ int CScene_LoadGameSettings::TexturePackDialogReturned(void *pParam,int iPad,C4J
if(pDLCInfo->ullOfferID_Trial!=0LL)
{
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
}
}
}
diff --git a/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp b/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp
index 7b9c1a56..4126c559 100644
--- a/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp
@@ -72,7 +72,7 @@ HRESULT CScene_Main::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
WCHAR szResourceLocator[ LOCATOR_SIZE ];
// load from the .xzp file
- const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
+ const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/splashes.txt");
BYTE *splashesData;
@@ -119,7 +119,7 @@ HRESULT CScene_Main::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
m_bIgnorePress=false;
// 4J Stu - Clear out any loaded game rules
- app.setLevelGenerationOptions(NULL);
+ app.setLevelGenerationOptions(nullptr);
// Fix for #45154 - Frontend: DLC: Content can only be downloaded from the frontend if you have not joined/exited multiplayer
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW);
@@ -325,7 +325,7 @@ HRESULT CScene_Main::OnTransitionStart( XUIMessageTransition *pTransition, BOOL&
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
{
// 4J-PB - remove the "hobo humping" message legal (Sony) say we can't have - pretty sure Microsoft would say the same if they noticed it.
- int splashIndex = eSplashRandomStart + 1 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 1) );
+ int splashIndex = eSplashRandomStart + 1 + random->nextInt( static_cast<int>(m_splashes.size()) - (eSplashRandomStart + 1) );
// Override splash text on certain dates
SYSTEMTIME LocalSysTime;
@@ -359,7 +359,7 @@ HRESULT CScene_Main::OnTransitionStart( XUIMessageTransition *pTransition, BOOL&
HRESULT hr=S_OK;
float fWidth,fHeight;
- HXUIOBJ visual=NULL;
+ HXUIOBJ visual=nullptr;
HXUIOBJ pulser, subtitle, text;
hr=XuiControlGetVisual(m_Subtitle.m_hObj,&visual);
hr=XuiElementGetChildById(visual,L"Pulser",&pulser);
@@ -436,7 +436,7 @@ HRESULT CScene_Main::OnControlNavigate(XUIMessageControlNavigate *pControlNaviga
// added so we can skip greyed out items for Minecon
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -457,7 +457,7 @@ HRESULT CScene_Main::OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled)
int CScene_Main::SignInReturned(void *pParam,bool bContinue)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
if(bContinue==true)
{
@@ -470,7 +470,7 @@ int CScene_Main::SignInReturned(void *pParam,bool bContinue)
int CScene_Main::DeviceSelectReturned(void *pParam,bool bContinue)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
//HRESULT hr;
if(bContinue==true)
@@ -506,7 +506,7 @@ int CScene_Main::DeviceSelectReturned(void *pParam,bool bContinue)
int CScene_Main::CreateLoad_OfflineProfileReturned(void *pParam,bool bContinue, int iPad)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
if(bContinue==true)
{
@@ -555,7 +555,7 @@ int CScene_Main::CreateLoad_OfflineProfileReturned(void *pParam,bool bContinue,
int CScene_Main::CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
if(bContinue==true)
{
@@ -662,7 +662,7 @@ int CScene_Main::CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad
int CScene_Main::MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
if(result==C4JStorage::EMessage_ResultAccept)
{
@@ -787,7 +787,7 @@ int CScene_Main::Achievements_SignInReturned(void *pParam,bool bContinue,int iPa
}
int CScene_Main::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
if(bContinue==true)
{
@@ -834,7 +834,7 @@ int CScene_Main::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int i
int CScene_Main::UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
if(bContinue==true)
{
@@ -907,7 +907,7 @@ void CScene_Main::LoadTrial(void)
NetworkGameInitData *param = new NetworkGameInitData();
param->seed = 0;
- param->saveData = NULL;
+ param->saveData = nullptr;
param->settings = app.GetGameHostOption( eGameHostOption_Tutorial );
vector<LevelGenerationOptions *> *generators = app.getLevelGenerators();
@@ -915,7 +915,7 @@ void CScene_Main::LoadTrial(void)
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
- loadingParams->lpParam = (LPVOID)param;
+ loadingParams->lpParam = static_cast<LPVOID>(param);
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
completionData->bShowBackground=TRUE;
@@ -1228,7 +1228,7 @@ void CScene_Main::RunUnlockOrDLC(int iPad)
int CScene_Main::TMSReadFileListReturned(void *pParam,int iPad,C4JStorage::PTMSPP_FILE_LIST pTmsFileList)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
// push the file details in to a unordered map if they are not already in there
// for(int i=0;i<pTmsFileList->iCount;i++)
@@ -1240,7 +1240,7 @@ int CScene_Main::TMSReadFileListReturned(void *pParam,int iPad,C4JStorage::PTMSP
int CScene_Main::TMSFileWriteReturned(void *pParam,int iPad,int iResult)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
// push the file details in to a unordered map if they are not already in there
// for(int i=0;i<pTmsFileList->iCount;i++)
@@ -1252,7 +1252,7 @@ int CScene_Main::TMSFileWriteReturned(void *pParam,int iPad,int iResult)
int CScene_Main::TMSFileReadReturned(void *pParam,int iPad,C4JStorage::PTMSPP_FILEDATA pData)
{
- CScene_Main* pClass = (CScene_Main*)pParam;
+ CScene_Main* pClass = static_cast<CScene_Main *>(pParam);
// push the file details in to a unordered map if they are not already in there
// for(int i=0;i<pTmsFileList->iCount;i++)
diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp
index b3608b06..b73f9305 100644
--- a/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp
@@ -38,7 +38,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
{
m_bSetup = false;
m_texturePackDescDisplayed = false;
- m_iConfigA=NULL;
+ m_iConfigA=nullptr;
WCHAR TempString[256];
MapChildControls();
@@ -52,10 +52,10 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
XuiControlSetText(m_labelRandomSeed,app.GetString(IDS_CREATE_NEW_WORLD_RANDOM_SEED));
XuiControlSetText(m_pTexturePacksList->m_hObj,app.GetString(IDS_DLC_MENU_TEXTUREPACKS));
- CreateWorldMenuInitData *params = (CreateWorldMenuInitData *)pInitData->pvInitData;
+ CreateWorldMenuInitData *params = static_cast<CreateWorldMenuInitData *>(pInitData->pvInitData);
m_MoreOptionsParams.bGenerateOptions=TRUE;
- m_MoreOptionsParams.bStructures=TRUE;
+ m_MoreOptionsParams.bStructures=TRUE;
m_MoreOptionsParams.bFlatWorld=FALSE;
m_MoreOptionsParams.bBonusChest=FALSE;
m_MoreOptionsParams.bPVP = TRUE;
@@ -96,7 +96,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
{
// The profile settings say Online, but either the player is offline, or they are not allowed to play online
m_MoreOptionsParams.bOnlineSettingChangedBySystem=true;
- }
+ }
}
m_ButtonGameMode.SetText(app.GetString(IDS_GAMEMODE_SURVIVAL));
@@ -104,7 +104,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_CurrentDifficulty=app.GetGameSettings(m_iPad,eGameSetting_Difficulty);
m_SliderDifficulty.SetValue(m_CurrentDifficulty);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty]));
+ swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[m_CurrentDifficulty]));
m_SliderDifficulty.SetText(TempString);
ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK);
@@ -135,11 +135,11 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_NewWorld.SetEnable(true);
m_EditWorldName.SetTextLimit(XCONTENT_MAX_DISPLAYNAME_LENGTH);
-
+
wstring wWorldName = m_EditWorldName.GetText();
// set the caret to the end of the default text
- m_EditWorldName.SetCaretPosition((int)wWorldName.length());
+ m_EditWorldName.SetCaretPosition(static_cast<int>(wWorldName.length()));
// In the dashboard, there's room for about 30 W characters on two lines before they go over the top of things
m_EditWorldName.SetTextLimit(25);
@@ -148,7 +148,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
XuiSetTimer(m_hObj,GAME_CREATE_ONLINE_TIMER_ID,GAME_CREATE_ONLINE_TIMER_TIME);
XuiSetTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID,CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME);
-
+
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_CreateWorldMenu, 0);
// 4J-PB - Load up any texture pack data we have locally in the XZP
@@ -176,7 +176,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
m_pTexturePacksList->SetSelectionChangedHandle(m_hObj);
Minecraft *pMinecraft = Minecraft::GetInstance();
- int texturePacksCount = pMinecraft->skins->getTexturePackCount();
+ int texturePacksCount = pMinecraft->skins->getTexturePackCount();
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
HRESULT hr;
for(unsigned int i = 0; i < texturePacksCount; ++i)
@@ -189,8 +189,8 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
if(dwImageBytes > 0 && pbImageData)
{
- ListInfo.fEnabled = TRUE;
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;
+ ListInfo.fEnabled = true;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tp);
if(pDLCTexPack)
{
int id=pDLCTexPack->getDLCParentPackId();
@@ -222,7 +222,7 @@ HRESULT CScene_MultiGameCreate::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
// 4J-PB - there may be texture packs we don't have, so use the info from TMS for this
- DLC_INFO *pDLCInfo=NULL;
+ DLC_INFO *pDLCInfo=nullptr;
// first pass - look to see if there are any that are not in the list
bool bTexturePackAlreadyListed;
@@ -297,7 +297,7 @@ HRESULT CScene_MultiGameCreate::OnDestroy()
app.RemoveMemoryTPDFile(app.TMSFileA[i].iConfig);
}
}
-
+
app.FreeLocalTMSFiles(eTMSFileType_TexturePack);
return S_OK;
@@ -322,7 +322,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
// texture pack hasn't been set yet, so check what it will be
TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
- if(pTexturePack==NULL)
+ if(pTexturePack==nullptr)
{
// They've selected a texture pack they don't have yet
// upsell
@@ -338,7 +338,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
// DLC might have been corrupt
if(ullOfferID_Full!=0LL)
- {
+ {
TelemetryManager->RecordUpsellPresented(ProfileManager.GetPrimaryPad(), eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF);
UINT uiIDA[3];
@@ -374,7 +374,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
// if the profile data has been changed, then force a profile write (we save the online/invite/friends of friends settings)
// It seems we're allowed to break the 5 minute rule if it's the result of a user action
// check the checkboxes
-
+
// Only save the online setting if the user changed it - we may change it because we're offline, but don't want that saved
if(!m_MoreOptionsParams.bOnlineSettingChangedBySystem)
{
@@ -389,15 +389,15 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
if(m_MoreOptionsParams.dwTexturePack!=0)
{
// texture pack hasn't been set yet, so check what it will be
- TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
-
- if(pTexturePack==NULL)
+ TexturePack *pTexturePack = pMinecraft->skins->getTexturePackById(m_MoreOptionsParams.dwTexturePack);
+
+ if(pTexturePack== nullptr)
{
// corrupt DLC so set it to the default textures
m_MoreOptionsParams.dwTexturePack=0;
}
else
- {
+ {
m_pDLCPack=pTexturePack->getDLCPack();
// do we have a license?
if(m_pDLCPack && !m_pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
@@ -419,7 +419,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_pDLCPack->getPurchaseOfferId());
ULONGLONG ullOfferID_Full;
- if(pDLCInfo!=NULL)
+ if(pDLCInfo!=nullptr)
{
ullOfferID_Full=pDLCInfo->ullOfferID_Full;
}
@@ -439,11 +439,11 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
return S_OK;
}
}
- }
+ }
}
if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges == TRUE)
- {
+ {
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL;
@@ -478,14 +478,14 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
-
+
if(isClientSide && noUGC )
{
m_bIgnoreInput = false;
SetShow( TRUE );
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
else
{
@@ -495,7 +495,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
}
}
else if(hObjPressed==m_MoreOptions)
- {
+ {
app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_LaunchMoreOptionsMenu,&m_MoreOptionsParams);
}
else if(hObjPressed == m_ButtonGameMode)
@@ -522,16 +522,16 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr
int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameCreate* pScene = (CScene_MultiGameCreate*)pParam;
+ CScene_MultiGameCreate* pScene = static_cast<CScene_MultiGameCreate *>(pParam);
#ifdef _XBOX
if(result==C4JStorage::EMessage_ResultAccept)
{
if(ProfileManager.IsSignedIn(iPad))
- {
+ {
ULONGLONG ullIndexA[1];
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId());
- if(pDLCInfo!=NULL)
+ if(pDLCInfo!=nullptr)
{
ullIndexA[0]=pDLCInfo->ullOfferID_Full;
}
@@ -540,9 +540,9 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS
ullIndexA[0]=pScene->m_pDLCPack->getPurchaseOfferId();
}
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
- // the license change coming in when the offer has been installed will cause this scene to refresh
+ // the license change coming in when the offer has been installed will cause this scene to refresh
}
}
else
@@ -558,7 +558,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS
int CScene_MultiGameCreate::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameCreate* pScene = (CScene_MultiGameCreate*)pParam;
+ CScene_MultiGameCreate* pScene = static_cast<CScene_MultiGameCreate *>(pParam);
pScene->m_bIgnoreInput = false;
pScene->SetShow( TRUE );
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pScene->m_MoreOptionsParams.bOnlineGame;
@@ -588,7 +588,7 @@ int CScene_MultiGameCreate::WarningTrialTexturePackReturned(void *pParam,int iPa
{
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
else
{
@@ -629,12 +629,12 @@ HRESULT CScene_MultiGameCreate::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINot
// Enable the done button when we have all of the necessary information
wstring wWorldName = m_EditWorldName.GetText();
BOOL bHasWorldName = ( wWorldName.length()!=0);
- m_NewWorld.SetEnable(bHasWorldName);
+ m_NewWorld.SetEnable(bHasWorldName);
}
else if(hObjSource==m_SliderDifficulty.GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pValueChangedData->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue]));
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pValueChangedData->nValue]));
m_SliderDifficulty.SetText(TempString);
}
@@ -645,7 +645,7 @@ HRESULT CScene_MultiGameCreate::OnControlNavigate(XUIMessageControlNavigate *pCo
{
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest==NULL)
+ if(pControlNavigateData->hObjDest==nullptr)
{
pControlNavigateData->hObjDest=pControlNavigateData->hObjSource;
}
@@ -656,11 +656,11 @@ HRESULT CScene_MultiGameCreate::OnControlNavigate(XUIMessageControlNavigate *pCo
HRESULT CScene_MultiGameCreate::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 GAME_CREATE_ONLINE_TIMER_ID:
{
bool bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad);
@@ -693,7 +693,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
}
}
break;
-
+
case CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID:
{
// also check for any new texture packs info being available
@@ -706,7 +706,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
if(m_iConfigA[i]!=-1)
{
DWORD dwBytes=0;
- PBYTE pbData=NULL;
+ PBYTE pbData=nullptr;
//app.DebugPrintf("Retrieving iConfig %d from TPD\n",m_iConfigA[i]);
app.GetTPD(m_iConfigA[i],&pbData,&dwBytes);
@@ -715,10 +715,10 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
if(dwBytes > 0 && pbData)
{
DWORD dwImageBytes=0;
- PBYTE pbImageData=NULL;
+ PBYTE pbImageData=nullptr;
app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes );
- ListInfo.fEnabled = TRUE;
+ ListInfo.fEnabled = TRUE;
ListInfo.iData = m_iConfigA[i];
HRESULT hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
app.DebugPrintf("Adding texturepack %d from TPD\n",m_iConfigA[i]);
@@ -734,7 +734,7 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
bool bAllDone=true;
for(int i=0;i<m_iTexturePacksNotInstalled;i++)
{
- if(m_iConfigA[i]!=-1)
+ if(m_iConfigA[i]!=-1)
{
bAllDone = false;
}
@@ -754,9 +754,9 @@ HRESULT CScene_MultiGameCreate::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled
int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameCreate* pClass = (CScene_MultiGameCreate*)pParam;
+ CScene_MultiGameCreate* pClass = static_cast<CScene_MultiGameCreate *>(pParam);
- if(result==C4JStorage::EMessage_ResultAccept)
+ if(result==C4JStorage::EMessage_ResultAccept)
{
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
@@ -780,14 +780,14 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
-
+
if(isClientSide && noUGC )
{
pClass->m_bIgnoreInput = false;
pClass->SetShow( TRUE );
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
else
{
@@ -808,7 +808,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora
int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad)
{
- CScene_MultiGameCreate* pClass = (CScene_MultiGameCreate*)pParam;
+ CScene_MultiGameCreate* pClass = static_cast<CScene_MultiGameCreate *>(pParam);
if(bContinue==true)
{
@@ -816,7 +816,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
if(ProfileManager.IsSignedIn(iPad))
{
DWORD dwLocalUsersMask = 0;
-
+
bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame;
bool noPrivileges = false;
@@ -835,7 +835,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
BOOL pccFriendsAllowed = TRUE;
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
-
+
if(isClientSide && (noPrivileges || noUGC) )
{
if( noUGC )
@@ -844,7 +844,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
pClass->SetShow( TRUE );
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
else
{
@@ -852,7 +852,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
pClass->SetShow( TRUE );
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
}
else
@@ -863,7 +863,7 @@ int CScene_MultiGameCreate::StartGame_SignInReturned(void *pParam,bool bContinue
}
}
else
- {
+ {
pClass->m_bIgnoreInput = false;
pClass->SetShow( TRUE );
}
@@ -884,12 +884,12 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
// create the world and launch
wstring wWorldName = pClass->m_EditWorldName.GetText();
-
+
StorageManager.ResetSaveData();
// Make our next save default to the name of the level
StorageManager.SetSaveTitle((wchar_t *)wWorldName.c_str());
- BOOL bHasSeed = (pClass->m_EditSeed.GetText() != NULL);
+ BOOL bHasSeed = (pClass->m_EditSeed.GetText() != nullptr);
wstring wSeed;
if(bHasSeed)
@@ -904,12 +904,12 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
// start the game
bool isFlat = (pClass->m_MoreOptionsParams.bFlatWorld==TRUE);
- __int64 seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
+ int64_t seedValue = 0; //BiomeSource::findSeed(isFlat?LevelType::lvl_flat:LevelType::lvl_normal); // 4J - was (new Random())->nextLong() - now trying to actually find a seed to suit our requirements
if (wSeed.length() != 0)
{
- __int64 value = 0;
- unsigned int len = (unsigned int)wSeed.length();
+ int64_t value = 0;
+ const unsigned int len = static_cast<unsigned int>(wSeed.length());
//Check if the input string contains a numerical value
bool isNumber = true;
@@ -923,7 +923,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
//If the input string is a numerical value, convert it to a number
if( isNumber )
- value = _fromString<__int64>(wSeed);
+ value = _fromString<int64_t>(wSeed);
//If the value is not 0 use it, otherwise use the algorithm from the java String.hashCode() function to hash it
if( value != 0 )
@@ -946,9 +946,9 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
NetworkGameInitData *param = new NetworkGameInitData();
param->seed = seedValue;
- param->saveData = NULL;
+ param->saveData = nullptr;
param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack;
-
+
Minecraft *pMinecraft = Minecraft::GetInstance();
pMinecraft->skins->selectTexturePackById(pClass->m_MoreOptionsParams.dwTexturePack);
//pMinecraft->skins->updateUI();
@@ -956,7 +956,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
app.SetGameHostOption(eGameHostOption_Difficulty,Minecraft::GetInstance()->options->difficulty);
app.SetGameHostOption(eGameHostOption_FriendsOfFriends,pClass->m_MoreOptionsParams.bAllowFriendsOfFriends);
app.SetGameHostOption(eGameHostOption_Gamertags,app.GetGameSettings(pClass->m_iPad,eGameSetting_GamertagsVisible)?1:0);
-
+
app.SetGameHostOption(eGameHostOption_BedrockFog,app.GetGameSettings(pClass->m_iPad,eGameSetting_BedrockFog)?1:0);
// CXuiList listObject;
@@ -979,7 +979,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
- loadingParams->lpParam = (LPVOID)param;
+ loadingParams->lpParam = static_cast<LPVOID>(param);
// Reset the autosave time
app.SetAutosaveTimerTime();
@@ -999,7 +999,7 @@ HRESULT CScene_MultiGameCreate::OnTransitionStart( XUIMessageTransition *pTransi
if(pTransition->dwTransAction==XUI_TRANSITION_ACTION_DESTROY ) return S_OK;
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
- {
+ {
m_SliderDifficulty.SetValueDisplay(FALSE);
}
@@ -1015,7 +1015,7 @@ HRESULT CScene_MultiGameCreate::OnTransitionEnd( XUIMessageTransition *pTransiti
{
}
else if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
- {
+ {
if(m_bSetup && m_texturePackDescDisplayed)
{
XUITimeline *timeline;
@@ -1054,7 +1054,7 @@ HRESULT CScene_MultiGameCreate::OnNotifySelChanged( HXUIOBJ hObjSource, XUINotif
if(hObjSource == m_pTexturePacksList->m_hObj)
{
UpdateTexturePackDescription(pNotifySelChangedData->iItem);
-
+
// 4J-JEV: Removed expand description check, taken care of elsewhere.
}
@@ -1095,12 +1095,12 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index)
int iTexPackId=m_pTexturePacksList->GetData(index).iData;
TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(iTexPackId);
- if(tp==NULL)
+ if(tp==nullptr)
{
// this is probably a texture pack icon added from TMS
DWORD dwBytes=0,dwFileBytes=0;
- PBYTE pbData=NULL,pbFileData=NULL;
+ PBYTE pbData=nullptr,pbFileData=nullptr;
CXuiCtrl4JList::LIST_ITEM_INFO ListItem;
// get the current index of the list, and then get the data
@@ -1130,7 +1130,7 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index)
}
else
{
- m_texturePackComparison->UseBrush(NULL);
+ m_texturePackComparison->UseBrush(nullptr);
}
}
else
@@ -1156,7 +1156,7 @@ void CScene_MultiGameCreate::UpdateTexturePackDescription(int index)
}
else
{
- m_texturePackComparison->UseBrush(NULL);
+ m_texturePackComparison->UseBrush(nullptr);
}
}
}
@@ -1168,7 +1168,7 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack()
TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(iTexPackId);
// if the texture pack is null, you don't have it yet
- if(tp==NULL)
+ if(tp==nullptr)
{
// Upsell
@@ -1205,9 +1205,9 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack()
StorageManager.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&CScene_MultiGameCreate::TexturePackDialogReturned,this,app.GetStringTable());
}
- // do set the texture pack id, and on the user pressing create world, check they have it
+ // do set the texture pack id, and on the user pressing create world, check they have it
m_MoreOptionsParams.dwTexturePack = ListItem.iData;
- return ;
+ return ;
}
else
{
@@ -1217,11 +1217,11 @@ void CScene_MultiGameCreate::UpdateCurrentTexturePack()
int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameCreate *pClass = (CScene_MultiGameCreate *)pParam;
+ CScene_MultiGameCreate *pClass = static_cast<CScene_MultiGameCreate *>(pParam);
pClass->m_currentTexturePackIndex = pClass->m_pTexturePacksList->GetCurSel();
// 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);
@@ -1236,7 +1236,7 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS
if( result==C4JStorage::EMessage_ResultAccept ) // Full version
{
ullIndexA[0]=ullOfferID_Full;
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
}
else // trial version
@@ -1246,9 +1246,9 @@ int CScene_MultiGameCreate::TexturePackDialogReturned(void *pParam,int iPad,C4JS
if(pDLCInfo->ullOfferID_Trial!=0LL)
{
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
}
- }
+ }
}
pClass->m_bIgnoreInput=false;
return 0;
@@ -1274,12 +1274,12 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCInstalled()
}
HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
-{
+{
// refill the texture pack list
m_pTexturePacksList->SetSelectionChangedHandle(m_hObj);
Minecraft *pMinecraft = Minecraft::GetInstance();
- int texturePacksCount = pMinecraft->skins->getTexturePackCount();
+ int texturePacksCount = pMinecraft->skins->getTexturePackCount();
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
HRESULT hr;
for(unsigned int i = 0; i < texturePacksCount; ++i)
@@ -1292,10 +1292,10 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
if(dwImageBytes > 0 && pbImageData)
{
- ListInfo.fEnabled = TRUE;
+ ListInfo.fEnabled = TRUE;
hr=XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&ListInfo.hXuiBrush);
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tp;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tp);
if(pDLCTexPack)
{
int id=pDLCTexPack->getDLCParentPackId();
@@ -1319,7 +1319,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
// 4J-PB - there may be texture packs we don't have, so use the info from TMS for this
// REMOVE UNTIL WORKING
- DLC_INFO *pDLCInfo=NULL;
+ DLC_INFO *pDLCInfo=nullptr;
// first pass - look to see if there are any that are not in the list
bool bTexturePackAlreadyListed;
@@ -1352,7 +1352,7 @@ HRESULT CScene_MultiGameCreate::OnCustomMessage_DLCMountingComplete()
// add a TMS request for them
app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n");
app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData);
- if(m_iConfigA!=NULL)
+ if(m_iConfigA!=nullptr)
{
delete m_iConfigA;
}
@@ -1392,6 +1392,6 @@ void CScene_MultiGameCreate::ClearTexturePackDescription()
{
m_texturePackTitle.SetText(L" ");
m_texturePackDescription.SetText(L" ");
- m_texturePackComparison->UseBrush(NULL);
- m_texturePackIcon->UseBrush(NULL);
+ m_texturePackComparison->UseBrush(nullptr);
+ m_texturePackIcon->UseBrush(nullptr);
} \ No newline at end of file
diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp
index bbfa243b..c1dba282 100644
--- a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp
@@ -31,7 +31,7 @@ HRESULT CScene_MultiGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
XuiControlSetText(m_labelTNTOn,app.GetString(IDS_LABEL_TNT));
XuiControlSetText(m_labelFireOn,app.GetString(IDS_LABEL_FIRE_SPREADS));
- JoinMenuInitData *initData = (JoinMenuInitData *)pInitData->pvInitData;
+ JoinMenuInitData *initData = static_cast<JoinMenuInitData *>(pInitData->pvInitData);
m_selectedSession = initData->selectedSession;
m_iPad = initData->iPad;
// 4J-PB - don't delete this - it's part of the joinload structure
@@ -39,7 +39,7 @@ HRESULT CScene_MultiGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
{
- if( m_selectedSession->data.players[i] != NULL )
+ if( m_selectedSession->data.players[i] != nullptr )
{
playersList.InsertItems(i,1);
#ifndef _CONTENT_PACKAGE
@@ -55,7 +55,7 @@ HRESULT CScene_MultiGameInfo::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
}
else
{
- // Leave the loop when we hit the first NULL player
+ // Leave the loop when we hit the first nullptr player
break;
}
}
@@ -185,7 +185,7 @@ HRESULT CScene_MultiGameInfo::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHan
rfHandled = TRUE;
break;
case VK_PAD_Y:
- if(m_selectedSession != NULL && playersList.TreeHasFocus() && playersList.GetItemCount() > 0)
+ if(m_selectedSession != nullptr && playersList.TreeHasFocus() && playersList.GetItemCount() > 0)
{
PlayerUID xuid = m_selectedSession->data.players[playersList.GetCurSel()];
if( xuid != INVALID_XUID )
@@ -237,7 +237,7 @@ HRESULT CScene_MultiGameInfo::OnNotifyKillFocus(HXUIOBJ hObjSource, XUINotifyFoc
int CScene_MultiGameInfo::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad)
{
- CScene_MultiGameInfo* pClass = (CScene_MultiGameInfo*)pParam;
+ CScene_MultiGameInfo* pClass = static_cast<CScene_MultiGameInfo *>(pParam);
if(bContinue==true)
{
@@ -302,7 +302,7 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass)
int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL;
if(dwSignedInUsers > 1) messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL;
- StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, messageText, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, messageText, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
else if(noPrivileges)
@@ -311,7 +311,7 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass)
pClass->m_bIgnoreInput=false;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
}
else
{
@@ -338,7 +338,7 @@ void CScene_MultiGameInfo::JoinGame(CScene_MultiGameInfo* pClass)
{
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ StorageManager.RequestMessageBox( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
exitReasonStringId = -1;
app.NavigateToHomeMenu();
@@ -361,7 +361,7 @@ HRESULT CScene_MultiGameInfo::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
int selectedIndex = 0;
for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
{
- if( m_selectedSession->data.players[i] != NULL )
+ if( m_selectedSession->data.players[i] != nullptr )
{
if(m_selectedSession->data.players[i] == selectedPlayerXUID) selectedIndex = i;
playersList.InsertItems(i,1);
@@ -378,7 +378,7 @@ HRESULT CScene_MultiGameInfo::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
}
else
{
- // Leave the loop when we hit the first NULL player
+ // Leave the loop when we hit the first nullptr player
break;
}
}
diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp
index c5e2fe9a..fab4a4fd 100644
--- a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp
@@ -36,12 +36,12 @@
HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad=*(int *)pInitData->pvInitData;
+ m_iPad=*static_cast<int *>(pInitData->pvInitData);
m_bReady=false;
MapChildControls();
m_iTexturePacksNotInstalled=0;
- m_iConfigA=NULL;
+ m_iConfigA=nullptr;
XuiControlSetText(m_LabelNoGames,app.GetString(IDS_NO_GAMES_FOUND));
XuiControlSetText(m_GamesList,app.GetString(IDS_JOIN_GAME));
@@ -51,7 +51,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
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);
+ const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png");
m_DefaultMinecraftIconSize = 0;
@@ -95,10 +95,10 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
VOID *pObj;
XuiObjectFromHandle( m_SavesList, &pObj );
- m_pSavesList = (CXuiCtrl4JList *)pObj;
+ m_pSavesList = static_cast<CXuiCtrl4JList *>(pObj);
XuiObjectFromHandle( m_GamesList, &pObj );
- m_pGamesList = (CXuiCtrl4JList *)pObj;
+ m_pGamesList = static_cast<CXuiCtrl4JList *>(pObj);
// 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)==true)
@@ -185,7 +185,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand
// 4J-PB - there may be texture packs we don't have, so use the info from TMS for this
- DLC_INFO *pDLCInfo=NULL;
+ DLC_INFO *pDLCInfo=nullptr;
// first pass - look to see if there are any that are not in the list
bool bTexturePackAlreadyListed;
@@ -326,7 +326,7 @@ HRESULT CScene_MultiGameJoinLoad::GetSaveInfo( )
if( savesDir.exists() )
{
m_saves = savesDir.listFiles();
- uiSaveC = (unsigned int)m_saves->size();
+ uiSaveC = static_cast<unsigned int>(m_saves->size());
}
// add the New Game and Tutorial after the saves list is retrieved, if there are any saves
@@ -384,7 +384,7 @@ HRESULT CScene_MultiGameJoinLoad::GetSaveInfo( )
HRESULT CScene_MultiGameJoinLoad::OnDestroy()
{
- g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL );
+ g_NetworkManager.SetSessionsUpdatedCallback( nullptr, nullptr );
for (auto& it : currentSessions )
{
@@ -415,7 +415,7 @@ HRESULT CScene_MultiGameJoinLoad::OnDestroy()
int CScene_MultiGameJoinLoad::DeviceRemovedDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
// results switched for this dialog
if(result==C4JStorage::EMessage_ResultDecline)
@@ -543,7 +543,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
CreateWorldMenuInitData *params = new CreateWorldMenuInitData();
params->iPad = m_iPad;
- app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_CreateWorldMenu,(void *)params);
+ app.NavigateToScene(pNotifyPressData->UserIndex,eUIScene_CreateWorldMenu,static_cast<void *>(params));
}
else if(info.iData >= 0)
{
@@ -594,7 +594,7 @@ HRESULT CScene_MultiGameJoinLoad::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
// need to get the iIndex from the list item, since the position in the list doesn't correspond to the GetSaveGameInfo list because of sorting
params->iSaveGameInfoIndex=m_pSavesList->GetData(iIndex).iIndex-m_iDefaultButtonsC;
//params->pbSaveRenamed=&m_bSaveRenamed;
- params->levelGen = NULL;
+ params->levelGen = nullptr;
// kill the texture pack timer
XuiKillTimer(m_hObj,CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID);
@@ -1050,7 +1050,7 @@ bool CScene_MultiGameJoinLoad::DoesSavesListHaveFocus()
{
HXUIOBJ hParentObj,hObj=TreeGetFocus();
- if(hObj!=NULL)
+ if(hObj!=nullptr)
{
// get the parent and see if it's the saves list
XuiElementGetParent(hObj,&hParentObj);
@@ -1070,7 +1070,7 @@ bool CScene_MultiGameJoinLoad::DoesMashUpWorldHaveFocus()
{
HXUIOBJ hParentObj,hObj=TreeGetFocus();
- if(hObj!=NULL)
+ if(hObj!=nullptr)
{
// get the parent and see if it's the saves list
XuiElementGetParent(hObj,&hParentObj);
@@ -1097,7 +1097,7 @@ bool CScene_MultiGameJoinLoad::DoesGamesListHaveFocus()
{
HXUIOBJ hParentObj,hObj=TreeGetFocus();
- if(hObj!=NULL)
+ if(hObj!=nullptr)
{
// get the parent and see if it's the saves list
XuiElementGetParent(hObj,&hParentObj);
@@ -1111,9 +1111,9 @@ bool CScene_MultiGameJoinLoad::DoesGamesListHaveFocus()
void CScene_MultiGameJoinLoad::UpdateGamesListCallback(LPVOID lpParam)
{
- if(lpParam != NULL)
+ if(lpParam != nullptr)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(lpParam);
// check this there's no save transfer in progress
if(!pClass->m_bSaveTransferInProgress)
{
@@ -1133,7 +1133,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
}
DWORD nIndex = -1;
- FriendSessionInfo *pSelectedSession = NULL;
+ FriendSessionInfo *pSelectedSession = nullptr;
if(m_pGamesList->TreeHasFocus() && m_pGamesList->GetItemCount() > 0)
{
nIndex = m_pGamesList->GetCurSel();
@@ -1141,8 +1141,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
}
SessionID selectedSessionId;
- if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId;
- pSelectedSession = NULL;
+ if( pSelectedSession != nullptr )selectedSessionId = pSelectedSession->sessionId;
+ pSelectedSession = nullptr;
for (auto& it : currentSessions )
{
@@ -1213,7 +1213,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
// Update the xui list displayed
unsigned int xuiListSize = m_pGamesList->GetItemCount();
- unsigned int filteredListSize = (unsigned int)currentSessions.size();
+ unsigned int filteredListSize = static_cast<unsigned int>(currentSessions.size());
BOOL gamesListHasFocus = m_pGamesList->TreeHasFocus();
@@ -1269,12 +1269,12 @@ void CScene_MultiGameJoinLoad::UpdateGamesList()
HRESULT hr;
DWORD dwImageBytes=0;
- PBYTE pbImageData=NULL;
+ PBYTE pbImageData=nullptr;
- if(tp==NULL)
+ if(tp==nullptr)
{
DWORD dwBytes=0;
- PBYTE pbData=NULL;
+ PBYTE pbData=nullptr;
app.GetTPD(sessionInfo->data.texturePackParentId,&pbData,&dwBytes);
// is it in the tpd data ?
@@ -1386,7 +1386,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
if(pSearchResult->dwOpenPublicSlots < m_localPlayers)
continue;
- FriendSessionInfo *sessionInfo = NULL;
+ FriendSessionInfo *sessionInfo = nullptr;
bool foundSession = false;
for( auto it = friendsSessions.begin(); it != friendsSessions.end(); ++it)
{
@@ -1481,8 +1481,8 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
XUIRect xuiRect;
HXUIOBJ item = XuiListGetItemControl(m_GamesList,0);
- HXUIOBJ hObj=NULL;
- HXUIOBJ hTextPres=NULL;
+ HXUIOBJ hObj=nullptr;
+ HXUIOBJ hTextPres=nullptr;
HRESULT hr=XuiControlGetVisual(item,&hObj);
hr=XuiElementGetChildById(hObj,L"text_Label",&hTextPres);
@@ -1491,7 +1491,7 @@ void CScene_MultiGameJoinLoad::UpdateGamesList(DWORD dwNumResults, IQNetGameSear
{
FriendSessionInfo *sessionInfo = currentSessions.at(i);
- if(hTextPres != NULL )
+ if(hTextPres != nullptr )
{
hr=XuiTextPresenterMeasureText(hTextPres, sessionInfo->displayLabel, &xuiRect);
@@ -1528,7 +1528,7 @@ void CScene_MultiGameJoinLoad::SearchForGameCallback(void *param, DWORD dwNumRes
int CScene_MultiGameJoinLoad::DeviceSelectReturned(void *pParam,bool bContinue)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
//HRESULT hr;
if(bContinue==true)
@@ -1741,7 +1741,7 @@ HRESULT CScene_MultiGameJoinLoad::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandl
if(m_iConfigA[i]!=-1)
{
DWORD dwBytes=0;
- PBYTE pbData=NULL;
+ PBYTE pbData=nullptr;
//app.DebugPrintf("Retrieving iConfig %d from TPD\n",m_iConfigA[i]);
app.GetTPD(m_iConfigA[i],&pbData,&dwBytes);
@@ -1814,7 +1814,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataReturned(void *pParam,bool bContinue)
int CScene_MultiGameJoinLoad::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
if(bContinue==true)
{
@@ -1852,7 +1852,7 @@ void CScene_MultiGameJoinLoad::StartGameFromSave(CScene_MultiGameJoinLoad* pClas
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
- loadingParams->lpParam = NULL;
+ loadingParams->lpParam = nullptr;
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
completionData->bShowBackground=TRUE;
@@ -1866,7 +1866,7 @@ void CScene_MultiGameJoinLoad::StartGameFromSave(CScene_MultiGameJoinLoad* pClas
int CScene_MultiGameJoinLoad::DeleteSaveDataReturned(void *pParam,bool bSuccess)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
if(bSuccess==true)
{
@@ -1909,7 +1909,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen)
NetworkGameInitData *param = new NetworkGameInitData();
param->seed = 0;
- param->saveData = NULL;
+ param->saveData = nullptr;
param->settings = app.GetGameHostOption( eGameHostOption_Tutorial );
param->levelGen = levelGen;
@@ -1924,7 +1924,7 @@ void CScene_MultiGameJoinLoad::LoadLevelGen(LevelGenerationOptions *levelGen)
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
- loadingParams->lpParam = (LPVOID)param;
+ loadingParams->lpParam = static_cast<LPVOID>(param);
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
completionData->bShowBackground=TRUE;
@@ -1945,7 +1945,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
// Make our next save default to the name of the level
StorageManager.SetSaveTitle(saveFile->getName().c_str());
- __int64 fileSize = saveFile->length();
+ int64_t fileSize = saveFile->length();
FileInputStream fis(*saveFile);
byteArray ba(fileSize);
fis.read(ba);
@@ -1974,7 +1974,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
- loadingParams->lpParam = (LPVOID)param;
+ loadingParams->lpParam = static_cast<LPVOID>(param);
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
completionData->bShowBackground=TRUE;
@@ -1988,7 +1988,7 @@ void CScene_MultiGameJoinLoad::LoadSaveFromDisk(File *saveFile)
int CScene_MultiGameJoinLoad::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
// results switched for this dialog
if(result==C4JStorage::EMessage_ResultDecline)
{
@@ -2013,7 +2013,7 @@ int CScene_MultiGameJoinLoad::DeleteSaveDialogReturned(void *pParam,int iPad,C4J
int CScene_MultiGameJoinLoad::SaveTransferDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
// results switched for this dialog
if(result==C4JStorage::EMessage_ResultAccept)
{
@@ -2039,7 +2039,7 @@ int CScene_MultiGameJoinLoad::SaveTransferDialogReturned(void *pParam,int iPad,C
int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter )
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParameter;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(lpParameter);
Minecraft *pMinecraft = Minecraft::GetInstance();
pMinecraft->progressRenderer->progressStart(IDS_SAVE_TRANSFER_TITLE);
@@ -2083,7 +2083,7 @@ int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter
{
// set the save icon
- PBYTE pbImageData=NULL;
+ PBYTE pbImageData=nullptr;
DWORD dwImageBytes=0;
XCONTENT_DATA XContentData;
int iIndex=pClass->m_pSavesList->GetData(pClass->m_pSavesList->GetCurSel()).iIndex-pClass->m_iDefaultButtonsC;
@@ -2092,14 +2092,14 @@ int CScene_MultiGameJoinLoad::UploadSaveForXboxOneThreadProc( LPVOID lpParameter
// 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)
+ if(pbImageData==nullptr)
{
- DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,NULL,&dwImageBytes,NULL);
+ DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,nullptr,&dwImageBytes,nullptr);
if(dwResult==ERROR_SUCCESS)
{
pClass->m_pbSaveTransferData = new BYTE[dwImageBytes];
pbImageData = pClass->m_pbSaveTransferData; // Copy pointer so that we can use the same name as the library owned one, but m_pbSaveTransferData will get deleted when done
- XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,pbImageData,&dwImageBytes,NULL);
+ XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,pbImageData,&dwImageBytes,nullptr);
}
}
@@ -2159,7 +2159,7 @@ void CScene_MultiGameJoinLoad::DeleteFile(CScene_MultiGameJoinLoad *pClass, char
C4JStorage::TMS_FILETYPE_BINARY,
&CScene_MultiGameJoinLoad::DeleteComplete,
pClass,
- NULL);
+ nullptr);
if(result != C4JStorage::ETMSStatus_DeleteInProgress)
{
@@ -2178,7 +2178,7 @@ void CScene_MultiGameJoinLoad::UploadFile(CScene_MultiGameJoinLoad *pClass, char
C4JStorage::TMS_FILETYPE_BINARY,
C4JStorage::TMS_UGCTYPE_NONE,
filename,
- (CHAR *)data,
+ static_cast<CHAR *>(data),
size,
&CScene_MultiGameJoinLoad::TransferComplete,pClass, 0,
&CScene_MultiGameJoinLoad::Progress,pClass);
@@ -2189,10 +2189,10 @@ void CScene_MultiGameJoinLoad::UploadFile(CScene_MultiGameJoinLoad *pClass, char
File targetFileDir(L"GAME:\\FakeTMSPP");
if(!targetFileDir.exists()) targetFileDir.mkdir();
string path = string( wstringtofilename( targetFileDir.getPath() ) ).append("\\").append(filename);
- HANDLE hSaveFile = CreateFile( path.c_str(), GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL);
+ HANDLE hSaveFile = CreateFile( path.c_str(), GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, nullptr);
DWORD numberOfBytesWritten = 0;
- WriteFile( hSaveFile,data,size,&numberOfBytesWritten,NULL);
+ WriteFile( hSaveFile,data,size,&numberOfBytesWritten,nullptr);
assert(numberOfBytesWritten == size);
CloseHandle(hSaveFile);
@@ -2219,7 +2219,7 @@ bool CScene_MultiGameJoinLoad::WaitForTransferComplete( CScene_MultiGameJoinLoad
}
Sleep(50);
// update the progress
- pMinecraft->progressRenderer->progressStagePercentage((unsigned int)(pClass->m_fProgress*100.0f));
+ pMinecraft->progressRenderer->progressStagePercentage(static_cast<unsigned int>(pClass->m_fProgress * 100.0f));
}
// was there a transfer error?
@@ -2229,7 +2229,7 @@ bool CScene_MultiGameJoinLoad::WaitForTransferComplete( CScene_MultiGameJoinLoad
int CScene_MultiGameJoinLoad::SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
// results switched for this dialog
// EMessage_ResultAccept means cancel
@@ -2261,7 +2261,7 @@ int CScene_MultiGameJoinLoad::SaveOptionsDialogReturned(void *pParam,int iPad,C4
int CScene_MultiGameJoinLoad::LoadSaveDataReturned(void *pParam,bool bContinue)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
if(bContinue==true)
{
@@ -2310,7 +2310,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataReturned(void *pParam,bool bContinue)
int CScene_MultiGameJoinLoad::Progress(void *pParam,float fProgress)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
app.DebugPrintf("Progress - %f\n",fProgress);
pClass->m_fProgress=fProgress;
@@ -2319,17 +2319,17 @@ int CScene_MultiGameJoinLoad::Progress(void *pParam,float fProgress)
int CScene_MultiGameJoinLoad::TransferComplete(void *pParam,int iPad, int iResult)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
delete [] pClass->m_pbSaveTransferData;
- pClass->m_pbSaveTransferData = NULL;
+ pClass->m_pbSaveTransferData = nullptr;
if(iResult!=0)
{
// There was a transfer fail
// Display a dialog
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- StorageManager.RequestMessageBox(IDS_SAVE_TRANSFER_TITLE, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,NULL,app.GetStringTable());
+ StorageManager.RequestMessageBox(IDS_SAVE_TRANSFER_TITLE, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA, 1, ProfileManager.GetPrimaryPad(),nullptr,nullptr,app.GetStringTable());
pClass->m_bTransferFail=true;
}
else
@@ -2343,14 +2343,14 @@ int CScene_MultiGameJoinLoad::TransferComplete(void *pParam,int iPad, int iResul
int CScene_MultiGameJoinLoad::DeleteComplete(void *pParam,int iPad, int iResult)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
pClass->m_bTransferComplete=true;
return 0;
}
int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
HRESULT hr = S_OK;
// if the user has left the name empty, treat this as backing out
@@ -2386,12 +2386,12 @@ int CScene_MultiGameJoinLoad::KeyboardReturned(void *pParam,bool bSet)
int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bContinue)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
#ifdef _XBOX
if(bContinue==true)
{
// set the save icon
- PBYTE pbImageData=NULL;
+ PBYTE pbImageData=nullptr;
DWORD dwImageBytes=0;
HXUIBRUSH hXuiBrush;
XCONTENT_DATA XContentData;
@@ -2400,13 +2400,13 @@ int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bC
// 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)
+ if(pbImageData==nullptr)
{
- DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,NULL,&dwImageBytes,NULL);
+ DWORD dwResult=XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,nullptr,&dwImageBytes,nullptr);
if(dwResult==ERROR_SUCCESS)
{
pbImageData = new BYTE[dwImageBytes];
- XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,pbImageData,&dwImageBytes,NULL);
+ XContentGetThumbnail(ProfileManager.GetPrimaryPad(),&XContentData,pbImageData,&dwImageBytes,nullptr);
XuiCreateTextureBrushFromMemory(pbImageData,dwImageBytes,&hXuiBrush);
}
}
@@ -2428,7 +2428,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bC
int CScene_MultiGameJoinLoad::CopySaveReturned(void *pParam,bool bResult)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad*)pParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
#ifdef _XBOX
if(bResult)
{
@@ -2450,7 +2450,7 @@ int CScene_MultiGameJoinLoad::CopySaveReturned(void *pParam,bool bResult)
int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_MultiGameJoinLoad *pClass = (CScene_MultiGameJoinLoad *)pParam;
+ CScene_MultiGameJoinLoad *pClass = static_cast<CScene_MultiGameJoinLoad *>(pParam);
// Exit with or without saving
// Decline means install full version of the texture pack in this dialog
@@ -2466,7 +2466,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4
if( result==C4JStorage::EMessage_ResultAccept ) // Full version
{
ullIndexA[0]=ullOfferID_Full;
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
}
else // trial version
@@ -2476,7 +2476,7 @@ int CScene_MultiGameJoinLoad::TexturePackDialogReturned(void *pParam,int iPad,C4
if(pDLCInfo->ullOfferID_Trial!=0LL)
{
ullIndexA[0]=pDLCInfo->ullOfferID_Trial;
- StorageManager.InstallOffer(1,ullIndexA,NULL,NULL);
+ StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr);
}
}
}
@@ -2510,7 +2510,7 @@ HRESULT CScene_MultiGameJoinLoad::OnCustomMessage_DLCMountingComplete()
VOID *pObj;
XuiObjectFromHandle( m_SavesList, &pObj );
- m_pSavesList = (CXuiCtrl4JList *)pObj;
+ m_pSavesList = static_cast<CXuiCtrl4JList *>(pObj);
m_iChangingSaveGameInfoIndex = 0;
@@ -2698,7 +2698,7 @@ bool CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID pParam,int iTotalSave
// we could put in a damaged save icon here
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);
+ const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
swprintf(szResourceLocator, LOCATOR_SIZE, L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/MinecraftBrokenIcon.png");
@@ -2738,7 +2738,7 @@ int CScene_MultiGameJoinLoad::GetSavesInfoCallback(LPVOID lpParam,const bool)
void CScene_MultiGameJoinLoad::CancelSaveUploadCallback(LPVOID lpParam)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(lpParam);
StorageManager.TMSPP_CancelWriteFileWithProgress(pClass->m_iPad);
@@ -2750,12 +2750,12 @@ void CScene_MultiGameJoinLoad::CancelSaveUploadCallback(LPVOID lpParam)
// pClass->m_eSaveUploadState = eSaveUpload_Idle;
UINT uiIDA[1] = { IDS_CONFIRM_OK };
- ui.RequestMessageBox(IDS_XBONE_CANCEL_UPLOAD_TITLE, IDS_XBONE_CANCEL_UPLOAD_TEXT, uiIDA, 1, pClass->m_iPad, NULL, NULL, app.GetStringTable());
+ ui.RequestMessageBox(IDS_XBONE_CANCEL_UPLOAD_TITLE, IDS_XBONE_CANCEL_UPLOAD_TEXT, uiIDA, 1, pClass->m_iPad, nullptr, nullptr, app.GetStringTable());
}
void CScene_MultiGameJoinLoad::SaveUploadCompleteCallback(LPVOID lpParam)
{
- CScene_MultiGameJoinLoad* pClass = (CScene_MultiGameJoinLoad *) lpParam;
+ CScene_MultiGameJoinLoad* pClass = static_cast<CScene_MultiGameJoinLoad *>(lpParam);
pClass->m_bSaveTransferInProgress=false;
// change back to the normal title group id
diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp
index 08656111..63d28498 100644
--- a/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp
@@ -28,7 +28,7 @@ HRESULT CScene_MultiGameLaunchMoreOptions::OnInit( XUIMessageInit* pInitData, BO
XuiControlSetText(m_CheckboxFlatWorld,app.GetString(IDS_SUPERFLAT_WORLD));
XuiControlSetText(m_CheckboxBonusChest,app.GetString(IDS_BONUS_CHEST));
- m_params = (LaunchMoreOptionsMenuInitData *)pInitData->pvInitData;
+ m_params = static_cast<LaunchMoreOptionsMenuInitData *>(pInitData->pvInitData);
if(m_params->bGenerateOptions)
{
@@ -231,7 +231,7 @@ HRESULT CScene_MultiGameLaunchMoreOptions::OnControlNavigate(XUIMessageControlNa
{
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
diff --git a/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp b/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp
index 49b524ff..fa6da21e 100644
--- a/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_NewUpdateMessage.cpp
@@ -8,7 +8,7 @@
HRESULT CScene_NewUpdateMessage::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *) pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
m_bIsSD=!RenderManager.IsHiDef() && !RenderManager.IsWidescreen();
MapChildControls();
diff --git a/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp b/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp
index 4de74d1f..0879ba27 100644
--- a/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp
@@ -31,7 +31,7 @@
HRESULT UIScene_PauseMenu::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
m_bIgnoreInput=true;
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
bool bUserisClientSide = ProfileManager.IsSignedInLive(m_iPad);
app.DebugPrintf("PAUSE PRESS PROCESSING - ipad = %d, UIScene_PauseMenu::OnInit\n",m_iPad);
@@ -247,7 +247,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress*
if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin())
{
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tPack);
m_pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack();
@@ -256,7 +256,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress*
// upsell
ULONGLONG ullOfferID_Full;
// get the dlc texture pack
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tPack);
app.GetDLCFullOfferIDForPackID(pDLCTexPack->getDLCParentPackId(),&ullOfferID_Full);
@@ -317,9 +317,9 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress*
if(pNotifyPressData->UserIndex==ProfileManager.GetPrimaryPad())
{
int playTime = -1;
- if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL )
+ if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr )
{
- playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer();
+ playTime = static_cast<int>(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer());
}
if(StorageManager.GetSaveDisabled())
@@ -357,9 +357,9 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress*
else
{
int playTime = -1;
- if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL )
+ if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr )
{
- playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer();
+ playTime = static_cast<int>(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer());
}
TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Exited);
@@ -375,9 +375,9 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress*
if(pNotifyPressData->UserIndex==ProfileManager.GetPrimaryPad())
{
int playTime = -1;
- if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL )
+ if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr )
{
- playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer();
+ playTime = static_cast<int>(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer());
}
// adjust the trial time played
@@ -392,9 +392,9 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress*
else
{
int playTime = -1;
- if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL )
+ if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr )
{
- playTime = (int)pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer();
+ playTime = static_cast<int>(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer());
}
TelemetryManager->RecordLevelExit(pNotifyPressData->UserIndex, eSen_LevelExitStatus_Exited);
@@ -596,7 +596,7 @@ HRESULT UIScene_PauseMenu::OnControlNavigate(XUIMessageControlNavigate *pControl
{
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -623,7 +623,7 @@ int UIScene_PauseMenu::DeviceSelectReturned(void *pParam,bool bContinue)
return 0;
}
- UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam;
+ UIScene_PauseMenu* pClass = static_cast<UIScene_PauseMenu *>(pParam);
bool bIsisPrimaryHost=g_NetworkManager.IsHost() && (ProfileManager.GetPrimaryPad()==pClass->m_iPad);
bool bDisplayBanTip = !g_NetworkManager.IsLocalGame() && !bIsisPrimaryHost && !ProfileManager.IsGuest(pClass->m_iPad);
bool bUserisClientSide = ProfileManager.IsSignedInLive(pClass->m_iPad);
@@ -721,7 +721,7 @@ int UIScene_PauseMenu::DeviceRemovedDialogReturned(void *pParam,int iPad,C4JStor
// Has someone pulled the ethernet cable and caused the pause menu to be closed before this callback returns?
if(app.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()))
{
- UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam;
+ UIScene_PauseMenu* pClass = static_cast<UIScene_PauseMenu *>(pParam);
// use the device select returned function to wipe the saves list and change the tooltip
pClass->DeviceSelectReturned(pClass,true);
@@ -732,7 +732,7 @@ int UIScene_PauseMenu::DeviceRemovedDialogReturned(void *pParam,int iPad,C4JStor
// Change device
if(app.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()))
{
- UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam;
+ UIScene_PauseMenu* pClass = static_cast<UIScene_PauseMenu *>(pParam);
StorageManager.SetSaveDevice(&UIScene_PauseMenu::DeviceSelectReturned,pClass,true);
}
}
@@ -770,7 +770,7 @@ void UIScene_PauseMenu::ShowScene(bool show)
int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- UIScene_PauseMenu* pScene = (UIScene_PauseMenu*)pParam;
+ UIScene_PauseMenu* pScene = static_cast<UIScene_PauseMenu *>(pParam);
//pScene->m_bIgnoreInput = false;
pScene->ShowScene( true );
@@ -782,7 +782,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
// get the dlc texture pack
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tPack);
// Need to get the parent packs id, since this may be one of many child packs with their own ids
app.GetDLCFullOfferIDForPackID(pDLCTexPack->getDLCParentPackId(),&ullIndexA[0]);
@@ -790,7 +790,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J
// 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
@@ -804,7 +804,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J
int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- UIScene_PauseMenu *pClass = (UIScene_PauseMenu *)pParam;
+ UIScene_PauseMenu *pClass = static_cast<UIScene_PauseMenu *>(pParam);
// Exit with or without saving
// Decline means save in this dialog
if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption)
@@ -815,7 +815,7 @@ int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStora
if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin())
{
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
- DLCTexturePack *pDLCTexPack=(DLCTexturePack *)tPack;
+ DLCTexturePack *pDLCTexPack=static_cast<DLCTexturePack *>(tPack);
DLCPack *pDLCPack=pDLCTexPack->getDLCInfoParentPack();//tPack->getDLCPack();
if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
@@ -890,7 +890,7 @@ int UIScene_PauseMenu::ExitGameDeclineSaveReturned(void *pParam,int iPad,C4JStor
// has someone disconnected the ethernet here, causing the pause menu to shut?
if(ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()))
{
- IUIScene_PauseMenu* pClass = (IUIScene_PauseMenu*)pParam;
+ IUIScene_PauseMenu* pClass = static_cast<IUIScene_PauseMenu *>(pParam);
UINT uiIDA[3];
// you cancelled the save on exit after choosing exit and save? You go back to the Exit choices then.
uiIDA[0]=IDS_CONFIRM_CANCEL;
@@ -927,7 +927,7 @@ int UIScene_PauseMenu::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage:
// has someone disconnected the ethernet here, causing the pause menu to shut?
if(ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()))
{
- UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam;
+ UIScene_PauseMenu* pClass = static_cast<UIScene_PauseMenu *>(pParam);
UINT uiIDA[3];
// you cancelled the save on exit after choosing exit and save? You go back to the Exit choices then.
uiIDA[0]=IDS_CONFIRM_CANCEL;
@@ -971,7 +971,7 @@ int UIScene_PauseMenu::ExitGameDialogReturned(void *pParam,int iPad,C4JStorage::
int UIScene_PauseMenu::SaveWorldThreadProc( LPVOID lpParameter )
{
- bool bAutosave=(bool)lpParameter;
+ bool bAutosave=static_cast<bool>(lpParameter);
if(bAutosave)
{
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_AutoSaveGame);
@@ -1036,7 +1036,7 @@ void UIScene_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 )
@@ -1104,21 +1104,21 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
uiIDA[0]=IDS_CONFIRM_OK;
// 4J Stu - Fix for #48669 - TU5: Code: Compliance: TCR #15: Incorrect/misleading messages after signing out a profile during online game session.
// If the primary player is signed out, then that is most likely the cause of the disconnection so don't display a message box. This will allow the message box requested by the libraries to be brought up
- if( ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) ui.RequestMessageBox( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ if( ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) ui.RequestMessageBox( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
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
@@ -1134,7 +1134,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
}
else
{
- if(lpParameter != NULL && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) )
+ if(lpParameter != nullptr && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) )
{
switch( app.GetDisconnectReason() )
{
@@ -1180,7 +1180,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
- ui.RequestMessageBox( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
+ ui.RequestMessageBox( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr, app.GetStringTable());
exitReasonStringId = -1;
}
}
@@ -1189,7 +1189,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
{
Sleep(1);
}
- pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats);
+ pMinecraft->setLevel(nullptr,exitReasonStringId,nullptr,saveStats);
TelemetryManager->Flush();
diff --git a/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp b/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp
index c1e06c0d..c0650335 100644
--- a/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp
@@ -26,7 +26,7 @@
HRESULT CScene_Reinstall::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
// We'll only be in this menu from the main menu, not in game
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
m_bIgnoreInput=false;
MapChildControls();
@@ -224,7 +224,7 @@ HRESULT CScene_Reinstall::OnControlNavigate(XUIMessageControlNavigate *pControlN
{
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -241,7 +241,7 @@ HRESULT CScene_Reinstall::OnTransitionStart( XUIMessageTransition *pTransition,
// 4J-PB - Going to resize buttons if the text is too big to fit on any of them (Br-pt problem with the length of Unlock Full Game)
XUIRect xuiRect;
- HXUIOBJ visual=NULL;
+ HXUIOBJ visual=nullptr;
HXUIOBJ text;
float fMaxTextLen=0.0f;
float fTextVisualLen;
@@ -283,7 +283,7 @@ HRESULT CScene_Reinstall::OnTransitionStart( XUIMessageTransition *pTransition,
int CScene_Reinstall::DeviceSelectReturned(void *pParam,bool bContinue)
{
- CScene_Reinstall* pClass = (CScene_Reinstall*)pParam;
+ CScene_Reinstall* pClass = static_cast<CScene_Reinstall *>(pParam);
if(!StorageManager.GetSaveDeviceSelected(pClass->m_iPad))
{
@@ -300,7 +300,7 @@ int CScene_Reinstall::DeviceSelectReturned(void *pParam,bool bContinue)
int CScene_Reinstall::DeviceSelectReturned_AndReinstall(void *pParam,bool bContinue)
{
- CScene_Reinstall* pClass = (CScene_Reinstall*)pParam;
+ CScene_Reinstall* pClass = static_cast<CScene_Reinstall *>(pParam);
if(!StorageManager.GetSaveDeviceSelected(pClass->m_iPad))
{
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp
index 03e783f4..2692c8f1 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp
@@ -71,8 +71,8 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex)
m_fPointerMaxX = fPanelWidth + fPointerWidth;
m_fPointerMaxY = fPanelHeight + (fPointerHeight/2);
-// m_hPointerText=NULL;
-// m_hPointerTextBkg=NULL;
+// m_hPointerText=nullptr;
+// m_hPointerTextBkg=nullptr;
UIVec2D itemPos;
UIVec2D itemSize;
@@ -113,7 +113,7 @@ void CXuiSceneAbstractContainer::PlatformInitialize(int iPad, int startIndex)
// Disable the default navigation behaviour for all slot lsit items (prevent old style cursor navigation).
for ( int iSection = m_eFirstSection; iSection < m_eMaxSection; ++iSection )
{
- ESceneSection eSection = ( ESceneSection )( iSection );
+ ESceneSection eSection = static_cast<ESceneSection>(iSection);
if(!IsSectionSlotList(eSection)) continue;
@@ -170,7 +170,7 @@ HRESULT CXuiSceneAbstractContainer::OnTransitionStart( XUIMessageTransition *pTr
InitDataAssociations(m_iPad, m_menu);
}
- HXUIOBJ hObj=NULL;
+ HXUIOBJ hObj=nullptr;
HRESULT hr=XuiControlGetVisual(m_pointerControl->m_hObj,&hObj);
hr=XuiElementGetChildById(hObj,L"text_measurer",&m_hPointerTextMeasurer);
hr=XuiElementGetChildById(hObj,L"text_name",&m_hPointerText);
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp
index 4a8617b4..36a12757 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp
@@ -28,7 +28,7 @@ HRESULT CXuiSceneAnvil::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
Minecraft *pMinecraft = Minecraft::GetInstance();
- AnvilScreenInput* initData = (AnvilScreenInput*)pInitData->pvInitData;
+ AnvilScreenInput* initData = static_cast<AnvilScreenInput *>(pInitData->pvInitData);
m_iPad=initData->iPad;
m_bSplitscreen=initData->bSplitscreen;
m_inventory = initData->inventory;
@@ -40,9 +40,9 @@ HRESULT CXuiSceneAnvil::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
}
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
- TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
+ TutorialMode *gameMode = static_cast<TutorialMode *>(pMinecraft->localgameModes[m_iPad]);
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Anvil_Menu, this);
}
@@ -67,15 +67,15 @@ HRESULT CXuiSceneAnvil::OnDestroy()
{
Minecraft *pMinecraft = Minecraft::GetInstance();
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
- TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ TutorialMode *gameMode = static_cast<TutorialMode *>(pMinecraft->localgameModes[m_iPad]);
+ if(gameMode != nullptr) 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -89,8 +89,8 @@ HRESULT CXuiSceneAnvil::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValue
// strip leading spaces
wstring b;
- int start = (int)newValue.find_first_not_of(L" ");
- int end = (int)newValue.find_last_not_of(L" ");
+ size_t start = newValue.find_first_not_of(L" ");
+ size_t end = newValue.find_last_not_of(L" ");
if( start == wstring::npos )
{
@@ -99,7 +99,7 @@ HRESULT CXuiSceneAnvil::OnNotifyValueChanged (HXUIOBJ hObjSource, XUINotifyValue
}
else
{
- if( end == wstring::npos ) end = (int)newValue.size()-1;
+ if( end == wstring::npos ) end = newValue.size() - 1;
b = newValue.substr(start,(end-start)+1);
newValue=b;
}
@@ -158,7 +158,7 @@ CXuiControl* CXuiSceneAnvil::GetSectionControl( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
CXuiCtrlSlotList* CXuiSceneAnvil::GetSectionSlotList( ESceneSection eSection )
@@ -184,7 +184,7 @@ CXuiCtrlSlotList* CXuiSceneAnvil::GetSectionSlotList( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
// 4J Stu - Added to support auto-save. Need to re-associate on a navigate back
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp
index 03782c79..c9a57f21 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp
@@ -22,26 +22,26 @@
#define PRESS_START_TIMER 0
-CXuiSceneBase *CXuiSceneBase::Instance = NULL;
+CXuiSceneBase *CXuiSceneBase::Instance = nullptr;
DWORD CXuiSceneBase::m_dwTrialTimerLimitSecs=DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME;
//----------------------------------------------------------------------------------
// Performs initialization tasks - retrieves controls.
//----------------------------------------------------------------------------------
HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- ASSERT( CXuiSceneBase::Instance == NULL );
+ ASSERT( CXuiSceneBase::Instance == nullptr );
CXuiSceneBase::Instance = this;
m_iWrongTexturePackTickC=20*5; // default 5 seconds before bringing up the upsell for not having the texture pack
MapChildControls();
// Display the tooltips
- HRESULT hr = S_OK;
+ HRESULT hr = S_OK;
CXuiElement xuiElement = m_hObj;
HXUIOBJ hTemp;
- m_hEmptyQuadrantLogo=NULL;
+ m_hEmptyQuadrantLogo=nullptr;
XuiElementGetChildById(m_hObj,L"EmptyQuadrantLogo",&m_hEmptyQuadrantLogo);
D3DXVECTOR3 lastPos;
@@ -51,8 +51,8 @@ HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
m_visible[idx][ i ] = FALSE;
m_iCurrentTooltipTextID[idx][i]=-1;
- hTooltipText[idx][i]=NULL;
- hTooltipTextSmall[idx][i]=NULL;
+ hTooltipText[idx][i]=nullptr;
+ hTooltipTextSmall[idx][i]=nullptr;
// set all tooltips to shown FALSE by default
m_Buttons[idx][i].SetShow( FALSE );
m_ButtonsSmall[idx][i].SetShow( FALSE );
@@ -106,7 +106,7 @@ HRESULT CXuiSceneBase::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
// clear the quadrants
m_iQuadrantsMask=0;
- HXUIOBJ hObj=NULL,hQuadrant;
+ HXUIOBJ hObj=nullptr,hQuadrant;
HRESULT hr=XuiControlGetVisual(m_PressStart.m_hObj,&hObj);
@@ -144,8 +144,8 @@ HRESULT CXuiSceneBase::OnSkinChanged(BOOL& bHandled)
{
for( unsigned int i = 0; i < BUTTONS_TOOLTIP_MAX; ++i )
{
- hTooltipText[idx][i]=NULL;
- hTooltipTextSmall[idx][i]=NULL;
+ hTooltipText[idx][i]=nullptr;
+ hTooltipTextSmall[idx][i]=nullptr;
}
}
@@ -169,7 +169,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
// make sure there's not a mount going on before using the textures
if(bCheckTexturePack && app.DLCInstallProcessCompleted() )
- {
+ {
TexturePack *tPack = pMinecraft->skins->getSelected();
if(tPack->getId()!=app.GetRequiredTexturePackID())
@@ -178,7 +178,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
//Is it available?
TexturePack * pRequiredTPack=pMinecraft->skins->getTexturePackById(app.GetRequiredTexturePackID());
- if(pRequiredTPack!=NULL)
+ if(pRequiredTPack!=nullptr)
{
// we can switch to the required pack
// reset the timer
@@ -186,7 +186,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID());
- // probably had background downloads enabled, so turn them off
+ // probably had background downloads enabled, so turn them off
XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO);
}
else
@@ -206,7 +206,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
}
}
- if (EnderDragonRenderer::bossInstance == NULL)
+ if (EnderDragonRenderer::bossInstance == nullptr)
{
if(m_ticksWithNoBoss<=20)
{
@@ -221,9 +221,9 @@ void CXuiSceneBase::_TickAllBaseScenes()
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
{
- if(pMinecraft->localplayers[i] != NULL && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD))
+ if(pMinecraft->localplayers[i] != nullptr && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD))
{
- int iGuiScale;
+ int iGuiScale;
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -234,7 +234,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
iGuiScale=app.GetGameSettings(i,eGameSetting_UISizeSplitscreen);
}
m_BossHealthGroup[i].SetShow(TRUE);
- m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
+ m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) );
if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -245,7 +245,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(TRUE);
m_BossHealthProgress2[i].SetShow(FALSE);
m_BossHealthProgress3[i].SetShow(FALSE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -259,7 +259,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(FALSE);
m_BossHealthProgress2[i].SetShow(TRUE);
m_BossHealthProgress3[i].SetShow(FALSE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -272,7 +272,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(FALSE);
m_BossHealthProgress2[i].SetShow(FALSE);
m_BossHealthProgress3[i].SetShow(TRUE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -295,7 +295,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(TRUE);
m_BossHealthProgress2[i].SetShow(FALSE);
m_BossHealthProgress3[i].SetShow(FALSE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -308,7 +308,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(FALSE);
m_BossHealthProgress2[i].SetShow(TRUE);
m_BossHealthProgress3[i].SetShow(FALSE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -320,7 +320,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
m_BossHealthProgress1[i].SetShow(FALSE);
m_BossHealthProgress2[i].SetShow(FALSE);
m_BossHealthProgress3[i].SetShow(TRUE);
- if(m_BossHealthProgress1_small[i]!=NULL)
+ if(m_BossHealthProgress1_small[i]!=nullptr)
{
m_BossHealthProgress1_small[i].SetShow(FALSE);
m_BossHealthProgress2_small[i].SetShow(FALSE);
@@ -364,7 +364,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
break;
}
}
- }
+ }
m_pBossHealthProgress[i].SetRange(0, boss->getMaxHealth() );
m_pBossHealthProgress[i].SetValue( boss->getSynchedHealth() );
@@ -401,7 +401,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
if(uiOpacityTimer < (SharedConstants::TICKS_PER_SECOND * 1) )
{
float fStep=(80.0f)/10.0f;
- float fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
XuiElementSetOpacity(m_selectedItemA[i],fVal);
XuiElementSetOpacity(m_selectedItemSmallA[i],fVal);
@@ -441,8 +441,8 @@ void CXuiSceneBase::_TickAllBaseScenes()
{
if(uiOpacityTimer<10)
{
- float fStep=(80.0f-(float)ucAlpha)/10.0f;
- fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
+ fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
}
else
{
@@ -451,7 +451,7 @@ void CXuiSceneBase::_TickAllBaseScenes()
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
}
else
@@ -461,22 +461,22 @@ void CXuiSceneBase::_TickAllBaseScenes()
{
ucAlpha=15;
}
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
XuiElementSetOpacity(app.GetCurrentHUDScene(i),fVal);
XUIMessage xuiMsg;
CustomMessage_TickScene( &xuiMsg );
XuiSendMessage( app.GetCurrentHUDScene(i), &xuiMsg );
-
+
bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(i) && !(app.GetXuiAction(i)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(i,eGameSetting_DisplayHUD)!=0;
- if(bDisplayGui && pMinecraft->localplayers[i] != NULL)
+ if(bDisplayGui && pMinecraft->localplayers[i] != nullptr)
{
- XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
+ XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE);
}
else
{
- XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
+ XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
}
}
}
@@ -495,29 +495,28 @@ HRESULT CXuiSceneBase::_SetEnableTooltips( unsigned int iPad, BOOL bVal )
HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiTooltip, int iTextID )
{
ASSERT( uiTooltip < BUTTONS_TOOLTIP_MAX );
-
+
XUIRect xuiRect, xuiRectSmall;
HRESULT hr=S_OK;
- LPCWSTR pString=NULL;
+ LPCWSTR pString=nullptr;
float fWidth,fHeight;
-
+
// Want to be able to show just a button (for RB LB)
if(iTextID>=0)
{
pString=app.GetString(iTextID);
}
-
- if(hTooltipText[iPad][uiTooltip]==NULL)
+ if(hTooltipText[iPad][uiTooltip]==nullptr)
{
- HXUIOBJ hObj=NULL;
+ HXUIOBJ hObj=nullptr;
hr=XuiControlGetVisual(m_Buttons[iPad][uiTooltip].m_hObj,&hObj);
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipText[iPad][uiTooltip]);
hr=XuiElementGetPosition(hTooltipText[iPad][uiTooltip],&m_vPosTextInTooltip[uiTooltip]);
}
- if(hTooltipTextSmall[iPad][uiTooltip]==NULL)
+ if(hTooltipTextSmall[iPad][uiTooltip]==nullptr)
{
- HXUIOBJ hObj=NULL;
+ HXUIOBJ hObj=nullptr;
hr=XuiControlGetVisual(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&hObj);
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipTextSmall[iPad][uiTooltip]);
hr=XuiElementGetPosition(hTooltipTextSmall[iPad][uiTooltip],&m_vPosTextInTooltipSmall[uiTooltip]);
@@ -525,8 +524,8 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
if(iTextID>=0)
{
- hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
-
+ hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect);
+
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
XuiElementGetBounds(m_Buttons[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
XuiElementSetBounds(m_Buttons[iPad][uiTooltip].m_hObj,xuiRect.right+1+m_vPosTextInTooltip[uiTooltip].x,fHeight);
@@ -537,7 +536,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti
hr=XuiTextPresenterMeasureText(hTooltipTextSmall[iPad][uiTooltip], pString, &xuiRectSmall);
-
+
// Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic)
XuiElementGetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&fWidth, &fHeight);
XuiElementSetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,xuiRectSmall.right+1+m_vPosTextInTooltipSmall[uiTooltip].x,fHeight);
@@ -627,8 +626,8 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
{
if(uiOpacityTimer<10)
{
- float fStep=(80.0f-(float)ucAlpha)/10.0f;
- fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
+ fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
}
else
{
@@ -637,7 +636,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
}
else
@@ -647,7 +646,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
{
ucAlpha=15;
}
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
m_Buttons[iPad][tooltip].SetOpacity(fVal);
@@ -678,8 +677,8 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
{
if(uiOpacityTimer<10)
{
- float fStep=(80.0f-(float)ucAlpha)/10.0f;
- fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
+ fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
}
else
{
@@ -688,12 +687,12 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
XuiElementSetOpacity(m_hGamerTagA[iPad],fVal);
}
@@ -701,7 +700,7 @@ HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bo
if(iPad==ProfileManager.GetPrimaryPad())
{
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
- XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*(float)ucAlpha);
+ XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*static_cast<float>(ucAlpha));
}
}
}
@@ -749,7 +748,7 @@ HRESULT CXuiSceneBase::_SetTooltipsEnabled( unsigned int iPad, bool bA, bool bB,
m_Buttons[iPad][BUTTON_TOOLTIP_LB].SetEnable( bLB );
m_Buttons[iPad][BUTTON_TOOLTIP_RB].SetEnable( bRB );
m_Buttons[iPad][BUTTON_TOOLTIP_LS].SetEnable( bLS );
-
+
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_A].SetEnable( bA );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_B].SetEnable( bB );
m_ButtonsSmall[iPad][BUTTON_TOOLTIP_X].SetEnable( bX );
@@ -858,9 +857,9 @@ HRESULT CXuiSceneBase::_ShowBackground( unsigned int iPad, BOOL bShow )
hr=XuiElementGetChildById(hVisual,L"NightGroup",&hNight);
hr=XuiElementGetChildById(hVisual,L"DayGroup",&hDay);
- if(bShow && pMinecraft->level!=NULL)
+ if(bShow && pMinecraft->level!=nullptr)
{
- __int64 i64TimeOfDay =0;
+ int64_t i64TimeOfDay =0;
// are we in the Nether? - Leave the time as 0 if we are, so we show daylight
if(pMinecraft->level->dimension->id==0)
{
@@ -911,7 +910,7 @@ HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad)
m_PressStart.SetShow(TRUE);
// retrieve the visual for this quadrant
- HXUIOBJ hObj=NULL,hQuadrant;
+ HXUIOBJ hObj=nullptr,hQuadrant;
HRESULT hr=XuiControlGetVisual(m_PressStart.m_hObj,&hObj);
hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hQuadrant);
memset(&xuiRect, 0, sizeof(xuiRect));
@@ -945,11 +944,11 @@ HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad)
int nStart, nEnd;
// XuiElementFindNamedFrame( m_hObj, L"StartFlash", &nStart );
// XuiElementFindNamedFrame( m_hObj, L"EndFlash", &nEnd );
-// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
+// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE );
XuiElementFindNamedFrame( hObj, L"StartFlash", &nStart );
XuiElementFindNamedFrame( hObj, L"EndFlash", &nEnd );
- XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
-
+ XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE );
+
return S_OK;
}
@@ -960,7 +959,7 @@ HRESULT CXuiSceneBase::_HidePressStart()
HRESULT CXuiSceneBase::_UpdateAutosaveCountdownTimer(unsigned int uiSeconds)
{
- WCHAR wcAutosaveCountdown[100];
+ WCHAR wcAutosaveCountdown[100];
swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds);
m_TrialTimer.SetText(wcAutosaveCountdown);
return S_OK;
@@ -974,15 +973,15 @@ HRESULT CXuiSceneBase::_ShowAutosaveCountdownTimer(BOOL bVal)
HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
{
- WCHAR wcTime[20];
+ WCHAR wcTime[20];
- DWORD dwTimeTicks=(DWORD)app.getTrialTimer();
+ DWORD dwTimeTicks=static_cast<DWORD>(app.getTrialTimer());
if(dwTimeTicks>m_dwTrialTimerLimitSecs)
{
dwTimeTicks=m_dwTrialTimerLimitSecs;
}
-
+
dwTimeTicks=m_dwTrialTimerLimitSecs-dwTimeTicks;
#ifndef _CONTENT_PACKAGE
@@ -1014,7 +1013,7 @@ HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad)
void CXuiSceneBase::_ReduceTrialTimerValue()
{
- DWORD dwTimeTicks=(int)app.getTrialTimer();
+ DWORD dwTimeTicks=static_cast<int>(app.getTrialTimer());
if(dwTimeTicks>m_dwTrialTimerLimitSecs)
{
@@ -1038,7 +1037,7 @@ bool CXuiSceneBase::_PressStartPlaying(unsigned int iPad)
HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position )
{
// turn off the empty quadrant logo
- if(m_hEmptyQuadrantLogo!=NULL)
+ if(m_hEmptyQuadrantLogo!=nullptr)
{
XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE);
}
@@ -1086,12 +1085,12 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
XuiElementSetShow( m_TooltipGroupSmall[iPad].m_hObj, TRUE);
}
- if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
- {
+ if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
+ {
//640x480 ->1280x720
scale.x = 2.0f; scale.y = 1.5f; scale.z = 1.0f;
XuiElementSetScale(m_hObj, &scale);
-
+
return S_OK;
}
@@ -1127,7 +1126,7 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
// No position adjustment
case e_BaseScene_Fullscreen:
tooltipsPos.x=SAFEZONE_HALF_WIDTH;
- tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
+ tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight;
crouchIconPos.x=SAFEZONE_HALF_WIDTH;
crouchIconPos.y=SAFEZONE_HALF_HEIGHT;
fBackWidth=XUI_BASE_SCENE_WIDTH;
@@ -1268,7 +1267,7 @@ HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScen
// 4J Stu - If we already have some scenes open, then call this to update their positions
// Fix for #10960 - All Lang: UI: Split-screen: Changing split screen mode (vertical/horizontal) make window layout strange
- if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL)
+ if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localplayers[iPad]!=nullptr)
{
// 4J-PB - Can only do this once we know what the player's UI settings are, so we need to have the player game settings read
_UpdateSelectedItemPos(iPad);
@@ -1303,7 +1302,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// Only adjust if fullscreen for now, leaving code to move others if required, but it's too far up the screen when on the bottom quadrants
- if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
+ if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) &&
(RenderManager.IsHiDef() || RenderManager.IsWidescreen()) )
{
D3DXVECTOR3 selectedItemPos;
@@ -1328,18 +1327,18 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// The move applies to the whole scene, so we'll need to move tooltips back in some cases
- selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
+ selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight;
selectedItemPos.x = XUI_BASE_SCENE_WIDTH_HALF - (fSelectedItemWidth/2.0f);
// Adjust selectedItemPos based on what gui is displayed
- // 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
+ // 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival
float fYOffset=0.0f;
unsigned char ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2;
-
- if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
+
+ if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localgameModes[iPad] != nullptr && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
{
// SURVIVAL MODE - Move up further because of hearts, shield and xp
switch(ucGuiScale)
@@ -1353,7 +1352,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = -94.0f;
break;
- }
+ }
}
else
{
@@ -1368,7 +1367,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = -58.0f;
break;
- }
+ }
}
@@ -1425,14 +1424,14 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
// 4J-PB - If it's in split screen vertical, adjust the position
// Adjust selectedItemPos based on what gui is displayed
if((m_playerBaseScenePosition[iPad]==e_BaseScene_Left) || (m_playerBaseScenePosition[iPad]==e_BaseScene_Right))
- {
+ {
float scale=0.5f;
selectedItemPos.y -= (scale * 88.0f);
- if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
+ if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localgameModes[iPad] != nullptr && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer())
{
selectedItemPos.y -= (scale * 80.0f);
}
-
+
// 4J-PB - selected the gui scale based on the slider settings
unsigned char ucGuiScale;
float fYOffset=0.0f;
@@ -1455,7 +1454,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad)
default: // 2
fYOffset = 85.0f;
break;
- }
+ }
selectedItemPos.y+=fYOffset;
}
@@ -1471,7 +1470,7 @@ CXuiSceneBase::EBaseScenePosition CXuiSceneBase::_GetPlayerBasePosition(int iPad
void CXuiSceneBase::_SetEmptyQuadrantLogo(int iPad,EBaseScenePosition ePos)
{
- if(m_hEmptyQuadrantLogo!=NULL)
+ if(m_hEmptyQuadrantLogo!=nullptr)
{
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
{
@@ -1512,7 +1511,7 @@ void CXuiSceneBase::_SetEmptyQuadrantLogo(int iPad,EBaseScenePosition ePos)
if(ProfileManager.GetLockedProfile()!=-1)
{
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
- XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*(float)ucAlpha);
+ XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*static_cast<float>(ucAlpha));
}
XuiElementSetPosition(m_hEmptyQuadrantLogo, &pos );
@@ -1606,8 +1605,8 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
{
// The host decides whether these are on or off
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
- {
- if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL)
+ {
+ if(Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->localplayers[iPad]!= nullptr)
{
wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad));
XuiControlSetText(m_hGamerTagA[iPad],wsGamertag.c_str());
@@ -1621,7 +1620,7 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
}
// The host decides whether these are on or off
if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0)
- {
+ {
XuiElementSetShow(m_hGamerTagA[iPad],bDisplay);
// set the opacity of the gamertag
@@ -1638,8 +1637,8 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
{
if(uiOpacityTimer<10)
{
- float fStep=(80.0f-(float)ucAlpha)/10.0f;
- fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep));
+ float fStep=(80.0f-static_cast<float>(ucAlpha))/10.0f;
+ fVal=0.01f*(80.0f-((10.0f-static_cast<float>(uiOpacityTimer))*fStep));
}
else
{
@@ -1648,12 +1647,12 @@ HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay )
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
}
else
{
- fVal=0.01f*(float)ucAlpha;
+ fVal=0.01f*static_cast<float>(ucAlpha);
}
XuiElementSetOpacity(m_hGamerTagA[iPad],0.01f*fVal);
}
@@ -1712,11 +1711,11 @@ void CXuiSceneBase::_HideAllGameUIElements()
m_uiSelectedItemOpacityCountDown[i] = 0;
m_selectedItemA[i].SetShow(FALSE);
m_selectedItemSmallA[i].SetShow(FALSE);
-
+
m_BossHealthGroup[i].SetShow(FALSE);
m_bossHealthVisible[i] = FALSE;
- XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
+ XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE);
_DisplayGamertag(i,FALSE);
}
@@ -1845,12 +1844,12 @@ void CXuiSceneBase::ReLayout( unsigned int iPad )
if( i>0 && lastVisible!=-1 )
{
float width, height;
- XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
+ XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height);
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
lastPos.x += width + m_iTooltipSpacingGap;
- XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
+ XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height);
// 4J Stu - This is for horizontal layout, will need changed if we do vertical layout
lastPosSmall.x += width + m_iTooltipSpacingGapSmall;
}
@@ -1864,7 +1863,7 @@ void CXuiSceneBase::ReLayout( unsigned int iPad )
void CXuiSceneBase::TickAllBaseScenes()
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
CXuiSceneBase::Instance->_TickAllBaseScenes();
}
@@ -1872,7 +1871,7 @@ void CXuiSceneBase::TickAllBaseScenes()
HRESULT CXuiSceneBase::SetEnableTooltips( unsigned int iPad, BOOL bVal )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_SetEnableTooltips(iPad, bVal );
}
@@ -1881,7 +1880,7 @@ HRESULT CXuiSceneBase::SetEnableTooltips( unsigned int iPad, BOOL bVal )
HRESULT CXuiSceneBase::SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_SetTooltipText(iPad, tooltip, iTextID );
}
@@ -1890,7 +1889,7 @@ HRESULT CXuiSceneBase::SetTooltipText( unsigned int iPad, unsigned int tooltip,
HRESULT CXuiSceneBase::RefreshTooltips( unsigned int iPad)
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_RefreshTooltips(iPad);
}
@@ -1899,7 +1898,7 @@ HRESULT CXuiSceneBase::RefreshTooltips( unsigned int iPad)
HRESULT CXuiSceneBase::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_ShowTooltip(iPad, tooltip, show );
}
@@ -1908,7 +1907,7 @@ HRESULT CXuiSceneBase::ShowTooltip( unsigned int iPad, unsigned int tooltip, boo
HRESULT CXuiSceneBase::ShowSafeArea( BOOL bShow )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_ShowSafeArea(bShow );
}
@@ -1917,7 +1916,7 @@ HRESULT CXuiSceneBase::ShowSafeArea( BOOL bShow )
HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int iY , int iLT, int iRT, int iRB, int iLB, int iLS, bool forceUpdate /*= false*/ )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
// Enable all the tooltips. We should disable them in the scenes as required
CXuiSceneBase::Instance->_SetTooltipsEnabled( iPad );
@@ -1948,15 +1947,15 @@ HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, i
}
else
{
- // does the tooltip need to change?
+ // does the tooltip need to change?
if(CXuiSceneBase::Instance->m_iCurrentTooltipTextID[iPad][i]!=iTooptipsA[i] || forceUpdate)
{
CXuiSceneBase::Instance->SetTooltipText(iPad, i, iTooptipsA[i] );
- }
+ }
CXuiSceneBase::Instance->_ShowTooltip(iPad, i, true );
}
}
-
+
}
return S_OK;
}
@@ -1978,7 +1977,7 @@ HRESULT CXuiSceneBase::AnimateKeyPress(DWORD userIndex, DWORD dwKeyCode)
HRESULT CXuiSceneBase::ShowSavingMessage( unsigned int iPad, C4JStorage::ESavingMessage eVal )
{
- if( CXuiSceneBase::Instance != NULL )
+ if( CXuiSceneBase::Instance != nullptr )
{
return CXuiSceneBase::Instance->_ShowSavingMessage(iPad, eVal);
}
@@ -2067,18 +2066,18 @@ HRESULT CXuiSceneBase::SetPlayerBasePositions(EBaseScenePosition pad0, EBaseScen
}
HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
-{
+{
EBaseScenePosition padPositions[XUSER_MAX_COUNT];
for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
padPositions[idx] = e_BaseScene_NotSet;
}
-
+
Minecraft *pMinecraft = Minecraft::GetInstance();
// If the game is not started (or is being held paused for a bit) then display all scenes fullscreen
- if( pMinecraft == NULL )
+ if( pMinecraft == nullptr )
{
for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
@@ -2105,7 +2104,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx)
{
- if(pMinecraft->localplayers[idx] != NULL)
+ if(pMinecraft->localplayers[idx] != nullptr)
{
if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN)
{
@@ -2134,7 +2133,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions()
padPositions[idx] = e_BaseScene_Right;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
- padPositions[idx] = e_BaseScene_Top_Left;
+ padPositions[idx] = e_BaseScene_Top_Left;
break;
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
padPositions[idx] = e_BaseScene_Top_Right;
@@ -2168,7 +2167,7 @@ void CXuiSceneBase::UpdateSelectedItemPos(int iPad)
CXuiSceneBase::Instance->_UpdateSelectedItemPos(iPad);
}
-HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
+HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad)
{
return CXuiSceneBase::Instance->_GetPlayerBaseScene(iPad);
}
@@ -2186,7 +2185,7 @@ void CXuiSceneBase::SetEmptyQuadrantLogo(int iScreenSection)
// find the empty player
for( iPad = 0; iPad < XUSER_MAX_COUNT; ++iPad)
{
- if(pMinecraft->localplayers[iPad] == NULL)
+ if(pMinecraft->localplayers[iPad] == nullptr)
{
switch( iScreenSection)
{
@@ -2238,6 +2237,6 @@ void CXuiSceneBase::CreateBaseSceneInstance()
{
CXuiSceneBase *sceneBase = new CXuiSceneBase();
BOOL handled;
- sceneBase->OnInit(NULL,handled);
+ sceneBase->OnInit(nullptr,handled);
}
#endif \ No newline at end of file
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp
index cf600966..a55e8f77 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp
@@ -24,7 +24,7 @@ HRESULT CXuiSceneBrewingStand::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
Minecraft *pMinecraft = Minecraft::GetInstance();
- BrewingScreenInput* initData = (BrewingScreenInput*)pInitData->pvInitData;
+ BrewingScreenInput* initData = static_cast<BrewingScreenInput *>(pInitData->pvInitData);
m_iPad=initData->iPad;
m_bSplitscreen=initData->bSplitscreen;
@@ -36,7 +36,7 @@ HRESULT CXuiSceneBrewingStand::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
}
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
@@ -67,16 +67,16 @@ HRESULT CXuiSceneBrewingStand::OnDestroy()
Minecraft *pMinecraft = Minecraft::GetInstance();
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
}
#endif
// 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -106,7 +106,7 @@ CXuiControl* CXuiSceneBrewingStand::GetSectionControl( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
CXuiCtrlSlotList* CXuiSceneBrewingStand::GetSectionSlotList( ESceneSection eSection )
@@ -135,7 +135,7 @@ CXuiCtrlSlotList* CXuiSceneBrewingStand::GetSectionSlotList( ESceneSection eSect
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
// 4J Stu - Added to support auto-save. Need to re-associate on a navigate back
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp
index 39b836d2..25f5cffc 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp
@@ -29,7 +29,7 @@ HRESULT CXuiSceneContainer::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
Minecraft *pMinecraft = Minecraft::GetInstance();
- ContainerScreenInput* initData = (ContainerScreenInput*)pInitData->pvInitData;
+ ContainerScreenInput* initData = static_cast<ContainerScreenInput *>(pInitData->pvInitData);
XuiControlSetText(m_ChestText,app.GetString(initData->container->getName()));
@@ -40,7 +40,7 @@ HRESULT CXuiSceneContainer::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
m_bSplitscreen=initData->bSplitscreen;
#ifdef _XBOX
- if( pMinecraft->localgameModes[initData->iPad] != NULL )
+ if( pMinecraft->localgameModes[initData->iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad];
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
@@ -75,9 +75,9 @@ HRESULT CXuiSceneContainer::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
// to get it into actual back buffer coordinates, and we need those to remain whole numbers to avoid issues with point sampling
if(!RenderManager.IsHiDef())
{
- int iY = (int)(vPos.y);
+ int iY = static_cast<int>(vPos.y);
iY &= 0xfffffffe;
- vPos.y = (float)iY;
+ vPos.y = static_cast<float>(iY);
}
this->SetPosition( &vPos );
@@ -95,16 +95,16 @@ HRESULT CXuiSceneContainer::OnDestroy()
Minecraft *pMinecraft = Minecraft::GetInstance();
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
}
#endif
// 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -125,7 +125,7 @@ CXuiControl* CXuiSceneContainer::GetSectionControl( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
CXuiCtrlSlotList* CXuiSceneContainer::GetSectionSlotList( ESceneSection eSection )
@@ -145,7 +145,7 @@ CXuiCtrlSlotList* CXuiSceneContainer::GetSectionSlotList( ESceneSection eSection
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
// 4J Stu - Added to support auto-save. Need to re-associate on a navigate back
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp
index a5dc6584..f1c51ff0 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp
@@ -40,7 +40,7 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
D3DXVECTOR3 vec;
VOID *pObj;
- CraftingPanelScreenInput* pCraftingPanelData = (CraftingPanelScreenInput*)pInitData->pvInitData;
+ CraftingPanelScreenInput* pCraftingPanelData = static_cast<CraftingPanelScreenInput *>(pInitData->pvInitData);
m_iContainerType=pCraftingPanelData->iContainerType;
m_pPlayer=pCraftingPanelData->player;
m_iPad=pCraftingPanelData->iPad;
@@ -89,12 +89,12 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
for(int i=0;i<m_iIngredients3x3SlotC;i++)
{
XuiObjectFromHandle( m_hCraftIngredientA[i], &pObj );
- m_pCraftingIngredientA[i] = (CXuiCtrlCraftIngredientSlot *)pObj;
+ m_pCraftingIngredientA[i] = static_cast<CXuiCtrlCraftIngredientSlot *>(pObj);
}
XuiObjectFromHandle( m_hCraftOutput, &pObj );
- m_pCraftingOutput = (CXuiCtrlCraftIngredientSlot *)pObj;
- m_pGroupA=(Recipy::_eGroupType *)&m_GroupTypeMapping9GridA;
- m_pGroupTabA=(CXuiSceneCraftingPanel::_eGroupTab *)&m_GroupTabBkgMapping3x3A;
+ m_pCraftingOutput = static_cast<CXuiCtrlCraftIngredientSlot *>(pObj);
+ m_pGroupA=static_cast<Recipy::_eGroupType *>(&m_GroupTypeMapping9GridA);
+ m_pGroupTabA=static_cast<CXuiSceneCraftingPanel::_eGroupTab *>(&m_GroupTabBkgMapping3x3A);
m_iCraftablesMaxHSlotC=m_iMaxHSlot3x3C;
@@ -102,7 +102,7 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
for(int i=0;i<4;i++)
{
XuiObjectFromHandle( m_hCraftIngredientDescA[i], &pObj );
- m_pCraftIngredientDescA[i] = (CXuiCtrlCraftIngredientSlot *)pObj;
+ m_pCraftIngredientDescA[i] = static_cast<CXuiCtrlCraftIngredientSlot *>(pObj);
}
}
else
@@ -113,13 +113,13 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
for(int i=0;i<m_iIngredients2x2SlotC;i++)
{
XuiObjectFromHandle( m_hCraftIngredientA[i], &pObj );
- m_pCraftingIngredientA[i] = (CXuiCtrlCraftIngredientSlot *)pObj;
+ m_pCraftingIngredientA[i] = static_cast<CXuiCtrlCraftIngredientSlot *>(pObj);
}
XuiObjectFromHandle( m_hCraftOutput, &pObj );
- m_pCraftingOutput = (CXuiCtrlCraftIngredientSlot *)pObj;
- m_pGroupA=(Recipy::_eGroupType *)&m_GroupTypeMapping4GridA;
- m_pGroupTabA=(CXuiSceneCraftingPanel::_eGroupTab *)&m_GroupTabBkgMapping2x2A;
+ m_pCraftingOutput = static_cast<CXuiCtrlCraftIngredientSlot *>(pObj);
+ m_pGroupA=static_cast<Recipy::_eGroupType *>(&m_GroupTypeMapping4GridA);
+ m_pGroupTabA=static_cast<CXuiSceneCraftingPanel::_eGroupTab *>(&m_GroupTabBkgMapping2x2A);
m_iCraftablesMaxHSlotC=m_iMaxHSlot2x2C;
@@ -127,7 +127,7 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
for(int i=0;i<4;i++)
{
XuiObjectFromHandle( m_hCraftIngredientDescA[i], &pObj );
- m_pCraftIngredientDescA[i] = (CXuiCtrlCraftIngredientSlot *)pObj;
+ m_pCraftIngredientDescA[i] = static_cast<CXuiCtrlCraftIngredientSlot *>(pObj);
}
}
@@ -165,7 +165,7 @@ HRESULT CXuiSceneCraftingPanel::OnInit( XUIMessageInit* pInitData, BOOL& bHandle
Minecraft *pMinecraft = Minecraft::GetInstance();
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
@@ -206,7 +206,7 @@ HRESULT CXuiSceneCraftingPanel::OnTransitionEnd( XUIMessageTransition *pTransDat
{
for(int i=0;i<m_iMaxGroup3x3;i++)
{
- m_hGroupIconA[i].PlayVisualRange(m_GroupIconNameA[m_pGroupA[i]],NULL,m_GroupIconNameA[m_pGroupA[i]]);
+ m_hGroupIconA[i].PlayVisualRange(m_GroupIconNameA[m_pGroupA[i]],nullptr,m_GroupIconNameA[m_pGroupA[i]]);
XuiElementSetShow(m_hGroupIconA[i].m_hObj,TRUE);
}
}
@@ -214,7 +214,7 @@ HRESULT CXuiSceneCraftingPanel::OnTransitionEnd( XUIMessageTransition *pTransDat
{
for(int i=0;i<m_iMaxGroup2x2;i++)
{
- m_hGroupIconA[i].PlayVisualRange(m_GroupIconNameA[m_pGroupA[i]],NULL,m_GroupIconNameA[m_pGroupA[i]]);
+ m_hGroupIconA[i].PlayVisualRange(m_GroupIconNameA[m_pGroupA[i]],nullptr,m_GroupIconNameA[m_pGroupA[i]]);
XuiElementSetShow(m_hGroupIconA[i].m_hObj,TRUE);
}
}
@@ -336,7 +336,7 @@ HRESULT CXuiSceneCraftingPanel::OnGetSourceImage(XUIMessageGetSourceImage* pData
HRESULT hr = S_OK;
//int iId=pData->iItem;
int iId=(pData->iData>>22)&0x1FF;
- pData->szPath = NULL;
+ pData->szPath = nullptr;
pData->bDirty=true;
rfHandled = TRUE;
return hr;
@@ -352,15 +352,15 @@ HRESULT CXuiSceneCraftingPanel::OnDestroy()
Minecraft *pMinecraft = Minecraft::GetInstance();
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
}
#endif
// 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();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -433,7 +433,7 @@ void CXuiSceneCraftingPanel::setCraftVSlotItem(int iPad, int iIndex, shared_ptr<
void CXuiSceneCraftingPanel::setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item)
{
- if(item == NULL)
+ if(item == nullptr)
{
m_pCraftingOutput->SetIcon(iPad, 0,0,0,0,0,false);
}
@@ -450,7 +450,7 @@ void CXuiSceneCraftingPanel::setCraftingOutputSlotRedBox(bool show)
void CXuiSceneCraftingPanel::setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item)
{
- if(item == NULL)
+ if(item == nullptr)
{
m_pCraftingIngredientA[index]->SetIcon(iPad, 0,0,0,0,0,false);
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp
index 5b3c7226..dabe6d6d 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp
@@ -30,7 +30,7 @@ HRESULT CXuiSceneEnchant::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
Minecraft *pMinecraft = Minecraft::GetInstance();
- EnchantingScreenInput *initData = (EnchantingScreenInput *) pInitData->pvInitData;
+ EnchantingScreenInput *initData = static_cast<EnchantingScreenInput *>(pInitData->pvInitData);
m_iPad=initData->iPad;
m_bSplitscreen=initData->bSplitscreen;
@@ -42,7 +42,7 @@ HRESULT CXuiSceneEnchant::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
}
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
@@ -73,16 +73,16 @@ HRESULT CXuiSceneEnchant::OnDestroy()
Minecraft *pMinecraft = Minecraft::GetInstance();
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
}
#endif
// 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -112,7 +112,7 @@ CXuiControl* CXuiSceneEnchant::GetSectionControl( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
CXuiCtrlSlotList* CXuiSceneEnchant::GetSectionSlotList( ESceneSection eSection )
@@ -132,7 +132,7 @@ CXuiCtrlSlotList* CXuiSceneEnchant::GetSectionSlotList( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
// 4J Stu - Added to support auto-save. Need to re-associate on a navigate back
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp
index 832d6b4c..c5e2d22c 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp
@@ -26,7 +26,7 @@ HRESULT CXuiSceneFurnace::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
Minecraft *pMinecraft = Minecraft::GetInstance();
- FurnaceScreenInput* initData = (FurnaceScreenInput*)pInitData->pvInitData;
+ FurnaceScreenInput* initData = static_cast<FurnaceScreenInput *>(pInitData->pvInitData);
m_iPad=initData->iPad;
m_bSplitscreen=initData->bSplitscreen;
@@ -38,7 +38,7 @@ HRESULT CXuiSceneFurnace::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
}
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
@@ -69,16 +69,16 @@ HRESULT CXuiSceneFurnace::OnDestroy()
Minecraft *pMinecraft = Minecraft::GetInstance();
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
}
#endif
// 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -105,7 +105,7 @@ CXuiControl* CXuiSceneFurnace::GetSectionControl( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
CXuiCtrlSlotList* CXuiSceneFurnace::GetSectionSlotList( ESceneSection eSection )
@@ -131,7 +131,7 @@ CXuiCtrlSlotList* CXuiSceneFurnace::GetSectionSlotList( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
// 4J Stu - Added to support auto-save. Need to re-associate on a navigate back
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp
index 6024b8d6..e86ff67e 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp
@@ -23,7 +23,7 @@ HRESULT CXuiSceneInventory::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
Minecraft *pMinecraft = Minecraft::GetInstance();
- InventoryScreenInput *initData = (InventoryScreenInput *)pInitData->pvInitData;
+ InventoryScreenInput *initData = static_cast<InventoryScreenInput *>(pInitData->pvInitData);
m_iPad=initData->iPad;
m_bSplitscreen=initData->bSplitscreen;
@@ -38,7 +38,7 @@ HRESULT CXuiSceneInventory::OnInit( XUIMessageInit *pInitData, BOOL &bHandled )
}
#ifdef _XBOX
- if( pMinecraft->localgameModes[initData->iPad] != NULL )
+ if( pMinecraft->localgameModes[initData->iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad];
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
@@ -79,15 +79,15 @@ HRESULT CXuiSceneInventory::OnDestroy()
{
Minecraft *pMinecraft = Minecraft::GetInstance();
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
- TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ TutorialMode *gameMode = static_cast<TutorialMode *>(pMinecraft->localgameModes[m_iPad]);
+ if(gameMode != nullptr) 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -118,7 +118,7 @@ CXuiControl* CXuiSceneInventory::GetSectionControl( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
CXuiCtrlSlotList* CXuiSceneInventory::GetSectionSlotList( ESceneSection eSection )
@@ -138,7 +138,7 @@ CXuiCtrlSlotList* CXuiSceneInventory::GetSectionSlotList( ESceneSection eSection
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
// 4J Stu - Added to support auto-save. Need to re-associate on a navigate back
@@ -156,12 +156,12 @@ void CXuiSceneInventory::updateEffectsDisplay()
Minecraft *pMinecraft = Minecraft::GetInstance();
shared_ptr<LocalPlayer> player = pMinecraft->localplayers[m_iPad];
- if(player == NULL) return;
+ if(player == nullptr) return;
vector<MobEffectInstance *> *activeEffects = player->getActiveEffects();
// Work out how to arrange the effects
- int effectCount = (int)activeEffects->size();
+ int effectCount = static_cast<int>(activeEffects->size());
// Total size of all effects + spacing, minus spacing for the last effect
float fHeight = (effectCount * m_effectDisplaySpacing) - (m_effectDisplaySpacing - m_effectDisplayHeight);
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp
index 0793fc9e..0fa3e780 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp
@@ -33,7 +33,7 @@ HRESULT CXuiSceneInventoryCreative::OnInit( XUIMessageInit *pInitData, BOOL &bHa
Minecraft *pMinecraft = Minecraft::GetInstance();
- InventoryScreenInput *initData = (InventoryScreenInput *)pInitData->pvInitData;
+ InventoryScreenInput *initData = static_cast<InventoryScreenInput *>(pInitData->pvInitData);
m_iPad=initData->iPad;
m_bSplitscreen=initData->bSplitscreen;
@@ -48,7 +48,7 @@ HRESULT CXuiSceneInventoryCreative::OnInit( XUIMessageInit *pInitData, BOOL &bHa
}
#ifdef _XBOX
- if( pMinecraft->localgameModes[initData->iPad] != NULL )
+ if( pMinecraft->localgameModes[initData->iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad];
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
@@ -60,7 +60,7 @@ HRESULT CXuiSceneInventoryCreative::OnInit( XUIMessageInit *pInitData, BOOL &bHa
initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_noArgs());
// 4J JEV - Item Picker Menu
- shared_ptr<SimpleContainer> creativeContainer = shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE + 9 ));
+ shared_ptr<SimpleContainer> creativeContainer = std::make_shared<SimpleContainer>(0, TabSpec::MAX_SIZE + 9);
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
// 4J JEV - InitDataAssociations.
@@ -95,16 +95,16 @@ HRESULT CXuiSceneInventoryCreative::OnDestroy()
Minecraft *pMinecraft = Minecraft::GetInstance();
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
}
#endif
// 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -126,7 +126,7 @@ HRESULT CXuiSceneInventoryCreative::OnTransitionEnd( XUIMessageTransition *pTran
{
for(int i=0;i<eCreativeInventoryTab_COUNT;i++)
{
- m_hGroupIconA[i].PlayVisualRange(specs[i]->m_icon,NULL,specs[i]->m_icon);
+ m_hGroupIconA[i].PlayVisualRange(specs[i]->m_icon,nullptr,specs[i]->m_icon);
XuiElementSetShow(m_hGroupIconA[i].m_hObj,TRUE);
}
}
@@ -139,16 +139,16 @@ CXuiControl* CXuiSceneInventoryCreative::GetSectionControl( ESceneSection eSecti
switch( eSection )
{
case eSectionInventoryCreativeUsing:
- return (CXuiControl *)m_useRowControl;
+ return static_cast<CXuiControl *>(m_useRowControl);
break;
case eSectionInventoryCreativeSelector:
- return (CXuiControl *)m_containerControl;
+ return static_cast<CXuiControl *>(m_containerControl);
break;
default:
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
CXuiCtrlSlotList* CXuiSceneInventoryCreative::GetSectionSlotList( ESceneSection eSection )
@@ -165,7 +165,7 @@ CXuiCtrlSlotList* CXuiSceneInventoryCreative::GetSectionSlotList( ESceneSection
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
void CXuiSceneInventoryCreative::updateTabHighlightAndText(ECreativeInventoryTabs tab)
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp
index 8738e683..3fbca979 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp
@@ -27,7 +27,7 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
Minecraft *pMinecraft = Minecraft::GetInstance();
- TradingScreenInput* initData = (TradingScreenInput *)pInitData->pvInitData;
+ TradingScreenInput* initData = static_cast<TradingScreenInput *>(pInitData->pvInitData);
m_iPad=initData->iPad;
m_bSplitscreen=initData->bSplitscreen;
m_merchant = initData->trader;
@@ -39,9 +39,9 @@ HRESULT CXuiSceneTrading::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad);
}
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
- TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
+ TutorialMode *gameMode = static_cast<TutorialMode *>(pMinecraft->localgameModes[m_iPad]);
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Trading_Menu, this);
}
@@ -79,15 +79,15 @@ HRESULT CXuiSceneTrading::OnDestroy()
{
Minecraft *pMinecraft = Minecraft::GetInstance();
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
- TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ TutorialMode *gameMode = static_cast<TutorialMode *>(pMinecraft->localgameModes[m_iPad]);
+ if(gameMode != nullptr) 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -97,7 +97,7 @@ HRESULT CXuiSceneTrading::OnTransitionStart( XUIMessageTransition *pTransition,
if(pTransition->dwTransType == XUI_TRANSITION_TO || pTransition->dwTransType == XUI_TRANSITION_BACKTO)
{
- HXUIOBJ hObj=NULL;
+ HXUIOBJ hObj=nullptr;
HRESULT hr=XuiControlGetVisual(m_offerInfoControl.m_hObj,&hObj);
hr=XuiElementGetChildById(hObj,L"text_measurer",&m_hOfferInfoTextMeasurer);
hr=XuiElementGetChildById(hObj,L"text_name",&m_hOfferInfoText);
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp
index 99dc6e4c..326e6263 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp
@@ -22,12 +22,12 @@ HRESULT CXuiSceneTrap::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
Minecraft *pMinecraft = Minecraft::GetInstance();
- TrapScreenInput* initData = (TrapScreenInput*)pInitData->pvInitData;
+ TrapScreenInput* initData = static_cast<TrapScreenInput *>(pInitData->pvInitData);
m_iPad=initData->iPad;
m_bSplitscreen=initData->bSplitscreen;
#ifdef _XBOX
- if( pMinecraft->localgameModes[initData->iPad] != NULL )
+ if( pMinecraft->localgameModes[initData->iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[initData->iPad];
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
@@ -57,16 +57,16 @@ HRESULT CXuiSceneTrap::OnDestroy()
Minecraft *pMinecraft = Minecraft::GetInstance();
#ifdef _XBOX
- if( pMinecraft->localgameModes[m_iPad] != NULL )
+ if( pMinecraft->localgameModes[m_iPad] != nullptr )
{
TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[m_iPad];
- if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
+ if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState);
}
#endif
// 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(Minecraft::GetInstance()->localplayers[m_iPad] != NULL) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
+ if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
return S_OK;
}
@@ -87,7 +87,7 @@ CXuiControl* CXuiSceneTrap::GetSectionControl( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
CXuiCtrlSlotList* CXuiSceneTrap::GetSectionSlotList( ESceneSection eSection )
@@ -107,7 +107,7 @@ CXuiCtrlSlotList* CXuiSceneTrap::GetSectionSlotList( ESceneSection eSection )
assert( false );
break;
}
- return NULL;
+ return nullptr;
}
// 4J Stu - Added to support auto-save. Need to re-associate on a navigate back
diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp
index 19e6b016..c4c279a6 100644
--- a/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp
@@ -21,7 +21,7 @@ const float CScene_Win::PLAYER_SCROLL_SPEED = 3.0f;
//----------------------------------------------------------------------------------
HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
m_bIgnoreInput = false;
@@ -57,18 +57,18 @@ HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
noNoiseString = app.FormatHTMLString(m_iPad, noNoiseString, 0xff000000);
Random random(8124371);
- int found=(int)noNoiseString.find_first_of(L"{");
- int length;
+ size_t found=noNoiseString.find_first_of(L"{");
+ size_t length;
while (found!=string::npos)
{
length = random.nextInt(4) + 3;
m_noiseLengths.push_back(length);
- found=(int)noNoiseString.find_first_of(L"{",found+1);
+ found=noNoiseString.find_first_of(L"{", found + 1);
}
Minecraft *pMinecraft = Minecraft::GetInstance();
- if(pMinecraft->localplayers[s_winUserIndex] != NULL)
+ if(pMinecraft->localplayers[s_winUserIndex] != nullptr)
{
noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",pMinecraft->localplayers[s_winUserIndex]->name);
}
@@ -134,7 +134,7 @@ HRESULT CScene_Win::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
app.CloseAllPlayersXuiScenes();
for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i)
{
- if(pMinecraft->localplayers[i] != NULL)
+ if(pMinecraft->localplayers[i] != nullptr)
{
app.SetAction(i,eAppAction_Respawn);
}
@@ -143,7 +143,7 @@ HRESULT CScene_Win::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
// Show the other players scenes
CXuiSceneBase::ShowOtherPlayersBaseScene(pInputData->UserIndex, true);
// This just allows it to be shown
- if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true);
+ if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(true);
ui.UpdatePlayerBasePositions();
rfHandled = TRUE;
@@ -277,7 +277,7 @@ HRESULT CScene_Win::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
CXuiSceneBase::ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false);
// This just allows it to be shown
- if(Minecraft::GetInstance()->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) Minecraft::GetInstance()->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
+ if(Minecraft::GetInstance()->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) Minecraft::GetInstance()->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false);
// Temporarily make this scene fullscreen
CXuiSceneBase::SetPlayerBaseScenePosition( ProfileManager.GetPrimaryPad(), CXuiSceneBase::e_BaseScene_Fullscreen );
diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp
index c6dc7118..3c37b8d8 100644
--- a/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp
@@ -10,9 +10,9 @@
HRESULT CScene_SettingsAll::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
//WCHAR TempString[256];
- 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);
MapChildControls();
@@ -112,7 +112,7 @@ HRESULT CScene_SettingsAll::OnControlNavigate(XUIMessageControlNavigate *pContro
// added so we can skip greyed out items
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -181,7 +181,7 @@ HRESULT CScene_SettingsAll::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress*
HRESULT CScene_SettingsAll::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
{
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
// if we're not in the game, we need to use basescene 0
if(bNotInGame)
diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp
index 0f0fe2e3..6f399d55 100644
--- a/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp
@@ -7,9 +7,9 @@
HRESULT CScene_SettingsAudio::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
WCHAR TempString[256];
- 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);
MapChildControls();
@@ -86,13 +86,13 @@ HRESULT CScene_SettingsAudio::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotif
if(hObjSource==m_SliderA[SLIDER_SETTINGS_MUSIC].GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_MusicVolume,pNotifyValueChanged->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),pNotifyValueChanged->nValue);
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_MUSIC ),pNotifyValueChanged->nValue);
m_SliderA[SLIDER_SETTINGS_MUSIC].SetText(TempString);
}
else if(hObjSource==m_SliderA[SLIDER_SETTINGS_SOUND].GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_SoundFXVolume,pNotifyValueChanged->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),pNotifyValueChanged->nValue);
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),pNotifyValueChanged->nValue);
m_SliderA[SLIDER_SETTINGS_SOUND].SetText(TempString);
}
@@ -141,7 +141,7 @@ HRESULT CScene_SettingsAudio::OnControlNavigate(XUIMessageControlNavigate *pCont
// added so we can skip greyed out items
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -240,7 +240,7 @@ HRESULT CScene_SettingsAudio::OnTransitionStart( XUIMessageTransition *pTransiti
HRESULT CScene_SettingsAudio::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
{
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
// if we're not in the game, we need to use basescene 0
if(bNotInGame)
diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp
index 7e2835a2..4fa335fb 100644
--- a/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp
@@ -10,9 +10,9 @@
HRESULT CScene_SettingsControl::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
WCHAR TempString[256];
- 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);
MapChildControls();
@@ -66,13 +66,13 @@ HRESULT CScene_SettingsControl::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot
if(hObjSource==m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INGAME].GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_Sensitivity_InGame,pNotifyValueChanged->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),pNotifyValueChanged->nValue);
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INGAME ),pNotifyValueChanged->nValue);
m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INGAME].SetText(TempString);
}
else if(hObjSource==m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INMENU].GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_Sensitivity_InMenu,pNotifyValueChanged->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),pNotifyValueChanged->nValue);
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SENSITIVITY_INMENU ),pNotifyValueChanged->nValue);
m_SliderA[SLIDER_SETTINGS_SENSITIVITY_INMENU].SetText(TempString);
}
@@ -120,7 +120,7 @@ HRESULT CScene_SettingsControl::OnControlNavigate(XUIMessageControlNavigate *pCo
// added so we can skip greyed out items
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -218,7 +218,7 @@ HRESULT CScene_SettingsControl::OnTransitionStart( XUIMessageTransition *pTransi
HRESULT CScene_SettingsControl::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
{
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
// if we're not in the game, we need to use basescene 0
if(bNotInGame)
diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp
index 48a933e2..d73baa0b 100644
--- a/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp
@@ -10,9 +10,9 @@
HRESULT CScene_SettingsGraphics::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
WCHAR TempString[256];
- 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 bIsPrimaryPad=(ProfileManager.GetPrimaryPad()==m_iPad);
MapChildControls();
@@ -139,13 +139,13 @@ HRESULT CScene_SettingsGraphics::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINo
if(hObjSource==m_SliderA[SLIDER_SETTINGS_GAMMA].GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_Gamma,pNotifyValueChanged->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),pNotifyValueChanged->nValue);
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_GAMMA ),pNotifyValueChanged->nValue);
m_SliderA[SLIDER_SETTINGS_GAMMA].SetText(TempString);
}
else if(hObjSource==m_SliderA[SLIDER_SETTINGS_INTERFACE_OPACITY].GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_InterfaceOpacity,pNotifyValueChanged->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),pNotifyValueChanged->nValue);
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_INTERFACEOPACITY ),pNotifyValueChanged->nValue);
m_SliderA[SLIDER_SETTINGS_INTERFACE_OPACITY].SetText(TempString);
}
@@ -198,7 +198,7 @@ HRESULT CScene_SettingsGraphics::OnControlNavigate(XUIMessageControlNavigate *pC
// added so we can skip greyed out items
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -310,7 +310,7 @@ HRESULT CScene_SettingsGraphics::OnTransitionStart( XUIMessageTransition *pTrans
HRESULT CScene_SettingsGraphics::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
{
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
// if we're not in the game, we need to use basescene 0
if(bNotInGame)
diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp
index 526847c7..683ee175 100644
--- a/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp
@@ -26,9 +26,9 @@ int CScene_SettingsOptions::m_iDifficultyTitleSettingA[4]=
HRESULT CScene_SettingsOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
WCHAR TempString[256];
- 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 bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad;
MapChildControls();
@@ -274,14 +274,14 @@ HRESULT CScene_SettingsOptions::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINot
else
{
app.SetAutosaveTimerTime();
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),pNotifyValueChanged->nValue*15, app.GetString( IDS_MINUTES ));
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),pNotifyValueChanged->nValue*15, app.GetString( IDS_MINUTES ));
}
m_SliderA[SLIDER_SETTINGS_AUTOSAVE].SetText(TempString);
}
else if(hObjSource==m_SliderA[SLIDER_SETTINGS_DIFFICULTY].GetSlider() )
{
app.SetGameSettings(m_iPad,eGameSetting_Difficulty,pNotifyValueChanged->nValue);
- swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue]));
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[pNotifyValueChanged->nValue]));
m_SliderA[SLIDER_SETTINGS_DIFFICULTY].SetText(TempString);
wstring wsText=app.GetString(m_iDifficultySettingA[pNotifyValueChanged->nValue]);
@@ -353,7 +353,7 @@ HRESULT CScene_SettingsOptions::OnControlNavigate(XUIMessageControlNavigate *pCo
// added so we can skip greyed out items
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -467,7 +467,7 @@ HRESULT CScene_SettingsOptions::OnTransitionStart( XUIMessageTransition *pTransi
// Need to refresh the scenes visual since the object size has now changed
XuiControlAttachVisual(m_hObj);
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
if(bNotInGame)
{
diff --git a/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp b/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp
index da95d084..ab9cc53b 100644
--- a/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp
@@ -10,9 +10,9 @@
HRESULT CScene_SettingsUI::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
WCHAR TempString[256];
- 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 bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad;
MapChildControls();
@@ -115,7 +115,7 @@ HRESULT CScene_SettingsUI::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyVa
// slider is 1 to 3
// is this different from the current value?
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),pNotifyValueChanged->nValue);
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZE ),pNotifyValueChanged->nValue);
m_SliderA[SLIDER_SETTINGS_UISIZE].SetText(TempString);
if(pNotifyValueChanged->nValue != app.GetGameSettings(m_iPad,eGameSetting_UISize)+1)
{
@@ -126,7 +126,7 @@ HRESULT CScene_SettingsUI::OnNotifyValueChanged( HXUIOBJ hObjSource, XUINotifyVa
}
else if(hObjSource==m_SliderA[SLIDER_SETTINGS_UISIZESPLITSCREEN].GetSlider() )
{
- swprintf( (WCHAR *)TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),pNotifyValueChanged->nValue);
+ swprintf( static_cast<WCHAR *>(TempString), 256, L"%ls: %d", app.GetString( IDS_SLIDER_UISIZESPLITSCREEN ),pNotifyValueChanged->nValue);
m_SliderA[SLIDER_SETTINGS_UISIZESPLITSCREEN].SetText(TempString);
if(pNotifyValueChanged->nValue != app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen)+1)
@@ -210,7 +210,7 @@ HRESULT CScene_SettingsUI::OnControlNavigate(XUIMessageControlNavigate *pControl
// added so we can skip greyed out items
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest!=NULL)
+ if(pControlNavigateData->hObjDest!=nullptr)
{
bHandled=TRUE;
}
@@ -353,7 +353,7 @@ HRESULT CScene_SettingsUI::OnTransitionStart( XUIMessageTransition *pTransition,
HRESULT CScene_SettingsUI::OnNavReturn(HXUIOBJ hObj,BOOL& rfHandled)
{
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
// if we're not in the game, we need to use basescene 0
if(bNotInGame)
diff --git a/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp b/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp
index 378ac147..963d8f10 100644
--- a/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp
@@ -15,7 +15,7 @@ HRESULT CScene_SignEntry::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
XuiControlSetText(m_ButtonDone,app.GetString(IDS_DONE));
XuiControlSetText(m_labelEditSign,app.GetString(IDS_EDIT_SIGN_MESSAGE));
- SignEntryScreenInput* initData = (SignEntryScreenInput*)pInitData->pvInitData;
+ SignEntryScreenInput* initData = static_cast<SignEntryScreenInput *>(pInitData->pvInitData);
m_sign = initData->sign;
CXuiSceneBase::ShowDarkOverlay( initData->iPad, TRUE );
@@ -75,9 +75,9 @@ HRESULT CScene_SignEntry::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* p
if (pMinecraft->level->isClientSide)
{
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[pNotifyPressData->UserIndex];
- if(player != NULL && player->connection && player->connection->isStarted())
+ if(player != nullptr && player->connection && player->connection->isStarted())
{
- player->connection->send( shared_ptr<SignUpdatePacket>( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) );
+ player->connection->send(std::make_shared<SignUpdatePacket>(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()));
}
}
app.CloseXuiScenes(pNotifyPressData->UserIndex);
diff --git a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp
index ee706610..b92159c0 100644
--- a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp
@@ -26,9 +26,9 @@ WCHAR *CScene_SkinSelect::wchDefaultNamesA[]=
//----------------------------------------------------------------------------------
HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- 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);
m_bIgnoreInput=false;
// 4J Stu - Added this so that we have skins loaded
@@ -46,7 +46,7 @@ HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
m_skinIndex = 0;
m_currentSkinPath = app.GetPlayerSkinName(m_iPad);
m_originalSkinId = app.GetPlayerSkinId(m_iPad);
- m_currentPack = NULL;
+ m_currentPack = nullptr;
m_bSlidingSkins = false;
m_bAnimatingMove = false;
currentPackCount = 0;
@@ -86,7 +86,7 @@ HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
// Change to display the favorites if there are any. The current skin will be in there (probably) - need to check for it
m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath);
bool bFound;
- if(m_currentPack != NULL)
+ if(m_currentPack != nullptr)
{
m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS;
}
@@ -232,7 +232,7 @@ HRESULT CScene_SkinSelect::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle
}
break;
default:
- if( m_currentPack != NULL )
+ if( m_currentPack != nullptr )
{
DLCSkinFile *skinFile = m_currentPack->getSkinFile(m_skinIndex);
@@ -266,7 +266,7 @@ HRESULT CScene_SkinSelect::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandle
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_currentPack->getPurchaseOfferId());
ULONGLONG ullOfferID_Full;
- if(pDLCInfo!=NULL)
+ if(pDLCInfo!=nullptr)
{
ullOfferID_Full=pDLCInfo->ullOfferID_Full;
}
@@ -626,8 +626,8 @@ void CScene_SkinSelect::handleSkinIndexChanged()
wstring skinOrigin = L"";
bool bSkinIsFree=false;
bool bLicensed=false;
- DLCSkinFile *skinFile=NULL;
- DLCPack *Pack=NULL;
+ DLCSkinFile *skinFile=nullptr;
+ DLCPack *Pack=nullptr;
BYTE sidePreviewControlsL,sidePreviewControlsR;
bool bNoSkinsToShow=false;
@@ -635,7 +635,7 @@ void CScene_SkinSelect::handleSkinIndexChanged()
m_selectedGroup.SetShow( FALSE );
m_skinDetails.SetShow( FALSE );
- if( m_currentPack != NULL )
+ if( m_currentPack != nullptr )
{
skinFile = m_currentPack->getSkinFile(m_skinIndex);
m_selectedSkinPath = skinFile->getPath();
@@ -665,7 +665,7 @@ void CScene_SkinSelect::handleSkinIndexChanged()
{
m_selectedSkinPath = L"";
m_selectedCapePath = L"";
- m_vAdditionalSkinBoxes = NULL;
+ m_vAdditionalSkinBoxes = nullptr;
switch(m_packIndex)
{
@@ -753,13 +753,13 @@ void CScene_SkinSelect::handleSkinIndexChanged()
{
// add the boxes to the humanoid model, but only if we've not done this already
vector<ModelPart *> *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID());
- if(pAdditionalModelParts==NULL)
+ if(pAdditionalModelParts==nullptr)
{
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),m_vAdditionalSkinBoxes);
}
}
- if(skinFile!=NULL)
+ if(skinFile!=nullptr)
{
app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask());
}
@@ -774,7 +774,7 @@ void CScene_SkinSelect::handleSkinIndexChanged()
wstring otherSkinPath = L"";
wstring otherCapePath = L"";
- vector<SKIN_BOX *> *othervAdditionalSkinBoxes=NULL;
+ vector<SKIN_BOX *> *othervAdditionalSkinBoxes=nullptr;
wchar_t chars[256];
// turn off all displays
@@ -820,10 +820,10 @@ void CScene_SkinSelect::handleSkinIndexChanged()
{
if(showNext)
{
- skinFile=NULL;
+ skinFile=nullptr;
m_previewNextControls[i]->SetShow(TRUE);
- if( m_currentPack != NULL )
+ if( m_currentPack != nullptr )
{
skinFile = m_currentPack->getSkinFile(nextIndex);
otherSkinPath = skinFile->getPath();
@@ -835,7 +835,7 @@ void CScene_SkinSelect::handleSkinIndexChanged()
{
otherSkinPath = L"";
otherCapePath = L"";
- othervAdditionalSkinBoxes=NULL;
+ othervAdditionalSkinBoxes=nullptr;
switch(m_packIndex)
{
case SKIN_SELECT_PACK_DEFAULT:
@@ -867,13 +867,13 @@ void CScene_SkinSelect::handleSkinIndexChanged()
if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0)
{
vector<ModelPart *> *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID());
- if(pAdditionalModelParts==NULL)
+ if(pAdditionalModelParts==nullptr)
{
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes);
}
}
// 4J-PB - anim override needs set before SetTexture
- if(skinFile!=NULL)
+ if(skinFile!=nullptr)
{
app.SetAnimOverrideBitmask(skinFile->getSkinID(),skinFile->getAnimOverrideBitmask());
}
@@ -892,10 +892,10 @@ void CScene_SkinSelect::handleSkinIndexChanged()
{
if(showPrevious)
{
- skinFile=NULL;
+ skinFile=nullptr;
m_previewPreviousControls[i]->SetShow(TRUE);
- if( m_currentPack != NULL )
+ if( m_currentPack != nullptr )
{
skinFile = m_currentPack->getSkinFile(previousIndex);
otherSkinPath = skinFile->getPath();
@@ -907,7 +907,7 @@ void CScene_SkinSelect::handleSkinIndexChanged()
{
otherSkinPath = L"";
otherCapePath = L"";
- othervAdditionalSkinBoxes=NULL;
+ othervAdditionalSkinBoxes=nullptr;
switch(m_packIndex)
{
case SKIN_SELECT_PACK_DEFAULT:
@@ -939,7 +939,7 @@ void CScene_SkinSelect::handleSkinIndexChanged()
if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0)
{
vector<ModelPart *> *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID());
- if(pAdditionalModelParts==NULL)
+ if(pAdditionalModelParts==nullptr)
{
pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes);
}
@@ -957,7 +957,7 @@ void CScene_SkinSelect::handleSkinIndexChanged()
}
// update the tooltips
- bool bNotInGame=(Minecraft::GetInstance()->level==NULL);
+ bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
if(bNoSkinsToShow)
{
@@ -1001,10 +1001,10 @@ void CScene_SkinSelect::handlePackIndexChanged()
}
else
{
- m_currentPack = NULL;
+ m_currentPack = nullptr;
}
m_skinIndex = 0;
- if(m_currentPack != NULL)
+ if(m_currentPack != nullptr)
{
bool found;
DWORD currentSkinIndex = m_currentPack->getSkinIndexAt(m_currentSkinPath, found);
@@ -1021,7 +1021,7 @@ void CScene_SkinSelect::handlePackIndexChanged()
DWORD defaultSkinIndex = GET_DEFAULT_SKIN_ID_FROM_BITMASK(m_originalSkinId);
if( ugcSkinIndex == 0 )
{
- m_skinIndex = (EDefaultSkins) defaultSkinIndex;
+ m_skinIndex = static_cast<EDefaultSkins>(defaultSkinIndex);
}
}
break;
@@ -1199,7 +1199,7 @@ int CScene_SkinSelect::getNextSkinIndex(DWORD sourceIndex)
{
nextSkin = eDefaultSkins_ServerSelected;
}
- else if(m_currentPack != NULL && nextSkin>=m_currentPack->getSkinCount())
+ else if(m_currentPack != nullptr && nextSkin>=m_currentPack->getSkinCount())
{
nextSkin = 0;
}
@@ -1233,7 +1233,7 @@ int CScene_SkinSelect::getPreviousSkinIndex(DWORD sourceIndex)
{
previousSkin = eDefaultSkins_Count - 1;
}
- else if(m_currentPack != NULL)
+ else if(m_currentPack != nullptr)
{
previousSkin = m_currentPack->getSkinCount()-1;
}
@@ -1311,7 +1311,7 @@ void CScene_SkinSelect::updateClipping()
int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
- CScene_SkinSelect* pScene = (CScene_SkinSelect*)pParam;
+ CScene_SkinSelect* pScene = static_cast<CScene_SkinSelect *>(pParam);
#ifdef _XBOX
if(result==C4JStorage::EMessage_ResultAccept)
{
@@ -1320,7 +1320,7 @@ int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMes
ULONGLONG ullIndexA[1];
DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_currentPack->getPurchaseOfferId());
- if(pDLCInfo!=NULL)
+ if(pDLCInfo!=nullptr)
{
ullIndexA[0]=pDLCInfo->ullOfferID_Full;
}
@@ -1330,13 +1330,13 @@ int CScene_SkinSelect::UnlockSkinReturned(void *pParam,int iPad,C4JStorage::EMes
}
// If we're in-game, then we need to enable DLC downloads. They'll be set back to Auto on leaving the pause menu
- if(Minecraft::GetInstance()->level!=NULL)
+ if(Minecraft::GetInstance()->level!=nullptr)
{
// need to allow downloads here, or the player would need to quit the game to let the download of a skin 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);
// the license change coming in when the offer has been installed will cause this scene to refresh
}
@@ -1380,7 +1380,7 @@ HRESULT CScene_SkinSelect::OnCustomMessage_DLCMountingComplete()
if(app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin)>0)
{
m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath);
- if(m_currentPack != NULL)
+ if(m_currentPack != nullptr)
{
bool bFound = false;
m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS;
@@ -1400,7 +1400,7 @@ HRESULT CScene_SkinSelect::OnCustomMessage_DLCMountingComplete()
updateCurrentFocus();
m_bIgnoreInput=false;
app.m_dlcManager.checkForCorruptDLCAndAlert();
- bool bInGame=(Minecraft::GetInstance()->level!=NULL);
+ bool bInGame=(Minecraft::GetInstance()->level!=nullptr);
if(bInGame) XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO);
diff --git a/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp b/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp
index f237e7d8..2bd84263 100644
--- a/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp
@@ -21,7 +21,7 @@
//----------------------------------------------------------------------------------
HRESULT CScene_SocialPost::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad = *(int *)pInitData->pvInitData;
+ m_iPad = *static_cast<int *>(pInitData->pvInitData);
MapChildControls();
@@ -48,8 +48,8 @@ HRESULT CScene_SocialPost::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
wstring wDesc = m_EditDesc.GetText();
// set the caret to the end of the default text
- m_EditCaption.SetCaretPosition((int)wCaption.length());
- m_EditDesc.SetCaretPosition((int)wDesc.length());
+ m_EditCaption.SetCaretPosition(static_cast<int>(wCaption.length()));
+ m_EditDesc.SetCaretPosition(static_cast<int>(wDesc.length()));
BOOL bHasAllText = /*( wTitle.length()!=0) && */(wCaption.length()!=0) && (wDesc.length()!=0);
@@ -89,7 +89,7 @@ HRESULT CScene_SocialPost::OnControlNavigate(XUIMessageControlNavigate *pControl
{
pControlNavigateData->hObjDest=XuiControlGetNavigation(pControlNavigateData->hObjSource,pControlNavigateData->nControlNavigate,TRUE,TRUE);
- if(pControlNavigateData->hObjDest==NULL)
+ if(pControlNavigateData->hObjDest==nullptr)
{
pControlNavigateData->hObjDest=pControlNavigateData->hObjSource;
}
diff --git a/Minecraft.Client/Common/XUI/XUI_Teleport.cpp b/Minecraft.Client/Common/XUI/XUI_Teleport.cpp
index 1d6ac3bf..bbf0005e 100644
--- a/Minecraft.Client/Common/XUI/XUI_Teleport.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_Teleport.cpp
@@ -21,7 +21,7 @@
//----------------------------------------------------------------------------------
HRESULT CScene_Teleport::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- TeleportMenuInitData *initParam = (TeleportMenuInitData *)pInitData->pvInitData;
+ TeleportMenuInitData *initParam = static_cast<TeleportMenuInitData *>(pInitData->pvInitData);
m_iPad = initParam->iPad;
m_teleportToPlayer = initParam->teleportToPlayer;
@@ -51,7 +51,7 @@ HRESULT CScene_Teleport::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i );
- if( player != NULL && !(player->IsLocal() && player->GetUserIndex() == m_iPad) )
+ if( player != nullptr && !(player->IsLocal() && player->GetUserIndex() == m_iPad) )
{
m_players[m_playersCount] = player->GetSmallId();
++m_playersCount;
@@ -125,7 +125,7 @@ HRESULT CScene_Teleport::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* pN
void CScene_Teleport::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving)
{
- CScene_Teleport *scene = (CScene_Teleport *)callbackParam;
+ CScene_Teleport *scene = static_cast<CScene_Teleport *>(callbackParam);
bool playerFound = false;
for(int i = 0; i < scene->m_playersCount; ++i)
@@ -167,7 +167,7 @@ HRESULT CScene_Teleport::OnGetSourceDataText(XUIMessageGetSourceText *pGetSource
if( pGetSourceTextData->iItem < m_playersCount )
{
INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId( m_players[pGetSourceTextData->iItem] );
- if( player != NULL )
+ if( player != nullptr )
{
#ifndef _CONTENT_PACKAGE
if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards)))
@@ -253,7 +253,7 @@ HRESULT CScene_Teleport::OnGetSourceDataText(XUIMessageGetSourceText *pGetSource
hr=XuiElementGetChildById(hVisual,L"VoiceGroup",&hVoiceIcon);
playFrame = -1;
- if(player != NULL && player->HasVoice() )
+ if(player != nullptr && player->HasVoice() )
{
if( player->IsMutedByLocalUser(m_iPad) )
{
diff --git a/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp b/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp
index 0369928b..5eff65e8 100644
--- a/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_TextEntry.cpp
@@ -24,7 +24,7 @@ HRESULT CScene_TextEntry::Init_Commands()
HRESULT CScene_TextEntry::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
MapChildControls();
- XuiTextInputParams *params = (XuiTextInputParams *)pInitData->pvInitData;
+ XuiTextInputParams *params = static_cast<XuiTextInputParams *>(pInitData->pvInitData);
m_iPad=params->iPad;
m_wchInitialChar=params->wch;
delete params;
diff --git a/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp b/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp
index 5a2e67b4..da224f7a 100644
--- a/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp
@@ -16,7 +16,7 @@
HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
m_iX=-1;
- m_params = (LoadMenuInitData *)pInitData->pvInitData;
+ m_params = static_cast<LoadMenuInitData *>(pInitData->pvInitData);
m_iPad=m_params->iPad;
@@ -26,9 +26,9 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHand
VOID *pObj;
XuiObjectFromHandle( m_SavesSlotList, &pObj );
- m_pSavesSlotList = (CXuiCtrl4JList *)pObj;
+ m_pSavesSlotList = static_cast<CXuiCtrl4JList *>(pObj);
- m_pbImageData=NULL;
+ m_pbImageData=nullptr;
m_dwImageBytes=0;
StorageManager.GetSaveCacheFileInfo(m_params->iSaveGameInfoIndex,m_XContentData);
@@ -48,7 +48,7 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHand
// saves will be called slot1 to slotx
// there will be a details file with the names and png of each slot
- m_pbSlotListFile=NULL;
+ m_pbSlotListFile=nullptr;
m_uiSlotListFileBytes=0;
if(StorageManager.TMSPP_InFileList(C4JStorage::eGlobalStorage_TitleUser,m_iPad,L"XboxOne/SlotList"))
@@ -86,7 +86,7 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHand
//----------------------------------------------------------------------------------
int CScene_TransferToXboxOne::TMSPPWriteReturned(LPVOID pParam,int iPad,int iUserData)
{
- CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) pParam;
+ CScene_TransferToXboxOne* pClass = static_cast<CScene_TransferToXboxOne *>(pParam);
pClass->m_bWaitingForWrite=false;
return 0;
@@ -97,13 +97,13 @@ int CScene_TransferToXboxOne::TMSPPWriteReturned(LPVOID pParam,int iPad,int iUse
//----------------------------------------------------------------------------------
int CScene_TransferToXboxOne::TMSPPDeleteReturned(LPVOID pParam,int iPad,int iUserData)
{
- CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) pParam;
+ CScene_TransferToXboxOne* pClass = static_cast<CScene_TransferToXboxOne *>(pParam);
pClass->m_SavesSlotListTimer.SetShow(FALSE);
pClass->m_bIgnoreInput=false;
// update the slots
delete pClass->m_pbSlotListFile;
- pClass->m_pbSlotListFile=NULL;
+ pClass->m_pbSlotListFile=nullptr;
pClass->m_uiSlotListFileBytes=0;
pClass->m_pSavesSlotList->RemoveAllData();
CXuiCtrl4JList::LIST_ITEM_INFO ListInfo;
@@ -129,7 +129,7 @@ int CScene_TransferToXboxOne::TMSPPDeleteReturned(LPVOID pParam,int iPad,int iUs
//----------------------------------------------------------------------------------
int CScene_TransferToXboxOne::TMSPPSlotListReturned(LPVOID pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename)
{
- CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) pParam;
+ CScene_TransferToXboxOne* pClass = static_cast<CScene_TransferToXboxOne *>(pParam);
unsigned int uiSlotListFileSlots=*((unsigned int *)pFileData->pbData);
pClass->m_pbSlotListFile=pFileData->pbData;
pClass->m_uiSlotListFileBytes=pFileData->dwSize;
@@ -220,7 +220,7 @@ HRESULT CScene_TransferToXboxOne::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
// check if there is a save there
CXuiCtrl4JList::LIST_ITEM_INFO info = m_pSavesSlotList->GetData(iIndex);
- if(info.pwszImage!=NULL)
+ if(info.pwszImage!=nullptr)
{
// we have a save here
// Are you sure, etc.
@@ -252,10 +252,10 @@ HRESULT CScene_TransferToXboxOne::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotify
HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbImageData,DWORD dwImageBytes )
{
- SLOTDATA *pCurrentSlotData=NULL;
- PBYTE pbCurrentSlotDataPtr=NULL;
+ SLOTDATA *pCurrentSlotData=nullptr;
+ PBYTE pbCurrentSlotDataPtr=nullptr;
// there may be no slot file yet
- if(m_pbSlotListFile!=NULL)
+ if(m_pbSlotListFile!=nullptr)
{
pCurrentSlotData=(SLOTDATA *)(m_pbSlotListFile+sizeof(unsigned int));
pbCurrentSlotDataPtr=m_pbSlotListFile + sizeof(unsigned int) + sizeof(SLOTDATA)*m_MaxSlotC;
@@ -298,7 +298,7 @@ HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbI
}
else
{
- if(pbCurrentSlotDataPtr!=NULL)
+ if(pbCurrentSlotDataPtr!=nullptr)
{
memcpy(pbNewSlotImageDataPtr,pbCurrentSlotDataPtr,pCurrentSlotData[i].uiImageLength);
pbNewSlotImageDataPtr+=pCurrentSlotData[i].uiImageLength;
@@ -307,7 +307,7 @@ HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbI
}
// move to the next image data in the current slot file
- if(pbCurrentSlotDataPtr!=NULL)
+ if(pbCurrentSlotDataPtr!=nullptr)
{
pbCurrentSlotDataPtr+=pCurrentSlotData[i].uiImageLength;
}
@@ -323,7 +323,7 @@ HRESULT CScene_TransferToXboxOne::BuildSlotFile(int iIndexBeingUpdated,PBYTE pbI
LoadingInputParams *loadingParams = new LoadingInputParams();
loadingParams->func = &CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc;
- loadingParams->lpParam = (LPVOID)this;
+ loadingParams->lpParam = static_cast<LPVOID>(this);
UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData();
completionData->bShowBackground=TRUE;
@@ -342,7 +342,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc( LPVOID lpParameter
{
HRESULT hr = S_OK;
char szFilename[32];
- CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne *) lpParameter;
+ CScene_TransferToXboxOne* pClass = static_cast<CScene_TransferToXboxOne *>(lpParameter);
Minecraft *pMinecraft = Minecraft::GetInstance();
unsigned int uiComplete=0;
pClass->m_bWaitingForWrite=true;
@@ -415,7 +415,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc( LPVOID lpParameter
for(int i=0;i<(pClass->m_uiStorageLength/uiChunkSize)+1;i++)
{
sprintf( szFilename, "XboxOne/Slot%.2d%.2d", pClass->m_uiSlotID,i );
- PCHAR pchData=((PCHAR)pClass->m_pvSaveMem)+i*uiChunkSize;
+ PCHAR pchData=static_cast<PCHAR>(pClass->m_pvSaveMem)+i*uiChunkSize;
pClass->m_bWaitingForWrite=true;
if(uiBytesLeft>=uiChunkSize)
@@ -461,7 +461,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc( LPVOID lpParameter
int CScene_TransferToXboxOne::LoadSaveDataReturned(void *pParam,bool bContinue)
{
- CScene_TransferToXboxOne* pClass = (CScene_TransferToXboxOne*)pParam;
+ CScene_TransferToXboxOne* pClass = static_cast<CScene_TransferToXboxOne *>(pParam);
if(bContinue==true)
{
@@ -502,7 +502,7 @@ HRESULT CScene_TransferToXboxOne::OnKeyDown(XUIMessageInput* pInputData, BOOL& r
break;
case VK_PAD_X:
// wipe the save slots
- if(m_pbSlotListFile!=NULL)
+ if(m_pbSlotListFile!=nullptr)
{
m_SavesSlotListTimer.SetShow(TRUE);
m_bIgnoreInput=true;
diff --git a/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp b/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp
index 51121099..d99df998 100644
--- a/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_TrialExitUpsell.cpp
@@ -19,7 +19,7 @@ WCHAR *CScene_TrialExitUpsell::wchImages[]=
//----------------------------------------------------------------------------------
HRESULT CScene_TrialExitUpsell::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad=*(int *)pInitData->pvInitData;
+ m_iPad=*static_cast<int *>(pInitData->pvInitData);
MapChildControls();
diff --git a/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp b/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp
index 98951d81..29893d04 100644
--- a/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp
@@ -14,7 +14,7 @@ HRESULT CScene_TutorialPopup::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
{
HRESULT hr = S_OK;
- tutorial = (Tutorial *)pInitData->pvInitData;
+ tutorial = static_cast<Tutorial *>(pInitData->pvInitData);
m_iPad = tutorial->getPad();
MapChildControls();
@@ -29,7 +29,7 @@ HRESULT CScene_TutorialPopup::OnInit( XUIMessageInit* pInitData, BOOL& bHandled
m_textFontSize = _fromString<int>( m_fontSizeControl.GetText() );
m_fontSizeControl.SetShow(false);
- m_interactScene = NULL;
+ m_interactScene = nullptr;
m_lastSceneMovedLeft = false;
m_bAllowFade = false;
@@ -63,7 +63,7 @@ HRESULT CScene_TutorialPopup::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled)
void CScene_TutorialPopup::UpdateInteractScenePosition(bool visible)
{
- if( m_interactScene == NULL ) return;
+ if( m_interactScene == nullptr ) return;
// 4J-PB - check this players screen section to see if we should allow the animation
bool bAllowAnim=false;
@@ -146,8 +146,8 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR
{
HRESULT hr = S_OK;
m_interactScene = interactScene;
- if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL;
- if(desc == NULL)
+ if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = nullptr;
+ if(desc == nullptr)
{
SetShow( false );
XuiSetTimer(m_hObj,TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME);
@@ -195,7 +195,7 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR
hr = XuiElementGetPosition( m_title, &titlePos );
BOOL titleShowAtStart = m_title.IsShown();
- if( title != NULL && title[0] != 0 )
+ if( title != nullptr && title[0] != 0 )
{
m_title.SetText( title );
m_title.SetShow(TRUE);
@@ -241,7 +241,7 @@ HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR
SetBounds(fWidth, fHeight + heightDiff);
m_description.GetBounds(&fWidth,&fHeight);
- m_description.SetBounds(fWidth, (float)(contentDims.nPageHeight + heightDiff));
+ m_description.SetBounds(fWidth, static_cast<float>(contentDims.nPageHeight + heightDiff));
}
return hr;
}
@@ -269,7 +269,7 @@ HRESULT CScene_TutorialPopup::SetDescription(int iPad, TutorialPopupInfo *info)
parsed = CScene_TutorialPopup::ParseDescription(iPad, parsed);
if(parsed.empty())
{
- hr = pThis->_SetDescription( info->interactScene, NULL, NULL, info->allowFade, info->isReminder );
+ hr = pThis->_SetDescription( info->interactScene, nullptr, nullptr, info->allowFade, info->isReminder );
}
else
{
@@ -289,7 +289,7 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS
if( icon != TUTORIAL_NO_ICON )
{
bool itemIsFoil = false;
- itemIsFoil = (shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal)))->isFoil();
+ itemIsFoil = (std::make_shared<ItemInstance>(icon, 1, iAuxVal))->isFoil();
if(!itemIsFoil) itemIsFoil = isFoil;
m_pCraftingPic->SetIcon(m_iPad, icon,iAuxVal,1,10,31,false,itemIsFoil);
@@ -298,13 +298,13 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS
{
wstring openTag(L"{*ICON*}");
wstring closeTag(L"{*/ICON*}");
- int iconTagStartPos = (int)temp.find(openTag);
- int iconStartPos = iconTagStartPos + (int)openTag.length();
- if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() )
+ size_t iconTagStartPos = temp.find(openTag);
+ size_t iconStartPos = iconTagStartPos + openTag.length();
+ if( iconTagStartPos > 0 && iconStartPos < temp.length() )
{
- int iconEndPos = (int)temp.find( closeTag, iconStartPos );
+ size_t iconEndPos = temp.find(closeTag, iconStartPos);
- if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() )
+ if(iconEndPos > iconStartPos && iconEndPos < temp.length() )
{
wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos);
@@ -322,7 +322,7 @@ wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWS
}
bool itemIsFoil = false;
- itemIsFoil = (shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal)))->isFoil();
+ itemIsFoil = (std::make_shared<ItemInstance>(iconId, 1, iAuxVal))->isFoil();
if(!itemIsFoil) itemIsFoil = isFoil;
m_pCraftingPic->SetIcon(m_iPad, iconId,iAuxVal,1,10,31,false,itemIsFoil);
@@ -443,13 +443,13 @@ wstring CScene_TutorialPopup::_SetImage(wstring &desc)
wstring openTag(L"{*IMAGE*}");
wstring closeTag(L"{*/IMAGE*}");
- int imageTagStartPos = (int)desc.find(openTag);
- int imageStartPos = imageTagStartPos + (int)openTag.length();
- if( imageTagStartPos > 0 && imageStartPos < (int)desc.length() )
+ size_t imageTagStartPos = desc.find(openTag);
+ size_t imageStartPos = imageTagStartPos + openTag.length();
+ if( imageTagStartPos > 0 && imageStartPos < desc.length() )
{
- int imageEndPos = (int)desc.find( closeTag, imageStartPos );
+ size_t imageEndPos = desc.find(closeTag, imageStartPos);
- if(imageEndPos > imageStartPos && imageEndPos < (int)desc.length() )
+ if(imageEndPos > imageStartPos && imageEndPos < desc.length() )
{
wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos);
m_image.SetImagePath( id.c_str() );
@@ -564,7 +564,7 @@ HRESULT CScene_TutorialPopup::SetSceneVisible(int iPad, bool show)
if( XuiClassDerivesFrom( objClass, thisClass ) )
{
CScene_TutorialPopup *pThis;
- hr = XuiObjectFromHandle(hObj, (void **) &pThis);
+ hr = XuiObjectFromHandle(hObj, static_cast<void **>(&pThis));
if (FAILED(hr))
return hr;
@@ -593,7 +593,7 @@ bool CScene_TutorialPopup::IsSceneVisible(int iPad)
if( XuiClassDerivesFrom( objClass, thisClass ) )
{
CScene_TutorialPopup *pThis;
- hr = XuiObjectFromHandle(hObj, (void **) &pThis);
+ hr = XuiObjectFromHandle(hObj, static_cast<void **>(&pThis));
if (FAILED(hr))
return false;
diff --git a/Minecraft.Client/Common/XUI/XUI_debug.cpp b/Minecraft.Client/Common/XUI/XUI_debug.cpp
index 61b818a0..9aee3888 100644
--- a/Minecraft.Client/Common/XUI/XUI_debug.cpp
+++ b/Minecraft.Client/Common/XUI/XUI_debug.cpp
@@ -50,7 +50,7 @@ LPCWSTR CScene_Debug::m_DebugButtonTextA[eDebugButton_Max+1]=
//----------------------------------------------------------------------------------
HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
{
- m_iPad=*(int *)pInitData->pvInitData;
+ m_iPad=*static_cast<int *>(pInitData->pvInitData);
// set text and enable any debug options required
int iCheckboxIndex=0;
@@ -89,7 +89,7 @@ HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
XuiCreateObject( XUI_CLASS_CHECKBOX, &m_DebugCheckboxDataA[iCheckboxIndex].hXuiObj );
XuiObjectFromHandle( m_DebugCheckboxDataA[iCheckboxIndex].hXuiObj, &m_DebugCheckboxDataA[iCheckboxIndex].pvData );
- pCheckbox = (CXuiCheckbox *)m_DebugCheckboxDataA[iCheckboxIndex].pvData;
+ pCheckbox = static_cast<CXuiCheckbox *>(m_DebugCheckboxDataA[iCheckboxIndex].pvData);
//m_phXuiObjA[iElementIndex] = pCheckbox->m_hObj;
pCheckbox->SetText(m_DebugCheckboxTextA[iCheckboxIndex]);
pCheckbox->SetShow(TRUE);
@@ -139,7 +139,7 @@ HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
XuiCreateObject( XUI_CLASS_BUTTON, &m_DebugButtonDataA[iButtonIndex].hXuiObj );
XuiObjectFromHandle( m_DebugButtonDataA[iButtonIndex].hXuiObj, &m_DebugButtonDataA[iButtonIndex].pvData );
- pButton = (CXuiControl *)m_DebugButtonDataA[iButtonIndex].pvData;
+ pButton = static_cast<CXuiControl *>(m_DebugButtonDataA[iButtonIndex].pvData);
//m_phXuiObjA[iElementIndex] = pCheckbox->m_hObj;
pButton->SetText(m_DebugButtonTextA[iButtonIndex]);
pButton->SetShow(TRUE);
@@ -171,7 +171,7 @@ HRESULT CScene_Debug::OnInit( XUIMessageInit* pInitData, BOOL& bHandled )
for(int i=0;i<iCheckboxIndex;i++)
{
- CXuiCheckbox *pCheckbox = (CXuiCheckbox *)m_DebugCheckboxDataA[i].pvData;
+ CXuiCheckbox *pCheckbox = static_cast<CXuiCheckbox *>(m_DebugCheckboxDataA[i].pvData);
pCheckbox->SetCheck( (uiDebugBitmask&(1<<i)) ?TRUE:FALSE);
}
@@ -213,7 +213,7 @@ HRESULT CScene_Debug::OnKeyDown(XUIMessageInput* pInputData, BOOL& rfHandled)
// check all the settings
for(int i=0;i<m_iTotalCheckboxElements;i++)
{
- CXuiCheckbox *pCheckbox = (CXuiCheckbox *)m_DebugCheckboxDataA[i].pvData;
+ CXuiCheckbox *pCheckbox = static_cast<CXuiCheckbox *>(m_DebugCheckboxDataA[i].pvData);
uiDebugBitmask|=pCheckbox->IsChecked()?(1<<iCurrentBitmaskIndex):0;
iCurrentBitmaskIndex++;
}