diff options
Diffstat (limited to 'Minecraft.Client/Common/Consoles_App.cpp')
| -rw-r--r-- | Minecraft.Client/Common/Consoles_App.cpp | 560 |
1 files changed, 274 insertions, 286 deletions
diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 43cf73e1..c3a623d5 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -100,7 +100,7 @@ CMinecraftApp::CMinecraftApp() { m_eTMSAction[i]=eTMSAction_Idle; m_eXuiAction[i]=eAppAction_Idle; - m_eXuiActionParam[i] = NULL; + m_eXuiActionParam[i] = nullptr; //m_dwAdditionalModelParts[i] = 0; if(FAILED(XUserGetSigninInfo(i,XUSER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY ,&m_currentSigninInfo[i]))) @@ -157,9 +157,9 @@ CMinecraftApp::CMinecraftApp() // m_bRead_TMS_XUIDS_XML=false; // m_bRead_TMS_DLCINFO_XML=false; - m_pDLCFileBuffer=NULL; + m_pDLCFileBuffer=nullptr; m_dwDLCFileSize=0; - m_pBannedListFileBuffer=NULL; + m_pBannedListFileBuffer=nullptr; m_dwBannedListFileSize=0; m_bDefaultCapeInstallAttempted=false; @@ -763,7 +763,7 @@ bool CMinecraftApp::LoadBeaconMenu(int iPad ,shared_ptr<Inventory> inventory, sh #ifdef _WINDOWS64 static void Win64_GetSettingsPath(char *outPath, DWORD size) { - GetModuleFileNameA(NULL, outPath, size); + GetModuleFileNameA(nullptr, outPath, size); char *lastSlash = strrchr(outPath, '\\'); if (lastSlash) *(lastSlash + 1) = '\0'; strncat_s(outPath, size, "settings.dat", _TRUNCATE); @@ -773,7 +773,7 @@ static void Win64_SaveSettings(GAME_SETTINGS *gs) if (!gs) return; char filePath[MAX_PATH] = {}; Win64_GetSettingsPath(filePath, MAX_PATH); - FILE *f = NULL; + FILE *f = nullptr; if (fopen_s(&f, filePath, "wb") == 0 && f) { fwrite(gs, sizeof(GAME_SETTINGS), 1, f); @@ -785,7 +785,7 @@ static void Win64_LoadSettings(GAME_SETTINGS *gs) if (!gs) return; char filePath[MAX_PATH] = {}; Win64_GetSettingsPath(filePath, MAX_PATH); - FILE *f = NULL; + FILE *f = nullptr; if (fopen_s(&f, filePath, "rb") == 0 && f) { GAME_SETTINGS temp = {}; @@ -803,7 +803,7 @@ void CMinecraftApp::InitGameSettings() #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) GameSettingsA[i]=(GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(i); #else - GameSettingsA[i]=(GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(i); + GameSettingsA[i]=static_cast<GAME_SETTINGS *>(ProfileManager.GetGameDefinedProfileData(i)); #endif // clear the flag to say the settings have changed GameSettingsA[i]->bSettingsChanged=false; @@ -840,7 +840,7 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con SetGameSettings(iPad,eGameSetting_FOV,0); // 4J-PB - Don't reset the difficult level if we're in-game - if(Minecraft::GetInstance()->level==NULL) + if(Minecraft::GetInstance()->level==nullptr) { app.DebugPrintf("SetDefaultOptions - Difficulty = 1\n"); SetGameSettings(iPad,eGameSetting_Difficulty,1); @@ -935,7 +935,7 @@ int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTI int CMinecraftApp::DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad) #endif { - CMinecraftApp *pApp=(CMinecraftApp *)pParam; + CMinecraftApp *pApp=static_cast<CMinecraftApp *>(pParam); // flag the default options to be set @@ -1372,29 +1372,29 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_MusicVolume: if(iPad==ProfileManager.GetPrimaryPad()) { - pMinecraft->options->set(Options::Option::MUSIC,((float)GameSettingsA[iPad]->ucMusicVolume)/100.0f); + pMinecraft->options->set(Options::Option::MUSIC,static_cast<float>(GameSettingsA[iPad]->ucMusicVolume)/100.0f); } break; - case eGameSetting_SoundFXVolume: - if(iPad==ProfileManager.GetPrimaryPad()) - { - pMinecraft->options->set(Options::Option::SOUND,((float)GameSettingsA[iPad]->ucSoundFXVolume)/100.0f); - } + case eGameSetting_SoundFXVolume: + if (iPad == ProfileManager.GetPrimaryPad()) + { + pMinecraft->options->set(Options::Option::SOUND, static_cast<float>(GameSettingsA[iPad]->ucSoundFXVolume) / 100.0f); + } break; case eGameSetting_RenderDistance: - if(iPad == ProfileManager.GetPrimaryPad()) - { - int dist = (GameSettingsA[iPad]->uiBitmaskValues >> 16) & 0xFF; + if (iPad == ProfileManager.GetPrimaryPad()) + { + int dist = (GameSettingsA[iPad]->uiBitmaskValues >> 16) & 0xFF; - int level = UIScene_SettingsGraphicsMenu::DistanceToLevel(dist); - pMinecraft->options->set(Options::Option::RENDER_DISTANCE, 3 - level); - } + int level = UIScene_SettingsGraphicsMenu::DistanceToLevel(dist); + pMinecraft->options->set(Options::Option::RENDER_DISTANCE, 3 - level); + }; break; case eGameSetting_Gamma: if(iPad==ProfileManager.GetPrimaryPad()) { #if defined(_WIN64) || defined(_WINDOWS64) - pMinecraft->options->set(Options::Option::GAMMA, ((float)GameSettingsA[iPad]->ucGamma) / 100.0f); + pMinecraft->options->set(Options::Option::GAMMA, static_cast<float>(GameSettingsA[iPad]->ucGamma) / 100.0f); #else // ucGamma range is 0-100, UpdateGamma is 0 - 32768 float fVal=((float)GameSettingsA[iPad]->ucGamma)*327.68f; @@ -1421,7 +1421,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) app.SetGameHostOption(eGameHostOption_Difficulty,pMinecraft->options->difficulty); // send this to the other players if we are in-game - bool bInGame=pMinecraft->level!=NULL; + bool bInGame=pMinecraft->level!=nullptr; // Game Host only (and for now we can't change the diff while in game, so this shouldn't happen) if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) @@ -1438,7 +1438,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_Sensitivity_InGame: // 4J-PB - we don't use the options value // tell the input that we've changed the sensitivity - range of the slider is 0 to 200, default is 100 - pMinecraft->options->set(Options::Option::SENSITIVITY,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); + pMinecraft->options->set(Options::Option::SENSITIVITY,static_cast<float>(GameSettingsA[iPad]->ucSensitivity)/100.0f); //InputManager.SetJoypadSensitivity(iPad,((float)GameSettingsA[iPad]->ucSensitivity)/100.0f); break; @@ -1485,7 +1485,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) break; case eGameSetting_GamertagsVisible: { - bool bInGame=pMinecraft->level!=NULL; + bool bInGame=pMinecraft->level!=nullptr; // Game Host only if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) @@ -1514,7 +1514,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_DisplaySplitscreenGamertags: 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) { @@ -1558,19 +1558,17 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_FriendsOfFriends: //nothing to do here break; - case eGameSetting_BedrockFog: - { - bool bInGame=pMinecraft->level!=NULL; - - // Game Host only - if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) - { - // Update the Game Host setting if you are the host and you are in-game - app.SetGameHostOption(eGameHostOption_BedrockFog,GetGameSettings(iPad,eGameSetting_BedrockFog)?1:0); - app.SetXuiServerAction(iPad,eXuiServerAction_ServerSettingChanged_BedrockFog); - } - } - break; + case eGameSetting_BedrockFog: + { + bool bInGame = pMinecraft->level != nullptr; + + if (bInGame && g_NetworkManager.IsHost() && (iPad == ProfileManager.GetPrimaryPad())) + { + app.SetGameHostOption(eGameHostOption_BedrockFog, GetGameSettings(iPad, eGameSetting_BedrockFog) ? 1 : 0); + app.SetXuiServerAction(iPad, eXuiServerAction_ServerSettingChanged_BedrockFog); + } + } + break; case eGameSetting_DisplayHUD: //nothing to do here break; @@ -1617,7 +1615,7 @@ void CMinecraftApp::SetPlayerSkin(int iPad,DWORD dwSkinId) TelemetryManager->RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin); - if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId); + if(Minecraft::GetInstance()->localplayers[iPad]!=nullptr) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomSkin(dwSkinId); } @@ -1629,8 +1627,8 @@ wstring CMinecraftApp::GetPlayerSkinName(int iPad) DWORD CMinecraftApp::GetPlayerSkinId(int iPad) { // 4J-PB -check the user has rights to use this skin - they may have had at some point but the entitlement has been removed. - DLCPack *Pack=NULL; - DLCSkinFile *skinFile=NULL; + DLCPack *Pack=nullptr; + DLCSkinFile *skinFile=nullptr; DWORD dwSkin=GameSettingsA[iPad]->dwSelectedSkin; wchar_t chars[256]; @@ -1685,7 +1683,7 @@ void CMinecraftApp::SetPlayerCape(int iPad,DWORD dwCapeId) //SentientManager.RecordSkinChanged(iPad, GameSettingsA[iPad]->dwSelectedSkin); - if(Minecraft::GetInstance()->localplayers[iPad]!=NULL) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId); + if(Minecraft::GetInstance()->localplayers[iPad]!=nullptr) Minecraft::GetInstance()->localplayers[iPad]->setAndBroadcastCustomCape(dwCapeId); } wstring CMinecraftApp::GetPlayerCapeName(int iPad) @@ -1718,7 +1716,7 @@ unsigned char CMinecraftApp::GetPlayerFavoriteSkinsPos(int iPad) void CMinecraftApp::SetPlayerFavoriteSkinsPos(int iPad, int iPos) { - GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=(unsigned char)iPos; + GameSettingsA[iPad]->ucCurrentFavoriteSkinPos=static_cast<unsigned char>(iPos); GameSettingsA[iPad]->bSettingsChanged = true; } @@ -1755,7 +1753,7 @@ void CMinecraftApp::ValidateFavoriteSkins(int iPad) // Also check they haven't reverted to a trial pack DLCPack *pDLCPack=app.m_dlcManager.getPackContainingSkin(chars); - if(pDLCPack!=NULL) + if(pDLCPack!=nullptr) { // 4J-PB - We should let players add the free skins to their favourites as well! //DLCFile *pDLCFile=pDLCPack->getFile(DLCManager::e_DLCType_Skin,chars); @@ -1802,7 +1800,7 @@ void CMinecraftApp::SetMinecraftLanguage(int iPad, unsigned char ucLanguage) unsigned char CMinecraftApp::GetMinecraftLanguage(int iPad) { // if there are no game settings read yet, return the default language - if(GameSettingsA[iPad]==NULL) + if(GameSettingsA[iPad]==nullptr) { return 0; } @@ -1821,7 +1819,7 @@ void CMinecraftApp::SetMinecraftLocale(int iPad, unsigned char ucLocale) unsigned char CMinecraftApp::GetMinecraftLocale(int iPad) { // if there are no game settings read yet, return the default language - if(GameSettingsA[iPad]==NULL) + if(GameSettingsA[iPad]==nullptr) { return 0; } @@ -2523,7 +2521,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlay shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad]; - if(bOverridePlayer || player==NULL) + if(bOverridePlayer || player==nullptr) { return GameSettingsA[iPad]->uiDebugBitmask; } @@ -2697,7 +2695,7 @@ int CMinecraftApp::DisplaySavingMessage(void *pParam, C4JStorage::ESavingMessage void CMinecraftApp::SetActionConfirmed(LPVOID param) { - XuiActionParam *actionInfo = (XuiActionParam *)param; + XuiActionParam *actionInfo = static_cast<XuiActionParam *>(param); app.SetAction(actionInfo->iPad, actionInfo->action); } @@ -2835,7 +2833,7 @@ void CMinecraftApp::HandleXuiActions(void) app.SetAutosaveTimerTime(); SetAction(i,eAppAction_Idle); // Check that there is a name for the save - if we're saving from the tutorial and this is the first save from the tutorial, we'll not have a name - /*if(StorageManager.GetSaveName()==NULL) + /*if(StorageManager.GetSaveName()==nullptr) { app.NavigateToScene(i,eUIScene_SaveWorld); } @@ -2853,7 +2851,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc; - loadingParams->lpParam = (LPVOID)false; + loadingParams->lpParam = static_cast<LPVOID>(false); // 4J-JEV - PS4: Fix for #5708 - [ONLINE] - If the user pulls their network cable out while saving the title will hang. loadingParams->waitForThreadToDelete = true; @@ -2904,7 +2902,7 @@ void CMinecraftApp::HandleXuiActions(void) ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false); // This just allows it to be shown - if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); + if(pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) pMinecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); //INT saveOrCheckpointId = 0; //bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); @@ -2914,7 +2912,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &UIScene_PauseMenu::SaveWorldThreadProc; - loadingParams->lpParam = (LPVOID)true; + loadingParams->lpParam = (LPVOID)(true); UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -2980,7 +2978,7 @@ void CMinecraftApp::HandleXuiActions(void) // send the message for(int idx=0;idx<XUSER_MAX_COUNT;idx++) { - if((i!=idx) && (pMinecraft->localplayers[idx]!=NULL)) + if((i!=idx) && (pMinecraft->localplayers[idx]!=nullptr)) { XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg ); } @@ -3062,7 +3060,7 @@ void CMinecraftApp::HandleXuiActions(void) // send the message for(int idx=0;idx<XUSER_MAX_COUNT;idx++) { - if((i!=idx) && (pMinecraft->localplayers[idx]!=NULL)) + if((i!=idx) && (pMinecraft->localplayers[idx]!=nullptr)) { XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg ); } @@ -3288,8 +3286,8 @@ void CMinecraftApp::HandleXuiActions(void) UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); // If param is non-null then this is a forced exit by the server, so make sure the player knows why // 4J Stu - Changed - Don't use the FullScreenProgressScreen for action, use a dialog instead - completionData->bRequiresUserAction = FALSE;//(param != NULL) ? TRUE : FALSE; - completionData->bShowTips = (param != NULL) ? FALSE : TRUE; + completionData->bRequiresUserAction = FALSE;//(param != nullptr) ? TRUE : FALSE; + completionData->bShowTips = (param != nullptr) ? FALSE : TRUE; completionData->bShowBackground=TRUE; completionData->bShowLogo=TRUE; completionData->type = e_ProgressCompletion_NavigateToHomeMenu; @@ -3401,7 +3399,7 @@ void CMinecraftApp::HandleXuiActions(void) break; case eAppAction_WaitForRespawnComplete: player = pMinecraft->localplayers[i]; - if(player != NULL && player->GetPlayerRespawned()) + if(player != nullptr && player->GetPlayerRespawned()) { SetAction(i,eAppAction_Idle); @@ -3426,7 +3424,7 @@ void CMinecraftApp::HandleXuiActions(void) break; case eAppAction_WaitForDimensionChangeComplete: player = pMinecraft->localplayers[i]; - if(player != NULL && player->connection && player->connection->isStarted()) + if(player != nullptr && player->connection && player->connection->isStarted()) { SetAction(i,eAppAction_Idle); ui.CloseUIScenes(i); @@ -3740,12 +3738,12 @@ void CMinecraftApp::HandleXuiActions(void) // unload any texture pack audio // if there is audio in use, clear out the audio, and unmount the pack TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=NULL; + DLCTexturePack *pDLCTexPack=nullptr; if(pTexPack->hasAudio()) { // get the dlc texture pack, and store it - pDLCTexPack=(DLCTexturePack *)pTexPack; + pDLCTexPack=static_cast<DLCTexturePack *>(pTexPack); } // change to the default texture pack @@ -3764,11 +3762,11 @@ void CMinecraftApp::HandleXuiActions(void) pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); #ifdef _XBOX - if(pDLCTexPack->m_pStreamedWaveBank!=NULL) + if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) { pDLCTexPack->m_pStreamedWaveBank->Destroy(); } - if(pDLCTexPack->m_pSoundBank!=NULL) + if(pDLCTexPack->m_pSoundBank!=nullptr) { pDLCTexPack->m_pSoundBank->Destroy(); } @@ -3787,18 +3785,18 @@ void CMinecraftApp::HandleXuiActions(void) for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { if(ProfileManager.IsSignedIn(index) ) - { - if(index==i || pMinecraft->localplayers[index]!=NULL ) - { - m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask( index ); - } + { + if (index == i || pMinecraft->localplayers[index] != nullptr) + { + m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask(index); + } } } #endif - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; - loadingParams->lpParam = (LPVOID)&m_InviteData; + LoadingInputParams *loadingParams = new LoadingInputParams(); + loadingParams->func = &CGameNetworkManager::ExitAndJoinFromInviteThreadProc; + loadingParams->lpParam = static_cast<LPVOID>(&m_InviteData); UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -3821,7 +3819,7 @@ void CMinecraftApp::HandleXuiActions(void) g_NetworkManager.SetLocalGame(false); - JoinFromInviteData *inviteData = (JoinFromInviteData *)param; + JoinFromInviteData *inviteData = static_cast<JoinFromInviteData *>(param); // 4J-PB - clear any previous connection errors Minecraft::GetInstance()->clearConnectionFailed(); @@ -3896,7 +3894,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::ChangeSessionTypeThreadProc; - loadingParams->lpParam = NULL; + loadingParams->lpParam = nullptr; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); #ifdef __PS3__ @@ -3947,7 +3945,7 @@ void CMinecraftApp::HandleXuiActions(void) #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__) SetDefaultOptions((C4JStorage::PROFILESETTINGS *)param,i); #else - SetDefaultOptions((C_4JProfile::PROFILESETTINGS *)param,i); + SetDefaultOptions(static_cast<C_4JProfile::PROFILESETTINGS *>(param), i); #endif // if the profile data has been changed, then force a profile write @@ -3977,7 +3975,7 @@ void CMinecraftApp::HandleXuiActions(void) LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CMinecraftApp::RemoteSaveThreadProc; - loadingParams->lpParam = NULL; + loadingParams->lpParam = nullptr; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bRequiresUserAction=FALSE; @@ -4276,7 +4274,7 @@ void CMinecraftApp::HandleXuiActions(void) SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting); app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,"\\",eTMSAction_TMSPP_XUIDSFile); #elif defined _XBOX_ONE - //StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",NULL,NULL, 0); + //StorageManager.TMSPP_DeleteFile(i,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",nullptr,nullptr, 0); SetTMSAction(i,eTMSAction_TMSPP_UserFileList_Waiting); app.TMSPP_RetrieveFileList(i,C4JStorage::eGlobalStorage_TitleUser,eTMSAction_TMSPP_DLCFileOnly); #else @@ -4365,7 +4363,7 @@ void CMinecraftApp::HandleXuiActions(void) int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; + CMinecraftApp* pApp = static_cast<CMinecraftApp *>(pParam); //Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4373,7 +4371,7 @@ int CMinecraftApp::BannedLevelDialogReturned(void *pParam,int iPad,const C4JStor #if defined _XBOX || defined _XBOX_ONE INetworkPlayer *pHost = g_NetworkManager.GetHostPlayer(); // unban the level - if (pHost != NULL) + if (pHost != nullptr) { #if defined _XBOX pApp->RemoveLevelFromBannedLevelList(iPad,((NetworkPlayerXbox *)pHost)->GetUID(),pApp->GetUniqueMapName()); @@ -4423,10 +4421,10 @@ void CMinecraftApp::loadMediaArchive() HANDLE hFile = CreateFile( path.c_str(), GENERIC_READ, FILE_SHARE_READ, - NULL, + nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, - NULL ); + nullptr ); if( hFile != INVALID_HANDLE_VALUE ) { @@ -4442,7 +4440,7 @@ void CMinecraftApp::loadMediaArchive() m_fBody, dwFileSize, &m_fSize, - NULL ); + nullptr ); assert( m_fSize == dwFileSize ); @@ -4454,7 +4452,7 @@ void CMinecraftApp::loadMediaArchive() { assert( false ); // AHHHHHHHHHHHH - m_mediaArchive = NULL; + m_mediaArchive = nullptr; } #endif } @@ -4463,7 +4461,7 @@ void CMinecraftApp::loadStringTable() { #ifndef _XBOX - if(m_stringTable!=NULL) + if(m_stringTable!=nullptr) { // we need to unload the current string table, this is a reload delete m_stringTable; @@ -4477,7 +4475,7 @@ void CMinecraftApp::loadStringTable() } else { - m_stringTable = NULL; + m_stringTable = nullptr; assert(false); // AHHHHHHHHH. } @@ -4490,7 +4488,7 @@ int CMinecraftApp::PrimaryPlayerSignedOutReturned(void *pParam,int iPad,const C4 //Minecraft *pMinecraft=Minecraft::GetInstance(); // if the player is null, we're in the menus - //if(Minecraft::GetInstance()->player!=NULL) + //if(Minecraft::GetInstance()->player!=nullptr) // We always create a session before kicking of any of the game code, so even though we may still be joining/creating a game // at this point we want to handle it differently from just being in a menu @@ -4511,10 +4509,10 @@ int CMinecraftApp::EthernetDisconnectReturned(void *pParam,int iPad,const C4JSto Minecraft *pMinecraft=Minecraft::GetInstance(); // if the player is null, we're in the menus - if(Minecraft::GetInstance()->player!=NULL) - { - app.SetAction(pMinecraft->player->GetXboxPad(),eAppAction_EthernetDisconnectedReturned); - } + if (Minecraft::GetInstance()->player != nullptr) + { + app.SetAction(pMinecraft->player->GetXboxPad(), eAppAction_EthernetDisconnectedReturned); + } else { // 4J-PB - turn off the PSN store icon just in case this happened when we were in one of the DLC menus @@ -4543,7 +4541,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) bool saveStats = false; if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession() ) { - if(lpParameter != NULL ) + if(lpParameter != nullptr ) { switch( app.GetDisconnectReason() ) { @@ -4575,16 +4573,16 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) } pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId ); // 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[0] != nullptr ) pMinecraft->levels[0]->disconnect(false); + if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->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[0] != nullptr ) pMinecraft->levels[0]->disconnect(); + if( pMinecraft->levels[1] != nullptr ) pMinecraft->levels[1]->disconnect(); } // 4J Stu - This only does something if we actually have a server, so don't need to do any other checks @@ -4599,7 +4597,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) } else { - if(lpParameter != NULL ) + if(lpParameter != nullptr ) { switch( app.GetDisconnectReason() ) { @@ -4636,7 +4634,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) pMinecraft->progressRenderer->progressStartNoAbort( exitReasonStringId ); } } - pMinecraft->setLevel(NULL,exitReasonStringId,nullptr,saveStats,true); + pMinecraft->setLevel(nullptr,exitReasonStringId,nullptr,saveStats,true); // 4J-JEV: Fix for #106402 - TCR #014 BAS Debug Output: // TU12: Mass Effect Mash-UP: Save file "Default_DisplayName" is created on all storage devices after signing out from a re-launched pre-generated world @@ -4662,7 +4660,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM // bug 11285 - TCR 001: BAS Game Stability: CRASH - When trying to join a full version game with a trial version, the trial crashes // 4J-PB - we may be in the main menus here, and we don't have a pMinecraft->player - if(pMinecraft->player==NULL) + if(pMinecraft->player==nullptr) { bNoPlayer=true; } @@ -4674,7 +4672,7 @@ int CMinecraftApp::UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EM // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -4719,7 +4717,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -4774,7 +4772,7 @@ int CMinecraftApp::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMes int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; + CMinecraftApp* pApp = static_cast<CMinecraftApp *>(pParam); Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4784,7 +4782,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -4846,7 +4844,7 @@ int CMinecraftApp::UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMes int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; + CMinecraftApp* pApp = static_cast<CMinecraftApp *>(pParam); Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -4857,7 +4855,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR // 4J-PB - need to check this user can access the store #if defined(__PS3__) || defined(__PSVITA__) bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -4904,7 +4902,7 @@ int CMinecraftApp::TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageR void CMinecraftApp::ProfileReadErrorCallback(void *pParam) { - CMinecraftApp *pApp=(CMinecraftApp *)pParam; + CMinecraftApp *pApp=static_cast<CMinecraftApp *>(pParam); int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); pApp->SetAction(iPrimaryPlayer, eAppAction_ProfileReadError); } @@ -4936,7 +4934,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange Minecraft::GetInstance()->user->name = convStringToWstring( ProfileManager.GetGamertag(ProfileManager.GetPrimaryPad())); #endif - CMinecraftApp *pApp=(CMinecraftApp *)pParam; + CMinecraftApp *pApp=static_cast<CMinecraftApp *>(pParam); // check if the primary player signed out int iPrimaryPlayer=ProfileManager.GetPrimaryPad(); @@ -5001,7 +4999,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange if(i == iPrimaryPlayer) continue; // A guest a signed in or out, out of order which invalidates all the guest players we have in the game - if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL) + if(hasGuestIdChanged && pApp->m_currentSigninInfo[i].dwGuestNumber != 0 && g_NetworkManager.GetLocalPlayerByUserIndex(i)!=nullptr) { pApp->DebugPrintf("Recommending removal of player at index %d because their guest id changed\n",i); pApp->SetAction(i, eAppAction_ExitPlayer); @@ -5025,7 +5023,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange // 4J-HG: If either the player is in the network manager or in the game, need to exit player // TODO: Do we need to check the network manager? - if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != NULL || Minecraft::GetInstance()->localplayers[i] != NULL) + if (g_NetworkManager.GetLocalPlayerByUserIndex(i) != nullptr || Minecraft::GetInstance()->localplayers[i] != nullptr) { pApp->DebugPrintf("Player %d signed out\n", i); pApp->SetAction(i, eAppAction_ExitPlayer); @@ -5036,7 +5034,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange // check if any of the addition players have signed out of PSN (primary player is handled below) if(!switchToOffline && i != ProfileManager.GetLockedProfile() && !g_NetworkManager.IsLocalGame()) { - if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=NULL) + if(g_NetworkManager.GetLocalPlayerByUserIndex(i)!=nullptr) { if(ProfileManager.IsSignedInLive(i) == false) { @@ -5111,7 +5109,7 @@ void CMinecraftApp::SignInChangeCallback(LPVOID pParam,bool bPrimaryPlayerChange void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, unsigned int uiParam) { - CMinecraftApp* pClass = (CMinecraftApp*)pParam; + CMinecraftApp* pClass = static_cast<CMinecraftApp *>(pParam); // push these on to the notifications to be handled in qnet's dowork @@ -5133,7 +5131,7 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { if(!InputManager.IsPadConnected(i) && - Minecraft::GetInstance()->localplayers[i] != NULL && + Minecraft::GetInstance()->localplayers[i] != nullptr && !ui.IsPauseMenuDisplayed(i) && !ui.IsSceneInStack(i, eUIScene_EndPoem) ) { ui.CloseUIScenes(i); @@ -5162,7 +5160,7 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un { DLCTexturePack *pDLCTexPack=(DLCTexturePack *)pTexPack; XCONTENTDEVICEID deviceID = pDLCTexPack->GetDLCDeviceID(); - if( XContentGetDeviceState( deviceID, NULL ) != ERROR_SUCCESS ) + if( XContentGetDeviceState( deviceID, nullptr ) != ERROR_SUCCESS ) { // Set texture pack flag so that it is now considered as not having audio - this is critical so that the next playStreaming does what it is meant to do, // and also so that we don't try and unmount this again, or play any sounds from it in the future @@ -5170,11 +5168,11 @@ void CMinecraftApp::NotificationsCallback(LPVOID pParam,DWORD dwNotification, un // need to stop the streaming audio - by playing streaming audio from the default texture pack now Minecraft::GetInstance()->soundEngine->playStreaming(L"", 0, 0, 0, 0, 0); - if(pDLCTexPack->m_pStreamedWaveBank!=NULL) + if(pDLCTexPack->m_pStreamedWaveBank!=nullptr) { pDLCTexPack->m_pStreamedWaveBank->Destroy(); } - if(pDLCTexPack->m_pSoundBank!=NULL) + if(pDLCTexPack->m_pSoundBank!=nullptr) { pDLCTexPack->m_pSoundBank->Destroy(); } @@ -5300,7 +5298,7 @@ void CMinecraftApp::SetDebugSequence(const char *pchSeq) } int CMinecraftApp::DebugInputCallback(LPVOID pParam) { - CMinecraftApp* pClass = (CMinecraftApp*)pParam; + CMinecraftApp* pClass = static_cast<CMinecraftApp *>(pParam); //printf("sequence matched\n"); pClass->m_bDebugOptions=!pClass->m_bDebugOptions; @@ -5326,7 +5324,7 @@ int CMinecraftApp::GetLocalPlayerCount(void) Minecraft *pMinecraft = Minecraft::GetInstance(); for(int i=0;i<XUSER_MAX_COUNT;i++) { - if(pMinecraft != NULL && pMinecraft->localplayers[i] != NULL) + if(pMinecraft != nullptr && pMinecraft->localplayers[i] != nullptr) { iPlayerC++; } @@ -5476,15 +5474,15 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d DLCPack *pack = app.m_dlcManager.getPack( CONTENT_DATA_DISPLAY_NAME(ContentData) ); - if( pack != NULL && pack->IsCorrupt() ) + if( pack != nullptr && pack->IsCorrupt() ) { app.DebugPrintf("Pack '%ls' is corrupt, removing it from the DLC Manager.\n", CONTENT_DATA_DISPLAY_NAME(ContentData)); app.m_dlcManager.removePack(pack); - pack = NULL; + pack = nullptr; } - if(pack == NULL) + if(pack == nullptr) { app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", CONTENT_DATA_DISPLAY_NAME(ContentData)); @@ -5536,8 +5534,8 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d // bool bRes=app.IsFileInMemoryTextures(wTemp); // // if the file is not already in the memory textures, then read it from TMS // if(!bRes) -// { -// BYTE *pBuffer=NULL; +// { +// BYTE* pBuffer = nullptr; // DWORD dwSize=0; // // 4J-PB - out for now for DaveK so he doesn't get the birthday cape // #ifdef _CONTENT_PACKAGE @@ -5566,7 +5564,7 @@ void CMinecraftApp::HandleDLC(DLCPack *pack) // 4J Stu - I don't know why we handle more than one file here any more, however this doesn't seem to work with the PS4 patches if(dlcFilenames.size() > 0) m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[0], pack); #else - for(int i=0; i<dlcFilenames.size();i++) + for(size_t i=0; i<dlcFilenames.size();i++) { m_dlcManager.readDLCDataFile(dwFilesProcessed, dlcFilenames[i], pack); } @@ -5645,7 +5643,7 @@ void CMinecraftApp::InitTime() // Get the frequency of the timer LARGE_INTEGER qwTicksPerSec; QueryPerformanceFrequency( &qwTicksPerSec ); - m_Time.fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; + m_Time.fSecsPerTick = 1.0f / static_cast<float>(qwTicksPerSec.QuadPart); // Save the start time QueryPerformanceCounter( &m_Time.qwTime ); @@ -5671,16 +5669,10 @@ void CMinecraftApp::UpdateTime() m_Time.qwAppTime.QuadPart += qwDeltaTime.QuadPart; m_Time.qwTime.QuadPart = qwNewTime.QuadPart; - m_Time.fElapsedTime = m_Time.fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); - m_Time.fAppTime = m_Time.fSecsPerTick * ((FLOAT)(m_Time.qwAppTime.QuadPart)); + m_Time.fElapsedTime = m_Time.fSecsPerTick * static_cast<FLOAT>(qwDeltaTime.QuadPart); + m_Time.fAppTime = m_Time.fSecsPerTick * static_cast<FLOAT>(m_Time.qwAppTime.QuadPart); } - - - - - - bool CMinecraftApp::isXuidNotch(PlayerUID xuid) { if(m_xuidNotch != INVALID_XUID && xuid != INVALID_XUID) @@ -5709,7 +5701,7 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD { EnterCriticalSection(&csMemFilesLock); // check it's not already in - PMEMDATA pData=NULL; + PMEMDATA pData=nullptr; auto it = m_MEM_Files.find(wName); if(it != m_MEM_Files.end()) { @@ -5720,8 +5712,8 @@ void CMinecraftApp::AddMemoryTextureFile(const wstring &wName,PBYTE pbData,DWORD if(pData->dwBytes == 0 && dwBytes != 0) { - // This should never be NULL if dwBytes is 0 - if(pData->pbData!=NULL) delete [] pData->pbData; + // This should never be nullptr if dwBytes is 0 + if(pData->pbData!=nullptr) delete [] pData->pbData; pData->pbData=pbData; pData->dwBytes=dwBytes; @@ -5817,7 +5809,7 @@ void CMinecraftApp::AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes) { EnterCriticalSection(&csMemTPDLock); // check it's not already in - PMEMDATA pData=NULL; + PMEMDATA pData=nullptr; auto it = m_MEM_TPD.find(iConfig); if(it == m_MEM_TPD.end()) { @@ -5837,7 +5829,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) { EnterCriticalSection(&csMemTPDLock); // check it's not already in - PMEMDATA pData=NULL; + PMEMDATA pData=nullptr; auto it = m_MEM_TPD.find(iConfig); if(it != m_MEM_TPD.end()) { @@ -5852,7 +5844,7 @@ void CMinecraftApp::RemoveMemoryTPDFile(int iConfig) #ifdef _XBOX int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) { - DLC_INFO *pDLCInfo=NULL; + DLC_INFO *pDLCInfo=nullptr; // run through the DLC info to find the right texture pack/mash-up pack for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { @@ -5870,7 +5862,7 @@ int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) #elif defined _XBOX_ONE int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) { - DLC_INFO *pDLCInfo=NULL; + DLC_INFO *pDLCInfo=nullptr; // run through the DLC info to find the right texture pack/mash-up pack for(unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) { @@ -5966,7 +5958,7 @@ void CMinecraftApp::ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, con int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp* pApp = (CMinecraftApp*)pParam; + CMinecraftApp* pApp = static_cast<CMinecraftApp *>(pParam); //Minecraft *pMinecraft=Minecraft::GetInstance(); // buttons are swapped on this menu @@ -5980,7 +5972,7 @@ int CMinecraftApp::ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMess int CMinecraftApp::ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - CMinecraftApp *pClass = (CMinecraftApp *)pParam; + CMinecraftApp *pClass = static_cast<CMinecraftApp *>(pParam); // Exit with or without saving // Decline means save in this dialog if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) @@ -6071,7 +6063,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor { // 4J-PB - need to check this user can access the store bool bContentRestricted; - ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -6090,7 +6082,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor app.DebugPrintf("Texture Pack - %s\n",pchPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if(pSONYDLCInfo!=NULL) + if(pSONYDLCInfo!=nullptr) { char chName[42]; char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; @@ -6140,7 +6132,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName((WCHAR *)pDLCPack->getName().c_str()); - StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),NULL,NULL); + StorageManager.InstallOffer(1,(WCHAR *)pDLCInfo->wsProductId.c_str(),nullptr,nullptr); // the license change coming in when the offer has been installed will cause this scene to refresh } @@ -6173,7 +6165,7 @@ int CMinecraftApp::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStor // 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 @@ -6219,7 +6211,7 @@ int CMinecraftApp::ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4 uiIDA[1]=IDS_CONFIRM_CANCEL; // Give the player a warning about the trial version of the texture pack - ui.RequestErrorMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,NULL); + ui.RequestErrorMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, iPad,&CMinecraftApp::WarningTrialTexturePackReturned,nullptr); return S_OK; } @@ -6731,7 +6723,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) default: break; } - return NULL; + return nullptr; #else wstring replacement = L""; switch(uiVKey) @@ -6830,7 +6822,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) default: break; } - return NULL; + return nullptr; #else wchar_t string[128]; @@ -6885,11 +6877,11 @@ HRESULT CMinecraftApp::RegisterMojangData(WCHAR *pXuidName, PlayerUID xuid, WCHA { HRESULT hr=S_OK; eXUID eTempXuid=eXUID_Undefined; - MOJANG_DATA *pMojangData=NULL; + MOJANG_DATA *pMojangData=nullptr; // ignore the names if we don't recognize them - if(pXuidName!=NULL) - { + if (pXuidName != nullptr) + { if( wcscmp( pXuidName, L"XUID_NOTCH" ) == 0 ) { eTempXuid = eXUID_Notch; // might be needed for the apple at some point @@ -6928,8 +6920,8 @@ HRESULT CMinecraftApp::RegisterConfigValues(WCHAR *pType, int iValue) HRESULT hr=S_OK; // #ifdef _XBOX - // if(pType!=NULL) - // { + // if(pType!=nullptr) + // { // if(wcscmp(pType,L"XboxOneTransfer")==0) // { // if(iValue>0) @@ -6979,8 +6971,8 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe } #endif - if(pType!=NULL) - { + if(pType!=nullptr) + { if(wcscmp(pType,L"Skin")==0) { pDLCData->eDLCType=e_DLC_SkinPack; @@ -7164,7 +7156,7 @@ bool CMinecraftApp::GetDLCNameForPackID(const int iPackID,char **ppchKeyID) auto it = DLCTextures_PackID.find(iPackID); if( it == DLCTextures_PackID.end() ) { - *ppchKeyID=NULL; + *ppchKeyID=nullptr; return false; } else @@ -7184,21 +7176,21 @@ DLC_INFO *CMinecraftApp::GetDLCInfo(char *pchDLCName) if( it == DLCInfo.end() ) { // nothing for this - return NULL; + return nullptr; } else { return it->second; } } - else return NULL; + else return nullptr; } DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID) { unordered_map<string, DLC_INFO *>::iterator it= DLCInfo.begin(); - for(int i=0;i<DLCInfo.size();i++) + for(size_t i=0;i<DLCInfo.size();i++) { if(((DLC_INFO *)it->second)->iConfig==iTPID) { @@ -7206,7 +7198,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID) } ++it; } - return NULL; + return nullptr; } DLC_INFO *CMinecraftApp::GetDLCInfo(int iIndex) @@ -7262,12 +7254,12 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,wstring &Produc } // DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(wstring &ProductId) // { -// return NULL; +// return nullptr; // } DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) { - return NULL; + return nullptr; } DLC_INFO *CMinecraftApp::GetDLCInfoFullOffer(int iIndex) { @@ -7321,7 +7313,7 @@ bool CMinecraftApp::GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pull } DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) { - //DLC_INFO *pDLCInfo=NULL; + //DLC_INFO *pDLCInfo=nullptr; if(DLCInfo_Trial.size()>0) { auto it = DLCInfo_Trial.find(ullOfferID_Trial); @@ -7329,14 +7321,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial) if( it == DLCInfo_Trial.end() ) { // nothing for this - return NULL; + return nullptr; } else { return it->second; } } - else return NULL; + else return nullptr; } DLC_INFO *CMinecraftApp::GetDLCInfoTrialOffer(int iIndex) @@ -7386,21 +7378,21 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(WCHAR *pwchProductID) if( it == DLCInfo_Full.end() ) { // nothing for this - return NULL; + return nullptr; } else { return it->second; } } - else return NULL; + else return nullptr; } DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName) { unordered_map<wstring, DLC_INFO *>::iterator it= DLCInfo_Full.begin(); wstring wsProductName=pwchProductName; - for(int i=0;i<DLCInfo_Full.size();i++) + for(size_t i=0;i<DLCInfo_Full.size();i++) { DLC_INFO *pDLCInfo=(DLC_INFO *)it->second; if(wsProductName==pDLCInfo->wsDisplayName) @@ -7410,7 +7402,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName) ++it; } - return NULL; + return nullptr; } #elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) @@ -7426,14 +7418,14 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full) if( it == DLCInfo_Full.end() ) { // nothing for this - return NULL; + return nullptr; } else { return it->second; } } - else return NULL; + else return nullptr; } #endif @@ -7524,7 +7516,7 @@ void CMinecraftApp::ExitGameFromRemoteSave( LPVOID lpParameter ) uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,NULL); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, primaryPad,&CMinecraftApp::ExitGameFromRemoteSaveDialogReturned,nullptr); } int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) @@ -7540,9 +7532,9 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4 { #ifndef _XBOX // Inform fullscreen progress scene that it's not being cancelled after all - UIScene_FullscreenProgress *pScene = (UIScene_FullscreenProgress *)ui.FindScene(eUIScene_FullscreenProgress); + UIScene_FullscreenProgress *pScene = static_cast<UIScene_FullscreenProgress *>(ui.FindScene(eUIScene_FullscreenProgress)); #ifdef __PS3__ - if(pScene!=NULL) + if(pScene!=nullptr) #else if (pScene != nullptr) #endif @@ -7558,7 +7550,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4 void CMinecraftApp::SetSpecialTutorialCompletionFlag(int iPad, int index) { - if(index >= 0 && index < 32 && GameSettingsA[iPad] != NULL) + if(index >= 0 && index < 32 && GameSettingsA[iPad] != nullptr) { GameSettingsA[iPad]->uiSpecialTutorialBitmask |= (1<<index); } @@ -7587,7 +7579,7 @@ void CMinecraftApp::InvalidateBannedList(int iPad) if(BannedListA[iPad].pBannedList) { delete [] BannedListA[iPad].pBannedList; - BannedListA[iPad].pBannedList=NULL; + BannedListA[iPad].pBannedList=nullptr; } } } @@ -7616,10 +7608,10 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps strcpy(pBannedListData->pszLevelName,pszLevelName); m_vBannedListA[iPad]->push_back(pBannedListData); - if(bWriteToTMS) - { - DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); - PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new CHAR [dwDataBytes]); + if (bWriteToTMS) + { + DWORD dwDataBytes = static_cast<DWORD>(sizeof(BANNEDLISTDATA)* m_vBannedListA[iPad]->size()); + PBANNEDLISTDATA pBannedList = reinterpret_cast<BANNEDLISTDATA*>(new CHAR [dwDataBytes]); int iCount=0; for (PBANNEDLISTDATA pData : *m_vBannedListA[iPad] ) { @@ -7630,9 +7622,9 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps //bool bRes=StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes); #ifdef _XBOX - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,C4JStorage::TMS_UGCTYPE_NONE,"BannedList",(PCHAR) pBannedList, dwDataBytes,nullptr,nullptr, 0); #elif defined _XBOX_ONE - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,nullptr,nullptr, 0); #endif } // update telemetry too @@ -7666,7 +7658,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha { PBANNEDLISTDATA pBannedListData = *it; - if(pBannedListData!=NULL) + if(pBannedListData!=nullptr) { #ifdef _XBOX_ONE PlayerUID bannedPlayerUID = pBannedListData->wchPlayerUID; @@ -7691,22 +7683,22 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha } } - DWORD dwDataBytes=(DWORD)(sizeof(BANNEDLISTDATA)*m_vBannedListA[iPad]->size()); + DWORD dwDataBytes=static_cast<DWORD>(sizeof(BANNEDLISTDATA) * m_vBannedListA[iPad]->size()); if(dwDataBytes==0) { // wipe the file #ifdef _XBOX StorageManager.DeleteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList"); #elif defined _XBOX_ONE - StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",NULL,NULL, 0); + StorageManager.TMSPP_DeleteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",nullptr,nullptr, 0); #endif } else { PBANNEDLISTDATA pBannedList = (BANNEDLISTDATA *)(new BYTE [dwDataBytes]); - int iSize=(int)m_vBannedListA[iPad]->size(); - for(int i=0;i<iSize;i++) + size_t iSize=m_vBannedListA[iPad]->size(); + for(size_t i=0;i<iSize;i++) { PBANNEDLISTDATA pBannedListData =m_vBannedListA[iPad]->at(i); @@ -7715,7 +7707,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha #ifdef _XBOX StorageManager.WriteTMSFile(iPad,C4JStorage::eGlobalStorage_TitleUser,L"BannedList",(PBYTE)pBannedList, dwDataBytes); #elif defined _XBOX_ONE - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"BannedList",(PBYTE) pBannedList, dwDataBytes,nullptr,nullptr, 0); #endif delete [] pBannedList; } @@ -7759,7 +7751,7 @@ bool CMinecraftApp::AlreadySeenCreditText(const wstring &wstemp) unsigned int CMinecraftApp::GetDLCCreditsCount() { - return (unsigned int)vDLCCredits.size(); + return static_cast<unsigned int>(vDLCCredits.size()); } SCreditTextItemDef * CMinecraftApp::GetDLCCredits(int iIndex) @@ -8179,7 +8171,7 @@ unsigned int CMinecraftApp::GetGameHostOption(unsigned int uiHostSettings, eGame bool CMinecraftApp::CanRecordStatsAndAchievements() { - bool isTutorial = Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->isTutorial(); + bool isTutorial = Minecraft::GetInstance() != nullptr && Minecraft::GetInstance()->isTutorial(); // 4J Stu - All of these options give the host player some advantage, so should not allow achievements return !(app.GetGameHostOption(eGameHostOption_HasBeenInCreative) || app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) || @@ -8878,7 +8870,7 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto { #endif - CMinecraftApp* pClass = (CMinecraftApp *) pParam; + CMinecraftApp* pClass = static_cast<CMinecraftApp *>(pParam); // find the right one in the vector EnterCriticalSection(&pClass->csTMSPPDownloadQueue); @@ -8897,9 +8889,8 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto // set this to retrieved whether it found it or not pCurrent->eState=e_TMS_ContentState_Retrieved; - if(pFileData!=NULL) - { - + if(pFileData!=nullptr) + { #ifdef _XBOX_ONE @@ -9139,7 +9130,7 @@ void CMinecraftApp::ClearTMSPPFilesRetrieved() int CMinecraftApp::DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad) { - CMinecraftApp* pClass = (CMinecraftApp *) pParam; + CMinecraftApp* pClass = static_cast<CMinecraftApp *>(pParam); // find the right one in the vector EnterCriticalSection(&pClass->csTMSPPDownloadQueue); @@ -9164,10 +9155,10 @@ eDLCContentType CMinecraftApp::Find_eDLCContentType(DWORD dwType) { if(m_dwContentTypeA[i]==dwType) { - return (eDLCContentType)i; + return static_cast<eDLCContentType>(i); } } - return (eDLCContentType)0; + return static_cast<eDLCContentType>(0); } bool CMinecraftApp::DLCContentRetrieved(eDLCMarketplaceType eType) { @@ -9250,7 +9241,7 @@ vector<ModelPart *> * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) { EnterCriticalSection( &csAdditionalModelParts ); - vector<ModelPart *> *pvModelParts=NULL; + vector<ModelPart *> *pvModelParts=nullptr; if(m_AdditionalModelParts.size()>0) { auto it = m_AdditionalModelParts.find(dwSkinID); @@ -9267,7 +9258,7 @@ vector<ModelPart *> *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) vector<SKIN_BOX *> *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID) { EnterCriticalSection( &csAdditionalSkinBoxes ); - vector<SKIN_BOX *> *pvSkinBoxes=NULL; + vector<SKIN_BOX *> *pvSkinBoxes=nullptr; if(m_AdditionalSkinBoxes.size()>0) { auto it = m_AdditionalSkinBoxes.find(dwSkinID); @@ -9371,95 +9362,92 @@ wstring CMinecraftApp::getSkinPathFromId(DWORD skinId) } -int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) +int CMinecraftApp::TexturePackDialogReturned(void* pParam, int iPad, C4JStorage::EMessageResult result) { - #if defined __PSVITA__ || defined __PS3__ || defined __ORBIS__ - if(result==C4JStorage::EMessage_ResultAccept) - { - Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID()) ) - { - // it's been installed already - } - else - { - // we need to enable background downloading for the DLC - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(app.GetRequiredTexturePackID()); - if(pSONYDLCInfo!=NULL) - { - char chName[42]; - char chKeyName[20]; - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - - memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char - memset(chKeyName, 0, sizeof(chKeyName)); - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - - #ifdef __ORBIS__ - strcpy(chName, chKeyName); - #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); - #endif - app.GetDLCSkuIDFromProductList(chName,chSkuID); - // 4J-PB - need to check for an empty store - if(app.CheckForEmptyStore(iPad)==false) - { - if(app.DLCAlreadyPurchased(chSkuID)) - { - app.DownloadAlreadyPurchased(chSkuID); - } - else - { - app.Checkout(chSkuID); - } - } - } - } - } - else - { - app.DebugPrintf("Continuing without installing texture pack\n"); - } + if (result == C4JStorage::EMessage_ResultAccept) + { + Minecraft* pMinecraft = Minecraft::GetInstance(); + if (pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID())) + { + // it's been installed already + } + else + { + // we need to enable background downloading for the DLC + XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); + + SONYDLC* pSONYDLCInfo = app.GetSONYDLCInfo(app.GetRequiredTexturePackID()); + if (pSONYDLCInfo != nullptr) + { + char chName[42]; + char chKeyName[20]; + char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; + + memset(chSkuID, 0, SCE_NP_COMMERCE2_SKU_ID_LEN); + + memset(chKeyName, 0, sizeof(chKeyName)); + strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); + + #ifdef __ORBIS__ + strcpy(chName, chKeyName); + #else + sprintf(chName, "%s-%s", app.GetCommerceCategory(), chKeyName); + #endif + + app.GetDLCSkuIDFromProductList(chName, chSkuID); + + if (app.CheckForEmptyStore(iPad) == false) + { + if (app.DLCAlreadyPurchased(chSkuID)) + { + app.DownloadAlreadyPurchased(chSkuID); + } + else + { + app.Checkout(chSkuID); + } + } + } + } + } + else + { + app.DebugPrintf("Continuing without installing texture pack\n"); + } #endif #ifdef _XBOX - if(result!=C4JStorage::EMessage_Cancelled) - { - if(app.GetRequiredTexturePackID()!=0) - { - // we need to enable background downloading for the DLC - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - - ULONGLONG ullOfferID_Full; - ULONGLONG ullIndexA[1]; - app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(),&ullOfferID_Full); - - if( result==C4JStorage::EMessage_ResultAccept ) // Full version - { - ullIndexA[0]=ullOfferID_Full; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); - } - else // trial version - { - DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full); - ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); - } - } - } + if (result != C4JStorage::EMessage_Cancelled) + { + if (app.GetRequiredTexturePackID() != 0) + { + XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); + + ULONGLONG ullOfferID_Full; + ULONGLONG ullIndexA[1]; + app.GetDLCFullOfferIDForPackID(app.GetRequiredTexturePackID(), &ullOfferID_Full); + + if (result == C4JStorage::EMessage_ResultAccept) + { + ullIndexA[0] = ullOfferID_Full; + StorageManager.InstallOffer(1, ullIndexA, nullptr, nullptr); + } + else + { + DLC_INFO* pDLCInfo = app.GetDLCInfoForFullOfferID(ullOfferID_Full); + ullIndexA[0] = pDLCInfo->ullOfferID_Trial; + StorageManager.InstallOffer(1, ullIndexA, nullptr, nullptr); + } + } + } #endif - return 0; + return 0; } - int CMinecraftApp::getArchiveFileSize(const wstring &filename) { - TexturePack *tPack = NULL; + TexturePack *tPack = nullptr; Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) @@ -9471,7 +9459,7 @@ int CMinecraftApp::getArchiveFileSize(const wstring &filename) bool CMinecraftApp::hasArchiveFile(const wstring &filename) { - TexturePack *tPack = NULL; + TexturePack *tPack = nullptr; Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) return true; @@ -9480,7 +9468,7 @@ bool CMinecraftApp::hasArchiveFile(const wstring &filename) byteArray CMinecraftApp::getArchiveFile(const wstring &filename) { - TexturePack *tPack = NULL; + TexturePack *tPack = nullptr; Minecraft *pMinecraft = Minecraft::GetInstance(); if(pMinecraft && pMinecraft->skins) tPack = pMinecraft->skins->getSelected(); if(tPack && tPack->hasData() && tPack->getArchiveFile() && tPack->getArchiveFile()->hasFile(filename)) @@ -9509,19 +9497,19 @@ int CMinecraftApp::GetDLCInfoFullOffersCount() } #else int CMinecraftApp::GetDLCInfoTrialOffersCount() -{ - return (int)DLCInfo_Trial.size(); +{ + return static_cast<int>(DLCInfo_Trial.size()); } -int CMinecraftApp::GetDLCInfoFullOffersCount() -{ - return (int)DLCInfo_Full.size(); +int CMinecraftApp::GetDLCInfoFullOffersCount() +{ + return static_cast<int>(DLCInfo_Full.size()); } #endif int CMinecraftApp::GetDLCInfoTexturesOffersCount() -{ - return (int)DLCTextures_PackID.size(); +{ + return static_cast<int>(DLCTextures_PackID.size()); } // AUTOSAVE @@ -9821,7 +9809,7 @@ void CMinecraftApp::getLocale(vector<wstring> &vecWstrLocales) locales.push_back(eMCLang_enUS); locales.push_back(eMCLang_null); - for (int i=0; i<locales.size(); i++) + for (size_t i=0; i<locales.size(); i++) { eMCLang lang = locales.at(i); vecWstrLocales.push_back( m_localeA[lang] ); |
