From 6d1d3b59cb9774d1d599cae3fb365a6d1f5190f7 Mon Sep 17 00:00:00 2001 From: Chase Cooper Date: Fri, 6 Mar 2026 13:59:42 -0500 Subject: [PATCH] Updated NULL to nullptr and fixing some type issues --- Minecraft.Client/AbstractContainerScreen.cpp | 14 +- Minecraft.Client/AbstractTexturePack.cpp | 48 +- Minecraft.Client/AbstractTexturePack.h | 2 +- Minecraft.Client/AchievementPopup.cpp | 4 +- Minecraft.Client/AchievementScreen.cpp | 8 +- Minecraft.Client/ArchiveFile.cpp | 20 +- Minecraft.Client/BreakingItemParticle.cpp | 2 +- Minecraft.Client/BufferedImage.cpp | 16 +- Minecraft.Client/BufferedImage.h | 2 +- Minecraft.Client/ChatScreen.cpp | 6 +- Minecraft.Client/ChestRenderer.cpp | 14 +- Minecraft.Client/Chunk.cpp | 6 +- Minecraft.Client/ClientConnection.cpp | 236 +- Minecraft.Client/ClockTexture.cpp | 12 +- Minecraft.Client/Common/Audio/SoundEngine.cpp | 32 +- Minecraft.Client/Common/Audio/miniaudio.h | 7378 ++++++++--------- Minecraft.Client/Common/Audio/stb_vorbis.h | 148 +- Minecraft.Client/Common/Consoles_App.cpp | 238 +- Minecraft.Client/Common/Consoles_App.h | 8 +- Minecraft.Client/Common/DLC/DLCAudioFile.cpp | 4 +- .../Common/DLC/DLCColourTableFile.cpp | 4 +- Minecraft.Client/Common/DLC/DLCFile.h | 2 +- .../Common/DLC/DLCGameRulesFile.cpp | 2 +- .../Common/DLC/DLCGameRulesHeader.cpp | 4 +- .../Common/DLC/DLCLocalisationFile.cpp | 2 +- Minecraft.Client/Common/DLC/DLCManager.cpp | 64 +- Minecraft.Client/Common/DLC/DLCPack.cpp | 32 +- .../Common/DLC/DLCTextureFile.cpp | 2 +- Minecraft.Client/Common/DLC/DLCUIDataFile.cpp | 4 +- .../AddEnchantmentRuleDefinition.cpp | 4 +- .../GameRules/AddItemRuleDefinition.cpp | 6 +- .../ApplySchematicRuleDefinition.cpp | 24 +- .../GameRules/CollectItemRuleDefinition.cpp | 8 +- .../GameRules/CompleteAllRuleDefinition.cpp | 6 +- .../GameRules/CompoundGameRuleDefinition.cpp | 8 +- .../GameRules/ConsoleGenerateStructure.cpp | 6 +- .../Common/GameRules/ConsoleSchematicFile.cpp | 40 +- Minecraft.Client/Common/GameRules/GameRule.h | 2 +- .../Common/GameRules/GameRuleDefinition.cpp | 2 +- .../Common/GameRules/GameRuleDefinition.h | 2 +- .../Common/GameRules/GameRuleManager.cpp | 56 +- .../GameRules/LevelGenerationOptions.cpp | 56 +- .../Common/GameRules/LevelGenerationOptions.h | 4 +- .../Common/GameRules/LevelRuleset.cpp | 6 +- .../Common/GameRules/StartFeature.cpp | 2 +- .../GameRules/UpdatePlayerRuleDefinition.cpp | 14 +- .../XboxStructureActionPlaceContainer.cpp | 6 +- .../XboxStructureActionPlaceSpawner.cpp | 4 +- .../Leaderboards/LeaderboardInterface.cpp | 2 +- .../Leaderboards/LeaderboardManager.cpp | 4 +- .../Leaderboards/SonyLeaderboardManager.cpp | 60 +- .../Common/Network/GameNetworkManager.cpp | 122 +- .../Common/Network/GameNetworkManager.h | 8 +- .../Network/PlatformNetworkManagerInterface.h | 2 +- .../Network/PlatformNetworkManagerStub.cpp | 60 +- .../Network/PlatformNetworkManagerStub.h | 2 +- Minecraft.Client/Common/Network/SessionInfo.h | 4 +- .../Common/Network/Sony/NetworkPlayerSony.cpp | 2 +- .../Sony/PlatformNetworkManagerSony.cpp | 76 +- .../Network/Sony/PlatformNetworkManagerSony.h | 2 +- .../Common/Network/Sony/SQRNetworkManager.cpp | 4 +- .../Common/Network/Sony/SQRNetworkPlayer.cpp | 18 +- .../Common/Network/Sony/SonyRemoteStorage.cpp | 16 +- .../Common/Network/Sony/SonyRemoteStorage.h | 2 +- .../Common/Telemetry/TelemetryManager.cpp | 4 +- .../Common/Tutorial/ChangeStateConstraint.cpp | 8 +- .../Common/Tutorial/ChangeStateConstraint.h | 2 +- .../Common/Tutorial/ChoiceTask.cpp | 2 +- .../Common/Tutorial/CompleteUsingItemTask.cpp | 2 +- .../Common/Tutorial/ControllerTask.cpp | 2 +- .../Common/Tutorial/ControllerTask.h | 2 +- .../Common/Tutorial/CraftTask.cpp | 4 +- Minecraft.Client/Common/Tutorial/CraftTask.h | 4 +- .../Common/Tutorial/DiggerItemHint.cpp | 4 +- .../Common/Tutorial/EffectChangedTask.cpp | 2 +- .../Common/Tutorial/FullTutorial.cpp | 78 +- .../Tutorial/FullTutorialActiveTask.cpp | 2 +- Minecraft.Client/Common/Tutorial/InfoTask.cpp | 2 +- Minecraft.Client/Common/Tutorial/PickupTask.h | 2 +- .../Common/Tutorial/ProcedureCompoundTask.cpp | 2 +- .../Common/Tutorial/ProcedureCompoundTask.h | 2 +- .../Common/Tutorial/ProgressFlagTask.h | 2 +- .../Common/Tutorial/RideEntityTask.h | 2 +- Minecraft.Client/Common/Tutorial/StatTask.cpp | 2 +- .../Common/Tutorial/StateChangeTask.h | 2 +- .../Common/Tutorial/TakeItemHint.cpp | 2 +- Minecraft.Client/Common/Tutorial/Tutorial.cpp | 90 +- Minecraft.Client/Common/Tutorial/Tutorial.h | 4 +- .../Common/Tutorial/TutorialHint.cpp | 2 +- .../Common/Tutorial/TutorialMode.cpp | 8 +- .../Common/Tutorial/TutorialMode.h | 2 +- .../Common/Tutorial/TutorialTask.cpp | 2 +- .../Common/Tutorial/UseItemTask.h | 2 +- .../Common/Tutorial/UseTileTask.h | 4 +- .../Common/Tutorial/XuiCraftingTask.cpp | 4 +- .../Common/Tutorial/XuiCraftingTask.h | 4 +- Minecraft.Client/Common/UI/IUIController.h | 2 +- .../UI/IUIScene_AbstractContainerMenu.cpp | 50 +- .../Common/UI/IUIScene_AnvilMenu.cpp | 10 +- .../Common/UI/IUIScene_BeaconMenu.cpp | 10 +- .../Common/UI/IUIScene_CraftingMenu.cpp | 24 +- .../Common/UI/IUIScene_CreativeMenu.cpp | 42 +- .../Common/UI/IUIScene_CreativeMenu.h | 2 +- Minecraft.Client/Common/UI/IUIScene_HUD.cpp | 6 +- .../Common/UI/IUIScene_PauseMenu.cpp | 26 +- .../Common/UI/IUIScene_StartGame.cpp | 24 +- .../Common/UI/IUIScene_TradingMenu.cpp | 28 +- Minecraft.Client/Common/UI/UIBitmapFont.cpp | 2 +- .../Common/UI/UIComponent_Chat.cpp | 2 +- .../Common/UI/UIComponent_Panorama.cpp | 2 +- .../Common/UI/UIComponent_Tooltips.cpp | 2 +- .../Common/UI/UIComponent_TutorialPopup.cpp | 16 +- Minecraft.Client/Common/UI/UIControl.cpp | 24 +- Minecraft.Client/Common/UI/UIControl_Base.cpp | 2 +- .../Common/UI/UIControl_ButtonList.cpp | 2 +- .../Common/UI/UIControl_CheckBox.cpp | 2 +- .../Common/UI/UIControl_DynamicLabel.cpp | 4 +- .../Common/UI/UIControl_EnchantmentBook.cpp | 6 +- .../Common/UI/UIControl_HTMLLabel.cpp | 6 +- .../Common/UI/UIControl_LeaderboardList.cpp | 2 +- .../Common/UI/UIControl_PlayerSkinPreview.cpp | 8 +- .../Common/UI/UIControl_Slider.cpp | 2 +- .../Common/UI/UIControl_TexturePackList.cpp | 4 +- Minecraft.Client/Common/UI/UIController.cpp | 94 +- Minecraft.Client/Common/UI/UIController.h | 12 +- Minecraft.Client/Common/UI/UIFontData.cpp | 6 +- Minecraft.Client/Common/UI/UIGroup.cpp | 18 +- Minecraft.Client/Common/UI/UILayer.cpp | 22 +- Minecraft.Client/Common/UI/UILayer.h | 2 +- Minecraft.Client/Common/UI/UIScene.cpp | 40 +- Minecraft.Client/Common/UI/UIScene.h | 2 +- .../UI/UIScene_AbstractContainerMenu.cpp | 16 +- .../Common/UI/UIScene_AbstractContainerMenu.h | 2 +- .../Common/UI/UIScene_AnvilMenu.cpp | 6 +- .../Common/UI/UIScene_BeaconMenu.cpp | 10 +- .../Common/UI/UIScene_BrewingStandMenu.cpp | 6 +- .../Common/UI/UIScene_ConnectingProgress.cpp | 2 +- .../Common/UI/UIScene_ContainerMenu.cpp | 6 +- .../Common/UI/UIScene_ControlsMenu.cpp | 2 +- .../Common/UI/UIScene_CraftingMenu.cpp | 18 +- .../Common/UI/UIScene_CreateWorldMenu.cpp | 34 +- .../Common/UI/UIScene_CreativeMenu.cpp | 6 +- .../Common/UI/UIScene_Credits.cpp | 2 +- .../Common/UI/UIScene_DLCOffersMenu.cpp | 22 +- .../Common/UI/UIScene_DeathMenu.cpp | 6 +- .../Common/UI/UIScene_DebugOverlay.cpp | 12 +- .../Common/UI/UIScene_DebugSetCamera.cpp | 2 +- .../Common/UI/UIScene_DispenserMenu.cpp | 6 +- .../Common/UI/UIScene_EnchantingMenu.cpp | 8 +- .../Common/UI/UIScene_EndPoem.cpp | 6 +- .../Common/UI/UIScene_FireworksMenu.cpp | 6 +- .../Common/UI/UIScene_FullscreenProgress.cpp | 6 +- .../Common/UI/UIScene_FurnaceMenu.cpp | 6 +- Minecraft.Client/Common/UI/UIScene_HUD.cpp | 14 +- .../Common/UI/UIScene_HelpAndOptionsMenu.cpp | 8 +- .../Common/UI/UIScene_HopperMenu.cpp | 6 +- .../Common/UI/UIScene_HorseInventoryMenu.cpp | 8 +- .../Common/UI/UIScene_HowToPlayMenu.cpp | 2 +- .../Common/UI/UIScene_InGameInfoMenu.cpp | 20 +- .../UI/UIScene_InGamePlayerOptionsMenu.cpp | 12 +- .../UI/UIScene_InGameSaveManagementMenu.cpp | 18 +- .../Common/UI/UIScene_InventoryMenu.cpp | 10 +- .../Common/UI/UIScene_JoinMenu.cpp | 14 +- .../Common/UI/UIScene_Keyboard.cpp | 20 +- .../Common/UI/UIScene_LanguageSelector.cpp | 2 +- .../UI/UIScene_LaunchMoreOptionsMenu.cpp | 4 +- .../Common/UI/UIScene_LeaderboardsMenu.cpp | 6 +- .../Common/UI/UIScene_LoadMenu.cpp | 40 +- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 114 +- .../Common/UI/UIScene_MainMenu.cpp | 36 +- .../Common/UI/UIScene_MessageBox.cpp | 4 +- .../Common/UI/UIScene_PauseMenu.cpp | 30 +- .../Common/UI/UIScene_QuadrantSignin.cpp | 2 +- .../Common/UI/UIScene_ReinstallMenu.cpp | 2 +- .../Common/UI/UIScene_SaveMessage.cpp | 2 +- .../Common/UI/UIScene_SettingsAudioMenu.cpp | 2 +- .../Common/UI/UIScene_SettingsControlMenu.cpp | 2 +- .../UI/UIScene_SettingsGraphicsMenu.cpp | 6 +- .../Common/UI/UIScene_SettingsMenu.cpp | 6 +- .../Common/UI/UIScene_SettingsOptionsMenu.cpp | 8 +- .../Common/UI/UIScene_SettingsUIMenu.cpp | 6 +- .../Common/UI/UIScene_SignEntryMenu.cpp | 2 +- .../Common/UI/UIScene_SkinSelectMenu.cpp | 72 +- .../Common/UI/UIScene_TeleportMenu.cpp | 12 +- .../Common/UI/UIScene_TradingMenu.cpp | 12 +- .../Common/UI/UIScene_TrialExitUpsell.cpp | 2 +- Minecraft.Client/Common/UI/UIString.cpp | 8 +- Minecraft.Client/Common/UI/UIStructs.h | 24 +- Minecraft.Client/Common/UI/UITTFFont.cpp | 6 +- Minecraft.Client/Common/XUI/XUI_Chat.cpp | 2 +- .../Common/XUI/XUI_ConnectingProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_4JEdit.cpp | 4 +- .../Common/XUI/XUI_Ctrl_4JIcon.cpp | 2 +- .../Common/XUI/XUI_Ctrl_4JList.cpp | 4 +- .../Common/XUI/XUI_Ctrl_BrewProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_BubblesProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_BurnProgress.cpp | 2 +- .../XUI/XUI_Ctrl_CraftIngredientSlot.cpp | 8 +- .../Common/XUI/XUI_Ctrl_EnchantButton.cpp | 4 +- .../Common/XUI/XUI_Ctrl_EnchantmentBook.cpp | 16 +- .../XUI/XUI_Ctrl_EnchantmentButtonText.cpp | 4 +- .../Common/XUI/XUI_Ctrl_FireProgress.cpp | 2 +- .../Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp | 6 +- .../XUI/XUI_Ctrl_MinecraftSkinPreview.cpp | 8 +- .../Common/XUI/XUI_Ctrl_MinecraftSlot.cpp | 14 +- .../Common/XUI/XUI_Ctrl_MobEffect.cpp | 4 +- .../Common/XUI/XUI_Ctrl_SliderWrapper.cpp | 6 +- .../Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp | 36 +- .../Common/XUI/XUI_Ctrl_SlotItemCtrlBase.h | 2 +- .../Common/XUI/XUI_Ctrl_SlotList.cpp | 2 +- .../Common/XUI/XUI_CustomMessages.h | 2 +- Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp | 56 +- Minecraft.Client/Common/XUI/XUI_Death.cpp | 4 +- .../Common/XUI/XUI_DebugItemEditor.cpp | 12 +- .../Common/XUI/XUI_DebugOverlay.cpp | 30 +- .../Common/XUI/XUI_DebugSetCamera.cpp | 4 +- .../Common/XUI/XUI_FullscreenProgress.cpp | 10 +- Minecraft.Client/Common/XUI/XUI_HUD.cpp | 56 +- .../Common/XUI/XUI_HelpAndOptions.cpp | 10 +- .../Common/XUI/XUI_HelpControls.cpp | 14 +- .../Common/XUI/XUI_HelpCredits.cpp | 2 +- .../Common/XUI/XUI_HelpHowToPlay.cpp | 2 +- .../Common/XUI/XUI_HowToPlayMenu.cpp | 4 +- .../Common/XUI/XUI_InGameHostOptions.cpp | 2 +- .../Common/XUI/XUI_InGameInfo.cpp | 18 +- .../Common/XUI/XUI_InGamePlayerOptions.cpp | 50 +- .../Common/XUI/XUI_Leaderboards.cpp | 70 +- .../Common/XUI/XUI_LoadSettings.cpp | 76 +- Minecraft.Client/Common/XUI/XUI_MainMenu.cpp | 10 +- .../Common/XUI/XUI_MultiGameCreate.cpp | 56 +- .../Common/XUI/XUI_MultiGameInfo.cpp | 16 +- .../Common/XUI/XUI_MultiGameJoinLoad.cpp | 78 +- .../XUI/XUI_MultiGameLaunchMoreOptions.cpp | 2 +- Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp | 34 +- Minecraft.Client/Common/XUI/XUI_Reinstall.cpp | 4 +- .../XUI/XUI_Scene_AbstractContainer.cpp | 6 +- .../Common/XUI/XUI_Scene_Anvil.cpp | 12 +- .../Common/XUI/XUI_Scene_Base.cpp | 86 +- .../Common/XUI/XUI_Scene_BrewingStand.cpp | 12 +- .../Common/XUI/XUI_Scene_Container.cpp | 12 +- .../Common/XUI/XUI_Scene_CraftingPanel.cpp | 18 +- .../Common/XUI/XUI_Scene_Enchant.cpp | 12 +- .../Common/XUI/XUI_Scene_Furnace.cpp | 12 +- .../Common/XUI/XUI_Scene_Inventory.cpp | 14 +- .../XUI/XUI_Scene_Inventory_Creative.cpp | 14 +- .../Common/XUI/XUI_Scene_Trading.cpp | 10 +- .../Common/XUI/XUI_Scene_Trap.cpp | 12 +- Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp | 8 +- .../Common/XUI/XUI_SettingsAll.cpp | 6 +- .../Common/XUI/XUI_SettingsAudio.cpp | 6 +- .../Common/XUI/XUI_SettingsControl.cpp | 6 +- .../Common/XUI/XUI_SettingsGraphics.cpp | 6 +- .../Common/XUI/XUI_SettingsOptions.cpp | 6 +- .../Common/XUI/XUI_SettingsUI.cpp | 6 +- Minecraft.Client/Common/XUI/XUI_SignEntry.cpp | 2 +- .../Common/XUI/XUI_SkinSelect.cpp | 62 +- .../Common/XUI/XUI_SocialPost.cpp | 2 +- Minecraft.Client/Common/XUI/XUI_Teleport.cpp | 6 +- .../Common/XUI/XUI_TransferToXboxOne.cpp | 20 +- .../Common/XUI/XUI_TutorialPopup.cpp | 12 +- Minecraft.Client/Common/zlib/crc32.c | 2 +- Minecraft.Client/Common/zlib/trees.c | 10 +- Minecraft.Client/Common/zlib/zlib.h | 10 +- Minecraft.Client/Common/zlib/zutil.c | 2 +- Minecraft.Client/Common/zlib/zutil.h | 6 +- Minecraft.Client/CompassTexture.cpp | 18 +- Minecraft.Client/ConnectScreen.cpp | 8 +- Minecraft.Client/CreateWorldScreen.cpp | 6 +- Minecraft.Client/DLCTexturePack.cpp | 74 +- Minecraft.Client/DLCTexturePack.h | 2 +- Minecraft.Client/DeathScreen.cpp | 6 +- Minecraft.Client/DefaultRenderer.h | 2 +- Minecraft.Client/DefaultTexturePack.cpp | 6 +- Minecraft.Client/DefaultTexturePack.h | 2 +- Minecraft.Client/DerivedServerLevel.cpp | 4 +- Minecraft.Client/DisconnectedScreen.cpp | 2 +- .../Durango/4JLibs/inc/4J_Input.h | 8 +- .../Durango/4JLibs/inc/4J_Profile.h | 2 +- .../Durango/4JLibs/inc/4J_Render.h | 6 +- .../Durango/4JLibs/inc/4J_Storage.h | 10 +- Minecraft.Client/Durango/Durango_App.cpp | 32 +- Minecraft.Client/Durango/Durango_App.h | 2 +- .../Durango/Durango_Minecraft.cpp | 10 +- .../Durango/Durango_UIController.cpp | 4 +- .../Iggy/gdraw/gdraw_d3d10_shaders.inl | 22 +- .../Durango/Iggy/gdraw/gdraw_d3d11.cpp | 16 +- .../Durango/Iggy/gdraw/gdraw_d3d11.h | 4 +- .../Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl | 146 +- .../Durango/Iggy/gdraw/gdraw_shared.inl | 76 +- Minecraft.Client/Durango/Iggy/include/gdraw.h | 8 +- .../Durango/Iggy/include/iggyexpruntime.h | 4 +- .../DurangoLeaderboardManager.cpp | 16 +- .../Leaderboards/DurangoStatsDebugger.cpp | 4 +- .../Durango/Leaderboards/GameProgress.cpp | 6 +- Minecraft.Client/Durango/Miles/include/mss.h | 14 +- .../Durango/Network/DQRNetworkManager.cpp | 48 +- .../Durango/Network/DQRNetworkManager.h | 2 +- .../DQRNetworkManager_FriendSessions.cpp | 4 +- .../Network/DQRNetworkManager_SendReceive.cpp | 8 +- .../Network/DQRNetworkManager_XRNSEvent.cpp | 6 +- .../Durango/Network/NetworkPlayerDurango.cpp | 2 +- .../Durango/Network/PartyController.cpp | 8 +- .../Network/PlatformNetworkManagerDurango.cpp | 54 +- .../Network/PlatformNetworkManagerDurango.h | 2 +- .../Durango/Sentient/DurangoTelemetry.cpp | 4 +- .../Events-XBLA.8-149E11AEEvents.h | 96 +- Minecraft.Client/Durango/XML/ATGXmlParser.cpp | 22 +- Minecraft.Client/Durango/XML/ATGXmlParser.h | 2 +- .../Durango/XML/xmlFilesCallback.h | 8 +- Minecraft.Client/EnderDragonRenderer.cpp | 2 +- Minecraft.Client/EntityRenderDispatcher.cpp | 4 +- Minecraft.Client/EntityRenderer.cpp | 6 +- Minecraft.Client/EntityTracker.cpp | 12 +- Minecraft.Client/Extrax64Stubs.cpp | 30 +- Minecraft.Client/FallingTileRenderer.cpp | 2 +- Minecraft.Client/FileTexturePack.cpp | 2 +- Minecraft.Client/FireworksParticles.cpp | 16 +- Minecraft.Client/FishingHookRenderer.cpp | 2 +- Minecraft.Client/FolderTexturePack.cpp | 4 +- Minecraft.Client/FolderTexturePack.h | 2 +- Minecraft.Client/Font.cpp | 4 +- Minecraft.Client/Font.h | 2 +- Minecraft.Client/GameRenderer.cpp | 54 +- Minecraft.Client/Gui.cpp | 22 +- .../HugeExplosionSeedParticle.cpp | 2 +- Minecraft.Client/HumanoidMobRenderer.cpp | 22 +- Minecraft.Client/HumanoidModel.cpp | 8 +- Minecraft.Client/Input.cpp | 2 +- Minecraft.Client/ItemFrameRenderer.cpp | 4 +- Minecraft.Client/ItemInHandRenderer.cpp | 22 +- Minecraft.Client/ItemRenderer.cpp | 18 +- Minecraft.Client/ItemSpriteRenderer.cpp | 2 +- Minecraft.Client/JoinMultiplayerScreen.cpp | 2 +- Minecraft.Client/LevelRenderer.cpp | 98 +- Minecraft.Client/LivingEntityRenderer.cpp | 10 +- Minecraft.Client/LocalPlayer.cpp | 52 +- Minecraft.Client/MemTexture.cpp | 2 +- Minecraft.Client/MinecartRenderer.cpp | 8 +- Minecraft.Client/Minecraft.cpp | 446 +- Minecraft.Client/Minecraft.h | 2 +- Minecraft.Client/MinecraftServer.cpp | 140 +- Minecraft.Client/MinecraftServer.h | 6 +- Minecraft.Client/Minimap.cpp | 14 +- Minecraft.Client/MobRenderer.cpp | 2 +- .../MobSkinMemTextureProcessor.cpp | 4 +- Minecraft.Client/MobSkinTextureProcessor.cpp | 4 +- Minecraft.Client/MobSpawnerRenderer.cpp | 2 +- Minecraft.Client/Model.h | 2 +- Minecraft.Client/ModelHorse.cpp | 4 +- Minecraft.Client/ModelPart.cpp | 10 +- Minecraft.Client/MultiPlayerChunkCache.cpp | 14 +- Minecraft.Client/MultiPlayerGameMode.cpp | 24 +- Minecraft.Client/MultiPlayerGameMode.h | 4 +- Minecraft.Client/MultiPlayerLevel.cpp | 18 +- Minecraft.Client/MultiPlayerLocalPlayer.cpp | 22 +- Minecraft.Client/NameEntryScreen.cpp | 2 +- Minecraft.Client/Options.cpp | 6 +- Minecraft.Client/OptionsScreen.cpp | 2 +- .../Orbis/4JLibs/inc/4J_Profile.h | 2 +- Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h | 6 +- .../Orbis/4JLibs/inc/4J_Storage.h | 8 +- .../Orbis/Iggy/gdraw/gdraw_orbis.cpp | 100 +- .../Orbis/Iggy/gdraw/gdraw_orbis.h | 6 +- .../Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl | 160 +- .../Orbis/Iggy/gdraw/gdraw_shared.inl | 76 +- Minecraft.Client/Orbis/Iggy/include/gdraw.h | 8 +- .../Orbis/Iggy/include/iggyexpruntime.h | 4 +- .../Leaderboards/OrbisLeaderboardManager.cpp | 60 +- Minecraft.Client/Orbis/Miles/include/mss.h | 14 +- .../Orbis/Network/Orbis_NPToolkit.cpp | 4 +- .../Orbis/Network/SQRNetworkManager_Orbis.cpp | 128 +- .../Orbis/Network/SQRNetworkManager_Orbis.h | 2 +- .../Orbis/Network/SonyCommerce_Orbis.cpp | 56 +- .../Orbis/Network/SonyCommerce_Orbis.h | 4 +- .../Orbis/Network/SonyHttp_Orbis.cpp | 8 +- .../Orbis/Network/SonyRemoteStorage_Orbis.cpp | 4 +- .../Orbis/Network/SonyVoiceChat_Orbis.cpp | 14 +- .../Orbis/OrbisExtras/OrbisStubs.cpp | 40 +- .../Orbis/OrbisExtras/TLSStorage.cpp | 10 +- Minecraft.Client/Orbis/OrbisExtras/winerror.h | 2 +- Minecraft.Client/Orbis/Orbis_App.cpp | 66 +- Minecraft.Client/Orbis/Orbis_App.h | 2 +- Minecraft.Client/Orbis/Orbis_Minecraft.cpp | 44 +- Minecraft.Client/Orbis/Orbis_UIController.cpp | 4 +- Minecraft.Client/Orbis/XML/ATGXmlParser.h | 2 +- Minecraft.Client/Orbis/user_malloc.cpp | 6 +- .../Orbis/user_malloc_for_tls.cpp | 6 +- Minecraft.Client/Orbis/user_new.cpp | 28 +- .../PS3/4JLibs/STO_TitleSmallStorage.cpp | 16 +- Minecraft.Client/PS3/4JLibs/inc/4J_Input.h | 4 +- Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h | 2 +- Minecraft.Client/PS3/4JLibs/inc/4J_Render.h | 6 +- Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h | 10 +- .../PS3/Audio/PS3_SoundEngine.cpp | 8 +- .../PS3/Iggy/gdraw/gdraw_ps3gcm.cpp | 84 +- .../PS3/Iggy/gdraw/gdraw_ps3gcm.h | 2 +- .../PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl | 154 +- .../PS3/Iggy/gdraw/gdraw_shared.inl | 76 +- Minecraft.Client/PS3/Iggy/include/gdraw.h | 8 +- .../PS3/Iggy/include/iggyexpruntime.h | 4 +- .../Leaderboards/PS3LeaderboardManager.cpp | 52 +- Minecraft.Client/PS3/Miles/include/mss.h | 14 +- .../PS3/Network/SQRNetworkManager_PS3.cpp | 128 +- .../PS3/Network/SQRNetworkManager_PS3.h | 2 +- .../PS3/Network/SonyCommerce_PS3.cpp | 48 +- .../PS3/Network/SonyCommerce_PS3.h | 4 +- Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp | 48 +- .../PS3/Network/SonyRemoteStorage_PS3.cpp | 10 +- .../PS3/Network/SonyVoiceChat.cpp | 14 +- .../PS3/PS3Extras/C4JSpursJob.cpp | 14 +- Minecraft.Client/PS3/PS3Extras/C4JSpursJob.h | 4 +- .../PS3/PS3Extras/C4JThread_SPU.cpp | 2 +- Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp | 10 +- Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp | 6 +- Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp | 18 +- .../PS3/PS3Extras/ShutdownManager.cpp | 4 +- Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp | 10 +- Minecraft.Client/PS3/PS3Extras/winerror.h | 2 +- Minecraft.Client/PS3/PS3_App.cpp | 56 +- Minecraft.Client/PS3/PS3_App.h | 2 +- Minecraft.Client/PS3/PS3_Minecraft.cpp | 32 +- .../PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h | 4 +- .../SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h | 2 +- .../ChunkUpdate/ChunkRebuildData.cpp | 4 +- .../PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h | 2 +- .../ChunkUpdate/HalfSlabTile_SPU.cpp | 2 +- .../SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h | 2 +- .../ChunkUpdate/PistonBaseTile_SPU.h | 2 +- .../ChunkUpdate/PistonExtensionTile_SPU.h | 2 +- .../ChunkUpdate/PistonMovingPiece_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/PortalTile_SPU.h | 2 +- .../ChunkUpdate/PressurePlateTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h | 2 +- .../ChunkUpdate/RedStoneDustTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp | 2 +- .../ChunkUpdate/TheEndPortalFrameTile_SPU.h | 2 +- .../ChunkUpdate/ThinFenceTile_SPU.cpp | 2 +- .../SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h | 2 +- .../ChunkUpdate/TileRenderer_SPU.cpp | 20 +- .../SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h | 4 +- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp | 36 +- .../PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h | 4 +- .../SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h | 2 +- .../SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h | 2 +- .../PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h | 6 +- .../CompressedTileStorage_SPU.cpp | 8 +- Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h | 4 +- .../PSVita/4JLibs/inc/4J_Profile.h | 2 +- .../PSVita/4JLibs/inc/4J_Render.h | 6 +- .../PSVita/4JLibs/inc/4J_Storage.h | 6 +- .../PSVita/Iggy/gdraw/gdraw_psp2.cpp | 108 +- .../PSVita/Iggy/gdraw/gdraw_psp2.h | 4 +- .../PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl | 46 +- .../PSVita/Iggy/gdraw/gdraw_shared.inl | 76 +- Minecraft.Client/PSVita/Iggy/include/gdraw.h | 8 +- .../PSVita/Iggy/include/iggyexpruntime.h | 4 +- .../Leaderboards/PSVitaLeaderboardManager.cpp | 2 +- Minecraft.Client/PSVita/Miles/include/mss.h | 14 +- .../PSVita/Network/PSVita_NPToolkit.cpp | 6 +- .../Network/SQRNetworkManager_AdHoc_Vita.cpp | 102 +- .../Network/SQRNetworkManager_AdHoc_Vita.h | 2 +- .../PSVita/Network/SQRNetworkManager_Vita.cpp | 138 +- .../PSVita/Network/SQRNetworkManager_Vita.h | 2 +- .../PSVita/Network/SonyCommerce_Vita.cpp | 60 +- .../PSVita/Network/SonyCommerce_Vita.h | 4 +- .../PSVita/Network/SonyHttp_Vita.cpp | 2 +- .../PSVita/Network/SonyRemoteStorage_Vita.cpp | 4 +- .../PSVita/Network/SonyVoiceChat_Vita.cpp | 14 +- .../PSVita/PSVitaExtras/CustomMap.cpp | 4 +- .../PSVita/PSVitaExtras/CustomSet.cpp | 4 +- .../PSVita/PSVitaExtras/PSVitaStrings.cpp | 4 +- .../PSVita/PSVitaExtras/PSVitaTLSStorage.cpp | 14 +- .../PSVita/PSVitaExtras/PsVitaStubs.cpp | 36 +- .../PSVita/PSVitaExtras/ShutdownManager.cpp | 4 +- .../PSVita/PSVitaExtras/libdivide.h | 12 +- .../PSVita/PSVitaExtras/user_malloc.c | 26 +- .../PSVita/PSVitaExtras/user_malloc_for_tls.c | 6 +- .../PSVita/PSVitaExtras/user_new.cpp | 26 +- Minecraft.Client/PSVita/PSVitaExtras/zlib.h | 10 +- Minecraft.Client/PSVita/PSVita_App.cpp | 80 +- Minecraft.Client/PSVita/PSVita_App.h | 2 +- Minecraft.Client/PSVita/PSVita_Minecraft.cpp | 16 +- .../PSVita/PSVita_UIController.cpp | 2 +- Minecraft.Client/PSVita/XML/ATGXmlParser.h | 2 +- Minecraft.Client/Particle.cpp | 4 +- Minecraft.Client/ParticleEngine.cpp | 6 +- Minecraft.Client/PauseScreen.cpp | 4 +- Minecraft.Client/PendingConnection.cpp | 10 +- Minecraft.Client/PistonPieceRenderer.cpp | 4 +- Minecraft.Client/PlayerChunkMap.cpp | 34 +- Minecraft.Client/PlayerCloudParticle.cpp | 2 +- Minecraft.Client/PlayerConnection.cpp | 92 +- Minecraft.Client/PlayerList.cpp | 114 +- Minecraft.Client/PlayerRenderer.cpp | 28 +- Minecraft.Client/PreStitchedTextureMap.cpp | 20 +- Minecraft.Client/ReceivingLevelScreen.cpp | 2 +- Minecraft.Client/RemotePlayer.cpp | 2 +- Minecraft.Client/RenameWorldScreen.cpp | 2 +- Minecraft.Client/Screen.cpp | 18 +- Minecraft.Client/SelectWorldScreen.cpp | 20 +- Minecraft.Client/ServerChunkCache.cpp | 62 +- Minecraft.Client/ServerConnection.cpp | 4 +- Minecraft.Client/ServerLevel.cpp | 32 +- Minecraft.Client/ServerPlayer.cpp | 70 +- Minecraft.Client/ServerPlayerGameMode.cpp | 24 +- Minecraft.Client/ServerPlayerGameMode.h | 2 +- Minecraft.Client/ServerScoreboard.cpp | 10 +- Minecraft.Client/Settings.cpp | 2 +- Minecraft.Client/SkullTileRenderer.cpp | 2 +- Minecraft.Client/SlimeModel.cpp | 8 +- Minecraft.Client/SmallButton.cpp | 4 +- Minecraft.Client/SnowManRenderer.cpp | 2 +- Minecraft.Client/StatsCounter.cpp | 48 +- Minecraft.Client/StatsScreen.cpp | 20 +- Minecraft.Client/StitchSlot.cpp | 10 +- Minecraft.Client/StitchedTexture.cpp | 16 +- Minecraft.Client/Stitcher.cpp | 4 +- Minecraft.Client/TeleportCommand.cpp | 2 +- Minecraft.Client/TerrainParticle.cpp | 2 +- Minecraft.Client/TextEditScreen.cpp | 2 +- Minecraft.Client/Texture.cpp | 20 +- Minecraft.Client/Texture.h | 2 +- Minecraft.Client/TextureManager.cpp | 12 +- Minecraft.Client/TextureMap.cpp | 20 +- Minecraft.Client/TexturePack.cpp | 6 +- Minecraft.Client/TexturePack.h | 4 +- Minecraft.Client/TexturePackRepository.cpp | 36 +- Minecraft.Client/Textures.cpp | 76 +- .../TileEntityRenderDispatcher.cpp | 20 +- Minecraft.Client/TileEntityRenderer.cpp | 4 +- Minecraft.Client/TileRenderer.cpp | 26 +- Minecraft.Client/TitleScreen.cpp | 4 +- Minecraft.Client/TrackedEntity.cpp | 40 +- Minecraft.Client/VideoSettingsScreen.cpp | 2 +- .../Windows64/4JLibs/inc/4J_Input.h | 4 +- .../Windows64/4JLibs/inc/4J_Profile.h | 2 +- .../Windows64/4JLibs/inc/4J_Render.h | 6 +- .../Windows64/4JLibs/inc/4J_Storage.h | 18 +- .../Iggy/gdraw/gdraw_d3d10_shaders.inl | 22 +- .../Windows64/Iggy/gdraw/gdraw_d3d11.cpp | 16 +- .../Windows64/Iggy/gdraw/gdraw_d3d11.h | 4 +- .../Iggy/gdraw/gdraw_d3d1x_shared.inl | 146 +- .../Windows64/Iggy/gdraw/gdraw_gl_shaders.inl | 40 +- .../Windows64/Iggy/gdraw/gdraw_gl_shared.inl | 96 +- .../Windows64/Iggy/gdraw/gdraw_shared.inl | 76 +- .../Windows64/Iggy/include/gdraw.h | 8 +- .../Windows64/Iggy/include/iggyexpruntime.h | 4 +- .../Windows64/KeyboardMouseInput.cpp | 8 +- .../Windows64/Network/WinsockNetLayer.cpp | 56 +- .../Windows64/Network/WinsockNetLayer.h | 2 +- Minecraft.Client/Windows64/Windows64_App.cpp | 8 +- Minecraft.Client/Windows64/Windows64_App.h | 2 +- .../Windows64/Windows64_Minecraft.cpp | 76 +- .../Windows64/Windows64_UIController.cpp | 4 +- Minecraft.Client/Windows64/XML/ATGXmlParser.h | 2 +- Minecraft.Client/WitchRenderer.cpp | 4 +- Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h | 4 +- Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h | 2 +- Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h | 2 +- Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h | 24 +- Minecraft.Client/Xbox/Audio/SoundEngine.cpp | 104 +- Minecraft.Client/Xbox/Font/XUI_Font.cpp | 10 +- Minecraft.Client/Xbox/Font/XUI_FontData.cpp | 12 +- .../Xbox/Font/XUI_FontRenderer.cpp | 16 +- .../Leaderboards/XboxLeaderboardManager.cpp | 104 +- .../Xbox/Network/NetworkPlayerXbox.cpp | 6 +- .../Network/PlatformNetworkManagerXbox.cpp | 126 +- .../Xbox/Network/PlatformNetworkManagerXbox.h | 2 +- .../Xbox/Sentient/DynamicConfigurations.cpp | 14 +- .../Xbox/Sentient/Include/SenClientAvatar.h | 18 +- .../Xbox/Sentient/Include/SenClientBoxArt.h | 38 +- .../Xbox/Sentient/Include/SenClientConfig.h | 4 +- .../Xbox/Sentient/Include/SenClientCore.h | 2 +- .../SenClientCultureBackCompat_SenClientUGC.h | 4 +- .../Sentient/Include/SenClientDynamicConfig.h | 8 +- .../Xbox/Sentient/Include/SenClientFame.h | 24 +- .../Xbox/Sentient/Include/SenClientUGC.h | 10 +- .../Xbox/Sentient/Include/SenClientUser.h | 4 +- .../Xbox/Sentient/SentientManager.cpp | 8 +- .../Xbox/Sentient/SentientStats.cpp | 72 +- .../Xbox/Social/SocialManager.cpp | 28 +- Minecraft.Client/Xbox/XML/ATGXmlParser.cpp | 22 +- Minecraft.Client/Xbox/XML/ATGXmlParser.h | 2 +- Minecraft.Client/Xbox/XML/xmlFilesCallback.h | 12 +- Minecraft.Client/Xbox/Xbox_App.cpp | 346 +- Minecraft.Client/Xbox/Xbox_App.h | 4 +- Minecraft.Client/Xbox/Xbox_Minecraft.cpp | 6 +- Minecraft.Client/Xbox/Xbox_UIController.cpp | 10 +- Minecraft.Client/Xbox/Xbox_UIController.h | 6 +- Minecraft.Client/ZombieRenderer.cpp | 8 +- Minecraft.Client/stubs.h | 6 +- Minecraft.World/AABB.cpp | 38 +- Minecraft.World/AbstractContainerMenu.cpp | 66 +- Minecraft.World/Achievement.cpp | 2 +- Minecraft.World/Achievements.cpp | 158 +- Minecraft.World/AddMobPacket.cpp | 10 +- Minecraft.World/AddPlayerPacket.cpp | 14 +- Minecraft.World/AgableMob.cpp | 6 +- Minecraft.World/Animal.cpp | 20 +- Minecraft.World/AnvilMenu.cpp | 16 +- Minecraft.World/AnvilTile.cpp | 2 +- Minecraft.World/ArmorDyeRecipe.cpp | 20 +- Minecraft.World/ArmorItem.cpp | 10 +- Minecraft.World/ArmorSlot.cpp | 8 +- Minecraft.World/ArrayWithLength.h | 6 +- Minecraft.World/Arrow.cpp | 28 +- Minecraft.World/AttributeModifier.cpp | 2 +- Minecraft.World/AvoidPlayerGoal.cpp | 16 +- Minecraft.World/AwardStatPacket.cpp | 8 +- Minecraft.World/BaseAttributeMap.cpp | 6 +- Minecraft.World/BaseEntityTile.cpp | 2 +- Minecraft.World/BaseMobSpawner.cpp | 46 +- Minecraft.World/BasePressurePlateTile.cpp | 2 +- Minecraft.World/BaseRailTile.cpp | 14 +- Minecraft.World/BasicTree.cpp | 6 +- Minecraft.World/BasicTypeContainers.cpp | 2 +- Minecraft.World/Bat.cpp | 10 +- Minecraft.World/BeaconMenu.cpp | 4 +- Minecraft.World/BeaconTile.cpp | 2 +- Minecraft.World/BeaconTileEntity.cpp | 10 +- Minecraft.World/BedTile.cpp | 10 +- Minecraft.World/BegGoal.cpp | 6 +- Minecraft.World/BinaryHeap.cpp | 6 +- Minecraft.World/Biome.cpp | 52 +- Minecraft.World/BiomeCache.cpp | 4 +- Minecraft.World/BiomeDecorator.cpp | 14 +- Minecraft.World/BiomeOverrideLayer.cpp | 8 +- Minecraft.World/BiomeSource.cpp | 32 +- Minecraft.World/BirchFeature.cpp | 2 +- Minecraft.World/Blaze.cpp | 2 +- Minecraft.World/BlockReplacements.cpp | 2 +- Minecraft.World/Boat.cpp | 16 +- Minecraft.World/BoatItem.cpp | 4 +- Minecraft.World/BonusChestFeature.cpp | 2 +- Minecraft.World/BottleItem.cpp | 4 +- Minecraft.World/BoundingBox.cpp | 2 +- Minecraft.World/BowItem.cpp | 2 +- Minecraft.World/BreedGoal.cpp | 12 +- Minecraft.World/BrewingStandMenu.cpp | 6 +- Minecraft.World/BrewingStandTile.cpp | 8 +- Minecraft.World/BrewingStandTileEntity.cpp | 32 +- Minecraft.World/BucketItem.cpp | 6 +- Minecraft.World/Bush.cpp | 2 +- Minecraft.World/ButtonTile.cpp | 2 +- Minecraft.World/ByteArrayInputStream.cpp | 2 +- Minecraft.World/ByteArrayOutputStream.cpp | 2 +- Minecraft.World/ByteArrayTag.h | 2 +- Minecraft.World/C4JThread.cpp | 74 +- Minecraft.World/CactusTile.cpp | 4 +- Minecraft.World/CakeTile.cpp | 6 +- Minecraft.World/CauldronTile.cpp | 10 +- Minecraft.World/CaveFeature.cpp | 2 +- Minecraft.World/ChestTile.cpp | 10 +- Minecraft.World/ChestTileEntity.cpp | 38 +- Minecraft.World/ChunkSource.h | 2 +- Minecraft.World/ClientSideMerchant.cpp | 4 +- Minecraft.World/ClockItem.cpp | 4 +- Minecraft.World/ColoredTileItem.cpp | 6 +- Minecraft.World/CombatEntry.cpp | 6 +- Minecraft.World/CombatTracker.cpp | 32 +- Minecraft.World/Command.cpp | 4 +- Minecraft.World/CommandBlock.cpp | 6 +- Minecraft.World/CommandBlockEntity.cpp | 2 +- Minecraft.World/CommonStats.cpp | 24 +- Minecraft.World/ComparatorTile.cpp | 2 +- Minecraft.World/CompassItem.cpp | 4 +- Minecraft.World/CompoundContainer.cpp | 4 +- Minecraft.World/CompoundTag.h | 2 +- Minecraft.World/CompressedTileStorage.cpp | 28 +- Minecraft.World/Connection.cpp | 44 +- Minecraft.World/ConsoleSaveFile.h | 4 +- Minecraft.World/ConsoleSaveFileConverter.cpp | 2 +- .../ConsoleSaveFileInputStream.cpp | 8 +- Minecraft.World/ConsoleSaveFileOriginal.cpp | 72 +- Minecraft.World/ConsoleSaveFileOriginal.h | 4 +- .../ConsoleSaveFileOutputStream.cpp | 8 +- Minecraft.World/ContainerMenu.cpp | 4 +- Minecraft.World/ContainerSetContentPacket.cpp | 2 +- Minecraft.World/ContainerSetSlotPacket.cpp | 2 +- Minecraft.World/ControlledByPlayerGoal.cpp | 6 +- Minecraft.World/Cow.cpp | 2 +- Minecraft.World/CraftingContainer.cpp | 4 +- Minecraft.World/CraftingMenu.cpp | 4 +- Minecraft.World/Creeper.cpp | 6 +- Minecraft.World/CropTile.cpp | 2 +- Minecraft.World/CustomLevelSource.cpp | 38 +- Minecraft.World/CustomPayloadPacket.cpp | 6 +- Minecraft.World/DamageEnchantment.cpp | 2 +- Minecraft.World/DamageSource.cpp | 6 +- Minecraft.World/DataLayer.cpp | 2 +- .../DaylightDetectorTileEntity.cpp | 4 +- Minecraft.World/DeadBushTile.cpp | 2 +- Minecraft.World/DefendVillageTargetGoal.cpp | 2 +- Minecraft.World/DetectorRailTile.cpp | 2 +- Minecraft.World/Dimension.cpp | 8 +- Minecraft.World/DiodeTile.cpp | 2 +- Minecraft.World/DirectoryLevelStorage.cpp | 18 +- .../DirectoryLevelStorageSource.cpp | 4 +- Minecraft.World/DispenserTile.cpp | 12 +- Minecraft.World/DispenserTileEntity.cpp | 22 +- Minecraft.World/DoorInteractGoal.cpp | 10 +- Minecraft.World/DropperTile.cpp | 8 +- Minecraft.World/DurangoStats.cpp | 20 +- Minecraft.World/DyePowderItem.cpp | 8 +- Minecraft.World/EnchantItemCommand.cpp | 12 +- Minecraft.World/EnchantedBookItem.cpp | 6 +- Minecraft.World/Enchantment.cpp | 48 +- Minecraft.World/EnchantmentCategory.cpp | 8 +- Minecraft.World/EnchantmentHelper.cpp | 26 +- Minecraft.World/EnchantmentMenu.cpp | 10 +- Minecraft.World/EnchantmentTableEntity.cpp | 2 +- Minecraft.World/EnchantmentTableTile.cpp | 4 +- Minecraft.World/EnderChestTile.cpp | 2 +- Minecraft.World/EnderCrystal.cpp | 2 +- Minecraft.World/EnderDragon.cpp | 86 +- Minecraft.World/EnderDragon.h | 2 +- Minecraft.World/EnderEyeItem.cpp | 10 +- Minecraft.World/EnderMan.cpp | 14 +- Minecraft.World/EnderpearlItem.cpp | 2 +- Minecraft.World/Enemy.cpp | 2 +- Minecraft.World/Entity.cpp | 44 +- Minecraft.World/EntityDamageSource.cpp | 6 +- Minecraft.World/EntityHorse.cpp | 62 +- Minecraft.World/EntityIO.cpp | 20 +- Minecraft.World/EntityPos.cpp | 2 +- Minecraft.World/EntitySelector.cpp | 4 +- Minecraft.World/ExperienceOrb.cpp | 4 +- Minecraft.World/Explosion.cpp | 10 +- Minecraft.World/Explosion.h | 2 +- Minecraft.World/FallingTile.cpp | 8 +- Minecraft.World/FarmTile.cpp | 4 +- Minecraft.World/FastNoise.cpp | 2 +- Minecraft.World/FenceGateTile.cpp | 4 +- Minecraft.World/FenceTile.cpp | 2 +- Minecraft.World/File.cpp | 38 +- Minecraft.World/FileHeader.cpp | 40 +- Minecraft.World/FileInputStream.cpp | 14 +- Minecraft.World/FileOutputStream.cpp | 14 +- Minecraft.World/FireChargeItem.cpp | 2 +- Minecraft.World/FireTile.cpp | 4 +- Minecraft.World/Fireball.cpp | 16 +- Minecraft.World/FireworksChargeItem.cpp | 8 +- Minecraft.World/FireworksItem.cpp | 4 +- Minecraft.World/FireworksMenu.cpp | 6 +- Minecraft.World/FireworksRecipe.cpp | 26 +- Minecraft.World/FireworksRocketEntity.cpp | 16 +- Minecraft.World/FishingHook.cpp | 18 +- Minecraft.World/FishingRodItem.cpp | 4 +- Minecraft.World/FixedBiomeSource.cpp | 16 +- Minecraft.World/FlatGeneratorInfo.cpp | 10 +- Minecraft.World/FlatLevelSource.cpp | 6 +- Minecraft.World/FleeSunGoal.cpp | 4 +- Minecraft.World/FlowerFeature.cpp | 2 +- Minecraft.World/FlowerPotTile.cpp | 8 +- Minecraft.World/FollowOwnerGoal.cpp | 4 +- Minecraft.World/FollowParentGoal.cpp | 4 +- Minecraft.World/FurnaceMenu.cpp | 4 +- Minecraft.World/FurnaceRecipes.cpp | 4 +- Minecraft.World/FurnaceTile.cpp | 12 +- Minecraft.World/FurnaceTileEntity.cpp | 28 +- Minecraft.World/GameCommandPacket.cpp | 6 +- Minecraft.World/GameModeCommand.cpp | 2 +- Minecraft.World/GenericStats.cpp | 142 +- Minecraft.World/Ghast.cpp | 10 +- Minecraft.World/GiveItemCommand.cpp | 4 +- Minecraft.World/GrassTile.cpp | 6 +- Minecraft.World/HangingEntity.cpp | 10 +- Minecraft.World/HangingEntityItem.cpp | 2 +- Minecraft.World/HatchetItem.cpp | 4 +- Minecraft.World/HellFlatLevelSource.cpp | 6 +- Minecraft.World/HellRandomLevelSource.cpp | 10 +- Minecraft.World/HopperMenu.cpp | 2 +- Minecraft.World/HopperTile.cpp | 8 +- Minecraft.World/HopperTileEntity.cpp | 60 +- Minecraft.World/HorseInventoryMenu.cpp | 2 +- Minecraft.World/HtmlString.cpp | 2 +- Minecraft.World/HugeMushroomTile.cpp | 6 +- Minecraft.World/HurtByTargetGoal.cpp | 2 +- Minecraft.World/IceTile.cpp | 2 +- .../IndirectEntityDamageSource.cpp | 6 +- Minecraft.World/InputStream.cpp | 2 +- Minecraft.World/IntArrayTag.h | 2 +- Minecraft.World/IntCache.cpp | 6 +- Minecraft.World/Inventory.cpp | 86 +- Minecraft.World/InventoryMenu.cpp | 6 +- Minecraft.World/Item.cpp | 348 +- Minecraft.World/ItemDispenseBehaviors.cpp | 2 +- Minecraft.World/ItemEntity.cpp | 12 +- Minecraft.World/ItemFrame.cpp | 18 +- Minecraft.World/ItemInstance.cpp | 86 +- Minecraft.World/JukeboxTile.cpp | 10 +- Minecraft.World/LakeFeature.cpp | 4 +- Minecraft.World/LargeFireball.cpp | 2 +- Minecraft.World/Layer.cpp | 2 +- Minecraft.World/LeafTile.cpp | 6 +- Minecraft.World/LeapAtTargetGoal.cpp | 4 +- Minecraft.World/LeashFenceKnotEntity.cpp | 10 +- Minecraft.World/LeashItem.cpp | 8 +- Minecraft.World/Level.cpp | 182 +- Minecraft.World/Level.h | 2 +- Minecraft.World/LevelChunk.cpp | 126 +- Minecraft.World/LevelData.cpp | 8 +- Minecraft.World/LevelSettings.cpp | 8 +- Minecraft.World/LevelStorage.h | 2 +- Minecraft.World/LevelType.cpp | 14 +- Minecraft.World/LeverTile.cpp | 2 +- Minecraft.World/LiquidTile.cpp | 6 +- Minecraft.World/LivingEntity.cpp | 74 +- Minecraft.World/LivingEntity.h | 2 +- Minecraft.World/LoginPacket.cpp | 10 +- Minecraft.World/LookAtPlayerGoal.cpp | 6 +- Minecraft.World/MakeLoveGoal.cpp | 8 +- Minecraft.World/MapItem.cpp | 8 +- Minecraft.World/MapItemSavedData.cpp | 8 +- Minecraft.World/Material.cpp | 66 +- Minecraft.World/MaterialColor.cpp | 28 +- Minecraft.World/McRegionChunkStorage.cpp | 24 +- Minecraft.World/McRegionLevelStorage.cpp | 8 +- .../McRegionLevelStorageSource.cpp | 8 +- Minecraft.World/MegaTreeFeature.cpp | 2 +- Minecraft.World/MeleeAttackGoal.cpp | 16 +- Minecraft.World/MelonTile.cpp | 2 +- Minecraft.World/MemoryChunkStorage.cpp | 2 +- Minecraft.World/MemoryLevelStorage.cpp | 4 +- Minecraft.World/MemoryLevelStorageSource.cpp | 2 +- Minecraft.World/MerchantContainer.cpp | 22 +- Minecraft.World/MerchantMenu.cpp | 6 +- Minecraft.World/MerchantRecipe.cpp | 8 +- Minecraft.World/MerchantRecipeList.cpp | 16 +- Minecraft.World/MerchantResultSlot.cpp | 8 +- Minecraft.World/MineShaftFeature.cpp | 2 +- Minecraft.World/MineShaftPieces.cpp | 36 +- Minecraft.World/Minecart.cpp | 54 +- Minecraft.World/MinecartContainer.cpp | 12 +- Minecraft.World/MinecartFurnace.cpp | 2 +- Minecraft.World/MinecartRideable.cpp | 4 +- Minecraft.World/Mob.cpp | 78 +- Minecraft.World/Mob.h | 2 +- Minecraft.World/MobCategory.cpp | 14 +- Minecraft.World/MobEffect.cpp | 24 +- Minecraft.World/MobSpawner.cpp | 12 +- Minecraft.World/MobSpawnerTileEntity.cpp | 2 +- Minecraft.World/MockedLevelStorage.cpp | 6 +- Minecraft.World/MockedLevelStorage.h | 2 +- .../ModifiableAttributeInstance.cpp | 6 +- Minecraft.World/Monster.cpp | 2 +- Minecraft.World/Monster.h | 2 +- Minecraft.World/MonsterRoomFeature.cpp | 4 +- Minecraft.World/MoveEntityPacket.cpp | 2 +- Minecraft.World/MoveEntityPacketSmall.cpp | 2 +- Minecraft.World/MoveIndoorsGoal.cpp | 10 +- Minecraft.World/MoveThroughVillageGoal.cpp | 20 +- .../MoveTowardsRestrictionGoal.cpp | 2 +- Minecraft.World/MoveTowardsTargetGoal.cpp | 6 +- Minecraft.World/Mth.cpp | 6 +- Minecraft.World/Mushroom.cpp | 8 +- Minecraft.World/MushroomCow.cpp | 4 +- Minecraft.World/MycelTile.cpp | 4 +- Minecraft.World/NameTagItem.cpp | 2 +- Minecraft.World/NbtIo.cpp | 4 +- Minecraft.World/NbtSlotFile.cpp | 40 +- .../NearestAttackableTargetGoal.cpp | 6 +- Minecraft.World/NearestAttackableTargetGoal.h | 2 +- Minecraft.World/NetherBridgeFeature.cpp | 6 +- Minecraft.World/NetherBridgePieces.cpp | 132 +- Minecraft.World/Node.cpp | 4 +- Minecraft.World/NotGateTile.cpp | 2 +- Minecraft.World/NoteBlockTile.cpp | 6 +- Minecraft.World/Ocelot.cpp | 6 +- Minecraft.World/OcelotAttackGoal.cpp | 4 +- Minecraft.World/OfferFlowerGoal.cpp | 4 +- Minecraft.World/OldChunkStorage.cpp | 28 +- Minecraft.World/OreFeature.cpp | 6 +- Minecraft.World/OwnerHurtByTargetGoal.cpp | 4 +- Minecraft.World/OwnerHurtTargetGoal.cpp | 4 +- Minecraft.World/Packet.cpp | 10 +- Minecraft.World/Painting.cpp | 6 +- Minecraft.World/Path.cpp | 8 +- Minecraft.World/PathFinder.cpp | 28 +- Minecraft.World/PathNavigation.cpp | 28 +- Minecraft.World/PathfinderMob.cpp | 34 +- Minecraft.World/PerlinNoise.cpp | 2 +- Minecraft.World/PerlinSimplexNoise.cpp | 4 +- Minecraft.World/PickaxeItem.cpp | 2 +- Minecraft.World/Pig.cpp | 8 +- Minecraft.World/PigZombie.cpp | 4 +- Minecraft.World/PineFeature.cpp | 2 +- Minecraft.World/PistonBaseTile.cpp | 16 +- Minecraft.World/PistonExtensionTile.cpp | 6 +- Minecraft.World/PistonMovingPiece.cpp | 26 +- Minecraft.World/PistonPieceEntity.cpp | 4 +- Minecraft.World/PlayGoal.cpp | 12 +- Minecraft.World/Player.cpp | 132 +- Minecraft.World/PlayerEnderChestContainer.cpp | 6 +- Minecraft.World/PlayerInfoPacket.cpp | 2 +- Minecraft.World/PlayerTeam.cpp | 2 +- Minecraft.World/PortalForcer.cpp | 2 +- Minecraft.World/PortalTile.cpp | 6 +- Minecraft.World/Pos.cpp | 4 +- Minecraft.World/PotionBrewing.cpp | 10 +- Minecraft.World/PotionItem.cpp | 34 +- Minecraft.World/PreLoginPacket.cpp | 6 +- Minecraft.World/PressurePlateTile.cpp | 4 +- Minecraft.World/ProtectionEnchantment.cpp | 2 +- Minecraft.World/PumpkinTile.cpp | 4 +- Minecraft.World/RandomLevelSource.cpp | 30 +- Minecraft.World/RandomPos.cpp | 6 +- .../RandomScatteredLargeFeature.cpp | 8 +- Minecraft.World/RandomStrollGoal.cpp | 4 +- Minecraft.World/RangedAttackGoal.cpp | 4 +- Minecraft.World/ReadOnlyChunkCache.cpp | 8 +- Minecraft.World/Recipes.cpp | 28 +- Minecraft.World/Recipes.h | 2 +- Minecraft.World/RecordingItem.cpp | 2 +- Minecraft.World/RedStoneDustTile.cpp | 12 +- Minecraft.World/ReedTile.cpp | 2 +- Minecraft.World/ReedsFeature.cpp | 2 +- Minecraft.World/Region.cpp | 22 +- Minecraft.World/RegionFile.cpp | 34 +- Minecraft.World/RegionFileCache.cpp | 6 +- Minecraft.World/RepairResultSlot.cpp | 2 +- Minecraft.World/RespawnPacket.cpp | 10 +- Minecraft.World/RestrictOpenDoorGoal.cpp | 6 +- Minecraft.World/ResultContainer.cpp | 4 +- Minecraft.World/ResultSlot.cpp | 4 +- Minecraft.World/RunAroundLikeCrazyGoal.cpp | 6 +- Minecraft.World/SaddleItem.cpp | 2 +- Minecraft.World/SandFeature.cpp | 2 +- Minecraft.World/SandStoneTile.cpp | 6 +- Minecraft.World/Sapling.cpp | 10 +- Minecraft.World/SavedDataStorage.cpp | 14 +- Minecraft.World/ScatteredFeaturePieces.cpp | 4 +- Minecraft.World/Scoreboard.cpp | 44 +- Minecraft.World/ServersideAttributeMap.cpp | 4 +- Minecraft.World/SetDisplayObjectivePacket.cpp | 2 +- Minecraft.World/SetEntityDataPacket.cpp | 2 +- Minecraft.World/SetEntityLinkPacket.cpp | 2 +- Minecraft.World/SetEquippedItemPacket.cpp | 2 +- Minecraft.World/SetPlayerTeamPacket.cpp | 2 +- Minecraft.World/ShapedRecipy.cpp | 14 +- Minecraft.World/SharedMonsterAttributes.cpp | 4 +- Minecraft.World/Sheep.cpp | 4 +- Minecraft.World/ShovelItem.cpp | 2 +- Minecraft.World/SignItem.cpp | 2 +- Minecraft.World/SignTile.cpp | 2 +- Minecraft.World/Silverfish.cpp | 8 +- Minecraft.World/SimpleContainer.cpp | 12 +- Minecraft.World/SitGoal.cpp | 4 +- Minecraft.World/Skeleton.cpp | 14 +- Minecraft.World/SkullItem.cpp | 2 +- Minecraft.World/SkullTile.cpp | 4 +- Minecraft.World/SkyIslandDimension.cpp | 2 +- Minecraft.World/Slime.cpp | 4 +- Minecraft.World/Slot.cpp | 22 +- Minecraft.World/SmallFireball.cpp | 2 +- Minecraft.World/SmoothStoneBrickTile.cpp | 2 +- Minecraft.World/Snowball.cpp | 2 +- Minecraft.World/Socket.cpp | 26 +- Minecraft.World/SparseDataStorage.cpp | 2 +- Minecraft.World/SparseLightStorage.cpp | 2 +- Minecraft.World/SpawnEggItem.cpp | 20 +- Minecraft.World/Spider.cpp | 8 +- Minecraft.World/SpringFeature.cpp | 2 +- Minecraft.World/SpruceFeature.cpp | 2 +- Minecraft.World/StairTile.cpp | 10 +- Minecraft.World/Stats.cpp | 50 +- Minecraft.World/StemTile.cpp | 4 +- Minecraft.World/StrongholdFeature.cpp | 10 +- Minecraft.World/StrongholdPieces.cpp | 132 +- Minecraft.World/StructureFeature.cpp | 18 +- Minecraft.World/StructureFeatureIO.cpp | 8 +- Minecraft.World/StructurePiece.cpp | 14 +- Minecraft.World/StructureStart.cpp | 4 +- Minecraft.World/SwampTreeFeature.cpp | 2 +- Minecraft.World/SwellGoal.cpp | 4 +- Minecraft.World/SynchedEntityData.cpp | 26 +- Minecraft.World/Tag.cpp | 4 +- Minecraft.World/TakeFlowerGoal.cpp | 2 +- Minecraft.World/TallGrass.cpp | 2 +- Minecraft.World/TamableAnimal.cpp | 6 +- Minecraft.World/TargetGoal.cpp | 14 +- Minecraft.World/Team.cpp | 2 +- Minecraft.World/TemptGoal.cpp | 6 +- Minecraft.World/TextureAndGeometryPacket.cpp | 16 +- Minecraft.World/TexturePacket.cpp | 4 +- Minecraft.World/TheEndDimension.cpp | 2 +- .../TheEndLevelRandomLevelSource.cpp | 8 +- Minecraft.World/TheEndPortal.cpp | 4 +- Minecraft.World/TheEndPortalFrameTile.cpp | 4 +- Minecraft.World/ThinFenceTile.cpp | 2 +- Minecraft.World/ThornsEnchantment.cpp | 4 +- Minecraft.World/Throwable.cpp | 14 +- Minecraft.World/ThrownEgg.cpp | 2 +- Minecraft.World/ThrownEnderpearl.cpp | 4 +- Minecraft.World/ThrownPotion.cpp | 12 +- Minecraft.World/TickNextTickData.cpp | 2 +- Minecraft.World/Tile.cpp | 402 +- Minecraft.World/TileEntity.cpp | 16 +- Minecraft.World/TileEntityDataPacket.cpp | 2 +- Minecraft.World/TileItem.cpp | 8 +- Minecraft.World/TntTile.cpp | 6 +- Minecraft.World/TorchTile.cpp | 2 +- Minecraft.World/TradeWithPlayerGoal.cpp | 2 +- Minecraft.World/TrapDoorTile.cpp | 2 +- Minecraft.World/TrapMenu.cpp | 2 +- Minecraft.World/TreeFeature.cpp | 2 +- Minecraft.World/TripWireSourceTile.cpp | 2 +- Minecraft.World/TripWireTile.cpp | 4 +- Minecraft.World/Vec3.cpp | 16 +- Minecraft.World/Village.cpp | 14 +- Minecraft.World/VillageFeature.cpp | 2 +- Minecraft.World/VillagePieces.cpp | 90 +- Minecraft.World/VillageSiege.cpp | 14 +- Minecraft.World/Villager.cpp | 32 +- Minecraft.World/VillagerGolem.cpp | 6 +- Minecraft.World/Villages.cpp | 4 +- Minecraft.World/VineTile.cpp | 6 +- Minecraft.World/WallTile.cpp | 2 +- Minecraft.World/WaterLevelChunk.cpp | 2 +- Minecraft.World/WaterLilyTile.cpp | 2 +- Minecraft.World/WaterLilyTileItem.cpp | 4 +- Minecraft.World/WebTile.cpp | 2 +- Minecraft.World/WeighedRandom.cpp | 4 +- Minecraft.World/Witch.cpp | 8 +- Minecraft.World/WitherBoss.cpp | 12 +- Minecraft.World/WitherSkull.cpp | 4 +- Minecraft.World/Wolf.cpp | 24 +- Minecraft.World/WoodTile.cpp | 2 +- Minecraft.World/WorkbenchTile.cpp | 4 +- Minecraft.World/Zombie.cpp | 26 +- Minecraft.World/ZoneFile.cpp | 2 +- Minecraft.World/ZoneIo.cpp | 8 +- Minecraft.World/ZonedChunkStorage.cpp | 10 +- Minecraft.World/compression.cpp | 18 +- Minecraft.World/x64headers/extraX64.h | 2 +- tall cloc | 324 + 1045 files changed, 12944 insertions(+), 12620 deletions(-) create mode 100644 tall cloc diff --git a/Minecraft.Client/AbstractContainerScreen.cpp b/Minecraft.Client/AbstractContainerScreen.cpp index fbf1331d0..c2de6dc9a 100644 --- a/Minecraft.Client/AbstractContainerScreen.cpp +++ b/Minecraft.Client/AbstractContainerScreen.cpp @@ -51,7 +51,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) glColor4f(1, 1, 1, 1); glEnable(GL_RESCALE_NORMAL); - Slot *hoveredSlot = NULL; + Slot *hoveredSlot = nullptr; for ( Slot *slot : *menu->slots ) { @@ -73,7 +73,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) } shared_ptr inventory = minecraft->player->inventory; - if (inventory->getCarried() != NULL) + if (inventory->getCarried() != nullptr) { glTranslatef(0, 0, 32); // Slot old = carriedSlot; @@ -90,7 +90,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a) renderLabels(); - if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem()) + if (inventory->getCarried() == nullptr && hoveredSlot != nullptr && hoveredSlot->hasItem()) { wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId())); @@ -127,7 +127,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot) int y = slot->y; shared_ptr item = slot->getItem(); - if (item == NULL) + if (item == nullptr) { int icon = slot->getNoItemIcon(); if (icon >= 0) @@ -151,7 +151,7 @@ Slot *AbstractContainerScreen::findSlot(int x, int y) { if (isHovering(slot, x, y)) return slot; } - return NULL; + return nullptr; } bool AbstractContainerScreen::isHovering(Slot *slot, int xm, int ym) @@ -177,7 +177,7 @@ void AbstractContainerScreen::mouseClicked(int x, int y, int buttonNum) bool clickedOutside = (x < xo || y < yo || x >= xo + imageWidth || y >= yo + imageHeight); int slotId = -1; - if (slot != NULL) slotId = slot->index; + if (slot != nullptr) slotId = slot->index; if (clickedOutside) { @@ -210,7 +210,7 @@ void AbstractContainerScreen::keyPressed(wchar_t eventCharacter, int eventKey) void AbstractContainerScreen::removed() { - if (minecraft->player == NULL) return; + if (minecraft->player == nullptr) return; } void AbstractContainerScreen::slotsChanged(shared_ptr container) diff --git a/Minecraft.Client/AbstractTexturePack.cpp b/Minecraft.Client/AbstractTexturePack.cpp index 80799a4c5..16d1b14e6 100644 --- a/Minecraft.Client/AbstractTexturePack.cpp +++ b/Minecraft.Client/AbstractTexturePack.cpp @@ -8,16 +8,16 @@ AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &na { // 4J init textureId = -1; - m_colourTable = NULL; + m_colourTable = nullptr; this->file = file; this->fallback = fallback; - m_iconData = NULL; + m_iconData = nullptr; m_iconSize = 0; - m_comparisonData = NULL; + m_comparisonData = nullptr; m_comparisonSize = 0; // 4J Stu - These calls need to be in the most derived version of the class @@ -41,7 +41,7 @@ void AbstractTexturePack::loadIcon() 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"); UINT size = 0; @@ -57,7 +57,7 @@ void AbstractTexturePack::loadComparison() 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/DefaultPack_Comparison.png"); UINT size = 0; @@ -70,8 +70,8 @@ void AbstractTexturePack::loadDescription() { // 4J Unused currently #if 0 - InputStream *inputStream = NULL; - BufferedReader *br = NULL; + InputStream *inputStream = nullptr; + BufferedReader *br = nullptr; //try { inputStream = getResourceImplementation(L"/pack.txt"); br = new BufferedReader(new InputStreamReader(inputStream)); @@ -81,12 +81,12 @@ void AbstractTexturePack::loadDescription() //} finally { // TODO [EB]: use IOUtils.closeSilently() // try { - if (br != NULL) + if (br != nullptr) { br->close(); delete br; } - if (inputStream != NULL) + if (inputStream != nullptr) { inputStream->close(); delete inputStream; @@ -105,7 +105,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal { app.DebugPrintf("texture - %ls\n",name.c_str()); InputStream *is = getResourceImplementation(name); - if (is == NULL && fallback != NULL && allowFallback) + if (is == nullptr && fallback != nullptr && allowFallback) { is = fallback->getResource(name, true); } @@ -121,7 +121,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal void AbstractTexturePack::unload(Textures *textures) { - if (iconImage != NULL && textureId != -1) + if (iconImage != nullptr && textureId != -1) { textures->releaseTexture(textureId); } @@ -129,7 +129,7 @@ void AbstractTexturePack::unload(Textures *textures) void AbstractTexturePack::load(Textures *textures) { - if (iconImage != NULL) + if (iconImage != nullptr) { if (textureId == -1) { @@ -149,7 +149,7 @@ bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback) { bool hasFile = this->hasFile(name); - return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile; + return !hasFile && (allowFallback && fallback != nullptr) ? fallback->hasFile(name, allowFallback) : hasFile; } DWORD AbstractTexturePack::getId() @@ -231,7 +231,7 @@ void AbstractTexturePack::loadDefaultUI() { #ifdef _XBOX // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); // Load new skin const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string @@ -240,7 +240,7 @@ void AbstractTexturePack::loadDefaultUI() swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur"); XuiFreeVisuals(L""); - app.LoadSkin(szResourceLocator,NULL);//L"TexturePack"); + app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack"); //CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack"); CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj); #else @@ -259,7 +259,7 @@ void AbstractTexturePack::loadDefaultColourTable() // Load the file #ifdef __PS3__ // need to check if it's a BD build, so pass in the name - File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":NULL).append(L"res/colours.col")); + File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":nullptr).append(L"res/colours.col")); #else File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col")); @@ -269,12 +269,12 @@ void AbstractTexturePack::loadDefaultColourTable() if(coloursFile.exists()) { DWORD dwLength = coloursFile.length(); - byteArray data(dwLength); + byteArray data(static_cast(dwLength)); FileInputStream fis(coloursFile); fis.read(data,0,dwLength); fis.close(); - if(m_colourTable != NULL) delete m_colourTable; + if(m_colourTable != nullptr) delete m_colourTable; m_colourTable = new ColourTable(data.data, dwLength); delete [] data.data; @@ -290,7 +290,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable() { #ifdef _XBOX // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; @@ -309,7 +309,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable() { wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/"); HXUIOBJ hScene; - HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", NULL, &hScene); + HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", nullptr, &hScene); if(HRESULT_SUCCEEDED(hr)) { @@ -333,7 +333,7 @@ void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj) HXUIOBJ child; HRESULT hr = XuiElementGetFirstChild(hObj, &child); - while(HRESULT_SUCCEEDED(hr) && child != NULL) + while(HRESULT_SUCCEEDED(hr) && child != nullptr) { LPCWSTR childName; XuiElementGetId(child,&childName); @@ -374,7 +374,7 @@ void AbstractTexturePack::unloadUI() wstring AbstractTexturePack::getXuiRootPath() { - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); // Load new skin const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string @@ -386,14 +386,14 @@ wstring AbstractTexturePack::getXuiRootPath() PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes) { - if(m_iconSize == 0 || m_iconData == NULL) loadIcon(); + if(m_iconSize == 0 || m_iconData == nullptr) loadIcon(); dwImageBytes = m_iconSize; return m_iconData; } PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes) { - if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison(); + if(m_comparisonSize == 0 || m_comparisonData == nullptr) loadComparison(); dwImageBytes = m_comparisonSize; return m_comparisonData; diff --git a/Minecraft.Client/AbstractTexturePack.h b/Minecraft.Client/AbstractTexturePack.h index e6410c193..6386ecf1e 100644 --- a/Minecraft.Client/AbstractTexturePack.h +++ b/Minecraft.Client/AbstractTexturePack.h @@ -89,5 +89,5 @@ public: virtual unsigned int getDLCParentPackId(); virtual unsigned char getDLCSubPackId(); virtual ColourTable *getColourTable() { return m_colourTable; } - virtual ArchiveFile *getArchiveFile() { return NULL; } + virtual ArchiveFile *getArchiveFile() { return nullptr; } }; diff --git a/Minecraft.Client/AchievementPopup.cpp b/Minecraft.Client/AchievementPopup.cpp index c10ebde32..4e08f3b81 100644 --- a/Minecraft.Client/AchievementPopup.cpp +++ b/Minecraft.Client/AchievementPopup.cpp @@ -14,7 +14,7 @@ AchievementPopup::AchievementPopup(Minecraft *mc) // 4J - added initialisers width = 0; height = 0; - ach = NULL; + ach = nullptr; startTime = 0; isHelper = false; @@ -88,7 +88,7 @@ void AchievementPopup::render() glDepthMask(true); glEnable(GL_DEPTH_TEST); } - if (ach == NULL || startTime == 0) return; + if (ach == nullptr || startTime == 0) return; double time = (System::currentTimeMillis() - startTime) / 3000.0; if (isHelper) diff --git a/Minecraft.Client/AchievementScreen.cpp b/Minecraft.Client/AchievementScreen.cpp index 902aed174..baafce30a 100644 --- a/Minecraft.Client/AchievementScreen.cpp +++ b/Minecraft.Client/AchievementScreen.cpp @@ -52,7 +52,7 @@ void AchievementScreen::buttonClicked(Button *button) { if (button->id == 1) { - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J removed } Screen::buttonClicked(button); @@ -62,7 +62,7 @@ void AchievementScreen::keyPressed(char eventCharacter, int eventKey) { if (eventKey == minecraft->options->keyBuild->key) { - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J removed } else @@ -286,7 +286,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) vLine(x2, y1, y2, color); } - Achievement *hoveredAchievement = NULL; + Achievement *hoveredAchievement = nullptr; ItemRenderer *ir = new ItemRenderer(); glPushMatrix(); @@ -372,7 +372,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) glEnable(GL_TEXTURE_2D); Screen::render(xm, ym, a); - if (hoveredAchievement != NULL) + if (hoveredAchievement != nullptr) { Achievement *ach = hoveredAchievement; wstring name = ach->name; diff --git a/Minecraft.Client/ArchiveFile.cpp b/Minecraft.Client/ArchiveFile.cpp index 2e57a5bb7..608428b6e 100644 --- a/Minecraft.Client/ArchiveFile.cpp +++ b/Minecraft.Client/ArchiveFile.cpp @@ -30,7 +30,7 @@ void ArchiveFile::_readHeader(DataInputStream *dis) ArchiveFile::ArchiveFile(File file) { - m_cachedData = NULL; + m_cachedData = nullptr; m_sourcefile = file; app.DebugPrintf("Loading archive file...\n"); #ifndef _CONTENT_PACKAGE @@ -48,7 +48,7 @@ ArchiveFile::ArchiveFile(File file) FileInputStream fis(file); #if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 - byteArray readArray(file.length()); + byteArray readArray(static_cast(file.length())); fis.read(readArray,0,file.length()); ByteArrayInputStream bais(readArray); @@ -122,20 +122,20 @@ byteArray ArchiveFile::getFile(const wstring &filename) HANDLE hfile = CreateFile( m_sourcefile.getPath().c_str(), GENERIC_READ, 0, - NULL, + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, - NULL + nullptr ); #else app.DebugPrintf("Createfile archive\n"); HANDLE hfile = CreateFile( wstringtofilename(m_sourcefile.getPath()), GENERIC_READ, 0, - NULL, + nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, - NULL + nullptr ); #endif @@ -144,7 +144,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) app.DebugPrintf("hfile ok\n"); DWORD ok = SetFilePointer( hfile, data->ptr, - NULL, + nullptr, FILE_BEGIN ); @@ -157,7 +157,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) (LPVOID) pbData, data->filesize, &bytesRead, - NULL + nullptr ); if(bSuccess==FALSE) @@ -182,7 +182,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) #endif // Compressed filenames are preceeded with an asterisk. - if ( data->isCompressed && out.data != NULL ) + if ( data->isCompressed && out.data != nullptr ) { /* 4J-JEV: * If a compressed file is accessed before compression object is @@ -204,7 +204,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) out.length = decompressedSize; } - assert(out.data != NULL); // THERE IS NO FILE WITH THIS NAME! + assert(out.data != nullptr); // THERE IS NO FILE WITH THIS NAME! } diff --git a/Minecraft.Client/BreakingItemParticle.cpp b/Minecraft.Client/BreakingItemParticle.cpp index 2eab8616d..8842209b8 100644 --- a/Minecraft.Client/BreakingItemParticle.cpp +++ b/Minecraft.Client/BreakingItemParticle.cpp @@ -42,7 +42,7 @@ void BreakingItemParticle::render(Tesselator *t, float a, float xa, float ya, fl float v1 = v0 + 0.999f / 16.0f / 4; float r = 0.1f * size; - if (tex != NULL) + if (tex != nullptr) { u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION); u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION); diff --git a/Minecraft.Client/BufferedImage.cpp b/Minecraft.Client/BufferedImage.cpp index 0b95c763d..8777d307b 100644 --- a/Minecraft.Client/BufferedImage.cpp +++ b/Minecraft.Client/BufferedImage.cpp @@ -31,7 +31,7 @@ BufferedImage::BufferedImage(int width,int height,int type) for( int i = 1 ; i < 10; i++ ) { - data[i] = NULL; + data[i] = nullptr; } this->width = width; this->height = height; @@ -140,7 +140,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f for( int l = 0 ; l < 10; l++ ) { - data[l] = NULL; + data[l] = nullptr; } for( int l = 0; l < 10; l++ ) @@ -193,12 +193,12 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam { HRESULT hr; wstring filePath = File; - BYTE *pbData = NULL; + BYTE *pbData = nullptr; DWORD dwBytes = 0; for( int l = 0 ; l < 10; l++ ) { - data[l] = NULL; + data[l] = nullptr; } for( int l = 0; l < 10; l++ ) @@ -230,7 +230,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenam DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name); pbData = dlcFile->getData(dwBytes); - if(pbData == NULL || dwBytes == 0) + if(pbData == nullptr || dwBytes == 0) { // 4J - If we haven't loaded the non-mipmap version then exit the game if( l == 0 ) @@ -269,7 +269,7 @@ BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes) int iCurrentByte=0; for( int l = 0 ; l < 10; l++ ) { - data[l] = NULL; + data[l] = nullptr; } D3DXIMAGE_INFO ImageInfo; @@ -329,7 +329,7 @@ int *BufferedImage::getData(int level) Graphics *BufferedImage::getGraphics() { - return NULL; + return nullptr; } //Returns the transparency. Returns either OPAQUE, BITMASK, or TRANSLUCENT. @@ -359,7 +359,7 @@ BufferedImage *BufferedImage::getSubimage(int x ,int y, int w, int h) this->getRGB(x, y, w, h, arrayWrapper,0,w); int level = 1; - while(getData(level) != NULL) + while(getData(level) != nullptr) { int ww = w >> level; int hh = h >> level; diff --git a/Minecraft.Client/BufferedImage.h b/Minecraft.Client/BufferedImage.h index a0227fe29..3a08383fc 100644 --- a/Minecraft.Client/BufferedImage.h +++ b/Minecraft.Client/BufferedImage.h @@ -7,7 +7,7 @@ class DLCPack; class BufferedImage { private: - int *data[10]; // Arrays for mipmaps - NULL if not used + int *data[10]; // Arrays for mipmaps - nullptr if not used int width; int height; void ByteFlip4(unsigned int &data); // 4J added diff --git a/Minecraft.Client/ChatScreen.cpp b/Minecraft.Client/ChatScreen.cpp index b68e6cac0..21c223749 100644 --- a/Minecraft.Client/ChatScreen.cpp +++ b/Minecraft.Client/ChatScreen.cpp @@ -30,7 +30,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey) { if (eventKey == Keyboard::KEY_ESCAPE) { - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); return; } if (eventKey == Keyboard::KEY_RETURN) @@ -44,7 +44,7 @@ void ChatScreen::keyPressed(wchar_t ch, int eventKey) minecraft->player->chat(trim); } } - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); return; } if (eventKey == Keyboard::KEY_BACK && message.length() > 0) message = message.substr(0, message.length() - 1); @@ -67,7 +67,7 @@ void ChatScreen::mouseClicked(int x, int y, int buttonNum) { if (buttonNum == 0) { - if (minecraft->gui->selectedName != L"") // 4J - was NULL comparison + if (minecraft->gui->selectedName != L"") // 4J - was nullptr comparison { if (message.length() > 0 && message[message.length()-1]!=L' ') { diff --git a/Minecraft.Client/ChestRenderer.cpp b/Minecraft.Client/ChestRenderer.cpp index 5b59eb411..7d306f45d 100644 --- a/Minecraft.Client/ChestRenderer.cpp +++ b/Minecraft.Client/ChestRenderer.cpp @@ -52,7 +52,7 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d Tile *tile = chest->getTile(); data = chest->getData(); - if (dynamic_cast(tile) != NULL && data == 0) + if (dynamic_cast(tile) != nullptr && data == 0) { static_cast(tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z); data = chest->getData(); @@ -60,11 +60,11 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d chest->checkNeighbors(); } - if (chest->n.lock() != NULL || chest->w.lock() != NULL) return; + if (chest->n.lock() != nullptr || chest->w.lock() != nullptr) return; ChestModel *model; - if (chest->e.lock() != NULL || chest->s.lock() != NULL) + if (chest->e.lock() != nullptr || chest->s.lock() != nullptr) { model = largeChestModel; @@ -112,11 +112,11 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d if (data == 4) rot = 90; if (data == 5) rot = -90; - if (data == 2 && chest->e.lock() != NULL) + if (data == 2 && chest->e.lock() != nullptr) { glTranslatef(1, 0, 0); } - if (data == 5 && chest->s.lock() != NULL) + if (data == 5 && chest->s.lock() != nullptr) { glTranslatef(0, 0, -1); } @@ -124,12 +124,12 @@ void ChestRenderer::render(shared_ptr _chest, double x, double y, d glTranslatef(-0.5f, -0.5f, -0.5f); float open = chest->oOpenness + (chest->openness - chest->oOpenness) * a; - if (chest->n.lock() != NULL) + if (chest->n.lock() != nullptr) { float open2 = chest->n.lock()->oOpenness + (chest->n.lock()->openness - chest->n.lock()->oOpenness) * a; if (open2 > open) open = open2; } - if (chest->w.lock() != NULL) + if (chest->w.lock() != nullptr) { float open2 = chest->w.lock()->oOpenness + (chest->w.lock()->openness - chest->w.lock()->oOpenness) * a; if (open2 > open) open = open2; diff --git a/Minecraft.Client/Chunk.cpp b/Minecraft.Client/Chunk.cpp index 58ee7f484..265f58701 100644 --- a/Minecraft.Client/Chunk.cpp +++ b/Minecraft.Client/Chunk.cpp @@ -173,7 +173,7 @@ void Chunk::makeCopyForRebuild(Chunk *source) this->ym = source->ym; this->zm = source->zm; this->bb = source->bb; - this->clipChunk = NULL; + this->clipChunk = nullptr; this->id = source->id; this->globalRenderableTileEntities = source->globalRenderableTileEntities; this->globalRenderableTileEntities_cs = source->globalRenderableTileEntities_cs; @@ -680,7 +680,7 @@ void Chunk::rebuild_SPU() // render chunk is 16 x 16 x 16. We wouldn't have to actually get all of it if the data was ordered differently, but currently // it is ordered by x then z then y so just getting a small range of y out of it would involve getting the whole thing into // the cache anyway. - ChunkRebuildData* pOutData = NULL; + ChunkRebuildData* pOutData = nullptr; g_rebuildDataIn.buildForChunk(®ion, level, x0, y0, z0); Tesselator::Bounds bounds; @@ -981,7 +981,7 @@ void Chunk::reset() void Chunk::_delete() { reset(); - level = NULL; + level = nullptr; } int Chunk::getList(int layer) diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index 9b9bb86a7..09a57759e 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -95,7 +95,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, const wstring& ip, int } else { - connection = NULL; + connection = nullptr; delete socket; } #endif @@ -106,9 +106,9 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs // 4J - added initiliasers random = new Random(); done = false; - level = NULL; + level = nullptr; started = false; - savedDataStorage = new SavedDataStorage(NULL); + savedDataStorage = new SavedDataStorage(nullptr); maxPlayers = 20; this->minecraft = minecraft; @@ -122,7 +122,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs m_userIndex = iUserIndex; } - if( socket == NULL ) + if( socket == nullptr ) { socket = new Socket(); // 4J - Local connection } @@ -134,7 +134,7 @@ ClientConnection::ClientConnection(Minecraft *minecraft, Socket *socket, int iUs } else { - connection = NULL; + connection = nullptr; // TODO 4J Stu - This will cause issues since the session player owns the socket //delete socket; } @@ -157,8 +157,8 @@ void ClientConnection::tick() INetworkPlayer *ClientConnection::getNetworkPlayer() { - if( connection != NULL && connection->getSocket() != NULL) return connection->getSocket()->getPlayer(); - else return NULL; + if( connection != nullptr && connection->getSocket() != nullptr) return connection->getSocket()->getPlayer(); + else return nullptr; } void ClientConnection::handleLogin(shared_ptr packet) @@ -167,7 +167,7 @@ void ClientConnection::handleLogin(shared_ptr packet) PlayerUID OnlineXuid; ProfileManager.GetXUID(m_userIndex,&OnlineXuid,true); // online xuid - MOJANG_DATA *pMojangData = NULL; + MOJANG_DATA *pMojangData = nullptr; if(!g_NetworkManager.IsLocalGame()) { @@ -208,7 +208,7 @@ void ClientConnection::handleLogin(shared_ptr packet) if(iUserID!=-1) { - BYTE *pBuffer=NULL; + BYTE *pBuffer=nullptr; DWORD dwSize=0; bool bRes; @@ -285,17 +285,17 @@ void ClientConnection::handleLogin(shared_ptr packet) Level *dimensionLevel = minecraft->getLevel( packet->dimension ); - if( dimensionLevel == NULL ) + if( dimensionLevel == nullptr ) { level = new MultiPlayerLevel(this, new LevelSettings(packet->seed, GameType::byId(packet->gameType), false, false, packet->m_newSeaLevel, packet->m_pLevelType, packet->m_xzSize, packet->m_hellScale), packet->dimension, packet->difficulty); // 4J Stu - We want to share the SavedDataStorage between levels int otherDimensionId = packet->dimension == 0 ? -1 : 0; Level *activeLevel = minecraft->getLevel(otherDimensionId); - if( activeLevel != NULL ) + if( activeLevel != nullptr ) { // Don't need to delete it here as it belongs to a client connection while will delete it when it's done - //if( level->savedDataStorage != NULL ) delete level->savedDataStorage; + //if( level->savedDataStorage != nullptr ) delete level->savedDataStorage; level->savedDataStorage = activeLevel->savedDataStorage; } @@ -341,12 +341,12 @@ void ClientConnection::handleLogin(shared_ptr packet) level = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension ); shared_ptr player; - if(level==NULL) + if(level==nullptr) { int otherDimensionId = packet->dimension == 0 ? -1 : 0; MultiPlayerLevel *activeLevel = minecraft->getLevel(otherDimensionId); - if(activeLevel == NULL) + if(activeLevel == nullptr) { otherDimensionId = packet->dimension == 0 ? 1 : (packet->dimension == -1 ? 1 : -1); activeLevel = minecraft->getLevel(otherDimensionId); @@ -433,7 +433,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match - if( owner == NULL ) + if( owner == nullptr ) { for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { @@ -449,7 +449,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } - if (owner != NULL && owner->instanceof(eTYPE_PLAYER)) + if (owner != nullptr && owner->instanceof(eTYPE_PLAYER)) { shared_ptr player = dynamic_pointer_cast(owner); shared_ptr hook = shared_ptr( new FishingHook(level, x, y, z, player) ); @@ -549,7 +549,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match - if( owner == NULL ) + if( owner == nullptr ) { for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { @@ -565,7 +565,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } shared_ptr player = dynamic_pointer_cast(owner); - if (player != NULL) + if (player != nullptr) { shared_ptr hook = shared_ptr( new FishingHook(level, x, y, z, player) ); e = hook; @@ -609,7 +609,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) */ - if (e != NULL) + if (e != nullptr) { e->xp = packet->x; e->yp = packet->y; @@ -661,7 +661,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) shared_ptr owner = getEntity(packet->data); // 4J - check all local players to find match - if( owner == NULL ) + if( owner == nullptr ) { for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { @@ -676,7 +676,7 @@ void ClientConnection::handleAddEntity(shared_ptr packet) } } - if ( owner != NULL && owner->instanceof(eTYPE_LIVINGENTITY) ) + if ( owner != nullptr && owner->instanceof(eTYPE_LIVINGENTITY) ) { dynamic_pointer_cast(e)->owner = dynamic_pointer_cast(owner); } @@ -709,7 +709,7 @@ void ClientConnection::handleAddGlobalEntity(shared_ptr p double z = packet->z / 32.0; shared_ptr e;// = nullptr; if (packet->type == AddGlobalEntityPacket::LIGHTNING) e = shared_ptr( new LightningBolt(level, x, y, z) ); - if (e != NULL) + if (e != nullptr) { e->xp = packet->x; e->yp = packet->y; @@ -730,14 +730,14 @@ void ClientConnection::handleAddPainting(shared_ptr packet) void ClientConnection::handleSetEntityMotion(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if (e == nullptr) return; e->lerpMotion(packet->xa / 8000.0, packet->ya / 8000.0, packet->za / 8000.0); } void ClientConnection::handleSetEntityData(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e != NULL && packet->getUnpackedData() != NULL) + if (e != nullptr && packet->getUnpackedData() != nullptr) { e->getEntityData()->assignValues(packet->getUnpackedData()); } @@ -764,7 +764,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) // a duplicate remote player for a local slot by checking the username directly. for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (minecraft->localplayers[idx] != NULL && minecraft->localplayers[idx]->name == packet->name) + if (minecraft->localplayers[idx] != nullptr && minecraft->localplayers[idx]->name == packet->name) { app.DebugPrintf("AddPlayerPacket received for local player name %ls\n", packet->name.c_str()); return; @@ -778,7 +778,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) // their stored server index rather than using it directly as an array subscript. for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(minecraft->localplayers[idx] != NULL && + if(minecraft->localplayers[idx] != nullptr && minecraft->localplayers[idx]->getPlayerIndex() == packet->m_playerIndex) { app.DebugPrintf("AddPlayerPacket received for local player (controller %d, server index %d), skipping RemotePlayer creation\n", idx, packet->m_playerIndex); @@ -804,7 +804,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) #ifdef _DURANGO // On Durango request player display name from network manager INetworkPlayer *networkPlayer = g_NetworkManager.GetPlayerByXuid(player->getXuid()); - if (networkPlayer != NULL) player->m_displayName = networkPlayer->GetDisplayName(); + if (networkPlayer != nullptr) player->m_displayName = networkPlayer->GetDisplayName(); #else // On all other platforms display name is just gamertag so don't check with the network manager player->m_displayName = player->getName(); @@ -812,7 +812,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) #ifdef _WINDOWS64 { - IQNetPlayer* matchedQNetPlayer = NULL; + IQNetPlayer* matchedQNetPlayer = nullptr; PlayerUID pktXuid = player->getXuid(); const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e; // Legacy compatibility path for peers still using embedded smallId XUIDs. @@ -820,7 +820,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) { BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE); INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId); - if (np != NULL) + if (np != nullptr) { NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; matchedQNetPlayer = npx->GetQNetPlayer(); @@ -828,17 +828,17 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) } // Current Win64 path: identify QNet player by name and attach packet XUID. - if (matchedQNetPlayer == NULL) + if (matchedQNetPlayer == nullptr) { for (BYTE smallId = 0; smallId < MINECRAFT_NET_MAX_PLAYERS; ++smallId) { INetworkPlayer* np = g_NetworkManager.GetPlayerBySmallId(smallId); - if (np == NULL) + if (np == nullptr) continue; NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; IQNetPlayer* qp = npx->GetQNetPlayer(); - if (qp != NULL && _wcsicmp(qp->m_gamertag, packet->name.c_str()) == 0) + if (qp != nullptr && _wcsicmp(qp->m_gamertag, packet->name.c_str()) == 0) { matchedQNetPlayer = qp; break; @@ -846,7 +846,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) } } - if (matchedQNetPlayer != NULL) + if (matchedQNetPlayer != nullptr) { // Store packet-authoritative XUID on this network slot so later lookups by XUID // (e.g. remove player, display mapping) work for both legacy and uid.dat clients. @@ -864,7 +864,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) int item = packet->carriedItem; if (item == 0) { - player->inventory->items[player->inventory->selected] = shared_ptr(); // NULL; + player->inventory->items[player->inventory->selected] = shared_ptr(); // nullptr; } else { @@ -883,13 +883,13 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) { app.DebugPrintf("Client sending TextureAndGeometryPacket to get custom skin %ls for player %ls\n",player->customTextureUrl.c_str(), player->name.c_str()); - send(shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); + send(shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,nullptr,0) ) ); } } else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl,NULL,0); + app.AddMemoryTextureFile(player->customTextureUrl,nullptr,0); } app.DebugPrintf("Custom skin for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl.c_str()); @@ -899,13 +899,13 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) if( minecraft->addPendingClientTextureRequest(player->customTextureUrl2) ) { app.DebugPrintf("Client sending texture packet to get custom cape %ls for player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str()); - send(shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); + send(shared_ptr( new TexturePacket(player->customTextureUrl2,nullptr,0) ) ); } } else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl2,NULL,0); + app.AddMemoryTextureFile(player->customTextureUrl2,nullptr,0); } app.DebugPrintf("Custom cape for player %ls is %ls\n",player->name.c_str(),player->customTextureUrl2.c_str()); @@ -913,7 +913,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) level->putEntity(packet->id, player); vector > *unpackedData = packet->getUnpackedData(); - if (unpackedData != NULL) + if (unpackedData != nullptr) { player->getEntityData()->assignValues(unpackedData); } @@ -923,7 +923,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) void ClientConnection::handleTeleportEntity(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if (e == nullptr) return; e->xp = packet->x; e->yp = packet->y; e->zp = packet->z; @@ -952,7 +952,7 @@ void ClientConnection::handleSetCarriedItem(shared_ptr pac void ClientConnection::handleMoveEntity(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if (e == nullptr) return; e->xp += packet->xa; e->yp += packet->ya; e->zp += packet->za; @@ -973,7 +973,7 @@ void ClientConnection::handleMoveEntity(shared_ptr packet) void ClientConnection::handleRotateMob(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if (e == nullptr) return; float yHeadRot = packet->yHeadRot * 360 / 256.f; e->setYHeadRot(yHeadRot); } @@ -981,7 +981,7 @@ void ClientConnection::handleRotateMob(shared_ptr packet) void ClientConnection::handleMoveEntitySmall(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if (e == nullptr) return; e->xp += packet->xa; e->yp += packet->ya; e->zp += packet->za; @@ -1007,18 +1007,18 @@ void ClientConnection::handleRemoveEntity(shared_ptr packe for (int i = 0; i < packet->ids.length; i++) { shared_ptr entity = getEntity(packet->ids[i]); - if (entity != NULL && entity->GetType() == eTYPE_PLAYER) + if (entity != nullptr && entity->GetType() == eTYPE_PLAYER) { shared_ptr player = dynamic_pointer_cast(entity); - if (player != NULL) + if (player != nullptr) { PlayerUID xuid = player->getXuid(); INetworkPlayer* np = g_NetworkManager.GetPlayerByXuid(xuid); - if (np != NULL) + if (np != nullptr) { NetworkPlayerXbox* npx = (NetworkPlayerXbox*)np; IQNetPlayer* qp = npx->GetQNetPlayer(); - if (qp != NULL) + if (qp != nullptr) { extern CPlatformNetworkManagerStub* g_pPlatformNetworkManager; g_pPlatformNetworkManager->NotifyPlayerLeaving(qp); @@ -1088,7 +1088,7 @@ void ClientConnection::handleMovePlayer(shared_ptr packet) player->zOld = player->z; started = true; - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); // Fix for #105852 - TU12: Content: Gameplay: Local splitscreen Players are spawned at incorrect places after re-joining previously saved and loaded "Mass Effect World". // Move this check from Minecraft::createExtraLocalPlayer @@ -1298,7 +1298,7 @@ void ClientConnection::handleDisconnect(shared_ptr packet) app.SetDisconnectReason( packet->reason ); app.SetAction(m_userIndex,eAppAction_ExitWorld,(void *)TRUE); - //minecraft->setLevel(NULL); + //minecraft->setLevel(nullptr); //minecraft->setScreen(new DisconnectedScreen(L"disconnect.disconnected", L"disconnect.genericReason", &packet->reason)); } @@ -1321,14 +1321,14 @@ void ClientConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,NULL); + ui.RequestErrorMessage(IDS_EXITING_GAME, IDS_GENERIC_ERROR, uiIDA, 1, ProfileManager.GetPrimaryPad(),&ClientConnection::HostDisconnectReturned,nullptr); } else { app.SetAction(m_userIndex,eAppAction_ExitWorld,(void *)TRUE); } - //minecraft->setLevel(NULL); + //minecraft->setLevel(nullptr); //minecraft->setScreen(new DisconnectedScreen(L"disconnect.lost", reason, reasonObjects)); } @@ -1366,7 +1366,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac } } - if (to == NULL) + if (to == nullptr) { // Don't know if this should ever really happen, but seems safest to try and remove the entity that has been collected even if we can't // create a particle as we don't know what really collected it @@ -1374,7 +1374,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac return; } - if (from != NULL) + if (from != nullptr) { // If this is a local player, then we only want to do processing for it if this connection is associated with the player it is for. In // particular, we don't want to remove the item entity until we are processing it for the right connection, or else we won't have a valid @@ -1388,7 +1388,7 @@ void ClientConnection::handleTakeItemEntity(shared_ptr pac // the tutorial for the player that actually picked up the item int playerPad = player->GetXboxPad(); - if( minecraft->localgameModes[playerPad] != NULL ) + if( minecraft->localgameModes[playerPad] != nullptr ) { // 4J-PB - add in the XP orb sound if(from->GetType() == eTYPE_EXPERIENCEORB) @@ -1830,7 +1830,7 @@ void ClientConnection::handleChat(shared_ptr packet) void ClientConnection::handleAnimate(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if (e == nullptr) return; if (packet->action == AnimatePacket::SWING) { if (e->instanceof(eTYPE_LIVINGENTITY)) dynamic_pointer_cast(e)->swing(); @@ -1867,7 +1867,7 @@ void ClientConnection::handleAnimate(shared_ptr packet) void ClientConnection::handleEntityActionAtPosition(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if (e == nullptr) return; if (packet->action == EntityActionAtPositionPacket::START_SLEEP) { shared_ptr player = dynamic_pointer_cast(e); @@ -1927,7 +1927,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) // Is this user friends with the host player? BOOL result; DWORD error; - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); + error = XUserAreUsersFriends(idx,&packet->m_playerXuids[packet->m_hostIndex],1,&result,nullptr); if(error == ERROR_SUCCESS && result != TRUE) { canPlay = FALSE; @@ -1957,7 +1957,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) // Is this user friends with the host player? BOOL result; DWORD error; - error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,NULL); + error = XUserAreUsersFriends(m_userIndex,&packet->m_playerXuids[packet->m_hostIndex],1,&result,nullptr); if(error == ERROR_SUCCESS && result != TRUE) { canPlay = FALSE; @@ -2009,7 +2009,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) { if( ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) { - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); + error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,nullptr); if(error == ERROR_SUCCESS && result == TRUE) isAtLeastOneFriend = TRUE; } } @@ -2037,7 +2037,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) { if( (!thisQuadrantOnly || m_userIndex == idx) && ProfileManager.IsSignedIn(idx) && !ProfileManager.IsGuest(idx) ) { - error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,NULL); + error = XUserAreUsersFriends(idx,&packet->m_playerXuids[i],1,&result,nullptr); if(error == ERROR_SUCCESS) canPlay &= result; } if(!canPlay) break; @@ -2060,7 +2060,7 @@ void ClientConnection::handlePreLogin(shared_ptr packet) { bool bChatRestricted=false; - ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,nullptr,nullptr); // Chat restricted orbis players can still play online #ifndef __ORBIS__ @@ -2149,11 +2149,11 @@ void ClientConnection::handlePreLogin(shared_ptr packet) // which seems to be very unstable at the point of starting up the game if(m_userIndex == ProfileManager.GetPrimaryPad()) { - ProfileManager.GetChatAndContentRestrictions(m_userIndex,false,&bChatRestricted,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(m_userIndex,false,&bChatRestricted,&bContentRestricted,nullptr); } else { - ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(m_userIndex,true,&bChatRestricted,&bContentRestricted,nullptr); } // Chat restricted orbis players can still play online @@ -2404,7 +2404,7 @@ void ClientConnection::handleAddMob(shared_ptr packet) level->putEntity(packet->id, mob); vector > *unpackedData = packet->getUnpackedData(); - if (unpackedData != NULL) + if (unpackedData != nullptr) { mob->getEntityData()->assignValues(unpackedData); } @@ -2439,10 +2439,10 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr pa // 4J: If the destination entity couldn't be found, defer handling of this packet // This was added to support leashing (the entity link packet is sent before the add entity packet) - if (destEntity == NULL && packet->destId >= 0) + if (destEntity == nullptr && packet->destId >= 0) { // We don't handle missing source entities because it shouldn't happen - assert(!(sourceEntity == NULL && packet->sourceId >= 0)); + assert(!(sourceEntity == nullptr && packet->sourceId >= 0)); deferredEntityLinkPackets.push_back(DeferredEntityLinkPacket(packet)); return; @@ -2455,16 +2455,16 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr pa { sourceEntity = Minecraft::GetInstance()->localplayers[m_userIndex]; - if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) (dynamic_pointer_cast(destEntity))->setDoLerp(false); + if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) (dynamic_pointer_cast(destEntity))->setDoLerp(false); - displayMountMessage = (sourceEntity->riding == NULL && destEntity != NULL); + displayMountMessage = (sourceEntity->riding == nullptr && destEntity != nullptr); } - else if (destEntity != NULL && destEntity->instanceof(eTYPE_BOAT)) + else if (destEntity != nullptr && destEntity->instanceof(eTYPE_BOAT)) { (dynamic_pointer_cast(destEntity))->setDoLerp(true); } - if (sourceEntity == NULL) return; + if (sourceEntity == nullptr) return; sourceEntity->ride(destEntity); @@ -2478,9 +2478,9 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr pa } else if (packet->type == SetEntityLinkPacket::LEASH) { - if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_MOB) ) + if ( (sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_MOB) ) { - if (destEntity != NULL) + if (destEntity != nullptr) { (dynamic_pointer_cast(sourceEntity))->setLeashedTo(destEntity, false); @@ -2496,7 +2496,7 @@ void ClientConnection::handleEntityLinkPacket(shared_ptr pa void ClientConnection::handleEntityEvent(shared_ptr packet) { shared_ptr e = getEntity(packet->entityId); - if (e != NULL) e->handleEntityEvent(packet->eventId); + if (e != nullptr) e->handleEntityEvent(packet->eventId); } shared_ptr ClientConnection::getEntity(int entityId) @@ -2520,7 +2520,7 @@ void ClientConnection::handleSetHealth(shared_ptr packet) // We need food if(packet->food < FoodConstants::HEAL_LEVEL - 1) { - if(minecraft->localgameModes[m_userIndex] != NULL && !minecraft->localgameModes[m_userIndex]->hasInfiniteItems() ) + if(minecraft->localgameModes[m_userIndex] != nullptr && !minecraft->localgameModes[m_userIndex]->hasInfiniteItems() ) { minecraft->localgameModes[m_userIndex]->getTutorial()->changeTutorialState(e_Tutorial_State_Food_Bar); } @@ -2544,7 +2544,7 @@ void ClientConnection::handleTexture(shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Client received request for custom texture %ls\n",packet->textureName.c_str()); #endif - PBYTE pbData=NULL; + PBYTE pbData=nullptr; DWORD dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); @@ -2576,7 +2576,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptrtextureName.c_str()); #endif - PBYTE pbData=NULL; + PBYTE pbData=nullptr; DWORD dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName); @@ -2626,7 +2626,7 @@ void ClientConnection::handleTextureAndGeometry(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if ( (e == NULL) || !e->instanceof(eTYPE_PLAYER) ) return; + if ( (e == nullptr) || !e->instanceof(eTYPE_PLAYER) ) return; shared_ptr player = dynamic_pointer_cast(e); bool isLocalPlayer = false; @@ -2667,22 +2667,22 @@ void ClientConnection::handleTextureChange(shared_ptr packe #ifndef _CONTENT_PACKAGE wprintf(L"handleTextureChange - Client sending texture packet to get custom skin %ls for player %ls\n",packet->path.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); + send(shared_ptr( new TexturePacket(packet->path,nullptr,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path,NULL,0); + app.AddMemoryTextureFile(packet->path,nullptr,0); } } void ClientConnection::handleTextureAndGeometryChange(shared_ptr packet) { shared_ptr e = getEntity(packet->id); - if (e == NULL) return; + if (e == nullptr) return; shared_ptr player = dynamic_pointer_cast(e); - if( e == NULL) return; + if( e == nullptr) return; bool isLocalPlayer = false; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) @@ -2712,13 +2712,13 @@ void ClientConnection::handleTextureAndGeometryChange(shared_ptrpath.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); + send(shared_ptr( new TextureAndGeometryPacket(packet->path,nullptr,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path,NULL,0); + app.AddMemoryTextureFile(packet->path,nullptr,0); } } @@ -2739,12 +2739,12 @@ void ClientConnection::handleRespawn(shared_ptr packet) level->removeClientConnection(this, false); MultiPlayerLevel *dimensionLevel = (MultiPlayerLevel *)minecraft->getLevel( packet->dimension ); - if( dimensionLevel == NULL ) + if( dimensionLevel == nullptr ) { dimensionLevel = new MultiPlayerLevel(this, new LevelSettings(packet->mapSeed, packet->playerGameType, false, minecraft->level->getLevelData()->isHardcore(), packet->m_newSeaLevel, packet->m_pLevelType, packet->m_xzSize, packet->m_hellScale), packet->dimension, packet->difficulty); // 4J Stu - We want to shared the savedDataStorage between both levels - //if( dimensionLevel->savedDataStorage != NULL ) + //if( dimensionLevel->savedDataStorage != nullptr ) //{ // Don't need to delete it here as it belongs to a client connection while will delete it when it's done // delete dimensionLevel->savedDataStorage;+ @@ -2784,7 +2784,7 @@ void ClientConnection::handleRespawn(shared_ptr packet) TelemetryManager->RecordLevelStart(m_userIndex, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->getLevel(packet->dimension)->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); #endif - if( minecraft->localgameModes[m_userIndex] != NULL ) + if( minecraft->localgameModes[m_userIndex] != nullptr ) { TutorialMode *gameMode = (TutorialMode *)minecraft->localgameModes[m_userIndex]; gameMode->getTutorial()->showTutorialPopup(false); @@ -3111,9 +3111,9 @@ void ClientConnection::handleContainerSetSlot(shared_ptr if(packet->slot >= 36 && packet->slot < 36 + 9) { shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); - if (packet->item != NULL) + if (packet->item != nullptr) { - if (lastItem == NULL || lastItem->count < packet->item->count) + if (lastItem == nullptr || lastItem->count < packet->item->count) { packet->item->popTime = Inventory::POP_TIME_DURATION; } @@ -3131,7 +3131,7 @@ void ClientConnection::handleContainerSetSlot(shared_ptr void ClientConnection::handleContainerAck(shared_ptr packet) { shared_ptr player = minecraft->localplayers[m_userIndex]; - AbstractContainerMenu *menu = NULL; + AbstractContainerMenu *menu = nullptr; if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY) { menu = player->inventoryMenu; @@ -3140,7 +3140,7 @@ void ClientConnection::handleContainerAck(shared_ptr packet) { menu = player->containerMenu; } - if (menu != NULL) + if (menu != nullptr) { if (!packet->accepted) { @@ -3165,7 +3165,7 @@ void ClientConnection::handleContainerContent(shared_ptr packet) { shared_ptr tileEntity = level->getTileEntity(packet->x, packet->y, packet->z); - if (tileEntity != NULL) + if (tileEntity != nullptr) { minecraft->localplayers[m_userIndex]->openTextEdit(tileEntity); } @@ -3188,7 +3188,7 @@ void ClientConnection::handleSignUpdate(shared_ptr packet) shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); // 4J-PB - on a client connecting, the line below fails - if (dynamic_pointer_cast(te) != NULL) + if (dynamic_pointer_cast(te) != nullptr) { shared_ptr ste = dynamic_pointer_cast(te); for (int i = 0; i < MAX_SIGN_LINES; i++) @@ -3204,7 +3204,7 @@ void ClientConnection::handleSignUpdate(shared_ptr packet) } else { - app.DebugPrintf("dynamic_pointer_cast(te) == NULL\n"); + app.DebugPrintf("dynamic_pointer_cast(te) == nullptr\n"); } } else @@ -3219,21 +3219,21 @@ void ClientConnection::handleTileEntityData(shared_ptr pac { shared_ptr te = minecraft->level->getTileEntity(packet->x, packet->y, packet->z); - if (te != NULL) + if (te != nullptr) { - if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && dynamic_pointer_cast(te) != NULL) + if (packet->type == TileEntityDataPacket::TYPE_MOB_SPAWNER && dynamic_pointer_cast(te) != nullptr) { dynamic_pointer_cast(te)->load(packet->tag); } - else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND && dynamic_pointer_cast(te) != NULL) + else if (packet->type == TileEntityDataPacket::TYPE_ADV_COMMAND && dynamic_pointer_cast(te) != nullptr) { dynamic_pointer_cast(te)->load(packet->tag); } - else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast(te) != NULL) + else if (packet->type == TileEntityDataPacket::TYPE_BEACON && dynamic_pointer_cast(te) != nullptr) { dynamic_pointer_cast(te)->load(packet->tag); } - else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast(te) != NULL) + else if (packet->type == TileEntityDataPacket::TYPE_SKULL && dynamic_pointer_cast(te) != nullptr) { dynamic_pointer_cast(te)->load(packet->tag); } @@ -3244,7 +3244,7 @@ void ClientConnection::handleTileEntityData(shared_ptr pac void ClientConnection::handleContainerSetData(shared_ptr packet) { onUnhandledPacket(packet); - if (minecraft->localplayers[m_userIndex]->containerMenu != NULL && minecraft->localplayers[m_userIndex]->containerMenu->containerId == packet->containerId) + if (minecraft->localplayers[m_userIndex]->containerMenu != nullptr && minecraft->localplayers[m_userIndex]->containerMenu->containerId == packet->containerId) { minecraft->localplayers[m_userIndex]->containerMenu->setData(packet->id, packet->value); } @@ -3253,7 +3253,7 @@ void ClientConnection::handleContainerSetData(shared_ptr void ClientConnection::handleSetEquippedItem(shared_ptr packet) { shared_ptr entity = getEntity(packet->entity); - if (entity != NULL) + if (entity != nullptr) { // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game entity->setEquippedSlot(packet->slot, packet->getItem() ); @@ -3279,7 +3279,7 @@ void ClientConnection::handleTileDestruction(shared_ptr p bool ClientConnection::canHandleAsyncPackets() { - return minecraft != NULL && minecraft->level != NULL && minecraft->localplayers[m_userIndex] != NULL && level != NULL; + return minecraft != nullptr && minecraft->level != nullptr && minecraft->localplayers[m_userIndex] != nullptr && level != nullptr; } void ClientConnection::handleGameEvent(shared_ptr gameEventPacket) @@ -3288,7 +3288,7 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack int param = gameEventPacket->param; if (event >= 0 && event < GameEventPacket::EVENT_LANGUAGE_ID_LENGTH) { - if (GameEventPacket::EVENT_LANGUAGE_ID[event] > 0) // 4J - was NULL check + if (GameEventPacket::EVENT_LANGUAGE_ID[event] > 0) // 4J - was nullptr check { minecraft->localplayers[m_userIndex]->displayClientMessage(GameEventPacket::EVENT_LANGUAGE_ID[event]); } @@ -3320,7 +3320,7 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack ui.ShowOtherPlayersBaseScene(ProfileManager.GetPrimaryPad(), false); // This just allows it to be shown - if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); + if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); // Temporarily make this scene fullscreen CXuiSceneBase::SetPlayerBaseScenePosition( ProfileManager.GetPrimaryPad(), CXuiSceneBase::e_BaseScene_Fullscreen ); @@ -3328,8 +3328,8 @@ void ClientConnection::handleGameEvent(shared_ptr gameEventPack #else app.DebugPrintf("handleGameEvent packet for WIN_GAME - %d\n", m_userIndex); // This just allows it to be shown - if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != NULL) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem, NULL, eUILayer_Scene, eUIGroup_Fullscreen); + if(minecraft->localgameModes[ProfileManager.GetPrimaryPad()] != nullptr) minecraft->localgameModes[ProfileManager.GetPrimaryPad()]->getTutorial()->showTutorialPopup(false); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_EndPoem, nullptr, eUILayer_Scene, eUIGroup_Fullscreen); #endif } else if( event == GameEventPacket::START_SAVING ) @@ -3373,7 +3373,7 @@ void ClientConnection::handleLevelEvent(shared_ptr packet) { for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if(minecraft->localplayers[i] != NULL && minecraft->localplayers[i]->level != NULL && minecraft->localplayers[i]->level->dimension->id == 1) + if(minecraft->localplayers[i] != nullptr && minecraft->localplayers[i]->level != nullptr && minecraft->localplayers[i]->level->dimension->id == 1) { minecraft->localplayers[i]->awardStat(GenericStats::completeTheEnd(),GenericStats::param_noArgs()); } @@ -3400,7 +3400,7 @@ void ClientConnection::handleAwardStat(shared_ptr packet) void ClientConnection::handleUpdateMobEffect(shared_ptr packet) { shared_ptr e = getEntity(packet->entityId); - if ( (e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY) ) return; + if ( (e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY) ) return; //( dynamic_pointer_cast(e) )->addEffect(new MobEffectInstance(packet->effectId, packet->effectDurationTicks, packet->effectAmplifier)); @@ -3412,7 +3412,7 @@ void ClientConnection::handleUpdateMobEffect(shared_ptr p void ClientConnection::handleRemoveMobEffect(shared_ptr packet) { shared_ptr e = getEntity(packet->entityId); - if ( (e == NULL) || !e->instanceof(eTYPE_LIVINGENTITY) ) return; + if ( (e == nullptr) || !e->instanceof(eTYPE_LIVINGENTITY) ) return; ( dynamic_pointer_cast(e) )->removeEffectNoUpdate(packet->effectId); } @@ -3428,7 +3428,7 @@ void ClientConnection::handlePlayerInfo(shared_ptr packet) INetworkPlayer *networkPlayer = g_NetworkManager.GetPlayerBySmallId(packet->m_networkSmallId); - if(networkPlayer != NULL && networkPlayer->IsHost()) + if(networkPlayer != nullptr && networkPlayer->IsHost()) { // Some settings should always be considered on for the host player Player::enableAllPlayerPrivileges(startingPrivileges,true); @@ -3439,17 +3439,17 @@ void ClientConnection::handlePlayerInfo(shared_ptr packet) app.UpdatePlayerInfo(packet->m_networkSmallId, packet->m_playerColourIndex, packet->m_playerPrivileges); shared_ptr entity = getEntity(packet->m_entityId); - if(entity != NULL && entity->instanceof(eTYPE_PLAYER)) + if(entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { shared_ptr player = dynamic_pointer_cast(entity); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All, packet->m_playerPrivileges); } - if(networkPlayer != NULL && networkPlayer->IsLocal()) + if(networkPlayer != nullptr && networkPlayer->IsLocal()) { for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { shared_ptr localPlayer = minecraft->localplayers[i]; - if(localPlayer != NULL && localPlayer->connection != NULL && localPlayer->connection->getNetworkPlayer() == networkPlayer ) + if(localPlayer != nullptr && localPlayer->connection != nullptr && localPlayer->connection->getNetworkPlayer() == networkPlayer ) { localPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_All,packet->m_playerPrivileges); displayPrivilegeChanges(localPlayer,startingPrivileges); @@ -3647,7 +3647,7 @@ void ClientConnection::handleServerSettingsChanged(shared_ptrlevels.length; ++i) { - if( minecraft->levels[i] != NULL ) + if( minecraft->levels[i] != nullptr ) { app.DebugPrintf("ClientConnection::handleServerSettingsChanged - Difficulty = %d",packet->data); minecraft->levels[i]->difficulty = packet->data; @@ -3681,11 +3681,11 @@ void ClientConnection::handleUpdateProgress(shared_ptr pac void ClientConnection::handleUpdateGameRuleProgressPacket(shared_ptr packet) { LPCWSTR string = app.GetGameRulesString(packet->m_messageId); - if(string != NULL) + if(string != nullptr) { wstring message(string); message = GameRuleDefinition::generateDescriptionString(packet->m_definitionType,message,packet->m_data.data,packet->m_data.length); - if(minecraft->localgameModes[m_userIndex]!=NULL) + if(minecraft->localgameModes[m_userIndex]!=nullptr) { minecraft->localgameModes[m_userIndex]->getTutorial()->setMessage(message, packet->m_icon, packet->m_auxValue); } @@ -3731,7 +3731,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL); + ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,nullptr); } else #else @@ -3746,7 +3746,7 @@ int ClientConnection::HostDisconnectReturned(void *pParam,int iPad,C4JStorage::E UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,NULL); + ui.RequestErrorMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(),&ClientConnection::ExitGameAndSaveReturned,nullptr); } else #endif @@ -3924,7 +3924,7 @@ void ClientConnection::handleParticleEvent(shared_ptr pack void ClientConnection::handleUpdateAttributes(shared_ptr packet) { shared_ptr entity = getEntity(packet->getEntityId()); - if (entity == NULL) return; + if (entity == nullptr) return; if ( !entity->instanceof(eTYPE_LIVINGENTITY) ) { diff --git a/Minecraft.Client/ClockTexture.cpp b/Minecraft.Client/ClockTexture.cpp index 37efc1839..5febeff34 100644 --- a/Minecraft.Client/ClockTexture.cpp +++ b/Minecraft.Client/ClockTexture.cpp @@ -10,7 +10,7 @@ ClockTexture::ClockTexture() : StitchedTexture(L"clock", L"clock") { rot = rota = 0.0; - m_dataTexture = NULL; + m_dataTexture = nullptr; m_iPad = XUSER_INDEX_ANY; } @@ -27,7 +27,7 @@ void ClockTexture::cycleFrames() Minecraft *mc = Minecraft::GetInstance(); double rott = 0; - if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != NULL && mc->localplayers[m_iPad] != NULL) + if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != nullptr && mc->localplayers[m_iPad] != nullptr) { float time = mc->localplayers[m_iPad]->level->getTimeOfDay(1); rott = time; @@ -55,7 +55,7 @@ void ClockTexture::cycleFrames() rot += rota; // 4J Stu - We share data with another texture - if(m_dataTexture != NULL) + if(m_dataTexture != nullptr) { int newFrame = static_cast((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); while (newFrame < 0) @@ -95,7 +95,7 @@ int ClockTexture::getSourceHeight() const int ClockTexture::getFrames() { - if(m_dataTexture == NULL) + if(m_dataTexture == nullptr) { return StitchedTexture::getFrames(); } @@ -107,7 +107,7 @@ int ClockTexture::getFrames() void ClockTexture::freeFrameTextures() { - if(m_dataTexture == NULL) + if(m_dataTexture == nullptr) { StitchedTexture::freeFrameTextures(); } @@ -115,5 +115,5 @@ void ClockTexture::freeFrameTextures() bool ClockTexture::hasOwnData() { - return m_dataTexture == NULL; + return m_dataTexture == nullptr; } \ No newline at end of file diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index b2ca2be33..7aec7b7c4 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -57,7 +57,7 @@ void SoundEngine::updateSoundEffectVolume(float fVal) {} void SoundEngine::add(const wstring& name, File *file) {} void SoundEngine::addMusic(const wstring& name, File *file) {} void SoundEngine::addStreaming(const wstring& name, File *file) {} -char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return NULL; } +char *SoundEngine::ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) { return nullptr; } bool SoundEngine::isStreamingWavebankReady() { return true; } void SoundEngine::playMusicTick() {}; @@ -335,7 +335,7 @@ void SoundEngine::tick(shared_ptr *players, float a) bool bListenerPostionSet = false; for( size_t i = 0; i < MAX_LOCAL_PLAYERS; i++ ) { - if( players[i] != NULL ) + if( players[i] != nullptr ) { m_ListenerA[i].bValid=true; F32 x,y,z; @@ -402,7 +402,7 @@ SoundEngine::SoundEngine() m_iMusicDelay=0; m_validListenerCount=0; - m_bHeardTrackA=NULL; + m_bHeardTrackA=nullptr; // Start the streaming music playing some music from the overworld SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3, @@ -551,8 +551,8 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa &m_engine, finalPath, MA_SOUND_FLAG_ASYNC, - NULL, - NULL, + nullptr, + nullptr, &s->sound) != MA_SUCCESS) { app.DebugPrintf("Failed to initialize sound from file: %s\n", finalPath); @@ -635,8 +635,8 @@ void SoundEngine::playUI(int iSound, float volume, float pitch) &m_engine, finalPath, MA_SOUND_FLAG_ASYNC, - NULL, - NULL, + nullptr, + nullptr, &s->sound) != MA_SUCCESS) { delete s; @@ -703,7 +703,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y , float z, for(unsigned int i=0;ilocalplayers[i]!=NULL) + if(pMinecraft->localplayers[i]!=nullptr) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { @@ -797,7 +797,7 @@ int SoundEngine::getMusicID(int iDomain) Minecraft *pMinecraft=Minecraft::GetInstance(); // Before the game has started? - if(pMinecraft==NULL) + if(pMinecraft==nullptr) { // any track from the overworld return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max); @@ -930,8 +930,8 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter) &soundEngine->m_engine, soundEngine->m_szStreamName, MA_SOUND_FLAG_STREAM, - NULL, - NULL, + nullptr, + nullptr, &soundEngine->m_musicStream); if (result != MA_SUCCESS) @@ -1189,7 +1189,7 @@ void SoundEngine::playMusicUpdate() if( !m_openStreamThread->isRunning() ) { delete m_openStreamThread; - m_openStreamThread = NULL; + m_openStreamThread = nullptr; app.DebugPrintf("OpenStreamThreadProc finished. m_musicStreamActive=%d\n", m_musicStreamActive); @@ -1246,7 +1246,7 @@ void SoundEngine::playMusicUpdate() if( !m_openStreamThread->isRunning() ) { delete m_openStreamThread; - m_openStreamThread = NULL; + m_openStreamThread = nullptr; m_StreamState = eMusicStreamState_Stop; } break; @@ -1282,14 +1282,14 @@ void SoundEngine::playMusicUpdate() } if(GetIsPlayingStreamingGameMusic()) { - //if(m_MusicInfo.pCue!=NULL) + //if(m_MusicInfo.pCue!=nullptr) { bool playerInEnd = false; bool playerInNether=false; Minecraft *pMinecraft = Minecraft::GetInstance(); for(unsigned int i = 0; i < MAX_LOCAL_PLAYERS; ++i) { - if(pMinecraft->localplayers[i]!=NULL) + if(pMinecraft->localplayers[i]!=nullptr) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { @@ -1420,7 +1420,7 @@ void SoundEngine::playMusicUpdate() for(unsigned int i=0;ilocalplayers[i]!=NULL) + if(pMinecraft->localplayers[i]!=nullptr) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { diff --git a/Minecraft.Client/Common/Audio/miniaudio.h b/Minecraft.Client/Common/Audio/miniaudio.h index 24e676bb2..f5997a42b 100644 --- a/Minecraft.Client/Common/Audio/miniaudio.h +++ b/Minecraft.Client/Common/Audio/miniaudio.h @@ -74,7 +74,7 @@ device on the stack, but you could allocate it on the heap if that suits your si config.pUserData = pMyCustomData; // Can be accessed from the device object (device.pUserData). ma_device device; - if (ma_device_init(NULL, &config, &device) != MA_SUCCESS) { + if (ma_device_init(nullptr, &config, &device) != MA_SUCCESS) { return -1; // Failed to initialize the device. } @@ -168,7 +168,7 @@ same for capture. All you need to do is change the device type from `ma_device_t ``` In the data callback you just read from the input buffer (`pInput` in the example above) and leave -the output buffer alone (it will be set to NULL when the device type is set to +the output buffer alone (it will be set to nullptr when the device type is set to `ma_device_type_capture`). These are the available device types and how you should handle the buffers in the callback: @@ -208,7 +208,7 @@ enumerating devices. The example below shows how to enumerate devices. ```c ma_context context; - if (ma_context_init(NULL, 0, NULL, &context) != MA_SUCCESS) { + if (ma_context_init(nullptr, 0, nullptr, &context) != MA_SUCCESS) { // Error. } @@ -247,10 +247,10 @@ enumerating devices. The example below shows how to enumerate devices. The first thing we do in this example is initialize a `ma_context` object with `ma_context_init()`. The first parameter is a pointer to a list of `ma_backend` values which are used to override the -default backend priorities. When this is NULL, as in this example, miniaudio's default priorities +default backend priorities. When this is nullptr, as in this example, miniaudio's default priorities are used. The second parameter is the number of backends listed in the array pointed to by the first parameter. The third parameter is a pointer to a `ma_context_config` object which can be -NULL, in which case defaults are used. The context configuration is used for setting the logging +nullptr, in which case defaults are used. The context configuration is used for setting the logging callback, custom memory allocation callbacks, user-defined data and some backend-specific configurations. @@ -267,7 +267,7 @@ config. It also contains the name of the device which is useful for presenting a to the user via the UI. When creating your own context you will want to pass it to `ma_device_init()` when initializing the -device. Passing in NULL, like we do in the first example, will result in miniaudio creating the +device. Passing in nullptr, like we do in the first example, will result in miniaudio creating the context for you, which you don't want to do since you've already created a context. Note that internally the context is only tracked by it's pointer which means you must not change the location of the `ma_context` object. If this is an issue, consider using `malloc()` to allocate memory for @@ -301,7 +301,7 @@ The code below shows how you can initialize an engine using its default configur ma_result result; ma_engine engine; - result = ma_engine_init(NULL, &engine); + result = ma_engine_init(nullptr, &engine); if (result != MA_SUCCESS) { return result; // Failed to initialize the engine. } @@ -352,7 +352,7 @@ By default the engine will be started, but nothing will be playing because no so initialized. The easiest but least flexible way of playing a sound is like so: ```c - ma_engine_play_sound(&engine, "my_sound.wav", NULL); + ma_engine_play_sound(&engine, "my_sound.wav", nullptr); ``` This plays what miniaudio calls an "inline" sound. It plays the sound once, and then puts the @@ -365,7 +365,7 @@ initialize a sound: ma_result result; ma_sound sound; - result = ma_sound_init_from_file(&engine, "my_sound.wav", 0, NULL, NULL, &sound); + result = ma_sound_init_from_file(&engine, "my_sound.wav", 0, nullptr, nullptr, &sound); if (result != MA_SUCCESS) { return result; } @@ -789,7 +789,7 @@ To read data from a data source: } ``` -If you don't need the number of frames that were successfully read you can pass in `NULL` to the +If you don't need the number of frames that were successfully read you can pass in `nullptr` to the `pFramesRead` parameter. If this returns a value less than the number of frames requested it means the end of the file has been reached. `MA_AT_END` will be returned only when the number of frames read is 0. @@ -809,7 +809,7 @@ you could plug in a decoder like so: } ``` -If you want to seek forward you can pass in `NULL` to the `pFramesOut` parameter. Alternatively you +If you want to seek forward you can pass in `nullptr` to the `pFramesOut` parameter. Alternatively you can use `ma_data_source_seek_pcm_frames()`. To seek to a specific PCM frame: @@ -864,7 +864,7 @@ retrieved like so: } ``` -If you do not need a specific data format property, just pass in NULL to the respective parameter. +If you do not need a specific data format property, just pass in nullptr to the respective parameter. There may be cases where you want to implement something like a sound bank where you only want to read data within a certain range of the underlying data. To do this you can use a range: @@ -1041,7 +1041,7 @@ The most basic way to initialize the engine is with a default config, like so: ma_result result; ma_engine engine; - result = ma_engine_init(NULL, &engine); + result = ma_engine_init(nullptr, &engine); if (result != MA_SUCCESS) { return result; // Failed to initialize the engine. } @@ -1072,7 +1072,7 @@ control of the device's data callback, it's their responsibility to manually cal ```c void playback_data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount) { - ma_engine_read_pcm_frames(&g_Engine, pOutput, frameCount, NULL); + ma_engine_read_pcm_frames(&g_Engine, pOutput, frameCount, nullptr); } ``` @@ -1200,7 +1200,7 @@ you'll want to initialize a sound object: ```c ma_sound sound; - result = ma_sound_init_from_file(&engine, "my_sound.wav", flags, pGroup, NULL, &sound); + result = ma_sound_init_from_file(&engine, "my_sound.wav", flags, pGroup, nullptr, &sound); if (result != MA_SUCCESS) { return result; // Failed to load sound. } @@ -1232,8 +1232,8 @@ standard config/init pattern: ma_sound_config soundConfig; soundConfig = ma_sound_config_init(); - soundConfig.pFilePath = NULL; // Set this to load from a file path. - soundConfig.pDataSource = NULL; // Set this to initialize from an existing data source. + soundConfig.pFilePath = nullptr; // Set this to load from a file path. + soundConfig.pDataSource = nullptr; // Set this to initialize from an existing data source. soundConfig.pInitialAttachment = &someNodeInTheNodeGraph; soundConfig.initialAttachmentInputBusIndex = 0; soundConfig.channelsIn = 1; @@ -1258,7 +1258,7 @@ will be decoded dynamically on the fly. In order to save processing time on the might be beneficial to pre-decode the sound. You can do this with the `MA_SOUND_FLAG_DECODE` flag: ```c - ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_DECODE, pGroup, NULL, &sound); + ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_DECODE, pGroup, nullptr, &sound); ``` By default, sounds will be loaded synchronously, meaning `ma_sound_init_*()` will not return until @@ -1266,7 +1266,7 @@ the sound has been fully loaded. If this is prohibitive you can instead load sou by specifying the `MA_SOUND_FLAG_ASYNC` flag: ```c - ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_DECODE | MA_SOUND_FLAG_ASYNC, pGroup, NULL, &sound); + ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_DECODE | MA_SOUND_FLAG_ASYNC, pGroup, nullptr, &sound); ``` This will result in `ma_sound_init_*()` returning quickly, but the sound won't yet have been fully @@ -1303,7 +1303,7 @@ If loading the entire sound into memory is prohibitive, you can also configure t the audio data: ```c - ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_STREAM, pGroup, NULL, &sound); + ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_STREAM, pGroup, nullptr, &sound); ``` When streaming sounds, 2 seconds worth of audio data is stored in memory. Although it should work @@ -1323,7 +1323,7 @@ only works for sounds that were initialized with `ma_sound_init_from_file()` and `MA_SOUND_FLAG_STREAM` flag. When you initialize a sound, if you specify a sound group the sound will be attached to that group -automatically. If you set it to NULL, it will be automatically attached to the engine's endpoint. +automatically. If you set it to nullptr, it will be automatically attached to the engine's endpoint. If you would instead rather leave the sound unattached by default, you can specify the `MA_SOUND_FLAG_NO_DEFAULT_ATTACHMENT` flag. This is useful if you want to set up a complex node graph. @@ -1345,7 +1345,7 @@ to disable spatialization of a sound: ```c // Disable spatialization at initialization time via a flag: - ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_NO_SPATIALIZATION, NULL, NULL, &sound); + ma_sound_init_from_file(&engine, "my_sound.wav", MA_SOUND_FLAG_NO_SPATIALIZATION, nullptr, nullptr, &sound); // Dynamically disable or enable spatialization post-initialization: ma_sound_set_spatialization_enabled(&sound, isSpatializationEnabled); @@ -1589,7 +1589,7 @@ vtables into the resource manager config: resourceManagerConfig.ppCustomDecodingBackendVTables = pCustomBackendVTables; resourceManagerConfig.customDecodingBackendCount = sizeof(pCustomBackendVTables) / sizeof(pCustomBackendVTables[0]); - resourceManagerConfig.pCustomDecodingBackendUserData = NULL; + resourceManagerConfig.pCustomDecodingBackendUserData = nullptr; ``` This system can allow you to support any kind of file format. See the "Decoding" section for @@ -2074,7 +2074,7 @@ standard config/init system: ```c ma_node_graph_config nodeGraphConfig = ma_node_graph_config_init(myChannelCount); - result = ma_node_graph_init(&nodeGraphConfig, NULL, &nodeGraph); // Second parameter is a pointer to allocation callbacks. + result = ma_node_graph_init(&nodeGraphConfig, nullptr, &nodeGraph); // Second parameter is a pointer to allocation callbacks. if (result != MA_SUCCESS) { // Failed to initialize node graph. } @@ -2114,7 +2114,7 @@ of the stock nodes that comes with miniaudio: ma_data_source_node_config config = ma_data_source_node_config_init(pMyDataSource); ma_data_source_node dataSourceNode; - result = ma_data_source_node_init(&nodeGraph, &config, NULL, &dataSourceNode); + result = ma_data_source_node_init(&nodeGraph, &config, nullptr, &dataSourceNode); if (result != MA_SUCCESS) { // Failed to create data source node. } @@ -2172,7 +2172,7 @@ pointer to the processing function and the number of input and output buses. Exa static ma_node_vtable my_custom_node_vtable = { my_custom_node_process_pcm_frames, // The function that will be called to process your custom node. This is where you'd implement your effect processing. - NULL, // Optional. A callback for calculating the number of input frames that are required to process a specified number of output frames. + nullptr, // Optional. A callback for calculating the number of input frames that are required to process a specified number of output frames. 2, // 2 input buses. 1, // 1 output bus. 0 // Default flags. @@ -2195,7 +2195,7 @@ pointer to the processing function and the number of input and output buses. Exa nodeConfig.pOutputChannels = outputChannels; ma_node_base node; - result = ma_node_init(&nodeGraph, &nodeConfig, NULL, &node); + result = ma_node_init(&nodeGraph, &nodeConfig, nullptr, &node); if (result != MA_SUCCESS) { // Failed to initialize node. } @@ -2210,7 +2210,7 @@ to `MA_NODE_BUS_COUNT_UNKNOWN`. In this case, the bus count should be set in the static ma_node_vtable my_custom_node_vtable = { my_custom_node_process_pcm_frames, // The function that will be called process your custom node. This is where you'd implement your effect processing. - NULL, // Optional. A callback for calculating the number of input frames that are required to process a specified number of output frames. + nullptr, // Optional. A callback for calculating the number of input frames that are required to process a specified number of output frames. MA_NODE_BUS_COUNT_UNKNOWN, // The number of input buses is determined on a per-node basis. 1, // 1 output bus. 0 // Default flags. @@ -2284,7 +2284,7 @@ and include the following: | MA_NODE_FLAG_ALLOW_NULL_INPUT | Used in conjunction with | | | `MA_NODE_FLAG_CONTINUOUS_PROCESSING`. When this | | | is set, the `ppFramesIn` parameter of the | - | | processing callback will be set to NULL when | + | | processing callback will be set to nullptr when | | | there are no input frames are available. When | | | this is unset, silence will be posted to the | | | processing callback. | @@ -2313,7 +2313,7 @@ You can use it like this: ma_splitter_node_config splitterNodeConfig = ma_splitter_node_config_init(channels); ma_splitter_node splitterNode; - result = ma_splitter_node_init(&nodeGraph, &splitterNodeConfig, NULL, &splitterNode); + result = ma_splitter_node_init(&nodeGraph, &splitterNodeConfig, nullptr, &splitterNode); if (result != MA_SUCCESS) { // Failed to create node. } @@ -2526,7 +2526,7 @@ an example for loading a decoder from a file: ```c ma_decoder decoder; - ma_result result = ma_decoder_init_file("MySong.mp3", NULL, &decoder); + ma_result result = ma_decoder_init_file("MySong.mp3", nullptr, &decoder); if (result != MA_SUCCESS) { return false; // An error occurred. } @@ -2537,14 +2537,14 @@ an example for loading a decoder from a file: ``` When initializing a decoder, you can optionally pass in a pointer to a `ma_decoder_config` object -(the `NULL` argument in the example above) which allows you to configure the output format, channel +(the `nullptr` argument in the example above) which allows you to configure the output format, channel count, sample rate and channel map: ```c ma_decoder_config config = ma_decoder_config_init(ma_format_f32, 2, 48000); ``` -When passing in `NULL` for decoder config in `ma_decoder_init*()`, the output format will be the +When passing in `nullptr` for decoder config in `ma_decoder_init*()`, the output format will be the same as that defined by the decoding backend. Data is read from the decoder as PCM frames. This will output the number of PCM frames actually @@ -2610,7 +2610,7 @@ to be implemented which is then passed into the decoder config: ... decoderConfig = ma_decoder_config_init_default(); - decoderConfig.pCustomBackendUserData = NULL; + decoderConfig.pCustomBackendUserData = nullptr; decoderConfig.ppCustomBackendVTables = pCustomBackendVTables; decoderConfig.customBackendCount = sizeof(pCustomBackendVTables) / sizeof(pCustomBackendVTables[0]); ``` @@ -2647,7 +2647,7 @@ If memory allocation is required, it should be done so via the specified allocat possible (the `pAllocationCallbacks` parameter). If an error occurs when initializing the decoder, you should leave `ppBackend` unset, or set to -NULL, and make sure everything is cleaned up appropriately and an appropriate result code returned. +nullptr, and make sure everything is cleaned up appropriately and an appropriate result code returned. When multiple custom backends are specified, miniaudio will cycle through the vtables in the order they're listed in the array that's passed into the decoder config so it's important that your initialization routine is clean. @@ -2707,7 +2707,7 @@ example below: ``` The `framesWritten` variable will contain the number of PCM frames that were actually written. This -is optionally and you can pass in `NULL` if you need this. +is optionally and you can pass in `nullptr` if you need this. Encoders must be uninitialized with `ma_encoder_uninit()`. @@ -2772,12 +2772,12 @@ initializing a simple channel converter which converts from mono to stereo. ma_channel_converter_config config = ma_channel_converter_config_init( ma_format, // Sample format 1, // Input channels - NULL, // Input channel map + nullptr, // Input channel map 2, // Output channels - NULL, // Output channel map + nullptr, // Output channel map ma_channel_mix_mode_default); // The mixing algorithm to use when combining channels. - result = ma_channel_converter_init(&config, NULL, &converter); + result = ma_channel_converter_init(&config, nullptr, &converter); if (result != MA_SUCCESS) { // Error. } @@ -2914,7 +2914,7 @@ like the following: ma_resample_algorithm_linear); ma_resampler resampler; - ma_result result = ma_resampler_init(&config, NULL, &resampler); + ma_result result = ma_resampler_init(&config, nullptr, &resampler); if (result != MA_SUCCESS) { // An error occurred... } @@ -2971,9 +2971,9 @@ De-interleaved processing is not supported. To process frames, use `ma_resampler_process_pcm_frames()`. On input, this function takes the number of output frames you can fit in the output buffer and the number of input frames contained in the input buffer. On output these variables contain the number of output frames that were written to the output buffer -and the number of input frames that were consumed in the process. You can pass in NULL for the +and the number of input frames that were consumed in the process. You can pass in nullptr for the input buffer in which case it will be treated as an infinitely large buffer of zeros. The output -buffer can also be NULL, in which case the processing will be treated as seek. +buffer can also be nullptr, in which case the processing will be treated as seek. The sample rate can be changed dynamically on the fly. You can change this with explicit sample rates with `ma_resampler_set_rate()` and also with a decimal ratio with @@ -3041,17 +3041,17 @@ On output, `pFrameCountIn` should be set to the number of input frames that were whereas `pFrameCountOut` should be set to the number of frames that were written to `pFramesOut`. The `onSetRate` callback is optional and is used for dynamically changing the sample rate. If -dynamic rate changes are not supported, you can set this callback to NULL. +dynamic rate changes are not supported, you can set this callback to nullptr. The `onGetInputLatency` and `onGetOutputLatency` functions are used for retrieving the latency in -input and output rates respectively. These can be NULL in which case latency calculations will be -assumed to be NULL. +input and output rates respectively. These can be nullptr in which case latency calculations will be +assumed to be nullptr. The `onGetRequiredInputFrameCount` callback is used to give miniaudio a hint as to how many input frames are required to be available to produce the given number of output frames. Likewise, the `onGetExpectedOutputFrameCount` callback is used to determine how many output frames will be produced given the specified number of input frames. miniaudio will use these as a hint, but they -are optional and can be set to NULL if you're unable to implement them. +are optional and can be set to nullptr if you're unable to implement them. @@ -3074,7 +3074,7 @@ object like this: ); ma_data_converter converter; - ma_result result = ma_data_converter_init(&config, NULL, &converter); + ma_result result = ma_data_converter_init(&config, nullptr, &converter); if (result != MA_SUCCESS) { // An error occurred... } @@ -3099,7 +3099,7 @@ Something like the following may be more suitable depending on your requirements Do the following to uninitialize the data converter: ```c - ma_data_converter_uninit(&converter, NULL); + ma_data_converter_uninit(&converter, nullptr); ``` The following example shows how data can be processed @@ -3131,9 +3131,9 @@ De-interleaved processing is not supported. To process frames, use `ma_data_converter_process_pcm_frames()`. On input, this function takes the number of output frames you can fit in the output buffer and the number of input frames contained in the input buffer. On output these variables contain the number of output frames that were written to the output buffer -and the number of input frames that were consumed in the process. You can pass in NULL for the +and the number of input frames that were consumed in the process. You can pass in nullptr for the input buffer in which case it will be treated as an infinitely large -buffer of zeros. The output buffer can also be NULL, in which case the processing will be treated +buffer of zeros. The output buffer can also be nullptr, in which case the processing will be treated as seek. Sometimes it's useful to know exactly how many input frames will be required to output a specific @@ -3156,7 +3156,7 @@ Biquad filtering is achieved with the `ma_biquad` API. Example: ```c ma_biquad_config config = ma_biquad_config_init(ma_format_f32, channels, b0, b1, b2, a0, a1, a2); - ma_result result = ma_biquad_init(&config, NULL, &biquad); + ma_result result = ma_biquad_init(&config, nullptr, &biquad); if (result != MA_SUCCESS) { // Error. } @@ -3553,7 +3553,7 @@ you will want to use. To initialize a ring buffer, do something like the followi ```c ma_pcm_rb rb; - ma_result result = ma_pcm_rb_init(FORMAT, CHANNELS, BUFFER_SIZE_IN_FRAMES, NULL, NULL, &rb); + ma_result result = ma_pcm_rb_init(FORMAT, CHANNELS, BUFFER_SIZE_IN_FRAMES, nullptr, nullptr, &rb); if (result != MA_SUCCESS) { // Error } @@ -3564,7 +3564,7 @@ it's the PCM variant of the ring buffer API. For the regular ring buffer that op would call `ma_rb_init()` which leaves these out and just takes the size of the buffer in bytes instead of frames. The fourth parameter is an optional pre-allocated buffer and the fifth parameter is a pointer to a `ma_allocation_callbacks` structure for custom memory allocation routines. -Passing in `NULL` for this results in `MA_MALLOC()` and `MA_FREE()` being used. +Passing in `nullptr` for this results in `MA_MALLOC()` and `MA_FREE()` being used. Use `ma_pcm_rb_init_ex()` if you need a deinterleaved buffer. The data for each sub-buffer is offset from each other based on the stride. To manage your sub-buffers you can use @@ -3843,9 +3843,9 @@ typedef void* ma_proc; typedef ma_uint16 wchar_t; #endif -/* Define NULL for some compilers. */ -#ifndef NULL -#define NULL 0 +/* Define nullptr for some compilers. */ +#ifndef nullptr +#define nullptr 0 #endif #if defined(SIZE_MAX) @@ -4503,7 +4503,7 @@ typedef ma_uint32 ma_spinlock; /* -Retrieves the version of miniaudio as separated integers. Each component can be NULL if it's not required. +Retrieves the version of miniaudio as separated integers. Each component can be nullptr if it's not required. */ MA_API void ma_version(ma_uint32* pMajor, ma_uint32* pMinor, ma_uint32* pRevision); @@ -5464,16 +5464,16 @@ ma_resampler_get_expected_output_frame_count() to know how many output frames wi On input, [pFrameCountIn] contains the number of input frames contained in [pFramesIn]. On output it contains the number of whole input frames that were actually processed. You can use ma_resampler_get_required_input_frame_count() to know how many input frames -you should provide for a given number of output frames. [pFramesIn] can be NULL, in which case zeroes will be used instead. +you should provide for a given number of output frames. [pFramesIn] can be nullptr, in which case zeroes will be used instead. -If [pFramesOut] is NULL, a seek is performed. In this case, if [pFrameCountOut] is not NULL it will seek by the specified number of -output frames. Otherwise, if [pFramesCountOut] is NULL and [pFrameCountIn] is not NULL, it will seek by the specified number of input -frames. When seeking, [pFramesIn] is allowed to NULL, in which case the internal timing state will be updated, but no input will be +If [pFramesOut] is nullptr, a seek is performed. In this case, if [pFrameCountOut] is not nullptr it will seek by the specified number of +output frames. Otherwise, if [pFramesCountOut] is nullptr and [pFrameCountIn] is not nullptr, it will seek by the specified number of input +frames. When seeking, [pFramesIn] is allowed to nullptr, in which case the internal timing state will be updated, but no input will be processed. In this case, any internal filter state will be updated as if zeroes were passed in. -It is an error for [pFramesOut] to be non-NULL and [pFrameCountOut] to be NULL. +It is an error for [pFramesOut] to be non-nullptr and [pFrameCountOut] to be nullptr. -It is an error for both [pFrameCountOut] and [pFrameCountIn] to be NULL. +It is an error for both [pFrameCountOut] and [pFrameCountIn] to be nullptr. */ MA_API ma_result ma_resampler_process_pcm_frames(ma_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut); @@ -5744,7 +5744,7 @@ MA_API void ma_channel_map_copy(ma_channel* pOut, const ma_channel* pIn, ma_uint /* Copies a channel map if one is specified, otherwise copies the default channel map. -The output buffer must have a capacity of at least `channels`. If not NULL, the input channel map must also have a capacity of at least `channels`. +The output buffer must have a capacity of at least `channels`. If not nullptr, the input channel map must also have a capacity of at least `channels`. */ MA_API void ma_channel_map_copy_or_default(ma_channel* pOut, size_t channelMapCapOut, const ma_channel* pIn, ma_uint32 channels); @@ -5816,8 +5816,8 @@ Conversion Helpers ************************************************************************************************************************************************************/ /* -High-level helper for doing a full format conversion in one go. Returns the number of output frames. Call this with pOut set to NULL to -determine the required size of the output buffer. frameCountOut should be set to the capacity of pOut. If pOut is NULL, frameCountOut is +High-level helper for doing a full format conversion in one go. Returns the number of output frames. Call this with pOut set to nullptr to +determine the required size of the output buffer. frameCountOut should be set to the capacity of pOut. If pOut is nullptr, frameCountOut is ignored. A return value of 0 indicates an error. @@ -5865,16 +5865,16 @@ typedef struct ma_uint64 rangeEndInFrames; /* Set to -1 for unranged (default). */ ma_uint64 loopBegInFrames; /* Relative to rangeBegInFrames. */ ma_uint64 loopEndInFrames; /* Relative to rangeBegInFrames. Set to -1 for the end of the range. */ - ma_data_source* pCurrent; /* When non-NULL, the data source being initialized will act as a proxy and will route all operations to pCurrent. Used in conjunction with pNext/onGetNext for seamless chaining. */ - ma_data_source* pNext; /* When set to NULL, onGetNext will be used. */ - ma_data_source_get_next_proc onGetNext; /* Will be used when pNext is NULL. If both are NULL, no next will be used. */ + ma_data_source* pCurrent; /* When non-nullptr, the data source being initialized will act as a proxy and will route all operations to pCurrent. Used in conjunction with pNext/onGetNext for seamless chaining. */ + ma_data_source* pNext; /* When set to nullptr, onGetNext will be used. */ + ma_data_source_get_next_proc onGetNext; /* Will be used when pNext is nullptr. If both are nullptr, no next will be used. */ MA_ATOMIC(4, ma_bool32) isLooping; } ma_data_source_base; MA_API ma_result ma_data_source_init(const ma_data_source_config* pConfig, ma_data_source* pDataSource); MA_API void ma_data_source_uninit(ma_data_source* pDataSource); -MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead); /* Must support pFramesOut = NULL in which case a forward seek should be performed. */ -MA_API ma_result ma_data_source_seek_pcm_frames(ma_data_source* pDataSource, ma_uint64 frameCount, ma_uint64* pFramesSeeked); /* Can only seek forward. Equivalent to ma_data_source_read_pcm_frames(pDataSource, NULL, frameCount, &framesRead); */ +MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead); /* Must support pFramesOut = nullptr in which case a forward seek should be performed. */ +MA_API ma_result ma_data_source_seek_pcm_frames(ma_data_source* pDataSource, ma_uint64 frameCount, ma_uint64* pFramesSeeked); /* Can only seek forward. Equivalent to ma_data_source_read_pcm_frames(pDataSource, nullptr, frameCount, &framesRead); */ MA_API ma_result ma_data_source_seek_to_pcm_frame(ma_data_source* pDataSource, ma_uint64 frameIndex); MA_API ma_result ma_data_source_seek_seconds(ma_data_source* pDataSource, float secondCount, float* pSecondsSeeked); /* Can only seek forward. Abstraction to ma_data_source_seek_pcm_frames() */ MA_API ma_result ma_data_source_seek_to_second(ma_data_source* pDataSource, float seekPointInSeconds); /* Abstraction to ma_data_source_seek_to_pcm_frame() */ @@ -5928,7 +5928,7 @@ typedef struct ma_uint32 channels; ma_uint32 sampleRate; ma_uint64 sizeInFrames; - const void* pData; /* If set to NULL, will allocate a block of memory for you. */ + const void* pData; /* If set to nullptr, will allocate a block of memory for you. */ ma_allocation_callbacks allocationCallbacks; } ma_audio_buffer_config; @@ -6499,7 +6499,7 @@ struct ma_job { /*ma_resource_manager_data_stream**/ void* pDataStream; char* pFilePath; /* Allocated when the job is posted, freed by the job thread after loading. */ - wchar_t* pFilePathW; /* ^ As above ^. Only used if pFilePath is NULL. */ + wchar_t* pFilePathW; /* ^ As above ^. Only used if pFilePath is nullptr. */ ma_uint64 initialSeekPoint; ma_async_notification* pInitNotification; /* Signalled after the first two pages have been decoded and frames can be read from the stream. */ ma_fence* pInitFence; @@ -7248,7 +7248,7 @@ needs to stop and the `onContextEnumerateDevices()` function returns with a succ Detailed device information can be retrieved from a device ID using `onContextGetDeviceInfo()`. This takes as input the device type and ID, and on output returns detailed information about the device in `ma_device_info`. The `onContextGetDeviceInfo()` callback must handle the -case when the device ID is NULL, in which case information about the default device needs to be retrieved. +case when the device ID is nullptr, in which case information about the default device needs to be retrieved. Once the context has been created and the device ID retrieved (if using anything other than the default device), the device can be created. This is a little bit more complicated than initialization of the context due to its more complicated configuration. When initializing a @@ -7794,7 +7794,7 @@ struct ma_device ma_event stopEvent; ma_thread thread; ma_result workResult; /* This is set by the worker thread after it's finished doing a job. */ - ma_bool8 isOwnerOfContext; /* When set to true, uninitializing the device will also uninitialize the context. Set to true when NULL is passed into ma_device_init(). */ + ma_bool8 isOwnerOfContext; /* When set to true, uninitializing the device will also uninitialize the context. Set to true when nullptr is passed into ma_device_init(). */ ma_bool8 noPreSilencedOutputBuffer; ma_bool8 noClip; ma_bool8 noDisableDenormals; @@ -7813,7 +7813,7 @@ struct ma_device } resampling; struct { - ma_device_id* pID; /* Set to NULL if using default ID, otherwise set to the address of "id". */ + ma_device_id* pID; /* Set to nullptr if using default ID, otherwise set to the address of "id". */ ma_device_id id; /* If using an explicit device, will be set to a copy of the ID used for initialization. Otherwise cleared to 0. */ char name[MA_MAX_DEVICE_NAME_LENGTH + 1]; /* Maybe temporary. Likely to be replaced with a query API. */ ma_share_mode shareMode; /* Set to whatever was passed in when the device was initialized. */ @@ -7839,7 +7839,7 @@ struct ma_device } playback; struct { - ma_device_id* pID; /* Set to NULL if using default ID, otherwise set to the address of "id". */ + ma_device_id* pID; /* Set to nullptr if using default ID, otherwise set to the address of "id". */ ma_device_id id; /* If using an explicit device, will be set to a copy of the ID used for initialization. Otherwise cleared to 0. */ char name[MA_MAX_DEVICE_NAME_LENGTH + 1]; /* Maybe temporary. Likely to be replaced with a query API. */ ma_share_mode shareMode; /* Set to whatever was passed in when the device was initialized. */ @@ -8114,10 +8114,10 @@ device. There is one context to many devices, and a device is created from a con Parameters ---------- backends (in, optional) - A list of backends to try initializing, in priority order. Can be NULL, in which case it uses default priority order. + A list of backends to try initializing, in priority order. Can be nullptr, in which case it uses default priority order. backendCount (in, optional) - The number of items in `backend`. Ignored if `backend` is NULL. + The number of items in `backend`. Ignored if `backend` is nullptr. pConfig (in, optional) The context configuration. @@ -8138,7 +8138,7 @@ Unsafe. Do not call this function across multiple threads as some backends read Remarks ------- -When `backends` is NULL, the default priority order will be used. Below is a list of backends in priority order: +When `backends` is nullptr, the default priority order will be used. Below is a list of backends in priority order: |-------------|-----------------------|--------------------------------------------------------| | Name | Enum Name | Supported Operating Systems | @@ -8163,7 +8163,7 @@ The context can be configured via the `pConfig` argument. The config object is i can then be set directly on the structure. Below are the members of the `ma_context_config` object. pLog - A pointer to the `ma_log` to post log messages to. Can be NULL if the application does not + A pointer to the `ma_log` to post log messages to. Can be nullptr if the application does not require logging. See the `ma_log` API for details on how to use the logging system. threadPriority @@ -8265,7 +8265,7 @@ The example below shows how to initialize the context using the default configur ```c ma_context context; -ma_result result = ma_context_init(NULL, 0, NULL, &context); +ma_result result = ma_context_init(nullptr, 0, nullptr, &context); if (result != MA_SUCCESS) { // Error. } @@ -8363,7 +8363,7 @@ You can attach your own logging callback to the log with `ma_log_register_callba Return Value ------------ A pointer to the `ma_log` object that the context uses to post log messages. If some error occurs, -NULL will be returned. +nullptr will be returned. */ MA_API ma_log* ma_context_get_log(ma_context* pContext); @@ -8478,7 +8478,7 @@ Remarks ------- It is _not_ safe to assume the first device in the list is the default device. -You can pass in NULL for the playback or capture lists in which case they'll be ignored. +You can pass in nullptr for the playback or capture lists in which case they'll be ignored. The returned pointers will become invalid upon the next call this this function, or when the context is uninitialized. Do not free the returned pointers. @@ -8666,13 +8666,13 @@ Unsafe. It is not safe to call this inside any callback. Remarks ------- -Setting `pContext` to NULL will result in miniaudio creating a default context internally and is equivalent to passing in a context initialized like so: +Setting `pContext` to nullptr will result in miniaudio creating a default context internally and is equivalent to passing in a context initialized like so: ```c - ma_context_init(NULL, 0, NULL, &context); + ma_context_init(nullptr, 0, nullptr, &context); ``` -Do not set `pContext` to NULL if you are needing to open multiple devices. You can, however, use NULL when initializing the first device, and then use +Do not set `pContext` to nullptr if you are needing to open multiple devices. You can, however, use nullptr when initializing the first device, and then use device.pContext for the initialization of other devices. The device can be configured via the `pConfig` argument. The config object is initialized with `ma_device_config_init()`. Individual configuration settings can @@ -8743,7 +8743,7 @@ then be set directly on the structure. Below are the members of the `ma_device_c `MA_MAX_FILTER_ORDER`. The default value is `min(4, MA_MAX_FILTER_ORDER)`. playback.pDeviceID - A pointer to a `ma_device_id` structure containing the ID of the playback device to initialize. Setting this NULL (default) will use the system's + A pointer to a `ma_device_id` structure containing the ID of the playback device to initialize. Setting this nullptr (default) will use the system's default playback device. Retrieve the device ID from the `ma_device_info` structure, which can be retrieved using device enumeration. playback.format @@ -8764,7 +8764,7 @@ then be set directly on the structure. Below are the members of the `ma_device_c ma_share_mode_shared and reinitializing. capture.pDeviceID - A pointer to a `ma_device_id` structure containing the ID of the capture device to initialize. Setting this NULL (default) will use the system's + A pointer to a `ma_device_id` structure containing the ID of the capture device to initialize. Setting this nullptr (default) will use the system's default capture device. Retrieve the device ID from the `ma_device_info` structure, which can be retrieved using device enumeration. capture.format @@ -8890,7 +8890,7 @@ config.dataCallback = ma_data_callback; config.pMyUserData = pMyUserData; ma_device device; -ma_result result = ma_device_init(NULL, &config, &device); +ma_result result = ma_device_init(nullptr, &config, &device); if (result != MA_SUCCESS) { // Error } @@ -8905,14 +8905,14 @@ enumeration. ```c ma_context context; -ma_result result = ma_context_init(NULL, 0, NULL, &context); +ma_result result = ma_context_init(nullptr, 0, nullptr, &context); if (result != MA_SUCCESS) { // Error } ma_device_info* pPlaybackDeviceInfos; ma_uint32 playbackDeviceCount; -result = ma_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, NULL, NULL); +result = ma_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, nullptr, nullptr); if (result != MA_SUCCESS) { // Error } @@ -8958,10 +8958,10 @@ allows you to configure the internally created context. Parameters ---------- backends (in, optional) - A list of backends to try initializing, in priority order. Can be NULL, in which case it uses default priority order. + A list of backends to try initializing, in priority order. Can be nullptr, in which case it uses default priority order. backendCount (in, optional) - The number of items in `backend`. Ignored if `backend` is NULL. + The number of items in `backend`. Ignored if `backend` is nullptr. pContextConfig (in, optional) The context configuration. @@ -9131,7 +9131,7 @@ which may or may not be safe. Remarks ------- -If the name does not fully fit into the output buffer, it'll be truncated. You can pass in NULL to +If the name does not fully fit into the output buffer, it'll be truncated. You can pass in nullptr to `pName` if you want to first get the length of the name for the purpose of memory allocation of the output buffer. Allocating a buffer of size `MA_MAX_DEVICE_NAME_LENGTH + 1` should be enough for most cases and will avoid the need for the inefficiency of calling this function twice. @@ -9387,7 +9387,7 @@ volume (in) Return Value ------------ MA_SUCCESS if the volume was set successfully. -MA_INVALID_ARGS if pDevice is NULL. +MA_INVALID_ARGS if pDevice is nullptr. MA_INVALID_ARGS if volume is negative. @@ -9432,8 +9432,8 @@ pVolume (in) Return Value ------------ MA_SUCCESS if successful. -MA_INVALID_ARGS if pDevice is NULL. -MA_INVALID_ARGS if pVolume is NULL. +MA_INVALID_ARGS if pDevice is nullptr. +MA_INVALID_ARGS if pVolume is nullptr. Thread Safety @@ -9477,7 +9477,7 @@ gainDB (in) Return Value ------------ MA_SUCCESS if the volume was set successfully. -MA_INVALID_ARGS if pDevice is NULL. +MA_INVALID_ARGS if pDevice is nullptr. MA_INVALID_ARGS if the gain is > 0. @@ -9522,8 +9522,8 @@ pGainDB (in) Return Value ------------ MA_SUCCESS if successful. -MA_INVALID_ARGS if pDevice is NULL. -MA_INVALID_ARGS if pGainDB is NULL. +MA_INVALID_ARGS if pDevice is nullptr. +MA_INVALID_ARGS if pGainDB is nullptr. Thread Safety @@ -9560,12 +9560,12 @@ pDevice (in) A pointer to device whose processing the data callback. pOutput (out) - A pointer to the buffer that will receive the output PCM frame data. On a playback device this must not be NULL. On a duplex device - this can be NULL, in which case pInput must not be NULL. + A pointer to the buffer that will receive the output PCM frame data. On a playback device this must not be nullptr. On a duplex device + this can be nullptr, in which case pInput must not be nullptr. pInput (in) - A pointer to the buffer containing input PCM frame data. On a capture device this must not be NULL. On a duplex device this can be - NULL, in which case `pOutput` must not be NULL. + A pointer to the buffer containing input PCM frame data. On a capture device this must not be nullptr. On a duplex device this can be + nullptr, in which case `pOutput` must not be nullptr. frameCount (in) The number of frames being processed. @@ -9589,7 +9589,7 @@ Do not call this from the miniaudio data callback. It should only ever be called Remarks ------- -If both `pOutput` and `pInput` are NULL, and error will be returned. In duplex scenarios, both `pOutput` and `pInput` can be non-NULL, in +If both `pOutput` and `pInput` are nullptr, and error will be returned. In duplex scenarios, both `pOutput` and `pInput` can be non-nullptr, in which case `pInput` will be processed first, followed by `pOutput`. If you are implementing a custom backend, and that backend uses a callback for data delivery, you'll need to call this from inside that @@ -9674,7 +9674,7 @@ Retrieves compile-time enabled backends. Parameters ---------- pBackends (out, optional) - A pointer to the buffer that will receive the enabled backends. Set to NULL to retrieve the backend count. Setting + A pointer to the buffer that will receive the enabled backends. Set to nullptr to retrieve the backend count. Setting the capacity of the buffer to `MA_BACKEND_COUNT` will guarantee it's large enough for all backends. backendCap (in) @@ -9687,7 +9687,7 @@ pBackendCount (out) Return Value ------------ MA_SUCCESS if successful. -MA_INVALID_ARGS if `pBackendCount` is NULL. +MA_INVALID_ARGS if `pBackendCount` is nullptr. MA_NO_SPACE if the capacity of `pBackends` is not large enough. If `MA_NO_SPACE` is returned, the `pBackends` buffer will be filled with `*pBackendCount` values. @@ -9706,7 +9706,7 @@ Safe. Remarks ------- If you want to retrieve the number of backends so you can determine the capacity of `pBackends` buffer, you can call -this function with `pBackends` set to NULL. +this function with `pBackends` set to nullptr. This will also enumerate the null backend. If you don't want to include this you need to check for `ma_backend_null` when you enumerate over the returned backends and handle it appropriately. Alternatively, you can disable it at @@ -10516,7 +10516,7 @@ typedef struct size_t jobThreadStackSize; ma_uint32 jobQueueCapacity; /* The maximum number of jobs that can fit in the queue at a time. Defaults to MA_JOB_TYPE_RESOURCE_MANAGER_QUEUE_CAPACITY. Cannot be zero. */ ma_uint32 flags; - ma_vfs* pVFS; /* Can be NULL in which case defaults will be used. */ + ma_vfs* pVFS; /* Can be nullptr in which case defaults will be used. */ ma_decoding_backend_vtable** ppCustomDecodingBackendVTables; ma_uint32 customDecodingBackendCount; void* pCustomDecodingBackendUserData; @@ -11213,7 +11213,7 @@ typedef struct const char* pFilePath; /* Set this to load from the resource manager. */ const wchar_t* pFilePathW; /* Set this to load from the resource manager. */ ma_data_source* pDataSource; /* Set this to load from an existing data source. */ - ma_node* pInitialAttachment; /* If set, the sound will be attached to an input of this node. This can be set to a ma_sound. If set to NULL, the sound will be attached directly to the endpoint unless MA_SOUND_FLAG_NO_DEFAULT_ATTACHMENT is set in `flags`. */ + ma_node* pInitialAttachment; /* If set, the sound will be attached to an input of this node. This can be set to a ma_sound. If set to nullptr, the sound will be attached directly to the endpoint unless MA_SOUND_FLAG_NO_DEFAULT_ATTACHMENT is set in `flags`. */ ma_uint32 initialAttachmentInputBusIndex; /* The index of the input bus of pInitialAttachment to attach the sound to. */ ma_uint32 channelsIn; /* Ignored if using a data source as input (the data source's channel count will be used always). Otherwise, setting to 0 will cause the engine's channel count to be used. */ ma_uint32 channelsOut; /* Set this to 0 (default) to use the engine's channel count. Set to MA_SOUND_SOURCE_CHANNEL_COUNT to use the data source's channel count (only used if using a data source as input). */ @@ -11290,7 +11290,7 @@ typedef struct ma_device_data_proc dataCallback; /* Can be null. Can be used to provide a custom device data callback. */ ma_device_notification_proc notificationCallback; #endif - ma_log* pLog; /* When set to NULL, will use the context's log. */ + ma_log* pLog; /* When set to nullptr, will use the context's log. */ ma_uint32 listenerCount; /* Must be between 1 and MA_ENGINE_MAX_LISTENERS. */ ma_uint32 channels; /* The number of channels to use when mixing and spatializing. When set to 0, will use the native channel count of the device. */ ma_uint32 sampleRate; /* The sample rate. When set to 0 will use the native sample rate of the device. */ @@ -11304,7 +11304,7 @@ typedef struct ma_bool32 noAutoStart; /* When set to true, requires an explicit call to ma_engine_start(). This is false by default, meaning the engine will be started automatically in ma_engine_init(). */ ma_bool32 noDevice; /* When set to true, don't create a default device. ma_engine_read_pcm_frames() can be called manually to read data. */ ma_mono_expansion_mode monoExpansionMode; /* Controls how the mono channel should be expanded to other channels when spatialization is disabled on a sound. */ - ma_vfs* pResourceManagerVFS; /* A pointer to a pre-allocated VFS object to use with the resource manager. This is ignored if pResourceManager is not NULL. */ + ma_vfs* pResourceManagerVFS; /* A pointer to a pre-allocated VFS object to use with the resource manager. This is ignored if pResourceManager is not nullptr. */ ma_engine_process_proc onProcess; /* Fired at the end of each call to ma_engine_read_pcm_frames(). For engine's that manage their own internal device (the default configuration), this will be fired from the audio thread, and you do not need to call ma_engine_read_pcm_frames() manually in order to trigger this. */ void* pProcessUserData; /* User data that's passed into onProcess. */ ma_resampler_config resourceManagerResampling; /* The resampling config to use with the resource manager. */ @@ -12010,12 +12010,12 @@ static void ma_sleep__posix(ma_uint32 milliseconds) struct timespec ts; ts.tv_sec = milliseconds / 1000; ts.tv_nsec = milliseconds % 1000 * 1000000; - nanosleep(&ts, NULL); + nanosleep(&ts, nullptr); #else struct timeval tv; tv.tv_sec = milliseconds / 1000; tv.tv_usec = milliseconds % 1000 * 1000; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); #endif #endif } @@ -12337,7 +12337,7 @@ Standard Library Stuff static MA_INLINE void ma_zero_memory_default(void* p, size_t sz) { - if (p == NULL) { + if (p == nullptr) { MA_ASSERT(sz == 0); /* If this is triggered there's an error with the calling code. */ return; } @@ -12684,7 +12684,7 @@ MA_API MA_NO_INLINE int ma_itoa_s(int value, char* dst, size_t dstSizeInBytes, i unsigned int valueU; char* dstEnd; - if (dst == NULL || dstSizeInBytes == 0) { + if (dst == nullptr || dstSizeInBytes == 0) { return 22; } if (radix < 2 || radix > 36) { @@ -12752,8 +12752,8 @@ MA_API MA_NO_INLINE int ma_strcmp(const char* str1, const char* str2) if (str1 == str2) return 0; /* These checks differ from the standard implementation. It's not important, but I prefer it just for sanity. */ - if (str1 == NULL) return -1; - if (str2 == NULL) return 1; + if (str1 == nullptr) return -1; + if (str2 == nullptr) return 1; for (;;) { if (str1[0] == '\0') { @@ -12775,8 +12775,8 @@ MA_API MA_NO_INLINE int ma_wcscmp(const wchar_t* str1, const wchar_t* str2) if (str1 == str2) return 0; /* These checks differ from the standard implementation. It's not important, but I prefer it just for sanity. */ - if (str1 == NULL) return -1; - if (str2 == NULL) return 1; + if (str1 == nullptr) return -1; + if (str2 == nullptr) return 1; for (;;) { if (str1[0] == L'\0') { @@ -12814,7 +12814,7 @@ MA_API MA_NO_INLINE size_t ma_wcslen(const wchar_t* str) { const wchar_t* end; - if (str == NULL) { + if (str == nullptr) { return 0; } @@ -12831,14 +12831,14 @@ MA_API MA_NO_INLINE char* ma_copy_string(const char* src, const ma_allocation_ca size_t sz; char* dst; - if (src == NULL) { - return NULL; + if (src == nullptr) { + return nullptr; } sz = strlen(src)+1; dst = (char*)ma_malloc(sz, pAllocationCallbacks); - if (dst == NULL) { - return NULL; + if (dst == nullptr) { + return nullptr; } ma_strcpy_s(dst, sz, src); @@ -12850,8 +12850,8 @@ MA_API MA_NO_INLINE wchar_t* ma_copy_string_w(const wchar_t* src, const ma_alloc { size_t sz = ma_wcslen(src)+1; wchar_t* dst = (wchar_t*)ma_malloc(sz * sizeof(*dst), pAllocationCallbacks); - if (dst == NULL) { - return NULL; + if (dst == nullptr) { + return nullptr; } ma_wcscpy_s(dst, sz, src); @@ -13271,11 +13271,11 @@ MA_API ma_result ma_fopen(FILE** ppFile, const char* pFilePath, const char* pOpe errno_t err; #endif - if (ppFile != NULL) { - *ppFile = NULL; /* Safety. */ + if (ppFile != nullptr) { + *ppFile = nullptr; /* Safety. */ } - if (pFilePath == NULL || pOpenMode == NULL || ppFile == NULL) { + if (pFilePath == nullptr || pOpenMode == nullptr || ppFile == nullptr) { return MA_INVALID_ARGS; } @@ -13294,10 +13294,10 @@ MA_API ma_result ma_fopen(FILE** ppFile, const char* pFilePath, const char* pOpe *ppFile = fopen(pFilePath, pOpenMode); #endif #endif - if (*ppFile == NULL) { + if (*ppFile == nullptr) { ma_result result = ma_result_from_errno(errno); if (result == MA_SUCCESS) { - result = MA_ERROR; /* Just a safety check to make sure we never ever return success when pFile == NULL. */ + result = MA_ERROR; /* Just a safety check to make sure we never ever return success when pFile == nullptr. */ } return result; @@ -13329,11 +13329,11 @@ fallback, so if you notice your compiler not detecting this properly I'm happy t MA_API ma_result ma_wfopen(FILE** ppFile, const wchar_t* pFilePath, const wchar_t* pOpenMode, const ma_allocation_callbacks* pAllocationCallbacks) { - if (ppFile != NULL) { - *ppFile = NULL; /* Safety. */ + if (ppFile != nullptr) { + *ppFile = nullptr; /* Safety. */ } - if (pFilePath == NULL || pOpenMode == NULL || ppFile == NULL) { + if (pFilePath == nullptr || pOpenMode == nullptr || ppFile == nullptr) { return MA_INVALID_ARGS; } @@ -13350,7 +13350,7 @@ MA_API ma_result ma_wfopen(FILE** ppFile, const wchar_t* pFilePath, const wchar_ #else { *ppFile = _wfopen(pFilePath, pOpenMode); - if (*ppFile == NULL) { + if (*ppFile == nullptr) { return ma_result_from_errno(errno); } } @@ -13368,18 +13368,18 @@ MA_API ma_result ma_wfopen(FILE** ppFile, const wchar_t* pFilePath, const wchar_ mbstate_t mbs; size_t lenMB; const wchar_t* pFilePathTemp = pFilePath; - char* pFilePathMB = NULL; + char* pFilePathMB = nullptr; char pOpenModeMB[32] = {0}; /* Get the length first. */ MA_ZERO_OBJECT(&mbs); - lenMB = wcsrtombs(NULL, &pFilePathTemp, 0, &mbs); + lenMB = wcsrtombs(nullptr, &pFilePathTemp, 0, &mbs); if (lenMB == (size_t)-1) { return ma_result_from_errno(errno); } pFilePathMB = (char*)ma_malloc(lenMB + 1, pAllocationCallbacks); - if (pFilePathMB == NULL) { + if (pFilePathMB == nullptr) { return MA_OUT_OF_MEMORY; } @@ -13408,11 +13408,11 @@ MA_API ma_result ma_wfopen(FILE** ppFile, const wchar_t* pFilePath, const wchar_ #else { /* Getting here means there is no way to open the file with a wide character string. */ - *ppFile = NULL; + *ppFile = nullptr; } #endif - if (*ppFile == NULL) { + if (*ppFile == nullptr) { return MA_ERROR; } @@ -13533,7 +13533,7 @@ static void ma__free_default(void* p, void* pUserData) static ma_allocation_callbacks ma_allocation_callbacks_init_default(void) { ma_allocation_callbacks callbacks; - callbacks.pUserData = NULL; + callbacks.pUserData = nullptr; callbacks.onMalloc = ma__malloc_default; callbacks.onRealloc = ma__realloc_default; callbacks.onFree = ma__free_default; @@ -13543,17 +13543,17 @@ static ma_allocation_callbacks ma_allocation_callbacks_init_default(void) static ma_result ma_allocation_callbacks_init_copy(ma_allocation_callbacks* pDst, const ma_allocation_callbacks* pSrc) { - if (pDst == NULL) { + if (pDst == nullptr) { return MA_INVALID_ARGS; } - if (pSrc == NULL) { + if (pSrc == nullptr) { *pDst = ma_allocation_callbacks_init_default(); } else { - if (pSrc->pUserData == NULL && pSrc->onFree == NULL && pSrc->onMalloc == NULL && pSrc->onRealloc == NULL) { + if (pSrc->pUserData == nullptr && pSrc->onFree == nullptr && pSrc->onMalloc == nullptr && pSrc->onRealloc == nullptr) { *pDst = ma_allocation_callbacks_init_default(); } else { - if (pSrc->onFree == NULL || (pSrc->onMalloc == NULL && pSrc->onRealloc == NULL)) { + if (pSrc->onFree == nullptr || (pSrc->onMalloc == nullptr && pSrc->onRealloc == nullptr)) { return MA_INVALID_ARGS; /* Invalid allocation callbacks. */ } else { *pDst = *pSrc; @@ -13639,7 +13639,7 @@ MA_API ma_log_callback ma_log_callback_init(ma_log_callback_proc onLog, void* pU MA_API ma_result ma_log_init(const ma_allocation_callbacks* pAllocationCallbacks, ma_log* pLog) { - if (pLog == NULL) { + if (pLog == nullptr) { return MA_INVALID_ARGS; } @@ -13659,7 +13659,7 @@ MA_API ma_result ma_log_init(const ma_allocation_callbacks* pAllocationCallbacks /* If we're using debug output, enable it. */ #if defined(MA_DEBUG_OUTPUT) { - ma_log_register_callback(pLog, ma_log_callback_init(ma_log_callback_debug, NULL)); /* Doesn't really matter if this fails. */ + ma_log_register_callback(pLog, ma_log_callback_init(ma_log_callback_debug, nullptr)); /* Doesn't really matter if this fails. */ } #endif @@ -13668,7 +13668,7 @@ MA_API ma_result ma_log_init(const ma_allocation_callbacks* pAllocationCallbacks MA_API void ma_log_uninit(ma_log* pLog) { - if (pLog == NULL) { + if (pLog == nullptr) { return; } @@ -13699,7 +13699,7 @@ MA_API ma_result ma_log_register_callback(ma_log* pLog, ma_log_callback callback { ma_result result = MA_SUCCESS; - if (pLog == NULL || callback.onLog == NULL) { + if (pLog == nullptr || callback.onLog == nullptr) { return MA_INVALID_ARGS; } @@ -13719,7 +13719,7 @@ MA_API ma_result ma_log_register_callback(ma_log* pLog, ma_log_callback callback MA_API ma_result ma_log_unregister_callback(ma_log* pLog, ma_log_callback callback) { - if (pLog == NULL) { + if (pLog == nullptr) { return MA_INVALID_ARGS; } @@ -13748,7 +13748,7 @@ MA_API ma_result ma_log_unregister_callback(ma_log* pLog, ma_log_callback callba MA_API ma_result ma_log_post(ma_log* pLog, ma_uint32 level, const char* pMessage) { - if (pLog == NULL || pMessage == NULL) { + if (pLog == nullptr || pMessage == nullptr) { return MA_INVALID_ARGS; } @@ -13778,17 +13778,17 @@ static int ma_vscprintf(const ma_allocation_callbacks* pAllocationCallbacks, con return _vscprintf(format, args); #else int result; - char* pTempBuffer = NULL; + char* pTempBuffer = nullptr; size_t tempBufferCap = 1024; - if (format == NULL) { + if (format == nullptr) { errno = EINVAL; return -1; } for (;;) { char* pNewTempBuffer = (char*)ma_realloc(pTempBuffer, tempBufferCap, pAllocationCallbacks); - if (pNewTempBuffer == NULL) { + if (pNewTempBuffer == nullptr) { ma_free(pTempBuffer, pAllocationCallbacks); errno = ENOMEM; return -1; /* Out of memory. */ @@ -13797,7 +13797,7 @@ static int ma_vscprintf(const ma_allocation_callbacks* pAllocationCallbacks, con pTempBuffer = pNewTempBuffer; result = _vsnprintf(pTempBuffer, tempBufferCap, format, args); - ma_free(pTempBuffer, NULL); + ma_free(pTempBuffer, nullptr); if (result != -1) { break; /* Got it. */ @@ -13814,7 +13814,7 @@ static int ma_vscprintf(const ma_allocation_callbacks* pAllocationCallbacks, con MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat, va_list args) { - if (pLog == NULL || pFormat == NULL) { + if (pLog == nullptr || pFormat == nullptr) { return MA_INVALID_ARGS; } @@ -13823,7 +13823,7 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat ma_result result; int length; char pFormattedMessageStack[1024]; - char* pFormattedMessageHeap = NULL; + char* pFormattedMessageHeap = nullptr; va_list args2; /* First try formatting into our fixed sized stack allocated buffer. If this is too small we'll fallback to a heap allocation. */ @@ -13843,7 +13843,7 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat } else { /* The stack buffer was too small, try the heap. */ pFormattedMessageHeap = (char*)ma_malloc(length + 1, &pLog->allocationCallbacks); - if (pFormattedMessageHeap == NULL) { + if (pFormattedMessageHeap == nullptr) { return MA_OUT_OF_MEMORY; } @@ -13870,7 +13870,7 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat { ma_result result; int formattedLen; - char* pFormattedMessage = NULL; + char* pFormattedMessage = nullptr; va_list args2; ma_va_copy(args2, args); @@ -13884,7 +13884,7 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat } pFormattedMessage = (char*)ma_malloc(formattedLen + 1, &pLog->allocationCallbacks); - if (pFormattedMessage == NULL) { + if (pFormattedMessage == nullptr) { return MA_OUT_OF_MEMORY; } @@ -13922,7 +13922,7 @@ MA_API ma_result ma_log_postf(ma_log* pLog, ma_uint32 level, const char* pFormat ma_result result; va_list args; - if (pLog == NULL || pFormat == NULL) { + if (pLog == nullptr || pFormat == nullptr) { return MA_INVALID_ARGS; } @@ -14079,7 +14079,7 @@ static ma_lcg g_maLCG = {MA_DEFAULT_LCG_SEED}; /* Non-zero initial seed. Use ma_ static MA_INLINE void ma_lcg_seed(ma_lcg* pLCG, ma_int32 seed) { - MA_ASSERT(pLCG != NULL); + MA_ASSERT(pLCG != nullptr); pLCG->state = seed; } @@ -17522,7 +17522,7 @@ Threading *******************************************************************************/ static MA_INLINE ma_result ma_spinlock_lock_ex(volatile ma_spinlock* pSpinlock, ma_bool32 yield) { - if (pSpinlock == NULL) { + if (pSpinlock == nullptr) { return MA_INVALID_ARGS; } @@ -17553,7 +17553,7 @@ MA_API ma_result ma_spinlock_lock_noyield(volatile ma_spinlock* pSpinlock) MA_API ma_result ma_spinlock_unlock(volatile ma_spinlock* pSpinlock) { - if (pSpinlock == NULL) { + if (pSpinlock == nullptr) { return MA_INVALID_ARGS; } @@ -17577,7 +17577,7 @@ typedef ma_thread_result (MA_THREADCALL * ma_thread_entry_proc)(void* pData); static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority priority, size_t stackSize, ma_thread_entry_proc entryProc, void* pData) { int result; - pthread_attr_t* pAttr = NULL; + pthread_attr_t* pAttr = nullptr; #if !defined(MA_EMSCRIPTEN) && !defined(MA_3DS) && !defined(MA_SWITCH) /* Try setting the thread priority. It's not critical if anything fails here. */ @@ -17674,7 +17674,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority result = pthread_create((pthread_t*)pThread, pAttr, entryProc, pData); /* The thread attributes object is no longer required. */ - if (pAttr != NULL) { + if (pAttr != nullptr) { pthread_attr_destroy(pAttr); } @@ -17702,7 +17702,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority static void ma_thread_wait__posix(ma_thread* pThread) { - pthread_join((pthread_t)*pThread, NULL); + pthread_join((pthread_t)*pThread, nullptr); } @@ -17710,13 +17710,13 @@ static ma_result ma_mutex_init__posix(ma_mutex* pMutex) { int result; - if (pMutex == NULL) { + if (pMutex == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pMutex); - result = pthread_mutex_init((pthread_mutex_t*)pMutex, NULL); + result = pthread_mutex_init((pthread_mutex_t*)pMutex, nullptr); if (result != 0) { return ma_result_from_errno(result); } @@ -17744,12 +17744,12 @@ static ma_result ma_event_init__posix(ma_event* pEvent) { int result; - result = pthread_mutex_init((pthread_mutex_t*)&pEvent->lock, NULL); + result = pthread_mutex_init((pthread_mutex_t*)&pEvent->lock, nullptr); if (result != 0) { return ma_result_from_errno(result); } - result = pthread_cond_init((pthread_cond_t*)&pEvent->cond, NULL); + result = pthread_cond_init((pthread_cond_t*)&pEvent->cond, nullptr); if (result != 0) { pthread_mutex_destroy((pthread_mutex_t*)&pEvent->lock); return ma_result_from_errno(result); @@ -17796,18 +17796,18 @@ static ma_result ma_semaphore_init__posix(int initialValue, ma_semaphore* pSemap { int result; - if (pSemaphore == NULL) { + if (pSemaphore == nullptr) { return MA_INVALID_ARGS; } pSemaphore->value = initialValue; - result = pthread_mutex_init((pthread_mutex_t*)&pSemaphore->lock, NULL); + result = pthread_mutex_init((pthread_mutex_t*)&pSemaphore->lock, nullptr); if (result != 0) { return ma_result_from_errno(result); /* Failed to create mutex. */ } - result = pthread_cond_init((pthread_cond_t*)&pSemaphore->cond, NULL); + result = pthread_cond_init((pthread_cond_t*)&pSemaphore->cond, nullptr); if (result != 0) { pthread_mutex_destroy((pthread_mutex_t*)&pSemaphore->lock); return ma_result_from_errno(result); /* Failed to create condition variable. */ @@ -17818,7 +17818,7 @@ static ma_result ma_semaphore_init__posix(int initialValue, ma_semaphore* pSemap static void ma_semaphore_uninit__posix(ma_semaphore* pSemaphore) { - if (pSemaphore == NULL) { + if (pSemaphore == nullptr) { return; } @@ -17828,7 +17828,7 @@ static void ma_semaphore_uninit__posix(ma_semaphore* pSemaphore) static ma_result ma_semaphore_wait__posix(ma_semaphore* pSemaphore) { - if (pSemaphore == NULL) { + if (pSemaphore == nullptr) { return MA_INVALID_ARGS; } @@ -17848,7 +17848,7 @@ static ma_result ma_semaphore_wait__posix(ma_semaphore* pSemaphore) static ma_result ma_semaphore_release__posix(ma_semaphore* pSemaphore) { - if (pSemaphore == NULL) { + if (pSemaphore == nullptr) { return MA_INVALID_ARGS; } @@ -17880,8 +17880,8 @@ static ma_result ma_thread_create__win32(ma_thread* pThread, ma_thread_priority { DWORD threadID; /* Not used. Only used for passing into CreateThread() so it doesn't fail on Windows 98. */ - *pThread = CreateThread(NULL, stackSize, entryProc, pData, 0, &threadID); - if (*pThread == NULL) { + *pThread = CreateThread(nullptr, stackSize, entryProc, pData, 0, &threadID); + if (*pThread == nullptr) { return ma_result_from_GetLastError(GetLastError()); } @@ -17899,8 +17899,8 @@ static void ma_thread_wait__win32(ma_thread* pThread) static ma_result ma_mutex_init__win32(ma_mutex* pMutex) { - *pMutex = CreateEventA(NULL, FALSE, TRUE, NULL); - if (*pMutex == NULL) { + *pMutex = CreateEventA(nullptr, FALSE, TRUE, nullptr); + if (*pMutex == nullptr) { return ma_result_from_GetLastError(GetLastError()); } @@ -17925,8 +17925,8 @@ static void ma_mutex_unlock__win32(ma_mutex* pMutex) static ma_result ma_event_init__win32(ma_event* pEvent) { - *pEvent = CreateEventA(NULL, FALSE, FALSE, NULL); - if (*pEvent == NULL) { + *pEvent = CreateEventA(nullptr, FALSE, FALSE, nullptr); + if (*pEvent == nullptr) { return ma_result_from_GetLastError(GetLastError()); } @@ -17965,8 +17965,8 @@ static ma_result ma_event_signal__win32(ma_event* pEvent) static ma_result ma_semaphore_init__win32(int initialValue, ma_semaphore* pSemaphore) { - *pSemaphore = CreateSemaphore(NULL, (LONG)initialValue, LONG_MAX, NULL); - if (*pSemaphore == NULL) { + *pSemaphore = CreateSemaphore(nullptr, (LONG)initialValue, LONG_MAX, nullptr); + if (*pSemaphore == nullptr) { return ma_result_from_GetLastError(GetLastError()); } @@ -17994,7 +17994,7 @@ static ma_result ma_semaphore_wait__win32(ma_semaphore* pSemaphore) static ma_result ma_semaphore_release__win32(ma_semaphore* pSemaphore) { - BOOL result = ReleaseSemaphore((HANDLE)*pSemaphore, 1, NULL); + BOOL result = ReleaseSemaphore((HANDLE)*pSemaphore, 1, nullptr); if (result == 0) { return ma_result_from_GetLastError(GetLastError()); } @@ -18041,12 +18041,12 @@ static ma_result ma_thread_create(ma_thread* pThread, ma_thread_priority priorit ma_result result; ma_thread_proxy_data* pProxyData; - if (pThread == NULL || entryProc == NULL) { + if (pThread == nullptr || entryProc == nullptr) { return MA_INVALID_ARGS; } pProxyData = (ma_thread_proxy_data*)ma_malloc(sizeof(*pProxyData), pAllocationCallbacks); /* Will be freed by the proxy entry proc. */ - if (pProxyData == NULL) { + if (pProxyData == nullptr) { return MA_OUT_OF_MEMORY; } @@ -18076,7 +18076,7 @@ static ma_result ma_thread_create(ma_thread* pThread, ma_thread_priority priorit static void ma_thread_wait(ma_thread* pThread) { - if (pThread == NULL) { + if (pThread == nullptr) { return; } @@ -18090,7 +18090,7 @@ static void ma_thread_wait(ma_thread* pThread) MA_API ma_result ma_mutex_init(ma_mutex* pMutex) { - if (pMutex == NULL) { + if (pMutex == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert so the caller is aware of this bug. */ return MA_INVALID_ARGS; } @@ -18104,7 +18104,7 @@ MA_API ma_result ma_mutex_init(ma_mutex* pMutex) MA_API void ma_mutex_uninit(ma_mutex* pMutex) { - if (pMutex == NULL) { + if (pMutex == nullptr) { return; } @@ -18117,7 +18117,7 @@ MA_API void ma_mutex_uninit(ma_mutex* pMutex) MA_API void ma_mutex_lock(ma_mutex* pMutex) { - if (pMutex == NULL) { + if (pMutex == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert so the caller is aware of this bug. */ return; } @@ -18131,7 +18131,7 @@ MA_API void ma_mutex_lock(ma_mutex* pMutex) MA_API void ma_mutex_unlock(ma_mutex* pMutex) { - if (pMutex == NULL) { + if (pMutex == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert so the caller is aware of this bug. */ return; } @@ -18146,7 +18146,7 @@ MA_API void ma_mutex_unlock(ma_mutex* pMutex) MA_API ma_result ma_event_init(ma_event* pEvent) { - if (pEvent == NULL) { + if (pEvent == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert so the caller is aware of this bug. */ return MA_INVALID_ARGS; } @@ -18164,14 +18164,14 @@ static ma_result ma_event_alloc_and_init(ma_event** ppEvent, ma_allocation_callb ma_result result; ma_event* pEvent; - if (ppEvent == NULL) { + if (ppEvent == nullptr) { return MA_INVALID_ARGS; } - *ppEvent = NULL; + *ppEvent = nullptr; pEvent = ma_malloc(sizeof(*pEvent), pAllocationCallbacks); - if (pEvent == NULL) { + if (pEvent == nullptr) { return MA_OUT_OF_MEMORY; } @@ -18188,7 +18188,7 @@ static ma_result ma_event_alloc_and_init(ma_event** ppEvent, ma_allocation_callb MA_API void ma_event_uninit(ma_event* pEvent) { - if (pEvent == NULL) { + if (pEvent == nullptr) { return; } @@ -18202,7 +18202,7 @@ MA_API void ma_event_uninit(ma_event* pEvent) #if 0 static void ma_event_uninit_and_free(ma_event* pEvent, ma_allocation_callbacks* pAllocationCallbacks) { - if (pEvent == NULL) { + if (pEvent == nullptr) { return; } @@ -18213,7 +18213,7 @@ static void ma_event_uninit_and_free(ma_event* pEvent, ma_allocation_callbacks* MA_API ma_result ma_event_wait(ma_event* pEvent) { - if (pEvent == NULL) { + if (pEvent == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert to the caller is aware of this bug. */ return MA_INVALID_ARGS; } @@ -18227,7 +18227,7 @@ MA_API ma_result ma_event_wait(ma_event* pEvent) MA_API ma_result ma_event_signal(ma_event* pEvent) { - if (pEvent == NULL) { + if (pEvent == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert to the caller is aware of this bug. */ return MA_INVALID_ARGS; } @@ -18242,7 +18242,7 @@ MA_API ma_result ma_event_signal(ma_event* pEvent) MA_API ma_result ma_semaphore_init(int initialValue, ma_semaphore* pSemaphore) { - if (pSemaphore == NULL) { + if (pSemaphore == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert so the caller is aware of this bug. */ return MA_INVALID_ARGS; } @@ -18256,7 +18256,7 @@ MA_API ma_result ma_semaphore_init(int initialValue, ma_semaphore* pSemaphore) MA_API void ma_semaphore_uninit(ma_semaphore* pSemaphore) { - if (pSemaphore == NULL) { + if (pSemaphore == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert so the caller is aware of this bug. */ return; } @@ -18270,7 +18270,7 @@ MA_API void ma_semaphore_uninit(ma_semaphore* pSemaphore) MA_API ma_result ma_semaphore_wait(ma_semaphore* pSemaphore) { - if (pSemaphore == NULL) { + if (pSemaphore == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert so the caller is aware of this bug. */ return MA_INVALID_ARGS; } @@ -18284,7 +18284,7 @@ MA_API ma_result ma_semaphore_wait(ma_semaphore* pSemaphore) MA_API ma_result ma_semaphore_release(ma_semaphore* pSemaphore) { - if (pSemaphore == NULL) { + if (pSemaphore == nullptr) { MA_ASSERT(MA_FALSE); /* Fire an assert so the caller is aware of this bug. */ return MA_INVALID_ARGS; } @@ -18308,7 +18308,7 @@ MA_API ma_result ma_semaphore_release(ma_semaphore* pSemaphore) MA_API ma_result ma_fence_init(ma_fence* pFence) { - if (pFence == NULL) { + if (pFence == nullptr) { return MA_INVALID_ARGS; } @@ -18331,7 +18331,7 @@ MA_API ma_result ma_fence_init(ma_fence* pFence) MA_API void ma_fence_uninit(ma_fence* pFence) { - if (pFence == NULL) { + if (pFence == nullptr) { return; } @@ -18346,7 +18346,7 @@ MA_API void ma_fence_uninit(ma_fence* pFence) MA_API ma_result ma_fence_acquire(ma_fence* pFence) { - if (pFence == NULL) { + if (pFence == nullptr) { return MA_INVALID_ARGS; } @@ -18376,7 +18376,7 @@ MA_API ma_result ma_fence_acquire(ma_fence* pFence) MA_API ma_result ma_fence_release(ma_fence* pFence) { - if (pFence == NULL) { + if (pFence == nullptr) { return MA_INVALID_ARGS; } @@ -18413,7 +18413,7 @@ MA_API ma_result ma_fence_release(ma_fence* pFence) MA_API ma_result ma_fence_wait(ma_fence* pFence) { - if (pFence == NULL) { + if (pFence == nullptr) { return MA_INVALID_ARGS; } @@ -18451,11 +18451,11 @@ MA_API ma_result ma_async_notification_signal(ma_async_notification* pNotificati { ma_async_notification_callbacks* pNotificationCallbacks = (ma_async_notification_callbacks*)pNotification; - if (pNotification == NULL) { + if (pNotification == nullptr) { return MA_INVALID_ARGS; } - if (pNotificationCallbacks->onSignal == NULL) { + if (pNotificationCallbacks->onSignal == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -18471,7 +18471,7 @@ static void ma_async_notification_poll__on_signal(ma_async_notification* pNotifi MA_API ma_result ma_async_notification_poll_init(ma_async_notification_poll* pNotificationPoll) { - if (pNotificationPoll == NULL) { + if (pNotificationPoll == nullptr) { return MA_INVALID_ARGS; } @@ -18483,7 +18483,7 @@ MA_API ma_result ma_async_notification_poll_init(ma_async_notification_poll* pNo MA_API ma_bool32 ma_async_notification_poll_is_signalled(const ma_async_notification_poll* pNotificationPoll) { - if (pNotificationPoll == NULL) { + if (pNotificationPoll == nullptr) { return MA_FALSE; } @@ -18498,7 +18498,7 @@ static void ma_async_notification_event__on_signal(ma_async_notification* pNotif MA_API ma_result ma_async_notification_event_init(ma_async_notification_event* pNotificationEvent) { - if (pNotificationEvent == NULL) { + if (pNotificationEvent == nullptr) { return MA_INVALID_ARGS; } @@ -18524,7 +18524,7 @@ MA_API ma_result ma_async_notification_event_init(ma_async_notification_event* p MA_API ma_result ma_async_notification_event_uninit(ma_async_notification_event* pNotificationEvent) { - if (pNotificationEvent == NULL) { + if (pNotificationEvent == nullptr) { return MA_INVALID_ARGS; } @@ -18542,7 +18542,7 @@ MA_API ma_result ma_async_notification_event_uninit(ma_async_notification_event* MA_API ma_result ma_async_notification_event_wait(ma_async_notification_event* pNotificationEvent) { - if (pNotificationEvent == NULL) { + if (pNotificationEvent == nullptr) { return MA_INVALID_ARGS; } @@ -18559,7 +18559,7 @@ MA_API ma_result ma_async_notification_event_wait(ma_async_notification_event* p MA_API ma_result ma_async_notification_event_signal(ma_async_notification_event* pNotificationEvent) { - if (pNotificationEvent == NULL) { + if (pNotificationEvent == nullptr) { return MA_INVALID_ARGS; } @@ -18617,11 +18617,11 @@ typedef struct static ma_result ma_slot_allocator_get_heap_layout(const ma_slot_allocator_config* pConfig, ma_slot_allocator_heap_layout* pHeapLayout) { - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -18647,7 +18647,7 @@ MA_API ma_result ma_slot_allocator_get_heap_size(const ma_slot_allocator_config* ma_result result; ma_slot_allocator_heap_layout layout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -18668,13 +18668,13 @@ MA_API ma_result ma_slot_allocator_init_preallocated(const ma_slot_allocator_con ma_result result; ma_slot_allocator_heap_layout heapLayout; - if (pAllocator == NULL) { + if (pAllocator == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pAllocator); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_INVALID_ARGS; } @@ -18706,11 +18706,11 @@ MA_API ma_result ma_slot_allocator_init(const ma_slot_allocator_config* pConfig, if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_slot_allocator_init_preallocated(pConfig, pHeap, pAllocator); @@ -18725,7 +18725,7 @@ MA_API ma_result ma_slot_allocator_init(const ma_slot_allocator_config* pConfig, MA_API void ma_slot_allocator_uninit(ma_slot_allocator* pAllocator, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocator == NULL) { + if (pAllocator == nullptr) { return; } @@ -18739,7 +18739,7 @@ MA_API ma_result ma_slot_allocator_alloc(ma_slot_allocator* pAllocator, ma_uint6 ma_uint32 iAttempt; const ma_uint32 maxAttempts = 2; /* The number of iterations to perform until returning MA_OUT_OF_MEMORY if no slots can be found. */ - if (pAllocator == NULL || pSlot == NULL) { + if (pAllocator == nullptr || pSlot == nullptr) { return MA_INVALID_ARGS; } @@ -18805,7 +18805,7 @@ MA_API ma_result ma_slot_allocator_free(ma_slot_allocator* pAllocator, ma_uint64 ma_uint32 iGroup; ma_uint32 iBit; - if (pAllocator == NULL) { + if (pAllocator == nullptr) { return MA_INVALID_ARGS; } @@ -18936,7 +18936,7 @@ static ma_job_proc g_jobVTable[MA_JOB_TYPE_COUNT] = MA_API ma_result ma_job_process(ma_job* pJob) { - if (pJob == NULL) { + if (pJob == nullptr) { return MA_INVALID_ARGS; } @@ -18949,7 +18949,7 @@ MA_API ma_result ma_job_process(ma_job* pJob) static ma_result ma_job_process__noop(ma_job* pJob) { - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); /* No-op. */ (void)pJob; @@ -18964,10 +18964,10 @@ static ma_result ma_job_process__quit(ma_job* pJob) static ma_result ma_job_process__custom(ma_job* pJob) { - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); /* No-op if there's no callback. */ - if (pJob->data.custom.proc == NULL) { + if (pJob->data.custom.proc == nullptr) { return MA_SUCCESS; } @@ -18998,11 +18998,11 @@ static ma_result ma_job_queue_get_heap_layout(const ma_job_queue_config* pConfig { ma_result result; - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -19039,7 +19039,7 @@ MA_API ma_result ma_job_queue_get_heap_size(const ma_job_queue_config* pConfig, ma_result result; ma_job_queue_heap_layout layout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -19061,7 +19061,7 @@ MA_API ma_result ma_job_queue_init_preallocated(const ma_job_queue_config* pConf ma_job_queue_heap_layout heapLayout; ma_slot_allocator_config allocatorConfig; - if (pQueue == NULL) { + if (pQueue == nullptr) { return MA_INVALID_ARGS; } @@ -19123,11 +19123,11 @@ MA_API ma_result ma_job_queue_init(const ma_job_queue_config* pConfig, const ma_ if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_job_queue_init_preallocated(pConfig, pHeap, pQueue); @@ -19142,7 +19142,7 @@ MA_API ma_result ma_job_queue_init(const ma_job_queue_config* pConfig, const ma_ MA_API void ma_job_queue_uninit(ma_job_queue* pQueue, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pQueue == NULL) { + if (pQueue == nullptr) { return; } @@ -19182,7 +19182,7 @@ MA_API ma_result ma_job_queue_post(ma_job_queue* pQueue, const ma_job* pJob) ma_uint64 tail; ma_uint64 next; - if (pQueue == NULL || pJob == NULL) { + if (pQueue == nullptr || pJob == nullptr) { return MA_INVALID_ARGS; } @@ -19249,7 +19249,7 @@ MA_API ma_result ma_job_queue_next(ma_job_queue* pQueue, ma_job* pJob) ma_uint64 tail; ma_uint64 next; - if (pQueue == NULL || pJob == NULL) { + if (pQueue == nullptr || pJob == nullptr) { return MA_INVALID_ARGS; } @@ -19359,7 +19359,7 @@ MA_API ma_handle ma_dlopen(ma_log* pLog, const char* filename) /* *sigh* It appears there is no ANSI version of LoadPackagedLibrary()... */ WCHAR filenameW[4096]; if (MultiByteToWideChar(CP_UTF8, 0, filename, -1, filenameW, sizeof(filenameW)) == 0) { - handle = NULL; + handle = nullptr; } else { handle = (ma_handle)LoadPackagedLibrary(filenameW, 0); } @@ -19372,7 +19372,7 @@ MA_API ma_handle ma_dlopen(ma_log* pLog, const char* filename) I'm not considering failure to load a library an error nor a warning because seamlessly falling through to a lower-priority backend is a deliberate design choice. Instead I'm logging it as an informational message. */ - if (handle == NULL) { + if (handle == nullptr) { ma_log_postf(pLog, MA_LOG_LEVEL_INFO, "Failed to load library: %s\n", filename); } @@ -19383,7 +19383,7 @@ MA_API ma_handle ma_dlopen(ma_log* pLog, const char* filename) /* Runtime linking is disabled. */ (void)pLog; (void)filename; - return NULL; + return nullptr; } #endif } @@ -19447,7 +19447,7 @@ MA_API ma_proc ma_dlsym(ma_log* pLog, ma_handle handle, const char* symbol) } #endif - if (proc == NULL) { + if (proc == nullptr) { ma_log_postf(pLog, MA_LOG_LEVEL_WARNING, "Failed to load symbol: %s\n", symbol); } @@ -19460,7 +19460,7 @@ MA_API ma_proc ma_dlsym(ma_log* pLog, ma_handle handle, const char* symbol) (void)pLog; (void)handle; (void)symbol; - return NULL; + return nullptr; } #endif } @@ -19498,7 +19498,7 @@ DEVICE I/O MA_API void ma_device_info_add_native_data_format(ma_device_info* pDeviceInfo, ma_format format, ma_uint32 channels, ma_uint32 sampleRate, ma_uint32 flags) { - if (pDeviceInfo == NULL) { + if (pDeviceInfo == nullptr) { return; } @@ -19550,13 +19550,13 @@ MA_API ma_result ma_get_backend_from_name(const char* pBackendName, ma_backend* { size_t iBackend; - if (pBackendName == NULL) { + if (pBackendName == nullptr) { return MA_INVALID_ARGS; } for (iBackend = 0; iBackend < ma_countof(gBackendInfo); iBackend += 1) { if (ma_strcmp(pBackendName, gBackendInfo[iBackend].pName) == 0) { - if (pBackend != NULL) { + if (pBackend != nullptr) { *pBackend = gBackendInfo[iBackend].backend; } @@ -19689,7 +19689,7 @@ MA_API ma_result ma_get_enabled_backends(ma_backend* pBackends, size_t backendCa size_t iBackend; ma_result result = MA_SUCCESS; - if (pBackendCount == NULL) { + if (pBackendCount == nullptr) { return MA_INVALID_ARGS; } @@ -19710,7 +19710,7 @@ MA_API ma_result ma_get_enabled_backends(ma_backend* pBackends, size_t backendCa } } - if (pBackendCount != NULL) { + if (pBackendCount != nullptr) { *pBackendCount = backendCount; } @@ -20107,7 +20107,7 @@ Timing static MA_INLINE void ma_timer_init(ma_timer* pTimer) { struct timeval newTime; - gettimeofday(&newTime, NULL); + gettimeofday(&newTime, nullptr); pTimer->counter = ((ma_int64)newTime.tv_sec * 1000000) + newTime.tv_usec; } @@ -20118,7 +20118,7 @@ Timing ma_uint64 oldTimeCounter; struct timeval newTime; - gettimeofday(&newTime, NULL); + gettimeofday(&newTime, nullptr); newTimeCounter = ((ma_uint64)newTime.tv_sec * 1000000) + newTime.tv_usec; oldTimeCounter = pTimer->counter; @@ -20164,7 +20164,7 @@ static ma_uint32 ma_get_closest_standard_sample_rate(ma_uint32 sampleRateIn) static MA_INLINE unsigned int ma_device_disable_denormals(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (!pDevice->noDisableDenormals) { return ma_disable_denormals(); @@ -20175,7 +20175,7 @@ static MA_INLINE unsigned int ma_device_disable_denormals(ma_device* pDevice) static MA_INLINE void ma_device_restore_denormals(ma_device* pDevice, unsigned int prevState) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (!pDevice->noDisableDenormals) { ma_restore_denormals(prevState); @@ -20198,14 +20198,14 @@ static ma_device_notification ma_device_notification_init(ma_device* pDevice, ma static void ma_device__on_notification(ma_device_notification notification) { - MA_ASSERT(notification.pDevice != NULL); + MA_ASSERT(notification.pDevice != nullptr); - if (notification.pDevice->onNotification != NULL) { + if (notification.pDevice->onNotification != nullptr) { notification.pDevice->onNotification(¬ification); } /* TEMP FOR COMPATIBILITY: If it's a stopped notification, fire the onStop callback as well. This is only for backwards compatibility and will be removed. */ - if (notification.pDevice->onStop != NULL && notification.type == ma_device_notification_type_stopped) { + if (notification.pDevice->onStop != nullptr && notification.type == ma_device_notification_type_stopped) { notification.pDevice->onStop(notification.pDevice); } } @@ -20244,10 +20244,10 @@ void EMSCRIPTEN_KEEPALIVE ma_device__on_notification_unlocked(ma_device* pDevice static void ma_device__on_data_inner(ma_device* pDevice, void* pFramesOut, const void* pFramesIn, ma_uint32 frameCount) { - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pDevice->onData != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pDevice->onData != nullptr); - if (!pDevice->noPreSilencedOutputBuffer && pFramesOut != NULL) { + if (!pDevice->noPreSilencedOutputBuffer && pFramesOut != nullptr) { ma_silence_pcm_frames(pFramesOut, frameCount, pDevice->playback.format, pDevice->playback.channels); } @@ -20256,7 +20256,7 @@ static void ma_device__on_data_inner(ma_device* pDevice, void* pFramesOut, const static void ma_device__on_data(ma_device* pDevice, void* pFramesOut, const void* pFramesIn, ma_uint32 frameCount) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Don't read more data from the client if we're in the process of stopping. */ if (ma_device_get_state(pDevice) == ma_device_state_stopping) { @@ -20274,7 +20274,7 @@ static void ma_device__on_data(ma_device* pDevice, void* pFramesOut, const void* ma_uint32 totalFramesRemaining = frameCount - totalFramesProcessed; ma_uint32 framesToProcessThisIteration = 0; - if (pFramesIn != NULL) { + if (pFramesIn != nullptr) { /* Capturing. Write to the intermediary buffer. If there's no room, fire the callback to empty it. */ if (pDevice->capture.intermediaryBufferLen < pDevice->capture.intermediaryBufferCap) { /* There's some room left in the intermediary buffer. Write to it without firing the callback. */ @@ -20297,7 +20297,7 @@ static void ma_device__on_data(ma_device* pDevice, void* pFramesOut, const void* if (pDevice->type == ma_device_type_duplex) { /* We'll do the duplex data callback later after we've processed the playback data. */ } else { - ma_device__on_data_inner(pDevice, NULL, pDevice->capture.pIntermediaryBuffer, pDevice->capture.intermediaryBufferCap); + ma_device__on_data_inner(pDevice, nullptr, pDevice->capture.pIntermediaryBuffer, pDevice->capture.intermediaryBufferCap); /* The intermediary buffer has just been drained. */ pDevice->capture.intermediaryBufferLen = 0; @@ -20305,7 +20305,7 @@ static void ma_device__on_data(ma_device* pDevice, void* pFramesOut, const void* } } - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { /* Playing back. Read from the intermediary buffer. If there's nothing in it, fire the callback to fill it. */ if (pDevice->playback.intermediaryBufferLen > 0) { /* There's some content in the intermediary buffer. Read from that without firing the callback. */ @@ -20332,7 +20332,7 @@ static void ma_device__on_data(ma_device* pDevice, void* pFramesOut, const void* if (pDevice->type == ma_device_type_duplex) { /* In duplex mode, the data callback will be fired later. Nothing to do here. */ } else { - ma_device__on_data_inner(pDevice, pDevice->playback.pIntermediaryBuffer, NULL, pDevice->playback.intermediaryBufferCap); + ma_device__on_data_inner(pDevice, pDevice->playback.pIntermediaryBuffer, nullptr, pDevice->playback.intermediaryBufferCap); /* The intermediary buffer has just been filled. */ pDevice->playback.intermediaryBufferLen = pDevice->playback.intermediaryBufferCap; @@ -20366,7 +20366,7 @@ static void ma_device__handle_data_callback(ma_device* pDevice, void* pFramesOut unsigned int prevDenormalState = ma_device_disable_denormals(pDevice); { /* Volume control of input makes things a bit awkward because the input buffer is read-only. We'll need to use a temp buffer and loop in this case. */ - if (pFramesIn != NULL && masterVolumeFactor != 1) { + if (pFramesIn != nullptr && masterVolumeFactor != 1) { ma_uint8 tempFramesIn[MA_DATA_CONVERTER_STACK_BUFFER_SIZE]; ma_uint32 bpfCapture = ma_get_bytes_per_frame(pDevice->capture.format, pDevice->capture.channels); ma_uint32 bpfPlayback = ma_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels); @@ -20388,9 +20388,9 @@ static void ma_device__handle_data_callback(ma_device* pDevice, void* pFramesOut } /* Volume control and clipping for playback devices. */ - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { if (masterVolumeFactor != 1) { - if (pFramesIn == NULL) { /* <-- In full-duplex situations, the volume will have been applied to the input samples before the data callback. Applying it again post-callback will incorrectly compound it. */ + if (pFramesIn == nullptr) { /* <-- In full-duplex situations, the volume will have been applied to the input samples before the data callback. Applying it again post-callback will incorrectly compound it. */ ma_apply_volume_factor_pcm_frames(pFramesOut, frameCount, pDevice->playback.format, pDevice->playback.channels, masterVolumeFactor); } } @@ -20403,7 +20403,7 @@ static void ma_device__handle_data_callback(ma_device* pDevice, void* pFramesOut ma_device_restore_denormals(pDevice, prevDenormalState); } else { /* No data callback. Just silence the output. */ - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { ma_silence_pcm_frames(pFramesOut, frameCount, pDevice->playback.format, pDevice->playback.channels); } } @@ -20414,12 +20414,12 @@ static void ma_device__handle_data_callback(ma_device* pDevice, void* pFramesOut /* A helper function for reading sample data from the client. */ static void ma_device__read_frames_from_client(ma_device* pDevice, ma_uint32 frameCount, void* pFramesOut) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(frameCount > 0); - MA_ASSERT(pFramesOut != NULL); + MA_ASSERT(pFramesOut != nullptr); if (pDevice->playback.converter.isPassthrough) { - ma_device__handle_data_callback(pDevice, pFramesOut, NULL, frameCount); + ma_device__handle_data_callback(pDevice, pFramesOut, nullptr, frameCount); } else { ma_result result; ma_uint64 totalFramesReadOut; @@ -20433,7 +20433,7 @@ static void ma_device__read_frames_from_client(ma_device* pDevice, ma_uint32 fra buffer for caching input data. This will be the case if the data converter does not have the ability to retrieve the required input frame count for a given output frame count. */ - if (pDevice->playback.pInputCache != NULL) { + if (pDevice->playback.pInputCache != nullptr) { while (totalFramesReadOut < frameCount) { ma_uint64 framesToReadThisIterationIn; ma_uint64 framesToReadThisIterationOut; @@ -20464,7 +20464,7 @@ static void ma_device__read_frames_from_client(ma_device* pDevice, ma_uint32 fra /* Getting here means there's no data in the cache and we need to fill it up with data from the client. */ if (pDevice->playback.inputCacheRemaining == 0) { - ma_device__handle_data_callback(pDevice, pDevice->playback.pInputCache, NULL, (ma_uint32)pDevice->playback.inputCacheCap); + ma_device__handle_data_callback(pDevice, pDevice->playback.pInputCache, nullptr, (ma_uint32)pDevice->playback.inputCacheCap); pDevice->playback.inputCacheConsumed = 0; pDevice->playback.inputCacheRemaining = pDevice->playback.inputCacheCap; @@ -20491,7 +20491,7 @@ static void ma_device__read_frames_from_client(ma_device* pDevice, ma_uint32 fra framesToReadThisIterationIn = requiredInputFrameCount; } - ma_device__handle_data_callback(pDevice, pIntermediaryBuffer, NULL, (ma_uint32)framesToReadThisIterationIn); + ma_device__handle_data_callback(pDevice, pIntermediaryBuffer, nullptr, (ma_uint32)framesToReadThisIterationIn); /* At this point we have our decoded data in input format and now we need to convert to output format. Note that even if we didn't read any @@ -20518,12 +20518,12 @@ static void ma_device__read_frames_from_client(ma_device* pDevice, ma_uint32 fra /* A helper for sending sample data to the client. */ static void ma_device__send_frames_to_client(ma_device* pDevice, ma_uint32 frameCountInDeviceFormat, const void* pFramesInDeviceFormat) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(frameCountInDeviceFormat > 0); - MA_ASSERT(pFramesInDeviceFormat != NULL); + MA_ASSERT(pFramesInDeviceFormat != nullptr); if (pDevice->capture.converter.isPassthrough) { - ma_device__handle_data_callback(pDevice, NULL, pFramesInDeviceFormat, frameCountInDeviceFormat); + ma_device__handle_data_callback(pDevice, nullptr, pFramesInDeviceFormat, frameCountInDeviceFormat); } else { ma_result result; ma_uint8 pFramesInClientFormat[MA_DATA_CONVERTER_STACK_BUFFER_SIZE]; @@ -20546,7 +20546,7 @@ static void ma_device__send_frames_to_client(ma_device* pDevice, ma_uint32 frame } if (clientFramesProcessedThisIteration > 0) { - ma_device__handle_data_callback(pDevice, NULL, pFramesInClientFormat, (ma_uint32)clientFramesProcessedThisIteration); /* Safe cast. */ + ma_device__handle_data_callback(pDevice, nullptr, pFramesInClientFormat, (ma_uint32)clientFramesProcessedThisIteration); /* Safe cast. */ } pRunningFramesInDeviceFormat = ma_offset_ptr(pRunningFramesInDeviceFormat, deviceFramesProcessedThisIteration * ma_get_bytes_per_frame(pDevice->capture.internalFormat, pDevice->capture.internalChannels)); @@ -20569,10 +20569,10 @@ static ma_result ma_device__handle_duplex_callback_capture(ma_device* pDevice, m ma_uint32 totalDeviceFramesProcessed = 0; const void* pRunningFramesInDeviceFormat = pFramesInDeviceFormat; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(frameCountInDeviceFormat > 0); - MA_ASSERT(pFramesInDeviceFormat != NULL); - MA_ASSERT(pRB != NULL); + MA_ASSERT(pFramesInDeviceFormat != nullptr); + MA_ASSERT(pRB != nullptr); /* Write to the ring buffer. The ring buffer is in the client format which means we need to convert. */ for (;;) { @@ -20626,11 +20626,11 @@ static ma_result ma_device__handle_duplex_callback_playback(ma_device* pDevice, ma_uint8 silentInputFrames[MA_DATA_CONVERTER_STACK_BUFFER_SIZE]; ma_uint32 totalFramesReadOut = 0; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(frameCount > 0); - MA_ASSERT(pFramesInInternalFormat != NULL); - MA_ASSERT(pRB != NULL); - MA_ASSERT(pDevice->playback.pInputCache != NULL); + MA_ASSERT(pFramesInInternalFormat != nullptr); + MA_ASSERT(pRB != nullptr); + MA_ASSERT(pDevice->playback.pInputCache != nullptr); /* Sitting in the ring buffer should be captured data from the capture callback in external format. If there's not enough data in there for @@ -20714,7 +20714,7 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d static ma_bool32 ma_device_descriptor_is_valid(const ma_device_descriptor* pDeviceDescriptor) { - if (pDeviceDescriptor == NULL) { + if (pDeviceDescriptor == nullptr) { return MA_FALSE; } @@ -20743,11 +20743,11 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice) ma_uint32 capturedDeviceDataCapInFrames = 0; ma_uint32 playbackDeviceDataCapInFrames = 0; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Just some quick validation on the device type and the available callbacks. */ if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex || pDevice->type == ma_device_type_loopback) { - if (pDevice->pContext->callbacks.onDeviceRead == NULL) { + if (pDevice->pContext->callbacks.onDeviceRead == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -20755,7 +20755,7 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice) } if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { - if (pDevice->pContext->callbacks.onDeviceWrite == NULL) { + if (pDevice->pContext->callbacks.onDeviceWrite == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -20828,7 +20828,7 @@ static ma_result ma_device_audio_thread__default_read_write(ma_device* pDevice) break; } - result = pDevice->pContext->callbacks.onDeviceWrite(pDevice, playbackDeviceData, (ma_uint32)convertedDeviceFrameCount, NULL); /* Safe cast. */ + result = pDevice->pContext->callbacks.onDeviceWrite(pDevice, playbackDeviceData, (ma_uint32)convertedDeviceFrameCount, nullptr); /* Safe cast. */ if (result != MA_SUCCESS) { exitLoop = MA_TRUE; break; @@ -20941,7 +20941,7 @@ Null Backend static ma_thread_result MA_THREADCALL ma_device_thread__null(void* pData) { ma_device* pDevice = (ma_device*)pData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); for (;;) { /* Keep the thread alive until the device is uninitialized. */ ma_uint32 operation; @@ -21052,14 +21052,14 @@ static ma_result ma_context_enumerate_devices__null(ma_context* pContext, ma_enu { ma_bool32 cbResult = MA_TRUE; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); /* Playback. */ if (cbResult) { ma_device_info deviceInfo; MA_ZERO_OBJECT(&deviceInfo); - ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), "NULL Playback Device", (size_t)-1); + ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), "nullptr Playback Device", (size_t)-1); deviceInfo.isDefault = MA_TRUE; /* Only one playback and capture device for the null backend, so might as well mark as default. */ cbResult = callback(pContext, ma_device_type_playback, &deviceInfo, pUserData); } @@ -21068,7 +21068,7 @@ static ma_result ma_context_enumerate_devices__null(ma_context* pContext, ma_enu if (cbResult) { ma_device_info deviceInfo; MA_ZERO_OBJECT(&deviceInfo); - ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), "NULL Capture Device", (size_t)-1); + ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), "nullptr Capture Device", (size_t)-1); deviceInfo.isDefault = MA_TRUE; /* Only one playback and capture device for the null backend, so might as well mark as default. */ cbResult = callback(pContext, ma_device_type_capture, &deviceInfo, pUserData); } @@ -21080,17 +21080,17 @@ static ma_result ma_context_enumerate_devices__null(ma_context* pContext, ma_enu static ma_result ma_context_get_device_info__null(ma_context* pContext, ma_device_type deviceType, const ma_device_id* pDeviceID, ma_device_info* pDeviceInfo) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); - if (pDeviceID != NULL && pDeviceID->nullbackend != 0) { + if (pDeviceID != nullptr && pDeviceID->nullbackend != 0) { return MA_NO_DEVICE; /* Don't know the device. */ } /* Name / Description */ if (deviceType == ma_device_type_playback) { - ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), "NULL Playback Device", (size_t)-1); + ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), "nullptr Playback Device", (size_t)-1); } else { - ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), "NULL Capture Device", (size_t)-1); + ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), "nullptr Capture Device", (size_t)-1); } pDeviceInfo->isDefault = MA_TRUE; /* Only one playback and capture device for the null backend, so might as well mark as default. */ @@ -21109,7 +21109,7 @@ static ma_result ma_context_get_device_info__null(ma_context* pContext, ma_devic static ma_result ma_device_uninit__null(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Keep it clean and wait for the device thread to finish before returning. */ ma_device_do_operation__null(pDevice, MA_DEVICE_OP_KILL__NULL); @@ -21129,7 +21129,7 @@ static ma_result ma_device_init__null(ma_device* pDevice, const ma_device_config { ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->null_device); @@ -21191,7 +21191,7 @@ static ma_result ma_device_init__null(ma_device* pDevice, const ma_device_config static ma_result ma_device_start__null(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_device_do_operation__null(pDevice, MA_DEVICE_OP_START__NULL); @@ -21201,7 +21201,7 @@ static ma_result ma_device_start__null(ma_device* pDevice) static ma_result ma_device_stop__null(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_device_do_operation__null(pDevice, MA_DEVICE_OP_SUSPEND__NULL); @@ -21211,7 +21211,7 @@ static ma_result ma_device_stop__null(ma_device* pDevice) static ma_bool32 ma_device_is_started__null(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); return ma_atomic_bool32_get(&pDevice->null_device.isStarted); } @@ -21222,7 +21222,7 @@ static ma_result ma_device_write__null(ma_device* pDevice, const void* pPCMFrame ma_uint32 totalPCMFramesProcessed; ma_bool32 wasStartedOnEntry; - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = 0; } @@ -21289,7 +21289,7 @@ static ma_result ma_device_write__null(ma_device* pDevice, const void* pPCMFrame pDevice->null_device.currentPeriodFramesRemainingPlayback = pDevice->playback.internalPeriodSizeInFrames; } - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = totalPCMFramesProcessed; } @@ -21301,7 +21301,7 @@ static ma_result ma_device_read__null(ma_device* pDevice, void* pPCMFrames, ma_u ma_result result = MA_SUCCESS; ma_uint32 totalPCMFramesProcessed; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -21360,7 +21360,7 @@ static ma_result ma_device_read__null(ma_device* pDevice, void* pPCMFrames, ma_u pDevice->null_device.currentPeriodFramesRemainingCapture = pDevice->capture.internalPeriodSizeInFrames; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalPCMFramesProcessed; } @@ -21369,7 +21369,7 @@ static ma_result ma_device_read__null(ma_device* pDevice, void* pPCMFrames, ma_u static ma_result ma_context_uninit__null(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_null); (void)pContext; @@ -21378,7 +21378,7 @@ static ma_result ma_context_uninit__null(ma_context* pContext) static ma_result ma_context_init__null(ma_context* pContext, const ma_context_config* pConfig, ma_backend_callbacks* pCallbacks) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); (void)pConfig; (void)pContext; @@ -21393,7 +21393,7 @@ static ma_result ma_context_init__null(ma_context* pContext, const ma_context_co pCallbacks->onDeviceStop = ma_device_stop__null; pCallbacks->onDeviceRead = ma_device_read__null; pCallbacks->onDeviceWrite = ma_device_write__null; - pCallbacks->onDeviceDataLoop = NULL; /* Our backend is asynchronous with a blocking read-write API which means we can get miniaudio to deal with the audio thread. */ + pCallbacks->onDeviceDataLoop = nullptr; /* Our backend is asynchronous with a blocking read-write API which means we can get miniaudio to deal with the audio thread. */ /* The null backend always works. */ return MA_SUCCESS; @@ -21637,7 +21637,7 @@ static MA_INLINE ma_bool32 ma_is_guid_null(const void* guid) static ma_format ma_format_from_WAVEFORMATEX(const MA_WAVEFORMATEX* pWF) { - MA_ASSERT(pWF != NULL); + MA_ASSERT(pWF != nullptr); if (pWF->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { const MA_WAVEFORMATEXTENSIBLE* pWFEX = (const MA_WAVEFORMATEXTENSIBLE*)pWF; @@ -22262,7 +22262,7 @@ static HRESULT STDMETHODCALLTYPE ma_completion_handler_uwp_QueryInterface(ma_com "implement" this, we just make sure we return pThis when the IAgileObject is requested. */ if (!ma_is_guid_equal(riid, &MA_IID_IUnknown) && !ma_is_guid_equal(riid, &MA_IID_IActivateAudioInterfaceCompletionHandler) && !ma_is_guid_equal(riid, &MA_IID_IAgileObject)) { - *ppObject = NULL; + *ppObject = nullptr; return E_NOINTERFACE; } @@ -22304,13 +22304,13 @@ static ma_completion_handler_uwp_vtbl g_maCompletionHandlerVtblInstance = { static ma_result ma_completion_handler_uwp_init(ma_completion_handler_uwp* pHandler) { - MA_ASSERT(pHandler != NULL); + MA_ASSERT(pHandler != nullptr); MA_ZERO_OBJECT(pHandler); pHandler->lpVtbl = &g_maCompletionHandlerVtblInstance; pHandler->counter = 1; - pHandler->hEvent = CreateEventA(NULL, FALSE, FALSE, NULL); - if (pHandler->hEvent == NULL) { + pHandler->hEvent = CreateEventA(nullptr, FALSE, FALSE, nullptr); + if (pHandler->hEvent == nullptr) { return ma_result_from_GetLastError(GetLastError()); } @@ -22319,7 +22319,7 @@ static ma_result ma_completion_handler_uwp_init(ma_completion_handler_uwp* pHand static void ma_completion_handler_uwp_uninit(ma_completion_handler_uwp* pHandler) { - if (pHandler->hEvent != NULL) { + if (pHandler->hEvent != nullptr) { CloseHandle(pHandler->hEvent); } } @@ -22339,7 +22339,7 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_QueryInterface(ma_IMMN we just return E_NOINTERFACE. Otherwise we need to increment the reference counter and return S_OK. */ if (!ma_is_guid_equal(riid, &MA_IID_IUnknown) && !ma_is_guid_equal(riid, &MA_IID_IMMNotificationClient)) { - *ppObject = NULL; + *ppObject = nullptr; return E_NOINTERFACE; } @@ -22371,7 +22371,7 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDeviceStateChanged(m ma_bool32 isPlayback = MA_FALSE; #ifdef MA_DEBUG_OUTPUT - /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnDeviceStateChanged(pDeviceID=%S, dwNewState=%u)\n", (pDeviceID != NULL) ? pDeviceID : L"(NULL)", (unsigned int)dwNewState);*/ + /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnDeviceStateChanged(pDeviceID=%S, dwNewState=%u)\n", (pDeviceID != nullptr) ? pDeviceID : L"(nullptr)", (unsigned int)dwNewState);*/ #endif /* @@ -22451,7 +22451,7 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDeviceStateChanged(m static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDeviceAdded(ma_IMMNotificationClient* pThis, const WCHAR* pDeviceID) { #ifdef MA_DEBUG_OUTPUT - /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnDeviceAdded(pDeviceID=%S)\n", (pDeviceID != NULL) ? pDeviceID : L"(NULL)");*/ + /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnDeviceAdded(pDeviceID=%S)\n", (pDeviceID != nullptr) ? pDeviceID : L"(nullptr)");*/ #endif /* We don't need to worry about this event for our purposes. */ @@ -22463,7 +22463,7 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDeviceAdded(ma_IMMNo static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDeviceRemoved(ma_IMMNotificationClient* pThis, const WCHAR* pDeviceID) { #ifdef MA_DEBUG_OUTPUT - /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnDeviceRemoved(pDeviceID=%S)\n", (pDeviceID != NULL) ? pDeviceID : L"(NULL)");*/ + /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnDeviceRemoved(pDeviceID=%S)\n", (pDeviceID != nullptr) ? pDeviceID : L"(nullptr)");*/ #endif /* We don't need to worry about this event for our purposes. */ @@ -22475,7 +22475,7 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDeviceRemoved(ma_IMM static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDefaultDeviceChanged(ma_IMMNotificationClient* pThis, ma_EDataFlow dataFlow, ma_ERole role, const WCHAR* pDefaultDeviceID) { #ifdef MA_DEBUG_OUTPUT - /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnDefaultDeviceChanged(dataFlow=%d, role=%d, pDefaultDeviceID=%S)\n", dataFlow, role, (pDefaultDeviceID != NULL) ? pDefaultDeviceID : L"(NULL)");*/ + /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnDefaultDeviceChanged(dataFlow=%d, role=%d, pDefaultDeviceID=%S)\n", dataFlow, role, (pDefaultDeviceID != nullptr) ? pDefaultDeviceID : L"(nullptr)");*/ #endif (void)role; @@ -22532,7 +22532,7 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDefaultDeviceChanged restartDevice = MA_TRUE; } - if (pDefaultDeviceID != NULL) { /* <-- The input device ID will be null if there's no other device available. */ + if (pDefaultDeviceID != nullptr) { /* <-- The input device ID will be null if there's no other device available. */ ma_mutex_lock(&pThis->pDevice->wasapi.rerouteLock); { if (dataFlow == ma_eRender) { @@ -22578,7 +22578,7 @@ static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnDefaultDeviceChanged static HRESULT STDMETHODCALLTYPE ma_IMMNotificationClient_OnPropertyValueChanged(ma_IMMNotificationClient* pThis, const WCHAR* pDeviceID, const PROPERTYKEY key) { #ifdef MA_DEBUG_OUTPUT - /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnPropertyValueChanged(pDeviceID=%S)\n", (pDeviceID != NULL) ? pDeviceID : L"(NULL)");*/ + /*ma_log_postf(ma_device_get_log(pThis->pDevice), MA_LOG_LEVEL_DEBUG, "IMMNotificationClient_OnPropertyValueChanged(pDeviceID=%S)\n", (pDeviceID != nullptr) ? pDeviceID : L"(nullptr)");*/ #endif (void)pThis; @@ -22603,13 +22603,13 @@ static const char* ma_to_usage_string__wasapi(ma_wasapi_usage usage) { switch (usage) { - case ma_wasapi_usage_default: return NULL; + case ma_wasapi_usage_default: return nullptr; case ma_wasapi_usage_games: return "Games"; case ma_wasapi_usage_pro_audio: return "Pro Audio"; default: break; } - return NULL; + return nullptr; } #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) @@ -22640,10 +22640,10 @@ static ma_result ma_context_post_command__wasapi(ma_context* pContext, const ma_ ma_bool32 isUsingLocalEvent = MA_FALSE; ma_event localEvent; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pCmd != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pCmd != nullptr); - if (pCmd->pEvent == NULL) { + if (pCmd->pEvent == nullptr) { isUsingLocalEvent = MA_TRUE; result = ma_event_init(&localEvent); @@ -22685,8 +22685,8 @@ static ma_result ma_context_next_command__wasapi(ma_context* pContext, ma_contex { ma_result result = MA_SUCCESS; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pCmd != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pCmd != nullptr); result = ma_semaphore_wait(&pContext->wasapi.commandSem); if (result == MA_SUCCESS) { @@ -22706,7 +22706,7 @@ static ma_thread_result MA_THREADCALL ma_context_command_thread__wasapi(void* pU { ma_result result; ma_context* pContext = (ma_context*)pUserData; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); for (;;) { ma_context_command__wasapi cmd; @@ -22734,16 +22734,16 @@ static ma_thread_result MA_THREADCALL ma_context_command_thread__wasapi(void* pU case MA_CONTEXT_COMMAND_RELEASE_IAUDIOCLIENT__WASAPI: { if (cmd.data.releaseAudioClient.deviceType == ma_device_type_playback) { - if (cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientPlayback != NULL) { + if (cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientPlayback != nullptr) { ma_IAudioClient_Release((ma_IAudioClient*)cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientPlayback); - cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientPlayback = NULL; + cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientPlayback = nullptr; } } if (cmd.data.releaseAudioClient.deviceType == ma_device_type_capture) { - if (cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientCapture != NULL) { + if (cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientCapture != nullptr) { ma_IAudioClient_Release((ma_IAudioClient*)cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientCapture); - cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientCapture = NULL; + cmd.data.releaseAudioClient.pDevice->wasapi.pAudioClientCapture = nullptr; } } } break; @@ -22755,7 +22755,7 @@ static ma_thread_result MA_THREADCALL ma_context_command_thread__wasapi(void* pU } break; } - if (cmd.pEvent != NULL) { + if (cmd.pEvent != nullptr) { ma_event_signal(cmd.pEvent); } @@ -22805,8 +22805,8 @@ static ma_result ma_device_release_IAudioClient_service__wasapi(ma_device* pDevi static void ma_add_native_data_format_to_device_info_from_WAVEFORMATEX(const MA_WAVEFORMATEX* pWF, ma_share_mode shareMode, ma_device_info* pInfo) { - MA_ASSERT(pWF != NULL); - MA_ASSERT(pInfo != NULL); + MA_ASSERT(pWF != nullptr); + MA_ASSERT(pInfo != nullptr); if (pInfo->nativeDataFormatCount >= ma_countof(pInfo->nativeDataFormats)) { return; /* Too many data formats. Need to ignore this one. Don't think this should ever happen with WASAPI. */ @@ -22822,10 +22822,10 @@ static void ma_add_native_data_format_to_device_info_from_WAVEFORMATEX(const MA_ static ma_result ma_context_get_device_info_from_IAudioClient__wasapi(ma_context* pContext, /*ma_IMMDevice**/void* pMMDevice, ma_IAudioClient* pAudioClient, ma_device_info* pInfo) { HRESULT hr; - MA_WAVEFORMATEX* pWF = NULL; + MA_WAVEFORMATEX* pWF = nullptr; - MA_ASSERT(pAudioClient != NULL); - MA_ASSERT(pInfo != NULL); + MA_ASSERT(pAudioClient != nullptr); + MA_ASSERT(pInfo != nullptr); /* Shared Mode. We use GetMixFormat() here. */ hr = ma_IAudioClient_GetMixFormat((ma_IAudioClient*)pAudioClient, (MA_WAVEFORMATEX**)&pWF); @@ -22862,7 +22862,7 @@ static ma_result ma_context_get_device_info_from_IAudioClient__wasapi(ma_context In my testing, the format returned by PKEY_AudioEngine_DeviceFormat is suitable for exclusive mode so we check this format first. If this fails, fall back to a search. */ - hr = ma_IAudioClient_IsFormatSupported((ma_IAudioClient*)pAudioClient, MA_AUDCLNT_SHAREMODE_EXCLUSIVE, pWF, NULL); + hr = ma_IAudioClient_IsFormatSupported((ma_IAudioClient*)pAudioClient, MA_AUDCLNT_SHAREMODE_EXCLUSIVE, pWF, nullptr); if (SUCCEEDED(hr)) { /* The format returned by PKEY_AudioEngine_DeviceFormat is supported. */ ma_add_native_data_format_to_device_info_from_WAVEFORMATEX(pWF, ma_share_mode_exclusive, pInfo); @@ -22908,7 +22908,7 @@ static ma_result ma_context_get_device_info_from_IAudioClient__wasapi(ma_context for (iSampleRate = 0; iSampleRate < ma_countof(g_maStandardSampleRatePriorities); ++iSampleRate) { wf.nSamplesPerSec = g_maStandardSampleRatePriorities[iSampleRate]; - hr = ma_IAudioClient_IsFormatSupported((ma_IAudioClient*)pAudioClient, MA_AUDCLNT_SHAREMODE_EXCLUSIVE, (MA_WAVEFORMATEX*)&wf, NULL); + hr = ma_IAudioClient_IsFormatSupported((ma_IAudioClient*)pAudioClient, MA_AUDCLNT_SHAREMODE_EXCLUSIVE, (MA_WAVEFORMATEX*)&wf, nullptr); if (SUCCEEDED(hr)) { ma_add_native_data_format_to_device_info_from_WAVEFORMATEX((MA_WAVEFORMATEX*)&wf, ma_share_mode_exclusive, pInfo); found = MA_TRUE; @@ -22963,12 +22963,12 @@ static ma_result ma_context_create_IMMDeviceEnumerator__wasapi(ma_context* pCont HRESULT hr; ma_IMMDeviceEnumerator* pDeviceEnumerator; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppDeviceEnumerator != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppDeviceEnumerator != nullptr); - *ppDeviceEnumerator = NULL; /* Safety. */ + *ppDeviceEnumerator = nullptr; /* Safety. */ - hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); + hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); if (FAILED(hr)) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create device enumerator."); return ma_result_from_HRESULT(hr); @@ -22982,13 +22982,13 @@ static ma_result ma_context_create_IMMDeviceEnumerator__wasapi(ma_context* pCont static WCHAR* ma_context_get_default_device_id_from_IMMDeviceEnumerator__wasapi(ma_context* pContext, ma_IMMDeviceEnumerator* pDeviceEnumerator, ma_device_type deviceType) { HRESULT hr; - ma_IMMDevice* pMMDefaultDevice = NULL; - WCHAR* pDefaultDeviceID = NULL; + ma_IMMDevice* pMMDefaultDevice = nullptr; + WCHAR* pDefaultDeviceID = nullptr; ma_EDataFlow dataFlow; ma_ERole role; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pDeviceEnumerator != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pDeviceEnumerator != nullptr); (void)pContext; @@ -23000,16 +23000,16 @@ static WCHAR* ma_context_get_default_device_id_from_IMMDeviceEnumerator__wasapi( hr = ma_IMMDeviceEnumerator_GetDefaultAudioEndpoint(pDeviceEnumerator, dataFlow, role, &pMMDefaultDevice); if (FAILED(hr)) { - return NULL; + return nullptr; } hr = ma_IMMDevice_GetId(pMMDefaultDevice, &pDefaultDeviceID); ma_IMMDevice_Release(pMMDefaultDevice); - pMMDefaultDevice = NULL; + pMMDefaultDevice = nullptr; if (FAILED(hr)) { - return NULL; + return nullptr; } return pDefaultDeviceID; @@ -23019,13 +23019,13 @@ static WCHAR* ma_context_get_default_device_id__wasapi(ma_context* pContext, ma_ { ma_result result; ma_IMMDeviceEnumerator* pDeviceEnumerator; - WCHAR* pDefaultDeviceID = NULL; + WCHAR* pDefaultDeviceID = nullptr; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); result = ma_context_create_IMMDeviceEnumerator__wasapi(pContext, &pDeviceEnumerator); if (result != MA_SUCCESS) { - return NULL; + return nullptr; } pDefaultDeviceID = ma_context_get_default_device_id_from_IMMDeviceEnumerator__wasapi(pContext, pDeviceEnumerator, deviceType); @@ -23040,8 +23040,8 @@ static ma_result ma_context_get_MMDevice__wasapi(ma_context* pContext, ma_device HRESULT hr; HRESULT CoInitializeResult; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppMMDevice != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppMMDevice != nullptr); /* This weird COM init/uninit here is a hack to work around a crash when changing devices. What is happening is @@ -23058,9 +23058,9 @@ static ma_result ma_context_get_MMDevice__wasapi(ma_context* pContext, ma_device called with a different COINIT value, and we don't call CoUninitialize in that case. Other errors are possible, so we check for S_OK and S_FALSE specifically. */ - CoInitializeResult = ma_CoInitializeEx(pContext, NULL, MA_COINIT_VALUE); + CoInitializeResult = ma_CoInitializeEx(pContext, nullptr, MA_COINIT_VALUE); { - hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); + hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); } if (CoInitializeResult == S_OK || CoInitializeResult == S_FALSE) { ma_CoUninitialize(pContext); } @@ -23069,7 +23069,7 @@ static ma_result ma_context_get_MMDevice__wasapi(ma_context* pContext, ma_device return ma_result_from_HRESULT(hr); } - if (pDeviceID == NULL) { + if (pDeviceID == nullptr) { hr = ma_IMMDeviceEnumerator_GetDefaultAudioEndpoint(pDeviceEnumerator, (deviceType == ma_device_type_capture) ? ma_eCapture : ma_eRender, ma_eConsole, ppMMDevice); } else { hr = ma_IMMDeviceEnumerator_GetDevice(pDeviceEnumerator, pDeviceID->wasapi, ppMMDevice); @@ -23089,7 +23089,7 @@ static ma_result ma_context_get_device_id_from_MMDevice__wasapi(ma_context* pCon WCHAR* pDeviceIDString; HRESULT hr; - MA_ASSERT(pDeviceID != NULL); + MA_ASSERT(pDeviceID != nullptr); hr = ma_IMMDevice_GetId(pMMDevice, &pDeviceIDString); if (SUCCEEDED(hr)) { @@ -23116,14 +23116,14 @@ static ma_result ma_context_get_device_info_from_MMDevice__wasapi(ma_context* pC ma_result result; HRESULT hr; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pMMDevice != NULL); - MA_ASSERT(pInfo != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pMMDevice != nullptr); + MA_ASSERT(pInfo != nullptr); /* ID. */ result = ma_context_get_device_id_from_MMDevice__wasapi(pContext, pMMDevice, &pInfo->id); if (result == MA_SUCCESS) { - if (pDefaultDeviceID != NULL) { + if (pDefaultDeviceID != nullptr) { if (ma_strcmp_WCHAR(pInfo->id.wasapi, pDefaultDeviceID) == 0) { pInfo->isDefault = MA_TRUE; } @@ -23151,7 +23151,7 @@ static ma_result ma_context_get_device_info_from_MMDevice__wasapi(ma_context* pC /* Format */ if (!onlySimpleInfo) { ma_IAudioClient* pAudioClient; - hr = ma_IMMDevice_Activate(pMMDevice, &MA_IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pAudioClient); + hr = ma_IMMDevice_Activate(pMMDevice, &MA_IID_IAudioClient, CLSCTX_ALL, nullptr, (void**)&pAudioClient); if (SUCCEEDED(hr)) { result = ma_context_get_device_info_from_IAudioClient__wasapi(pContext, pMMDevice, pAudioClient, pInfo); @@ -23172,11 +23172,11 @@ static ma_result ma_context_enumerate_devices_by_type__wasapi(ma_context* pConte UINT deviceCount; HRESULT hr; ma_uint32 iDevice; - WCHAR* pDefaultDeviceID = NULL; - ma_IMMDeviceCollection* pDeviceCollection = NULL; + WCHAR* pDefaultDeviceID = nullptr; + ma_IMMDeviceCollection* pDeviceCollection = nullptr; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); /* Grab the default device. We use this to know whether or not flag the returned device info as being the default. */ pDefaultDeviceID = ma_context_get_default_device_id_from_IMMDeviceEnumerator__wasapi(pContext, pDeviceEnumerator, deviceType); @@ -23213,14 +23213,14 @@ static ma_result ma_context_enumerate_devices_by_type__wasapi(ma_context* pConte } done: - if (pDefaultDeviceID != NULL) { + if (pDefaultDeviceID != nullptr) { ma_CoTaskMemFree(pContext, pDefaultDeviceID); - pDefaultDeviceID = NULL; + pDefaultDeviceID = nullptr; } - if (pDeviceCollection != NULL) { + if (pDeviceCollection != nullptr) { ma_IMMDeviceCollection_Release(pDeviceCollection); - pDeviceCollection = NULL; + pDeviceCollection = nullptr; } return result; @@ -23231,9 +23231,9 @@ static ma_result ma_context_get_IAudioClient_Desktop__wasapi(ma_context* pContex ma_result result; HRESULT hr; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppAudioClient != NULL); - MA_ASSERT(ppMMDevice != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppAudioClient != nullptr); + MA_ASSERT(ppMMDevice != nullptr); result = ma_context_get_MMDevice__wasapi(pContext, deviceType, pDeviceID, ppMMDevice); if (result != MA_SUCCESS) { @@ -23250,7 +23250,7 @@ static ma_result ma_context_get_IAudioClient_Desktop__wasapi(ma_context* pContex #else static ma_result ma_context_get_IAudioClient_UWP__wasapi(ma_context* pContext, ma_device_type deviceType, const ma_device_id* pDeviceID, MA_PROPVARIANT* pActivationParams, ma_IAudioClient** ppAudioClient, ma_IUnknown** ppActivatedInterface) { - ma_IActivateAudioInterfaceAsyncOperation *pAsyncOp = NULL; + ma_IActivateAudioInterfaceAsyncOperation *pAsyncOp = nullptr; ma_completion_handler_uwp completionHandler; IID iid; WCHAR* iidStr; @@ -23259,10 +23259,10 @@ static ma_result ma_context_get_IAudioClient_UWP__wasapi(ma_context* pContext, m HRESULT activateResult; ma_IUnknown* pActivatedInterface; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppAudioClient != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppAudioClient != nullptr); - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { iidStr = (WCHAR*)pDeviceID->wasapi; } else { if (deviceType == ma_device_type_capture) { @@ -23297,7 +23297,7 @@ static ma_result ma_context_get_IAudioClient_UWP__wasapi(ma_context* pContext, m return ma_result_from_HRESULT(hr); } - if (pDeviceID == NULL) { + if (pDeviceID == nullptr) { ma_CoTaskMemFree(pContext, iidStr); } @@ -23385,11 +23385,11 @@ static ma_result ma_context_get_IAudioClient__wasapi(ma_context* pContext, ma_de ma_bool32 usingProcessLoopback = MA_FALSE; MA_AUDIOCLIENT_ACTIVATION_PARAMS audioclientActivationParams; MA_PROPVARIANT activationParams; - MA_PROPVARIANT* pActivationParams = NULL; + MA_PROPVARIANT* pActivationParams = nullptr; ma_device_id virtualDeviceID; /* Activation parameters specific to loopback mode. Note that process-specific loopback will only work when a default device ID is specified. */ - if (deviceType == ma_device_type_loopback && loopbackProcessID != 0 && pDeviceID == NULL) { + if (deviceType == ma_device_type_loopback && loopbackProcessID != 0 && pDeviceID == nullptr) { usingProcessLoopback = MA_TRUE; } @@ -23409,7 +23409,7 @@ static ma_result ma_context_get_IAudioClient__wasapi(ma_context* pContext, ma_de MA_COPY_MEMORY(virtualDeviceID.wasapi, MA_VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK, (ma_wcslen(MA_VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK) + 1) * sizeof(wchar_t)); /* +1 for the null terminator. */ pDeviceID = &virtualDeviceID; } else { - pActivationParams = NULL; /* No activation parameters required. */ + pActivationParams = nullptr; /* No activation parameters required. */ } #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) @@ -23441,7 +23441,7 @@ static ma_result ma_context_enumerate_devices__wasapi(ma_context* pContext, ma_e HRESULT hr; ma_IMMDeviceEnumerator* pDeviceEnumerator; - hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); + hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); if (FAILED(hr)) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create device enumerator."); return ma_result_from_HRESULT(hr); @@ -23490,8 +23490,8 @@ static ma_result ma_context_get_device_info__wasapi(ma_context* pContext, ma_dev { #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) ma_result result; - ma_IMMDevice* pMMDevice = NULL; - WCHAR* pDefaultDeviceID = NULL; + ma_IMMDevice* pMMDevice = nullptr; + WCHAR* pDefaultDeviceID = nullptr; result = ma_context_get_MMDevice__wasapi(pContext, deviceType, pDeviceID, &pMMDevice); if (result != MA_SUCCESS) { @@ -23503,9 +23503,9 @@ static ma_result ma_context_get_device_info__wasapi(ma_context* pContext, ma_dev result = ma_context_get_device_info_from_MMDevice__wasapi(pContext, pMMDevice, pDefaultDeviceID, MA_FALSE, pDeviceInfo); /* MA_FALSE = !onlySimpleInfo. */ - if (pDefaultDeviceID != NULL) { + if (pDefaultDeviceID != nullptr) { ma_CoTaskMemFree(pContext, pDefaultDeviceID); - pDefaultDeviceID = NULL; + pDefaultDeviceID = nullptr; } ma_IMMDevice_Release(pMMDevice); @@ -23522,12 +23522,12 @@ static ma_result ma_context_get_device_info__wasapi(ma_context* pContext, ma_dev ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), MA_DEFAULT_CAPTURE_DEVICE_NAME, (size_t)-1); } - result = ma_context_get_IAudioClient_UWP__wasapi(pContext, deviceType, pDeviceID, NULL, &pAudioClient, NULL); + result = ma_context_get_IAudioClient_UWP__wasapi(pContext, deviceType, pDeviceID, nullptr, &pAudioClient, nullptr); if (result != MA_SUCCESS) { return result; } - result = ma_context_get_device_info_from_IAudioClient__wasapi(pContext, NULL, pAudioClient, pDeviceInfo); + result = ma_context_get_device_info_from_IAudioClient__wasapi(pContext, nullptr, pAudioClient, pDeviceInfo); pDeviceInfo->isDefault = MA_TRUE; /* UWP only supports default devices. */ @@ -23538,7 +23538,7 @@ static ma_result ma_context_get_device_info__wasapi(ma_context* pContext, ma_dev static ma_result ma_device_uninit__wasapi(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) { @@ -23552,9 +23552,9 @@ static ma_result ma_device_uninit__wasapi(ma_device* pDevice) #endif if (pDevice->wasapi.pRenderClient) { - if (pDevice->wasapi.pMappedBufferPlayback != NULL) { + if (pDevice->wasapi.pMappedBufferPlayback != nullptr) { ma_IAudioRenderClient_ReleaseBuffer((ma_IAudioRenderClient*)pDevice->wasapi.pRenderClient, pDevice->wasapi.mappedBufferPlaybackCap, 0); - pDevice->wasapi.pMappedBufferPlayback = NULL; + pDevice->wasapi.pMappedBufferPlayback = nullptr; pDevice->wasapi.mappedBufferPlaybackCap = 0; pDevice->wasapi.mappedBufferPlaybackLen = 0; } @@ -23562,9 +23562,9 @@ static ma_result ma_device_uninit__wasapi(ma_device* pDevice) ma_IAudioRenderClient_Release((ma_IAudioRenderClient*)pDevice->wasapi.pRenderClient); } if (pDevice->wasapi.pCaptureClient) { - if (pDevice->wasapi.pMappedBufferCapture != NULL) { + if (pDevice->wasapi.pMappedBufferCapture != nullptr) { ma_IAudioCaptureClient_ReleaseBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, pDevice->wasapi.mappedBufferCaptureCap); - pDevice->wasapi.pMappedBufferCapture = NULL; + pDevice->wasapi.pMappedBufferCapture = nullptr; pDevice->wasapi.mappedBufferCaptureCap = 0; pDevice->wasapi.mappedBufferCaptureLen = 0; } @@ -23633,24 +23633,24 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device MA_REFERENCE_TIME periodDurationInMicroseconds; ma_bool32 wasInitializedUsingIAudioClient3 = MA_FALSE; MA_WAVEFORMATEXTENSIBLE wf; - ma_WASAPIDeviceInterface* pDeviceInterface = NULL; + ma_WASAPIDeviceInterface* pDeviceInterface = nullptr; ma_IAudioClient2* pAudioClient2; ma_uint32 nativeSampleRate; ma_bool32 usingProcessLoopback = MA_FALSE; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pData != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pData != nullptr); /* This function is only used to initialize one device type: either playback, capture or loopback. Never full-duplex. */ if (deviceType == ma_device_type_duplex) { return MA_INVALID_ARGS; } - usingProcessLoopback = deviceType == ma_device_type_loopback && pData->loopbackProcessID != 0 && pDeviceID == NULL; + usingProcessLoopback = deviceType == ma_device_type_loopback && pData->loopbackProcessID != 0 && pDeviceID == nullptr; - pData->pAudioClient = NULL; - pData->pRenderClient = NULL; - pData->pCaptureClient = NULL; + pData->pAudioClient = nullptr; + pData->pRenderClient = nullptr; + pData->pCaptureClient = nullptr; streamFlags = MA_AUDCLNT_STREAMFLAGS_EVENTCALLBACK; if (!pData->noAutoConvertSRC && pData->sampleRateIn != 0 && pData->shareMode != ma_share_mode_exclusive) { /* <-- Exclusive streams must use the native sample rate. */ @@ -23694,7 +23694,7 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device if (pData->shareMode == ma_share_mode_exclusive) { #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) /* In exclusive mode on desktop we always use the backend's native format. */ - ma_IPropertyStore* pStore = NULL; + ma_IPropertyStore* pStore = nullptr; hr = ma_IMMDevice_OpenPropertyStore(pDeviceInterface, STGM_READ, &pStore); if (SUCCEEDED(hr)) { MA_PROPVARIANT prop; @@ -23702,7 +23702,7 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device hr = ma_IPropertyStore_GetValue(pStore, &MA_PKEY_AudioEngine_DeviceFormat, &prop); if (SUCCEEDED(hr)) { MA_WAVEFORMATEX* pActualFormat = (MA_WAVEFORMATEX*)prop.blob.pBlobData; - hr = ma_IAudioClient_IsFormatSupported((ma_IAudioClient*)pData->pAudioClient, MA_AUDCLNT_SHAREMODE_EXCLUSIVE, pActualFormat, NULL); + hr = ma_IAudioClient_IsFormatSupported((ma_IAudioClient*)pData->pAudioClient, MA_AUDCLNT_SHAREMODE_EXCLUSIVE, pActualFormat, nullptr); if (SUCCEEDED(hr)) { MA_COPY_MEMORY(&wf, pActualFormat, sizeof(MA_WAVEFORMATEXTENSIBLE)); } @@ -23731,7 +23731,7 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device } } else { /* In shared mode we are always using the format reported by the operating system. */ - MA_WAVEFORMATEXTENSIBLE* pNativeFormat = NULL; + MA_WAVEFORMATEXTENSIBLE* pNativeFormat = nullptr; hr = ma_IAudioClient_GetMixFormat((ma_IAudioClient*)pData->pAudioClient, (MA_WAVEFORMATEX**)&pNativeFormat); if (hr != S_OK) { /* When using process-specific loopback, GetMixFormat() seems to always fail. */ @@ -23855,7 +23855,7 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device */ hr = E_FAIL; for (;;) { - hr = ma_IAudioClient_Initialize((ma_IAudioClient*)pData->pAudioClient, shareMode, streamFlags, bufferDuration, bufferDuration, (MA_WAVEFORMATEX*)&wf, NULL); + hr = ma_IAudioClient_Initialize((ma_IAudioClient*)pData->pAudioClient, shareMode, streamFlags, bufferDuration, bufferDuration, (MA_WAVEFORMATEX*)&wf, nullptr); if (hr == MA_AUDCLNT_E_INVALID_DEVICE_PERIOD) { if (bufferDuration > 500*10000) { break; @@ -23882,13 +23882,13 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device ma_IAudioClient_Release((ma_IAudioClient*)pData->pAudioClient); #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) - hr = ma_IMMDevice_Activate(pDeviceInterface, &MA_IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pData->pAudioClient); + hr = ma_IMMDevice_Activate(pDeviceInterface, &MA_IID_IAudioClient, CLSCTX_ALL, nullptr, (void**)&pData->pAudioClient); #else hr = ma_IUnknown_QueryInterface(pDeviceInterface, &MA_IID_IAudioClient, (void**)&pData->pAudioClient); #endif if (SUCCEEDED(hr)) { - hr = ma_IAudioClient_Initialize((ma_IAudioClient*)pData->pAudioClient, shareMode, streamFlags, bufferDuration, bufferDuration, (MA_WAVEFORMATEX*)&wf, NULL); + hr = ma_IAudioClient_Initialize((ma_IAudioClient*)pData->pAudioClient, shareMode, streamFlags, bufferDuration, bufferDuration, (MA_WAVEFORMATEX*)&wf, nullptr); } } } @@ -23920,7 +23920,7 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device #ifndef MA_WASAPI_NO_LOW_LATENCY_SHARED_MODE { if ((streamFlags & MA_AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM) == 0 || nativeSampleRate == wf.nSamplesPerSec) { - ma_IAudioClient3* pAudioClient3 = NULL; + ma_IAudioClient3* pAudioClient3 = nullptr; hr = ma_IAudioClient_QueryInterface(pData->pAudioClient, &MA_IID_IAudioClient3, (void**)&pAudioClient3); if (SUCCEEDED(hr)) { ma_uint32 defaultPeriodInFrames; @@ -23951,7 +23951,7 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device MA_AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | MA_AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY must not be in the stream flags. If either of these are specified, IAudioClient3_InitializeSharedAudioStream() will fail. */ - hr = ma_IAudioClient3_InitializeSharedAudioStream(pAudioClient3, streamFlags & ~(MA_AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | MA_AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY), actualPeriodInFrames, (MA_WAVEFORMATEX*)&wf, NULL); + hr = ma_IAudioClient3_InitializeSharedAudioStream(pAudioClient3, streamFlags & ~(MA_AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | MA_AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY), actualPeriodInFrames, (MA_WAVEFORMATEX*)&wf, nullptr); if (SUCCEEDED(hr)) { wasInitializedUsingIAudioClient3 = MA_TRUE; pData->periodSizeInFramesOut = actualPeriodInFrames; @@ -23969,7 +23969,7 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device } ma_IAudioClient3_Release(pAudioClient3); - pAudioClient3 = NULL; + pAudioClient3 = nullptr; } } } @@ -23982,7 +23982,7 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device /* If we don't have an IAudioClient3 then we need to use the normal initialization routine. */ if (!wasInitializedUsingIAudioClient3) { MA_REFERENCE_TIME bufferDuration = periodDurationInMicroseconds * pData->periodsOut * 10; /* <-- Multiply by 10 for microseconds to 100-nanoseconds. */ - hr = ma_IAudioClient_Initialize((ma_IAudioClient*)pData->pAudioClient, shareMode, streamFlags, bufferDuration, 0, (const MA_WAVEFORMATEX*)&wf, NULL); + hr = ma_IAudioClient_Initialize((ma_IAudioClient*)pData->pAudioClient, shareMode, streamFlags, bufferDuration, 0, (const MA_WAVEFORMATEX*)&wf, nullptr); if (FAILED(hr)) { if (hr == E_ACCESSDENIED) { errorMsg = "[WASAPI] Failed to initialize device. Access denied.", result = MA_ACCESS_DENIED; @@ -24072,11 +24072,11 @@ static ma_result ma_device_init_internal__wasapi(ma_context* pContext, ma_device done: /* Clean up. */ #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) - if (pDeviceInterface != NULL) { + if (pDeviceInterface != nullptr) { ma_IMMDevice_Release(pDeviceInterface); } #else - if (pDeviceInterface != NULL) { + if (pDeviceInterface != nullptr) { ma_IUnknown_Release(pDeviceInterface); } #endif @@ -24084,18 +24084,18 @@ done: if (result != MA_SUCCESS) { if (pData->pRenderClient) { ma_IAudioRenderClient_Release((ma_IAudioRenderClient*)pData->pRenderClient); - pData->pRenderClient = NULL; + pData->pRenderClient = nullptr; } if (pData->pCaptureClient) { ma_IAudioCaptureClient_Release((ma_IAudioCaptureClient*)pData->pCaptureClient); - pData->pCaptureClient = NULL; + pData->pCaptureClient = nullptr; } if (pData->pAudioClient) { ma_IAudioClient_Release((ma_IAudioClient*)pData->pAudioClient); - pData->pAudioClient = NULL; + pData->pAudioClient = nullptr; } - if (errorMsg != NULL && errorMsg[0] != '\0') { + if (errorMsg != nullptr && errorMsg[0] != '\0') { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "%s\n", errorMsg); } @@ -24110,7 +24110,7 @@ static ma_result ma_device_reinit__wasapi(ma_device* pDevice, ma_device_type dev ma_device_init_internal_data__wasapi data; ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* We only re-initialize the playback or capture device. Never a full-duplex device. */ if (deviceType == ma_device_type_duplex) { @@ -24131,24 +24131,24 @@ static ma_result ma_device_reinit__wasapi(ma_device* pDevice, ma_device_type dev if (deviceType == ma_device_type_capture || deviceType == ma_device_type_loopback) { if (pDevice->wasapi.pCaptureClient) { ma_IAudioCaptureClient_Release((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient); - pDevice->wasapi.pCaptureClient = NULL; + pDevice->wasapi.pCaptureClient = nullptr; } if (pDevice->wasapi.pAudioClientCapture) { /*ma_device_release_IAudioClient_service__wasapi(pDevice, ma_device_type_capture);*/ - pDevice->wasapi.pAudioClientCapture = NULL; + pDevice->wasapi.pAudioClientCapture = nullptr; } } if (deviceType == ma_device_type_playback) { if (pDevice->wasapi.pRenderClient) { ma_IAudioRenderClient_Release((ma_IAudioRenderClient*)pDevice->wasapi.pRenderClient); - pDevice->wasapi.pRenderClient = NULL; + pDevice->wasapi.pRenderClient = nullptr; } if (pDevice->wasapi.pAudioClientPlayback) { /*ma_device_release_IAudioClient_service__wasapi(pDevice, ma_device_type_playback);*/ - pDevice->wasapi.pAudioClientPlayback = NULL; + pDevice->wasapi.pAudioClientPlayback = nullptr; } } @@ -24175,7 +24175,7 @@ static ma_result ma_device_reinit__wasapi(ma_device* pDevice, ma_device_type dev data.noHardwareOffloading = pDevice->wasapi.noHardwareOffloading; data.loopbackProcessID = pDevice->wasapi.loopbackProcessID; data.loopbackProcessExclude = pDevice->wasapi.loopbackProcessExclude; - result = ma_device_init_internal__wasapi(pDevice->pContext, deviceType, NULL, &data); + result = ma_device_init_internal__wasapi(pDevice->pContext, deviceType, nullptr, &data); if (result != MA_SUCCESS) { return result; } @@ -24235,7 +24235,7 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf ma_IMMDeviceEnumerator* pDeviceEnumerator; #endif - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->wasapi); pDevice->wasapi.usage = pConfig->wasapi.usage; @@ -24283,17 +24283,17 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf The event for capture needs to be manual reset for the same reason as playback. We keep the initial state set to unsignaled, however, because we want to block until we actually have something for the first call to ma_device_read(). */ - pDevice->wasapi.hEventCapture = (ma_handle)CreateEventA(NULL, FALSE, FALSE, NULL); /* Auto reset, unsignaled by default. */ - if (pDevice->wasapi.hEventCapture == NULL) { + pDevice->wasapi.hEventCapture = (ma_handle)CreateEventA(nullptr, FALSE, FALSE, nullptr); /* Auto reset, unsignaled by default. */ + if (pDevice->wasapi.hEventCapture == nullptr) { result = ma_result_from_GetLastError(GetLastError()); - if (pDevice->wasapi.pCaptureClient != NULL) { + if (pDevice->wasapi.pCaptureClient != nullptr) { ma_IAudioCaptureClient_Release((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient); - pDevice->wasapi.pCaptureClient = NULL; + pDevice->wasapi.pCaptureClient = nullptr; } - if (pDevice->wasapi.pAudioClientCapture != NULL) { + if (pDevice->wasapi.pAudioClientCapture != nullptr) { ma_IAudioClient_Release((ma_IAudioClient*)pDevice->wasapi.pAudioClientCapture); - pDevice->wasapi.pAudioClientCapture = NULL; + pDevice->wasapi.pAudioClientCapture = nullptr; } ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create event for capture."); @@ -24336,17 +24336,17 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf result = ma_device_init_internal__wasapi(pDevice->pContext, ma_device_type_playback, pDescriptorPlayback->pDeviceID, &data); if (result != MA_SUCCESS) { if (pConfig->deviceType == ma_device_type_duplex) { - if (pDevice->wasapi.pCaptureClient != NULL) { + if (pDevice->wasapi.pCaptureClient != nullptr) { ma_IAudioCaptureClient_Release((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient); - pDevice->wasapi.pCaptureClient = NULL; + pDevice->wasapi.pCaptureClient = nullptr; } - if (pDevice->wasapi.pAudioClientCapture != NULL) { + if (pDevice->wasapi.pAudioClientCapture != nullptr) { ma_IAudioClient_Release((ma_IAudioClient*)pDevice->wasapi.pAudioClientCapture); - pDevice->wasapi.pAudioClientCapture = NULL; + pDevice->wasapi.pAudioClientCapture = nullptr; } CloseHandle((HANDLE)pDevice->wasapi.hEventCapture); - pDevice->wasapi.hEventCapture = NULL; + pDevice->wasapi.hEventCapture = nullptr; } return result; } @@ -24365,31 +24365,31 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf The playback event also needs to be initially set to a signaled state so that the first call to ma_device_write() is able to get passed WaitForMultipleObjects(). */ - pDevice->wasapi.hEventPlayback = (ma_handle)CreateEventA(NULL, FALSE, TRUE, NULL); /* Auto reset, signaled by default. */ - if (pDevice->wasapi.hEventPlayback == NULL) { + pDevice->wasapi.hEventPlayback = (ma_handle)CreateEventA(nullptr, FALSE, TRUE, nullptr); /* Auto reset, signaled by default. */ + if (pDevice->wasapi.hEventPlayback == nullptr) { result = ma_result_from_GetLastError(GetLastError()); if (pConfig->deviceType == ma_device_type_duplex) { - if (pDevice->wasapi.pCaptureClient != NULL) { + if (pDevice->wasapi.pCaptureClient != nullptr) { ma_IAudioCaptureClient_Release((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient); - pDevice->wasapi.pCaptureClient = NULL; + pDevice->wasapi.pCaptureClient = nullptr; } - if (pDevice->wasapi.pAudioClientCapture != NULL) { + if (pDevice->wasapi.pAudioClientCapture != nullptr) { ma_IAudioClient_Release((ma_IAudioClient*)pDevice->wasapi.pAudioClientCapture); - pDevice->wasapi.pAudioClientCapture = NULL; + pDevice->wasapi.pAudioClientCapture = nullptr; } CloseHandle((HANDLE)pDevice->wasapi.hEventCapture); - pDevice->wasapi.hEventCapture = NULL; + pDevice->wasapi.hEventCapture = nullptr; } - if (pDevice->wasapi.pRenderClient != NULL) { + if (pDevice->wasapi.pRenderClient != nullptr) { ma_IAudioRenderClient_Release((ma_IAudioRenderClient*)pDevice->wasapi.pRenderClient); - pDevice->wasapi.pRenderClient = NULL; + pDevice->wasapi.pRenderClient = nullptr; } - if (pDevice->wasapi.pAudioClientPlayback != NULL) { + if (pDevice->wasapi.pAudioClientPlayback != nullptr) { ma_IAudioClient_Release((ma_IAudioClient*)pDevice->wasapi.pAudioClientPlayback); - pDevice->wasapi.pAudioClientPlayback = NULL; + pDevice->wasapi.pAudioClientPlayback = nullptr; } ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create event for playback."); @@ -24419,17 +24419,17 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf */ #if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK) if (pConfig->wasapi.noAutoStreamRouting == MA_FALSE) { - if ((pConfig->deviceType == ma_device_type_capture || pConfig->deviceType == ma_device_type_duplex || pConfig->deviceType == ma_device_type_loopback) && pConfig->capture.pDeviceID == NULL) { + if ((pConfig->deviceType == ma_device_type_capture || pConfig->deviceType == ma_device_type_duplex || pConfig->deviceType == ma_device_type_loopback) && pConfig->capture.pDeviceID == nullptr) { pDevice->wasapi.allowCaptureAutoStreamRouting = MA_TRUE; } - if ((pConfig->deviceType == ma_device_type_playback || pConfig->deviceType == ma_device_type_duplex) && pConfig->playback.pDeviceID == NULL) { + if ((pConfig->deviceType == ma_device_type_playback || pConfig->deviceType == ma_device_type_duplex) && pConfig->playback.pDeviceID == nullptr) { pDevice->wasapi.allowPlaybackAutoStreamRouting = MA_TRUE; } } ma_mutex_init(&pDevice->wasapi.rerouteLock); - hr = ma_CoCreateInstance(pDevice->pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); + hr = ma_CoCreateInstance(pDevice->pContext, &MA_CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator); if (FAILED(hr)) { ma_device_uninit__wasapi(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create device enumerator."); @@ -24461,8 +24461,8 @@ static ma_result ma_device__get_available_frames__wasapi(ma_device* pDevice, ma_ HRESULT hr; ma_share_mode shareMode; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pFrameCount != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pFrameCount != nullptr); *pFrameCount = 0; @@ -24574,7 +24574,7 @@ static ma_result ma_device_start__wasapi(ma_device* pDevice) { ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Wait for any rerouting to finish before attempting to start the device. */ ma_mutex_lock(&pDevice->wasapi.rerouteLock); @@ -24591,18 +24591,18 @@ static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice) ma_result result; HRESULT hr; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->wasapi.hAvrtHandle) { ((MA_PFN_AvRevertMmThreadCharacteristics)pDevice->pContext->wasapi.AvRevertMmThreadcharacteristics)((HANDLE)pDevice->wasapi.hAvrtHandle); - pDevice->wasapi.hAvrtHandle = NULL; + pDevice->wasapi.hAvrtHandle = nullptr; } if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex || pDevice->type == ma_device_type_loopback) { /* If we have a mapped buffer we need to release it. */ - if (pDevice->wasapi.pMappedBufferCapture != NULL) { + if (pDevice->wasapi.pMappedBufferCapture != nullptr) { ma_IAudioCaptureClient_ReleaseBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, pDevice->wasapi.mappedBufferCaptureCap); - pDevice->wasapi.pMappedBufferCapture = NULL; + pDevice->wasapi.pMappedBufferCapture = nullptr; pDevice->wasapi.mappedBufferCaptureCap = 0; pDevice->wasapi.mappedBufferCaptureLen = 0; } @@ -24624,14 +24624,14 @@ static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice) } if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { - if (pDevice->wasapi.pMappedBufferPlayback != NULL) { + if (pDevice->wasapi.pMappedBufferPlayback != nullptr) { ma_silence_pcm_frames( ma_offset_pcm_frames_ptr(pDevice->wasapi.pMappedBufferPlayback, pDevice->wasapi.mappedBufferPlaybackLen, pDevice->playback.internalFormat, pDevice->playback.internalChannels), pDevice->wasapi.mappedBufferPlaybackCap - pDevice->wasapi.mappedBufferPlaybackLen, pDevice->playback.internalFormat, pDevice->playback.internalChannels ); ma_IAudioRenderClient_ReleaseBuffer((ma_IAudioRenderClient*)pDevice->wasapi.pRenderClient, pDevice->wasapi.mappedBufferPlaybackCap, 0); - pDevice->wasapi.pMappedBufferPlayback = NULL; + pDevice->wasapi.pMappedBufferPlayback = nullptr; pDevice->wasapi.mappedBufferPlaybackCap = 0; pDevice->wasapi.mappedBufferPlaybackLen = 0; } @@ -24705,7 +24705,7 @@ static ma_result ma_device_stop__wasapi(ma_device* pDevice) { ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Wait for any rerouting to finish before attempting to stop the device. */ ma_mutex_lock(&pDevice->wasapi.rerouteLock); @@ -24738,7 +24738,7 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui ma_uint32 framesRemaining = frameCount - totalFramesProcessed; /* If we have a mapped data buffer, consume that first. */ - if (pDevice->wasapi.pMappedBufferCapture != NULL) { + if (pDevice->wasapi.pMappedBufferCapture != nullptr) { /* We have a cached data pointer so consume that before grabbing another one from WASAPI. */ ma_uint32 framesToProcessNow = framesRemaining; if (framesToProcessNow > pDevice->wasapi.mappedBufferCaptureLen) { @@ -24759,7 +24759,7 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui /* If the data buffer has been fully consumed we need to release it. */ if (pDevice->wasapi.mappedBufferCaptureLen == 0) { ma_IAudioCaptureClient_ReleaseBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, pDevice->wasapi.mappedBufferCaptureCap); - pDevice->wasapi.pMappedBufferCapture = NULL; + pDevice->wasapi.pMappedBufferCapture = nullptr; pDevice->wasapi.mappedBufferCaptureCap = 0; } } else { @@ -24768,7 +24768,7 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui DWORD flags = 0; /* First just ask WASAPI for a data buffer. If it's not available, we'll wait for more. */ - hr = ma_IAudioCaptureClient_GetBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, (BYTE**)&pDevice->wasapi.pMappedBufferCapture, &pDevice->wasapi.mappedBufferCaptureCap, &flags, NULL, NULL); + hr = ma_IAudioCaptureClient_GetBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, (BYTE**)&pDevice->wasapi.pMappedBufferCapture, &pDevice->wasapi.mappedBufferCaptureCap, &flags, nullptr, nullptr); if (hr == S_OK) { /* We got a data buffer. Continue to the next loop iteration which will then read from the mapped pointer. */ pDevice->wasapi.mappedBufferCaptureLen = pDevice->wasapi.mappedBufferCaptureCap; @@ -24828,14 +24828,14 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui } flags = 0; - hr = ma_IAudioCaptureClient_GetBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, (BYTE**)&pDevice->wasapi.pMappedBufferCapture, &pDevice->wasapi.mappedBufferCaptureCap, &flags, NULL, NULL); + hr = ma_IAudioCaptureClient_GetBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, (BYTE**)&pDevice->wasapi.pMappedBufferCapture, &pDevice->wasapi.mappedBufferCaptureCap, &flags, nullptr, nullptr); if (hr == MA_AUDCLNT_S_BUFFER_EMPTY || FAILED(hr)) { /* The buffer has been completely emptied or an error occurred. In this case we'll need to reset the state of the mapped buffer which will trigger the next iteration to get a fresh buffer from WASAPI. */ - pDevice->wasapi.pMappedBufferCapture = NULL; + pDevice->wasapi.pMappedBufferCapture = nullptr; pDevice->wasapi.mappedBufferCaptureCap = 0; pDevice->wasapi.mappedBufferCaptureLen = 0; @@ -24856,7 +24856,7 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui } /* If at this point we have a valid buffer mapped, make sure the buffer length is set appropriately. */ - if (pDevice->wasapi.pMappedBufferCapture != NULL) { + if (pDevice->wasapi.pMappedBufferCapture != nullptr) { pDevice->wasapi.mappedBufferCaptureLen = pDevice->wasapi.mappedBufferCaptureCap; } } @@ -24905,14 +24905,14 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui there's a good chance either an error occurred or the device was stopped mid-read. In this case we'll need to make sure the buffer is released. */ - if (totalFramesProcessed < frameCount && pDevice->wasapi.pMappedBufferCapture != NULL) { + if (totalFramesProcessed < frameCount && pDevice->wasapi.pMappedBufferCapture != nullptr) { ma_IAudioCaptureClient_ReleaseBuffer((ma_IAudioCaptureClient*)pDevice->wasapi.pCaptureClient, pDevice->wasapi.mappedBufferCaptureCap); - pDevice->wasapi.pMappedBufferCapture = NULL; + pDevice->wasapi.pMappedBufferCapture = nullptr; pDevice->wasapi.mappedBufferCaptureCap = 0; pDevice->wasapi.mappedBufferCaptureLen = 0; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesProcessed; } @@ -24934,7 +24934,7 @@ static ma_result ma_device_write__wasapi(ma_device* pDevice, const void* pFrames a requested buffer size equal to our actual period size. If it returns AUDCLNT_E_BUFFER_TOO_LARGE it means we need to wait for some data to become available. */ - if (pDevice->wasapi.pMappedBufferPlayback != NULL) { + if (pDevice->wasapi.pMappedBufferPlayback != nullptr) { /* We still have some space available in the mapped data buffer. Write to it. */ ma_uint32 framesToProcessNow = framesRemaining; if (framesToProcessNow > (pDevice->wasapi.mappedBufferPlaybackCap - pDevice->wasapi.mappedBufferPlaybackLen)) { @@ -24955,7 +24955,7 @@ static ma_result ma_device_write__wasapi(ma_device* pDevice, const void* pFrames /* If the data buffer has been fully consumed we need to release it. */ if (pDevice->wasapi.mappedBufferPlaybackLen == pDevice->wasapi.mappedBufferPlaybackCap) { ma_IAudioRenderClient_ReleaseBuffer((ma_IAudioRenderClient*)pDevice->wasapi.pRenderClient, pDevice->wasapi.mappedBufferPlaybackCap, 0); - pDevice->wasapi.pMappedBufferPlayback = NULL; + pDevice->wasapi.pMappedBufferPlayback = nullptr; pDevice->wasapi.mappedBufferPlaybackCap = 0; pDevice->wasapi.mappedBufferPlaybackLen = 0; @@ -25005,7 +25005,7 @@ static ma_result ma_device_write__wasapi(ma_device* pDevice, const void* pFrames } } - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = totalFramesProcessed; } @@ -25014,7 +25014,7 @@ static ma_result ma_device_write__wasapi(ma_device* pDevice, const void* pFrames static ma_result ma_device_data_loop_wakeup__wasapi(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex || pDevice->type == ma_device_type_loopback) { SetEvent((HANDLE)pDevice->wasapi.hEventCapture); @@ -25032,7 +25032,7 @@ static ma_result ma_context_uninit__wasapi(ma_context* pContext) { ma_context_command__wasapi cmd = ma_context_init_command__wasapi(MA_CONTEXT_COMMAND_QUIT__WASAPI); - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_wasapi); ma_context_post_command__wasapi(pContext, &cmd); @@ -25040,14 +25040,14 @@ static ma_result ma_context_uninit__wasapi(ma_context* pContext) if (pContext->wasapi.hAvrt) { ma_dlclose(ma_context_get_log(pContext), pContext->wasapi.hAvrt); - pContext->wasapi.hAvrt = NULL; + pContext->wasapi.hAvrt = nullptr; } #if defined(MA_WIN32_UWP) { if (pContext->wasapi.hMMDevapi) { ma_dlclose(ma_context_get_log(pContext), pContext->wasapi.hMMDevapi); - pContext->wasapi.hMMDevapi = NULL; + pContext->wasapi.hMMDevapi = nullptr; } } #endif @@ -25063,7 +25063,7 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_ { ma_result result = MA_SUCCESS; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); (void)pConfig; @@ -25081,13 +25081,13 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_ ma_PFNVerSetConditionMask _VerSetConditionMask; kernel32DLL = ma_dlopen(ma_context_get_log(pContext), "kernel32.dll"); - if (kernel32DLL == NULL) { + if (kernel32DLL == nullptr) { return MA_NO_BACKEND; } _VerifyVersionInfoW = (ma_PFNVerifyVersionInfoW )ma_dlsym(ma_context_get_log(pContext), kernel32DLL, "VerifyVersionInfoW"); _VerSetConditionMask = (ma_PFNVerSetConditionMask)ma_dlsym(ma_context_get_log(pContext), kernel32DLL, "VerSetConditionMask"); - if (_VerifyVersionInfoW == NULL || _VerSetConditionMask == NULL) { + if (_VerifyVersionInfoW == nullptr || _VerSetConditionMask == nullptr) { ma_dlclose(ma_context_get_log(pContext), kernel32DLL); return MA_NO_BACKEND; } @@ -25120,7 +25120,7 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_ pContext->wasapi.hMMDevapi = ma_dlopen(ma_context_get_log(pContext), "mmdevapi.dll"); if (pContext->wasapi.hMMDevapi) { pContext->wasapi.ActivateAudioInterfaceAsync = ma_dlsym(ma_context_get_log(pContext), pContext->wasapi.hMMDevapi, "ActivateAudioInterfaceAsync"); - if (pContext->wasapi.ActivateAudioInterfaceAsync == NULL) { + if (pContext->wasapi.ActivateAudioInterfaceAsync == nullptr) { ma_dlclose(ma_context_get_log(pContext), pContext->wasapi.hMMDevapi); return MA_NO_BACKEND; /* ActivateAudioInterfaceAsync() could not be loaded. */ } @@ -25138,10 +25138,10 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_ /* If either function could not be found, disable use of avrt entirely. */ if (!pContext->wasapi.AvSetMmThreadCharacteristicsA || !pContext->wasapi.AvRevertMmThreadcharacteristics) { - pContext->wasapi.AvSetMmThreadCharacteristicsA = NULL; - pContext->wasapi.AvRevertMmThreadcharacteristics = NULL; + pContext->wasapi.AvSetMmThreadCharacteristicsA = nullptr; + pContext->wasapi.AvRevertMmThreadcharacteristics = nullptr; ma_dlclose(ma_context_get_log(pContext), pContext->wasapi.hAvrt); - pContext->wasapi.hAvrt = NULL; + pContext->wasapi.hAvrt = nullptr; } } @@ -25202,7 +25202,7 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_ pCallbacks->onDeviceStop = ma_device_stop__wasapi; pCallbacks->onDeviceRead = ma_device_read__wasapi; pCallbacks->onDeviceWrite = ma_device_write__wasapi; - pCallbacks->onDeviceDataLoop = NULL; + pCallbacks->onDeviceDataLoop = nullptr; pCallbacks->onDeviceDataLoopWakeup = ma_device_data_loop_wakeup__wasapi; return MA_SUCCESS; @@ -25583,12 +25583,12 @@ static void ma_get_channels_from_speaker_config__dsound(DWORD speakerConfig, WOR DWORD channelMap; channels = 0; - if (pChannelsOut != NULL) { + if (pChannelsOut != nullptr) { channels = *pChannelsOut; } channelMap = 0; - if (pChannelMapOut != NULL) { + if (pChannelMapOut != nullptr) { channelMap = *pChannelMapOut; } @@ -25609,11 +25609,11 @@ static void ma_get_channels_from_speaker_config__dsound(DWORD speakerConfig, WOR default: break; } - if (pChannelsOut != NULL) { + if (pChannelsOut != nullptr) { *pChannelsOut = channels; } - if (pChannelMapOut != NULL) { + if (pChannelMapOut != nullptr) { *pChannelMapOut = channelMap; } } @@ -25625,13 +25625,13 @@ static ma_result ma_context_create_IDirectSound__dsound(ma_context* pContext, ma HWND hWnd; HRESULT hr; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppDirectSound != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppDirectSound != nullptr); - *ppDirectSound = NULL; - pDirectSound = NULL; + *ppDirectSound = nullptr; + pDirectSound = nullptr; - if (FAILED(((ma_DirectSoundCreateProc)pContext->dsound.DirectSoundCreate)((pDeviceID == NULL) ? NULL : (const GUID*)pDeviceID->dsound, &pDirectSound, NULL))) { + if (FAILED(((ma_DirectSoundCreateProc)pContext->dsound.DirectSoundCreate)((pDeviceID == nullptr) ? nullptr : (const GUID*)pDeviceID->dsound, &pDirectSound, nullptr))) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[DirectSound] DirectSoundCreate() failed for playback device."); return MA_FAILED_TO_OPEN_BACKEND_DEVICE; } @@ -25660,18 +25660,18 @@ static ma_result ma_context_create_IDirectSoundCapture__dsound(ma_context* pCont ma_IDirectSoundCapture* pDirectSoundCapture; HRESULT hr; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppDirectSoundCapture != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppDirectSoundCapture != nullptr); /* DirectSound does not support exclusive mode for capture. */ if (shareMode == ma_share_mode_exclusive) { return MA_SHARE_MODE_NOT_SUPPORTED; } - *ppDirectSoundCapture = NULL; - pDirectSoundCapture = NULL; + *ppDirectSoundCapture = nullptr; + pDirectSoundCapture = nullptr; - hr = ((ma_DirectSoundCaptureCreateProc)pContext->dsound.DirectSoundCaptureCreate)((pDeviceID == NULL) ? NULL : (const GUID*)pDeviceID->dsound, &pDirectSoundCapture, NULL); + hr = ((ma_DirectSoundCaptureCreateProc)pContext->dsound.DirectSoundCaptureCreate)((pDeviceID == nullptr) ? nullptr : (const GUID*)pDeviceID->dsound, &pDirectSoundCapture, nullptr); if (FAILED(hr)) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[DirectSound] DirectSoundCaptureCreate() failed for capture device."); return ma_result_from_HRESULT(hr); @@ -25688,8 +25688,8 @@ static ma_result ma_context_get_format_info_for_IDirectSoundCapture__dsound(ma_c WORD bitsPerSample; DWORD sampleRate; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pDirectSoundCapture != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pDirectSoundCapture != nullptr); if (pChannels) { *pChannels = 0; @@ -25803,7 +25803,7 @@ static BOOL CALLBACK ma_context_enumerate_devices_callback__dsound(GUID* lpGuid, MA_ZERO_OBJECT(&deviceInfo); /* ID. */ - if (lpGuid != NULL) { + if (lpGuid != nullptr) { MA_COPY_MEMORY(deviceInfo.id.dsound, lpGuid, 16); } else { MA_ZERO_MEMORY(deviceInfo.id.dsound, 16); @@ -25815,7 +25815,7 @@ static BOOL CALLBACK ma_context_enumerate_devices_callback__dsound(GUID* lpGuid, /* Call the callback function, but make sure we stop enumerating if the callee requested so. */ - MA_ASSERT(pData != NULL); + MA_ASSERT(pData != nullptr); pData->terminated = (pData->callback(pData->pContext, pData->deviceType, &deviceInfo, pData->pUserData) == MA_FALSE); if (pData->terminated) { return FALSE; /* Stop enumeration. */ @@ -25828,8 +25828,8 @@ static ma_result ma_context_enumerate_devices__dsound(ma_context* pContext, ma_e { ma_context_enumerate_devices_callback_data__dsound data; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); data.pContext = pContext; data.callback = callback; @@ -25862,9 +25862,9 @@ typedef struct static BOOL CALLBACK ma_context_get_device_info_callback__dsound(GUID* lpGuid, const char* lpcstrDescription, const char* lpcstrModule, void* lpContext) { ma_context_get_device_info_callback_data__dsound* pData = (ma_context_get_device_info_callback_data__dsound*)lpContext; - MA_ASSERT(pData != NULL); + MA_ASSERT(pData != nullptr); - if ((pData->pDeviceID == NULL || ma_is_guid_null(pData->pDeviceID->dsound)) && (lpGuid == NULL || ma_is_guid_null(lpGuid))) { + if ((pData->pDeviceID == nullptr || ma_is_guid_null(pData->pDeviceID->dsound)) && (lpGuid == nullptr || ma_is_guid_null(lpGuid))) { /* Default device. */ ma_strncpy_s(pData->pDeviceInfo->name, sizeof(pData->pDeviceInfo->name), lpcstrDescription, (size_t)-1); pData->pDeviceInfo->isDefault = MA_TRUE; @@ -25872,7 +25872,7 @@ static BOOL CALLBACK ma_context_get_device_info_callback__dsound(GUID* lpGuid, c return FALSE; /* Stop enumeration. */ } else { /* Not the default device. */ - if (lpGuid != NULL && pData->pDeviceID != NULL) { + if (lpGuid != nullptr && pData->pDeviceID != nullptr) { if (memcmp(pData->pDeviceID->dsound, lpGuid, sizeof(pData->pDeviceID->dsound)) == 0) { ma_strncpy_s(pData->pDeviceInfo->name, sizeof(pData->pDeviceInfo->name), lpcstrDescription, (size_t)-1); pData->found = MA_TRUE; @@ -25890,7 +25890,7 @@ static ma_result ma_context_get_device_info__dsound(ma_context* pContext, ma_dev ma_result result; HRESULT hr; - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { ma_context_get_device_info_callback_data__dsound data; /* ID. */ @@ -25956,7 +25956,7 @@ static ma_result ma_context_get_device_info__dsound(ma_context* pContext, ma_dev /* Look at the speaker configuration to get a better idea on the channel count. */ hr = ma_IDirectSound_GetSpeakerConfig(pDirectSound, &speakerConfig); if (SUCCEEDED(hr)) { - ma_get_channels_from_speaker_config__dsound(speakerConfig, &channels, NULL); + ma_get_channels_from_speaker_config__dsound(speakerConfig, &channels, nullptr); } } else { /* It does not support stereo, which means we are stuck with mono. */ @@ -26042,22 +26042,22 @@ static ma_result ma_context_get_device_info__dsound(ma_context* pContext, ma_dev static ma_result ma_device_uninit__dsound(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); - if (pDevice->dsound.pCaptureBuffer != NULL) { + if (pDevice->dsound.pCaptureBuffer != nullptr) { ma_IDirectSoundCaptureBuffer_Release((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer); } - if (pDevice->dsound.pCapture != NULL) { + if (pDevice->dsound.pCapture != nullptr) { ma_IDirectSoundCapture_Release((ma_IDirectSoundCapture*)pDevice->dsound.pCapture); } - if (pDevice->dsound.pPlaybackBuffer != NULL) { + if (pDevice->dsound.pPlaybackBuffer != nullptr) { ma_IDirectSoundBuffer_Release((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer); } - if (pDevice->dsound.pPlaybackPrimaryBuffer != NULL) { + if (pDevice->dsound.pPlaybackPrimaryBuffer != nullptr) { ma_IDirectSoundBuffer_Release((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackPrimaryBuffer); } - if (pDevice->dsound.pPlayback != NULL) { + if (pDevice->dsound.pPlayback != nullptr) { ma_IDirectSound_Release((ma_IDirectSound*)pDevice->dsound.pPlayback); } @@ -26137,7 +26137,7 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf ma_result result; HRESULT hr; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->dsound); @@ -26189,7 +26189,7 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf descDS.dwFlags = 0; descDS.dwBufferBytes = periodSizeInFrames * periodCount * wf.nBlockAlign; descDS.lpwfxFormat = (MA_WAVEFORMATEX*)&wf; - hr = ma_IDirectSoundCapture_CreateCaptureBuffer((ma_IDirectSoundCapture*)pDevice->dsound.pCapture, &descDS, (ma_IDirectSoundCaptureBuffer**)&pDevice->dsound.pCaptureBuffer, NULL); + hr = ma_IDirectSoundCapture_CreateCaptureBuffer((ma_IDirectSoundCapture*)pDevice->dsound.pCapture, &descDS, (ma_IDirectSoundCaptureBuffer**)&pDevice->dsound.pCaptureBuffer, nullptr); if (FAILED(hr)) { ma_device_uninit__dsound(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] IDirectSoundCapture_CreateCaptureBuffer() failed for capture device."); @@ -26198,7 +26198,7 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf /* Get the _actual_ properties of the buffer. */ pActualFormat = (MA_WAVEFORMATEXTENSIBLE*)rawdata; - hr = ma_IDirectSoundCaptureBuffer_GetFormat((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, (MA_WAVEFORMATEX*)pActualFormat, sizeof(rawdata), NULL); + hr = ma_IDirectSoundCaptureBuffer_GetFormat((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, (MA_WAVEFORMATEX*)pActualFormat, sizeof(rawdata), nullptr); if (FAILED(hr)) { ma_device_uninit__dsound(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to retrieve the actual format of the capture device's buffer."); @@ -26225,7 +26225,7 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf descDS.dwBufferBytes = periodSizeInFrames * ma_get_bytes_per_frame(pDescriptorCapture->format, pDescriptorCapture->channels) * periodCount; ma_IDirectSoundCaptureBuffer_Release((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer); - hr = ma_IDirectSoundCapture_CreateCaptureBuffer((ma_IDirectSoundCapture*)pDevice->dsound.pCapture, &descDS, (ma_IDirectSoundCaptureBuffer**)&pDevice->dsound.pCaptureBuffer, NULL); + hr = ma_IDirectSoundCapture_CreateCaptureBuffer((ma_IDirectSoundCapture*)pDevice->dsound.pCapture, &descDS, (ma_IDirectSoundCaptureBuffer**)&pDevice->dsound.pCaptureBuffer, nullptr); if (FAILED(hr)) { ma_device_uninit__dsound(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Second attempt at IDirectSoundCapture_CreateCaptureBuffer() failed for capture device."); @@ -26264,7 +26264,7 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf MA_ZERO_OBJECT(&descDSPrimary); descDSPrimary.dwSize = sizeof(MA_DSBUFFERDESC); descDSPrimary.dwFlags = MA_DSBCAPS_PRIMARYBUFFER | MA_DSBCAPS_CTRLVOLUME; - hr = ma_IDirectSound_CreateSoundBuffer((ma_IDirectSound*)pDevice->dsound.pPlayback, &descDSPrimary, (ma_IDirectSoundBuffer**)&pDevice->dsound.pPlaybackPrimaryBuffer, NULL); + hr = ma_IDirectSound_CreateSoundBuffer((ma_IDirectSound*)pDevice->dsound.pPlayback, &descDSPrimary, (ma_IDirectSoundBuffer**)&pDevice->dsound.pPlaybackPrimaryBuffer, nullptr); if (FAILED(hr)) { ma_device_uninit__dsound(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] IDirectSound_CreateSoundBuffer() failed for playback device's primary buffer."); @@ -26348,7 +26348,7 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf /* Get the _actual_ properties of the buffer. */ pActualFormat = (MA_WAVEFORMATEXTENSIBLE*)rawdata; - hr = ma_IDirectSoundBuffer_GetFormat((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackPrimaryBuffer, (MA_WAVEFORMATEX*)pActualFormat, sizeof(rawdata), NULL); + hr = ma_IDirectSoundBuffer_GetFormat((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackPrimaryBuffer, (MA_WAVEFORMATEX*)pActualFormat, sizeof(rawdata), nullptr); if (FAILED(hr)) { ma_device_uninit__dsound(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to retrieve the actual format of the playback device's primary buffer."); @@ -26391,7 +26391,7 @@ static ma_result ma_device_init__dsound(ma_device* pDevice, const ma_device_conf descDS.dwFlags = MA_DSBCAPS_CTRLPOSITIONNOTIFY | MA_DSBCAPS_GLOBALFOCUS | MA_DSBCAPS_GETCURRENTPOSITION2; descDS.dwBufferBytes = periodSizeInFrames * periodCount * ma_get_bytes_per_frame(pDescriptorPlayback->format, pDescriptorPlayback->channels); descDS.lpwfxFormat = (MA_WAVEFORMATEX*)pActualFormat; - hr = ma_IDirectSound_CreateSoundBuffer((ma_IDirectSound*)pDevice->dsound.pPlayback, &descDS, (ma_IDirectSoundBuffer**)&pDevice->dsound.pPlaybackBuffer, NULL); + hr = ma_IDirectSound_CreateSoundBuffer((ma_IDirectSound*)pDevice->dsound.pPlayback, &descDS, (ma_IDirectSoundBuffer**)&pDevice->dsound.pPlaybackBuffer, nullptr); if (FAILED(hr)) { ma_device_uninit__dsound(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] IDirectSound_CreateSoundBuffer() failed for playback device's secondary buffer."); @@ -26432,7 +26432,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) ma_uint32 waitTimeInMilliseconds = 1; DWORD playbackBufferStatus = 0; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* The first thing to do is start the capture device. The playback device is only started after the first period is written. */ if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { @@ -26490,7 +26490,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) continue; /* Nothing is available in the capture buffer. */ } - hr = ma_IDirectSoundCaptureBuffer_Lock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, lockOffsetInBytesCapture, lockSizeInBytesCapture, &pMappedDeviceBufferCapture, &mappedSizeInBytesCapture, NULL, NULL, 0); + hr = ma_IDirectSoundCaptureBuffer_Lock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, lockOffsetInBytesCapture, lockSizeInBytesCapture, &pMappedDeviceBufferCapture, &mappedSizeInBytesCapture, nullptr, nullptr, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to map buffer from capture device in preparation for writing to the device."); return ma_result_from_HRESULT(hr); @@ -26589,7 +26589,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) lockSizeInBytesPlayback = physicalPlayCursorInBytes - virtualWriteCursorInBytesPlayback; } - hr = ma_IDirectSoundBuffer_Lock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, lockOffsetInBytesPlayback, lockSizeInBytesPlayback, &pMappedDeviceBufferPlayback, &mappedSizeInBytesPlayback, NULL, NULL, 0); + hr = ma_IDirectSoundBuffer_Lock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, lockOffsetInBytesPlayback, lockSizeInBytesPlayback, &pMappedDeviceBufferPlayback, &mappedSizeInBytesPlayback, nullptr, nullptr, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to map buffer from playback device in preparation for writing to the device."); result = ma_result_from_HRESULT(hr); @@ -26632,7 +26632,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) } - hr = ma_IDirectSoundBuffer_Unlock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, pMappedDeviceBufferPlayback, framesWrittenThisIteration*bpfDevicePlayback, NULL, 0); + hr = ma_IDirectSoundBuffer_Unlock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, pMappedDeviceBufferPlayback, framesWrittenThisIteration*bpfDevicePlayback, nullptr, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to unlock internal buffer from playback device after writing to the device."); result = ma_result_from_HRESULT(hr); @@ -26672,7 +26672,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) /* At this point we're done with the mapped portion of the capture buffer. */ - hr = ma_IDirectSoundCaptureBuffer_Unlock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, pMappedDeviceBufferCapture, mappedSizeInBytesCapture, NULL, 0); + hr = ma_IDirectSoundCaptureBuffer_Unlock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, pMappedDeviceBufferCapture, mappedSizeInBytesCapture, nullptr, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to unlock internal buffer from capture device after reading from the device."); return ma_result_from_HRESULT(hr); @@ -26723,7 +26723,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) continue; /* Nothing is available in the capture buffer. */ } - hr = ma_IDirectSoundCaptureBuffer_Lock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, lockOffsetInBytesCapture, lockSizeInBytesCapture, &pMappedDeviceBufferCapture, &mappedSizeInBytesCapture, NULL, NULL, 0); + hr = ma_IDirectSoundCaptureBuffer_Lock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, lockOffsetInBytesCapture, lockSizeInBytesCapture, &pMappedDeviceBufferCapture, &mappedSizeInBytesCapture, nullptr, nullptr, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to map buffer from capture device in preparation for writing to the device."); result = ma_result_from_HRESULT(hr); @@ -26735,7 +26735,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) ma_device__send_frames_to_client(pDevice, mappedSizeInBytesCapture/bpfDeviceCapture, pMappedDeviceBufferCapture); - hr = ma_IDirectSoundCaptureBuffer_Unlock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, pMappedDeviceBufferCapture, mappedSizeInBytesCapture, NULL, 0); + hr = ma_IDirectSoundCaptureBuffer_Unlock((ma_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, pMappedDeviceBufferCapture, mappedSizeInBytesCapture, nullptr, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to unlock internal buffer from capture device after reading from the device."); return ma_result_from_HRESULT(hr); @@ -26826,7 +26826,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) lockSizeInBytesPlayback = physicalPlayCursorInBytes - virtualWriteCursorInBytesPlayback; } - hr = ma_IDirectSoundBuffer_Lock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, lockOffsetInBytesPlayback, lockSizeInBytesPlayback, &pMappedDeviceBufferPlayback, &mappedSizeInBytesPlayback, NULL, NULL, 0); + hr = ma_IDirectSoundBuffer_Lock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, lockOffsetInBytesPlayback, lockSizeInBytesPlayback, &pMappedDeviceBufferPlayback, &mappedSizeInBytesPlayback, nullptr, nullptr, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to map buffer from playback device in preparation for writing to the device."); result = ma_result_from_HRESULT(hr); @@ -26836,7 +26836,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) /* At this point we have a buffer for output. */ ma_device__read_frames_from_client(pDevice, (mappedSizeInBytesPlayback/bpfDevicePlayback), pMappedDeviceBufferPlayback); - hr = ma_IDirectSoundBuffer_Unlock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, pMappedDeviceBufferPlayback, mappedSizeInBytesPlayback, NULL, 0); + hr = ma_IDirectSoundBuffer_Unlock((ma_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer, pMappedDeviceBufferPlayback, mappedSizeInBytesPlayback, nullptr, 0); if (FAILED(hr)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[DirectSound] Failed to unlock internal buffer from playback device after writing to the device."); result = ma_result_from_HRESULT(hr); @@ -26938,7 +26938,7 @@ static ma_result ma_device_data_loop__dsound(ma_device* pDevice) static ma_result ma_context_uninit__dsound(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_dsound); ma_dlclose(ma_context_get_log(pContext), pContext->dsound.hDSoundDLL); @@ -26948,12 +26948,12 @@ static ma_result ma_context_uninit__dsound(ma_context* pContext) static ma_result ma_context_init__dsound(ma_context* pContext, const ma_context_config* pConfig, ma_backend_callbacks* pCallbacks) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); (void)pConfig; pContext->dsound.hDSoundDLL = ma_dlopen(ma_context_get_log(pContext), "dsound.dll"); - if (pContext->dsound.hDSoundDLL == NULL) { + if (pContext->dsound.hDSoundDLL == nullptr) { return MA_API_NOT_FOUND; } @@ -26967,10 +26967,10 @@ static ma_result ma_context_init__dsound(ma_context* pContext, const ma_context_ well in my testing. For example, it's missing DirectSoundCaptureEnumerateA(). This is a convenient place to just disable the DirectSound backend for Windows 95. */ - if (pContext->dsound.DirectSoundCreate == NULL || - pContext->dsound.DirectSoundEnumerateA == NULL || - pContext->dsound.DirectSoundCaptureCreate == NULL || - pContext->dsound.DirectSoundCaptureEnumerateA == NULL) { + if (pContext->dsound.DirectSoundCreate == nullptr || + pContext->dsound.DirectSoundEnumerateA == nullptr || + pContext->dsound.DirectSoundCaptureCreate == nullptr || + pContext->dsound.DirectSoundCaptureEnumerateA == nullptr) { return MA_API_NOT_FOUND; } @@ -26982,10 +26982,10 @@ static ma_result ma_context_init__dsound(ma_context* pContext, const ma_context_ pCallbacks->onContextGetDeviceInfo = ma_context_get_device_info__dsound; pCallbacks->onDeviceInit = ma_device_init__dsound; pCallbacks->onDeviceUninit = ma_device_uninit__dsound; - pCallbacks->onDeviceStart = NULL; /* Not used. Started in onDeviceDataLoop. */ - pCallbacks->onDeviceStop = NULL; /* Not used. Stopped in onDeviceDataLoop. */ - pCallbacks->onDeviceRead = NULL; /* Not used. Data is read directly in onDeviceDataLoop. */ - pCallbacks->onDeviceWrite = NULL; /* Not used. Data is written directly in onDeviceDataLoop. */ + pCallbacks->onDeviceStart = nullptr; /* Not used. Started in onDeviceDataLoop. */ + pCallbacks->onDeviceStop = nullptr; /* Not used. Stopped in onDeviceDataLoop. */ + pCallbacks->onDeviceRead = nullptr; /* Not used. Data is read directly in onDeviceDataLoop. */ + pCallbacks->onDeviceWrite = nullptr; /* Not used. Data is written directly in onDeviceDataLoop. */ pCallbacks->onDeviceDataLoop = ma_device_data_loop__dsound; return MA_SUCCESS; @@ -27132,11 +27132,11 @@ static char* ma_find_last_character(char* str, char ch) { char* last; - if (str == NULL) { - return NULL; + if (str == nullptr) { + return nullptr; } - last = NULL; + last = nullptr; while (*str != '\0') { if (*str == ch) { last = str; @@ -27250,7 +27250,7 @@ static ma_result ma_formats_flags_to_WAVEFORMATEX__winmm(DWORD dwFormats, WORD c { ma_result result; - MA_ASSERT(pWF != NULL); + MA_ASSERT(pWF != nullptr); MA_ZERO_OBJECT(pWF); pWF->cbSize = sizeof(*pWF); @@ -27277,9 +27277,9 @@ static ma_result ma_context_get_device_info_from_WAVECAPS(ma_context* pContext, DWORD sampleRate; ma_result result; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pCaps != NULL); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pCaps != nullptr); + MA_ASSERT(pDeviceInfo != nullptr); /* Name / Description @@ -27317,7 +27317,7 @@ static ma_result ma_context_get_device_info_from_WAVECAPS(ma_context* pContext, if (((MA_PFN_RegOpenKeyExA)pContext->win32.RegOpenKeyExA)(HKEY_LOCAL_MACHINE, keyStr, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { BYTE nameFromReg[512]; DWORD nameFromRegSize = sizeof(nameFromReg); - LONG resultWin32 = ((MA_PFN_RegQueryValueExA)pContext->win32.RegQueryValueExA)(hKey, "Name", 0, NULL, (BYTE*)nameFromReg, (DWORD*)&nameFromRegSize); + LONG resultWin32 = ((MA_PFN_RegQueryValueExA)pContext->win32.RegQueryValueExA)(hKey, "Name", 0, nullptr, (BYTE*)nameFromReg, (DWORD*)&nameFromRegSize); ((MA_PFN_RegCloseKey)pContext->win32.RegCloseKey)(hKey); if (resultWin32 == ERROR_SUCCESS) { @@ -27325,7 +27325,7 @@ static ma_result ma_context_get_device_info_from_WAVECAPS(ma_context* pContext, char name[1024]; if (ma_strcpy_s(name, sizeof(name), pDeviceInfo->name) == 0) { char* nameBeg = ma_find_last_character(name, '('); - if (nameBeg != NULL) { + if (nameBeg != nullptr) { size_t leadingLen = (nameBeg - name); ma_strncpy_s(nameBeg + 1, sizeof(name) - leadingLen, (const char*)nameFromReg, (size_t)-1); @@ -27371,9 +27371,9 @@ static ma_result ma_context_get_device_info_from_WAVEOUTCAPS2(ma_context* pConte { MA_WAVECAPSA caps; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pCaps != NULL); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pCaps != nullptr); + MA_ASSERT(pDeviceInfo != nullptr); MA_COPY_MEMORY(caps.szPname, pCaps->szPname, sizeof(caps.szPname)); caps.dwFormats = pCaps->dwFormats; @@ -27386,9 +27386,9 @@ static ma_result ma_context_get_device_info_from_WAVEINCAPS2(ma_context* pContex { MA_WAVECAPSA caps; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pCaps != NULL); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pCaps != nullptr); + MA_ASSERT(pDeviceInfo != nullptr); MA_COPY_MEMORY(caps.szPname, pCaps->szPname, sizeof(caps.szPname)); caps.dwFormats = pCaps->dwFormats; @@ -27405,8 +27405,8 @@ static ma_result ma_context_enumerate_devices__winmm(ma_context* pContext, ma_en UINT iPlaybackDevice; UINT iCaptureDevice; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); /* Playback. */ playbackDeviceCount = ((MA_PFN_waveOutGetNumDevs)pContext->winmm.waveOutGetNumDevs)(); @@ -27473,10 +27473,10 @@ static ma_result ma_context_get_device_info__winmm(ma_context* pContext, ma_devi { UINT winMMDeviceID; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); winMMDeviceID = 0; - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { winMMDeviceID = (UINT)pDeviceID->winmm; } @@ -27515,7 +27515,7 @@ static ma_result ma_context_get_device_info__winmm(ma_context* pContext, ma_devi static ma_result ma_device_uninit__winmm(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { ((MA_PFN_waveInClose)pDevice->pContext->winmm.waveInClose)((MA_HWAVEIN)pDevice->winmm.hDeviceCapture); @@ -27558,7 +27558,7 @@ static ma_result ma_device_init__winmm(ma_device* pDevice, const ma_device_confi UINT winMMDeviceIDPlayback = 0; UINT winMMDeviceIDCapture = 0; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->winmm); @@ -27572,10 +27572,10 @@ static ma_result ma_device_init__winmm(ma_device* pDevice, const ma_device_confi return MA_SHARE_MODE_NOT_SUPPORTED; } - if (pDescriptorPlayback->pDeviceID != NULL) { + if (pDescriptorPlayback->pDeviceID != nullptr) { winMMDeviceIDPlayback = (UINT)pDescriptorPlayback->pDeviceID->winmm; } - if (pDescriptorCapture->pDeviceID != NULL) { + if (pDescriptorCapture->pDeviceID != nullptr) { winMMDeviceIDCapture = (UINT)pDescriptorCapture->pDeviceID->winmm; } @@ -27586,8 +27586,8 @@ static ma_result ma_device_init__winmm(ma_device* pDevice, const ma_device_confi MA_MMRESULT resultMM; /* We use an event to know when a new fragment needs to be enqueued. */ - pDevice->winmm.hEventCapture = (ma_handle)CreateEventA(NULL, TRUE, TRUE, NULL); - if (pDevice->winmm.hEventCapture == NULL) { + pDevice->winmm.hEventCapture = (ma_handle)CreateEventA(nullptr, TRUE, TRUE, nullptr); + if (pDevice->winmm.hEventCapture == nullptr) { errorMsg = "[WinMM] Failed to create event for fragment enqueuing for the capture device.", errorCode = ma_result_from_GetLastError(GetLastError()); goto on_error; } @@ -27624,8 +27624,8 @@ static ma_result ma_device_init__winmm(ma_device* pDevice, const ma_device_confi MA_MMRESULT resultMM; /* We use an event to know when a new fragment needs to be enqueued. */ - pDevice->winmm.hEventPlayback = (ma_handle)CreateEventA(NULL, TRUE, TRUE, NULL); - if (pDevice->winmm.hEventPlayback == NULL) { + pDevice->winmm.hEventPlayback = (ma_handle)CreateEventA(nullptr, TRUE, TRUE, nullptr); + if (pDevice->winmm.hEventPlayback == nullptr) { errorMsg = "[WinMM] Failed to create event for fragment enqueuing for the playback device.", errorCode = ma_result_from_GetLastError(GetLastError()); goto on_error; } @@ -27670,7 +27670,7 @@ static ma_result ma_device_init__winmm(ma_device* pDevice, const ma_device_confi } pDevice->winmm._pHeapData = (ma_uint8*)ma_calloc(heapSize, &pDevice->pContext->allocationCallbacks); - if (pDevice->winmm._pHeapData == NULL) { + if (pDevice->winmm._pHeapData == nullptr) { errorMsg = "[WinMM] Failed to allocate memory for the intermediary buffer.", errorCode = MA_OUT_OF_MEMORY; goto on_error; } @@ -27739,7 +27739,7 @@ static ma_result ma_device_init__winmm(ma_device* pDevice, const ma_device_confi on_error: if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { - if (pDevice->winmm.pWAVEHDRCapture != NULL) { + if (pDevice->winmm.pWAVEHDRCapture != nullptr) { ma_uint32 iPeriod; for (iPeriod = 0; iPeriod < pDescriptorCapture->periodCount; ++iPeriod) { ((MA_PFN_waveInUnprepareHeader)pDevice->pContext->winmm.waveInUnprepareHeader)((MA_HWAVEIN)pDevice->winmm.hDeviceCapture, &((MA_WAVEHDR*)pDevice->winmm.pWAVEHDRCapture)[iPeriod], sizeof(MA_WAVEHDR)); @@ -27750,7 +27750,7 @@ on_error: } if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { - if (pDevice->winmm.pWAVEHDRCapture != NULL) { + if (pDevice->winmm.pWAVEHDRCapture != nullptr) { ma_uint32 iPeriod; for (iPeriod = 0; iPeriod < pDescriptorPlayback->periodCount; ++iPeriod) { ((MA_PFN_waveOutUnprepareHeader)pDevice->pContext->winmm.waveOutUnprepareHeader)((MA_HWAVEOUT)pDevice->winmm.hDevicePlayback, &((MA_WAVEHDR*)pDevice->winmm.pWAVEHDRPlayback)[iPeriod], sizeof(MA_WAVEHDR)); @@ -27762,7 +27762,7 @@ on_error: ma_free(pDevice->winmm._pHeapData, &pDevice->pContext->allocationCallbacks); - if (errorMsg != NULL && errorMsg[0] != '\0') { + if (errorMsg != nullptr && errorMsg[0] != '\0') { ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "%s", errorMsg); } @@ -27771,7 +27771,7 @@ on_error: static ma_result ma_device_start__winmm(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { MA_MMRESULT resultMM; @@ -27814,10 +27814,10 @@ static ma_result ma_device_stop__winmm(ma_device* pDevice) { MA_MMRESULT resultMM; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { - if (pDevice->winmm.hDeviceCapture == NULL) { + if (pDevice->winmm.hDeviceCapture == nullptr) { return MA_INVALID_ARGS; } @@ -27831,7 +27831,7 @@ static ma_result ma_device_stop__winmm(ma_device* pDevice) ma_uint32 iPeriod; MA_WAVEHDR* pWAVEHDR; - if (pDevice->winmm.hDevicePlayback == NULL) { + if (pDevice->winmm.hDevicePlayback == nullptr) { return MA_INVALID_ARGS; } @@ -27863,10 +27863,10 @@ static ma_result ma_device_write__winmm(ma_device* pDevice, const void* pPCMFram ma_uint32 totalFramesWritten; MA_WAVEHDR* pWAVEHDR; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pPCMFrames != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pPCMFrames != nullptr); - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = 0; } @@ -27941,7 +27941,7 @@ static ma_result ma_device_write__winmm(ma_device* pDevice, const void* pPCMFram } } - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = totalFramesWritten; } @@ -27955,10 +27955,10 @@ static ma_result ma_device_read__winmm(ma_device* pDevice, void* pPCMFrames, ma_ ma_uint32 totalFramesRead; MA_WAVEHDR* pWAVEHDR; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pPCMFrames != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pPCMFrames != nullptr); - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -28030,7 +28030,7 @@ static ma_result ma_device_read__winmm(ma_device* pDevice, void* pPCMFrames, ma_ } } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesRead; } @@ -28039,7 +28039,7 @@ static ma_result ma_device_read__winmm(ma_device* pDevice, void* pPCMFrames, ma_ static ma_result ma_context_uninit__winmm(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_winmm); ma_dlclose(ma_context_get_log(pContext), pContext->winmm.hWinMM); @@ -28048,12 +28048,12 @@ static ma_result ma_context_uninit__winmm(ma_context* pContext) static ma_result ma_context_init__winmm(ma_context* pContext, const ma_context_config* pConfig, ma_backend_callbacks* pCallbacks) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); (void)pConfig; pContext->winmm.hWinMM = ma_dlopen(ma_context_get_log(pContext), "winmm.dll"); - if (pContext->winmm.hWinMM == NULL) { + if (pContext->winmm.hWinMM == nullptr) { return MA_NO_BACKEND; } @@ -28085,7 +28085,7 @@ static ma_result ma_context_init__winmm(ma_context* pContext, const ma_context_c pCallbacks->onDeviceStop = ma_device_stop__winmm; pCallbacks->onDeviceRead = ma_device_read__winmm; pCallbacks->onDeviceWrite = ma_device_write__winmm; - pCallbacks->onDeviceDataLoop = NULL; /* This is a blocking read-write API, so this can be NULL since miniaudio will manage the audio thread for us. */ + pCallbacks->onDeviceDataLoop = nullptr; /* This is a blocking read-write API, so this can be nullptr since miniaudio will manage the audio thread for us. */ return MA_SUCCESS; } @@ -28546,7 +28546,7 @@ static const char* ma_find_char(const char* str, char c, int* index) for (;;) { if (str[i] == '\0') { if (index) *index = -1; - return NULL; + return nullptr; } if (str[i] == c) { @@ -28559,7 +28559,7 @@ static const char* ma_find_char(const char* str, char c, int* index) /* Should never get here, but treat it as though the character was not found to make me feel better inside. */ if (index) *index = -1; - return NULL; + return nullptr; } static ma_bool32 ma_is_device_name_in_hw_format__alsa(const char* hwid) @@ -28570,7 +28570,7 @@ static ma_bool32 ma_is_device_name_in_hw_format__alsa(const char* hwid) const char* dev; int i; - if (hwid == NULL) { + if (hwid == nullptr) { return MA_FALSE; } @@ -28581,7 +28581,7 @@ static ma_bool32 ma_is_device_name_in_hw_format__alsa(const char* hwid) hwid += 3; dev = ma_find_char(hwid, ',', &commaPos); - if (dev == NULL) { + if (dev == nullptr) { return MA_FALSE; } else { dev += 1; /* Skip past the ",". */ @@ -28616,7 +28616,7 @@ static int ma_convert_device_name_to_hw_format__alsa(ma_context* pContext, char* const char* dev; int cardIndex; - if (dst == NULL) { + if (dst == nullptr) { return -1; } if (dstSize < 7) { @@ -28624,7 +28624,7 @@ static int ma_convert_device_name_to_hw_format__alsa(ma_context* pContext, char* } *dst = '\0'; /* Safety. */ - if (src == NULL) { + if (src == nullptr) { return -1; } @@ -28634,12 +28634,12 @@ static int ma_convert_device_name_to_hw_format__alsa(ma_context* pContext, char* } src = ma_find_char(src, ':', &colonPos); - if (src == NULL) { + if (src == nullptr) { return -1; /* Couldn't find a colon */ } dev = ma_find_char(src, ',', &commaPos); - if (dev == NULL) { + if (dev == nullptr) { dev = "0"; ma_strncpy_s(card, sizeof(card), src+6, (size_t)-1); /* +6 = ":CARD=" */ } else { @@ -28672,7 +28672,7 @@ static ma_bool32 ma_does_id_exist_in_list__alsa(ma_device_id* pUniqueIDs, ma_uin { ma_uint32 i; - MA_ASSERT(pHWID != NULL); + MA_ASSERT(pHWID != nullptr); for (i = 0; i < count; ++i) { if (ma_strcmp(pUniqueIDs[i].alsa, pHWID) == 0) { @@ -28689,15 +28689,15 @@ static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode s ma_snd_pcm_t* pPCM; ma_snd_pcm_stream_t stream; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppPCM != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppPCM != nullptr); - *ppPCM = NULL; - pPCM = NULL; + *ppPCM = nullptr; + pPCM = nullptr; stream = (deviceType == ma_device_type_playback) ? MA_SND_PCM_STREAM_PLAYBACK : MA_SND_PCM_STREAM_CAPTURE; - if (pDeviceID == NULL) { + if (pDeviceID == nullptr) { ma_bool32 isDeviceOpen; size_t i; @@ -28707,12 +28707,12 @@ static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode s */ const char* defaultDeviceNames[] = { "default", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr }; if (shareMode == ma_share_mode_exclusive) { @@ -28736,7 +28736,7 @@ static ma_result ma_context_open_pcm__alsa(ma_context* pContext, ma_share_mode s isDeviceOpen = MA_FALSE; for (i = 0; i < ma_countof(defaultDeviceNames); ++i) { - if (defaultDeviceNames[i] != NULL && defaultDeviceNames[i][0] != '\0') { + if (defaultDeviceNames[i] != nullptr && defaultDeviceNames[i][0] != '\0') { if (((ma_snd_pcm_open_proc)pContext->alsa.snd_pcm_open)(&pPCM, defaultDeviceNames[i], stream, openMode) == 0) { isDeviceOpen = MA_TRUE; break; @@ -28809,12 +28809,12 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu int resultALSA; ma_bool32 cbResult = MA_TRUE; char** ppDeviceHints; - ma_device_id* pUniqueIDs = NULL; + ma_device_id* pUniqueIDs = nullptr; ma_uint32 uniqueIDCount = 0; char** ppNextDeviceHint; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); ma_mutex_lock(&pContext->alsa.internalDeviceEnumLock); @@ -28825,7 +28825,7 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu } ppNextDeviceHint = ppDeviceHints; - while (*ppNextDeviceHint != NULL) { + while (*ppNextDeviceHint != nullptr) { char* NAME = ((ma_snd_device_name_get_hint_proc)pContext->alsa.snd_device_name_get_hint)(*ppNextDeviceHint, "NAME"); char* DESC = ((ma_snd_device_name_get_hint_proc)pContext->alsa.snd_device_name_get_hint)(*ppNextDeviceHint, "DESC"); char* IOID = ((ma_snd_device_name_get_hint_proc)pContext->alsa.snd_device_name_get_hint)(*ppNextDeviceHint, "IOID"); @@ -28834,14 +28834,14 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu char hwid[sizeof(pUniqueIDs->alsa)]; ma_device_info deviceInfo; - if ((IOID == NULL || ma_strcmp(IOID, "Output") == 0)) { + if ((IOID == nullptr || ma_strcmp(IOID, "Output") == 0)) { deviceType = ma_device_type_playback; } - if ((IOID != NULL && ma_strcmp(IOID, "Input" ) == 0)) { + if ((IOID != nullptr && ma_strcmp(IOID, "Input" ) == 0)) { deviceType = ma_device_type_capture; } - if (NAME != NULL) { + if (NAME != nullptr) { if (pContext->alsa.useVerboseDeviceEnumeration) { /* Verbose mode. Use the name exactly as-is. */ ma_strncpy_s(hwid, sizeof(hwid), NAME, (size_t)-1); @@ -28868,7 +28868,7 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu /* The device has not yet been enumerated. Make sure it's added to our list so that it's not enumerated again. */ size_t newCapacity = sizeof(*pUniqueIDs) * (uniqueIDCount + 1); ma_device_id* pNewUniqueIDs = (ma_device_id*)ma_realloc(pUniqueIDs, newCapacity, &pContext->allocationCallbacks); - if (pNewUniqueIDs == NULL) { + if (pNewUniqueIDs == nullptr) { goto next_device; /* Failed to allocate memory. */ } @@ -28904,10 +28904,10 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu it makes formatting ugly and annoying. I'm therefore deciding to put it all on a single line with the second line being put into parentheses. In simplified mode I'm just stripping the second line entirely. */ - if (DESC != NULL) { + if (DESC != nullptr) { int lfPos; const char* line2 = ma_find_char(DESC, '\n', &lfPos); - if (line2 != NULL) { + if (line2 != nullptr) { line2 += 1; /* Skip past the new-line character. */ if (pContext->alsa.useVerboseDeviceEnumeration) { @@ -28932,11 +28932,11 @@ static ma_result ma_context_enumerate_devices__alsa(ma_context* pContext, ma_enu /* Some devices are both playback and capture, but they are only enumerated by ALSA once. We need to fire the callback - again for the other device type in this case. We do this for known devices and where the IOID hint is NULL, which + again for the other device type in this case. We do this for known devices and where the IOID hint is nullptr, which means both Input and Output. */ if (cbResult) { - if (ma_is_common_device_name__alsa(NAME) || IOID == NULL) { + if (ma_is_common_device_name__alsa(NAME) || IOID == nullptr) { if (deviceType == ma_device_type_playback) { if (!ma_is_capture_device_blacklisted__alsa(NAME)) { cbResult = callback(pContext, ma_device_type_capture, &deviceInfo, pUserData); @@ -28986,15 +28986,15 @@ typedef struct static ma_bool32 ma_context_get_device_info_enum_callback__alsa(ma_context* pContext, ma_device_type deviceType, const ma_device_info* pDeviceInfo, void* pUserData) { ma_context_get_device_info_enum_callback_data__alsa* pData = (ma_context_get_device_info_enum_callback_data__alsa*)pUserData; - MA_ASSERT(pData != NULL); + MA_ASSERT(pData != nullptr); (void)pContext; - if (pData->pDeviceID == NULL && ma_strcmp(pDeviceInfo->id.alsa, "default") == 0) { + if (pData->pDeviceID == nullptr && ma_strcmp(pDeviceInfo->id.alsa, "default") == 0) { ma_strncpy_s(pData->pDeviceInfo->name, sizeof(pData->pDeviceInfo->name), pDeviceInfo->name, (size_t)-1); pData->foundDevice = MA_TRUE; } else { - if (pData->deviceType == deviceType && (pData->pDeviceID != NULL && ma_strcmp(pData->pDeviceID->alsa, pDeviceInfo->id.alsa) == 0)) { + if (pData->deviceType == deviceType && (pData->pDeviceID != nullptr && ma_strcmp(pData->pDeviceID->alsa, pDeviceInfo->id.alsa) == 0)) { ma_strncpy_s(pData->pDeviceInfo->name, sizeof(pData->pDeviceInfo->name), pDeviceInfo->name, (size_t)-1); pData->foundDevice = MA_TRUE; } @@ -29006,9 +29006,9 @@ static ma_bool32 ma_context_get_device_info_enum_callback__alsa(ma_context* pCon static void ma_context_test_rate_and_add_native_data_format__alsa(ma_context* pContext, ma_snd_pcm_t* pPCM, ma_snd_pcm_hw_params_t* pHWParams, ma_format format, ma_uint32 channels, ma_uint32 sampleRate, ma_uint32 flags, ma_device_info* pDeviceInfo) { - MA_ASSERT(pPCM != NULL); - MA_ASSERT(pHWParams != NULL); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pPCM != nullptr); + MA_ASSERT(pHWParams != nullptr); + MA_ASSERT(pDeviceInfo != nullptr); if (pDeviceInfo->nativeDataFormatCount < ma_countof(pDeviceInfo->nativeDataFormats) && ((ma_snd_pcm_hw_params_test_rate_proc)pContext->alsa.snd_pcm_hw_params_test_rate)(pPCM, pHWParams, sampleRate, 0) == 0) { pDeviceInfo->nativeDataFormats[pDeviceInfo->nativeDataFormatCount].format = format; @@ -29062,7 +29062,7 @@ static ma_result ma_context_get_device_info__alsa(ma_context* pContext, ma_devic ma_uint32 iFormat; ma_uint32 iChannel; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); /* We just enumerate to find basic information about the device. */ data.deviceType = deviceType; @@ -29090,7 +29090,7 @@ static ma_result ma_context_get_device_info__alsa(ma_context* pContext, ma_devic /* We need to initialize a HW parameters object in order to know what formats are supported. */ pHWParams = (ma_snd_pcm_hw_params_t*)ma_calloc(((ma_snd_pcm_hw_params_sizeof_proc)pContext->alsa.snd_pcm_hw_params_sizeof)(), &pContext->allocationCallbacks); - if (pHWParams == NULL) { + if (pHWParams == nullptr) { ((ma_snd_pcm_close_proc)pContext->alsa.snd_pcm_close)(pPCM); return MA_OUT_OF_MEMORY; } @@ -29192,7 +29192,7 @@ static ma_result ma_context_get_device_info__alsa(ma_context* pContext, ma_devic static ma_result ma_device_uninit__alsa(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if ((ma_snd_pcm_t*)pDevice->alsa.pPCMCapture) { ((ma_snd_pcm_close_proc)pDevice->pContext->alsa.snd_pcm_close)((ma_snd_pcm_t*)pDevice->alsa.pPCMCapture); @@ -29230,9 +29230,9 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic struct pollfd* pPollDescriptors; int wakeupfd; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); MA_ASSERT(deviceType != ma_device_type_duplex); /* This function should only be called for playback _or_ capture, never duplex. */ - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); formatALSA = ma_convert_ma_format_to_alsa_format(pDescriptor->format); @@ -29255,7 +29255,7 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic /* Hardware parameters. */ pHWParams = (ma_snd_pcm_hw_params_t*)ma_calloc(((ma_snd_pcm_hw_params_sizeof_proc)pDevice->pContext->alsa.snd_pcm_hw_params_sizeof)(), &pDevice->pContext->allocationCallbacks); - if (pHWParams == NULL) { + if (pHWParams == nullptr) { ((ma_snd_pcm_close_proc)pDevice->pContext->alsa.snd_pcm_close)(pPCM); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[ALSA] Failed to allocate memory for hardware parameters."); return MA_OUT_OF_MEMORY; @@ -29400,7 +29400,7 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic { ma_uint32 periods = pDescriptor->periodCount; - resultALSA = ((ma_snd_pcm_hw_params_set_periods_near_proc)pDevice->pContext->alsa.snd_pcm_hw_params_set_periods_near)(pPCM, pHWParams, &periods, NULL); + resultALSA = ((ma_snd_pcm_hw_params_set_periods_near_proc)pDevice->pContext->alsa.snd_pcm_hw_params_set_periods_near)(pPCM, pHWParams, &periods, nullptr); if (resultALSA < 0) { ma_free(pHWParams, &pDevice->pContext->allocationCallbacks); ((ma_snd_pcm_close_proc)pDevice->pContext->alsa.snd_pcm_close)(pPCM); @@ -29436,12 +29436,12 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic } ma_free(pHWParams, &pDevice->pContext->allocationCallbacks); - pHWParams = NULL; + pHWParams = nullptr; /* Software parameters. */ pSWParams = (ma_snd_pcm_sw_params_t*)ma_calloc(((ma_snd_pcm_sw_params_sizeof_proc)pDevice->pContext->alsa.snd_pcm_sw_params_sizeof)(), &pDevice->pContext->allocationCallbacks); - if (pSWParams == NULL) { + if (pSWParams == nullptr) { ((ma_snd_pcm_close_proc)pDevice->pContext->alsa.snd_pcm_close)(pPCM); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[ALSA] Failed to allocate memory for software parameters."); return MA_OUT_OF_MEMORY; @@ -29499,17 +29499,17 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic } ma_free(pSWParams, &pDevice->pContext->allocationCallbacks); - pSWParams = NULL; + pSWParams = nullptr; /* Grab the internal channel map. For now we're not going to bother trying to change the channel map and instead just do it ourselves. */ { - ma_snd_pcm_chmap_t* pChmap = NULL; - if (pDevice->pContext->alsa.snd_pcm_get_chmap != NULL) { + ma_snd_pcm_chmap_t* pChmap = nullptr; + if (pDevice->pContext->alsa.snd_pcm_get_chmap != nullptr) { pChmap = ((ma_snd_pcm_get_chmap_proc)pDevice->pContext->alsa.snd_pcm_get_chmap)(pPCM); } - if (pChmap != NULL) { + if (pChmap != nullptr) { ma_uint32 iChannel; /* There are cases where the returned channel map can have a different channel count than was returned by snd_pcm_hw_params_set_channels_near(). */ @@ -29553,7 +29553,7 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic } free(pChmap); - pChmap = NULL; + pChmap = nullptr; } else { /* Could not retrieve the channel map. Fall back to a hard-coded assumption. */ ma_channel_map_init_standard(ma_standard_channel_map_alsa, internalChannelMap, ma_countof(internalChannelMap), internalChannels); @@ -29574,7 +29574,7 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic } pPollDescriptors = (struct pollfd*)ma_malloc(sizeof(*pPollDescriptors) * (pollDescriptorCount + 1), &pDevice->pContext->allocationCallbacks); /* +1 because we want room for the wakeup descriptor. */ - if (pPollDescriptors == NULL) { + if (pPollDescriptors == nullptr) { ((ma_snd_pcm_close_proc)pDevice->pContext->alsa.snd_pcm_close)(pPCM); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[ALSA] Failed to allocate memory for poll descriptors."); return MA_OUT_OF_MEMORY; @@ -29649,7 +29649,7 @@ static ma_result ma_device_init_by_type__alsa(ma_device* pDevice, const ma_devic static ma_result ma_device_init__alsa(ma_device* pDevice, const ma_device_config* pConfig, ma_device_descriptor* pDescriptorPlayback, ma_device_descriptor* pDescriptorCapture) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->alsa); @@ -29843,10 +29843,10 @@ static ma_result ma_device_read__alsa(ma_device* pDevice, void* pFramesOut, ma_u { ma_snd_pcm_sframes_t resultALSA = 0; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pFramesOut != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pFramesOut != nullptr); - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -29888,7 +29888,7 @@ static ma_result ma_device_read__alsa(ma_device* pDevice, void* pFramesOut, ma_u } } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = resultALSA; } @@ -29899,10 +29899,10 @@ static ma_result ma_device_write__alsa(ma_device* pDevice, const void* pFrames, { ma_snd_pcm_sframes_t resultALSA = 0; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pFrames != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pFrames != nullptr); - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = 0; } @@ -29950,7 +29950,7 @@ static ma_result ma_device_write__alsa(ma_device* pDevice, const void* pFrames, } } - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = resultALSA; } @@ -29962,15 +29962,15 @@ static ma_result ma_device_data_loop_wakeup__alsa(ma_device* pDevice) ma_uint64 t = 1; int resultWrite = 0; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[ALSA] Waking up...\n"); /* Write to an eventfd to trigger a wakeup from poll() and abort any reading or writing. */ - if (pDevice->alsa.pPollDescriptorsCapture != NULL) { + if (pDevice->alsa.pPollDescriptorsCapture != nullptr) { resultWrite = write(pDevice->alsa.wakeupfdCapture, &t, sizeof(t)); } - if (pDevice->alsa.pPollDescriptorsPlayback != NULL) { + if (pDevice->alsa.pPollDescriptorsPlayback != nullptr) { resultWrite = write(pDevice->alsa.wakeupfdPlayback, &t, sizeof(t)); } @@ -29986,7 +29986,7 @@ static ma_result ma_device_data_loop_wakeup__alsa(ma_device* pDevice) static ma_result ma_context_uninit__alsa(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_alsa); /* Clean up memory for memory leak checkers. */ @@ -30013,12 +30013,12 @@ static ma_result ma_context_init__alsa(ma_context* pContext, const ma_context_co for (i = 0; i < ma_countof(libasoundNames); ++i) { pContext->alsa.asoundSO = ma_dlopen(ma_context_get_log(pContext), libasoundNames[i]); - if (pContext->alsa.asoundSO != NULL) { + if (pContext->alsa.asoundSO != nullptr) { break; } } - if (pContext->alsa.asoundSO == NULL) { + if (pContext->alsa.asoundSO == nullptr) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_DEBUG, "[ALSA] Failed to open shared object.\n"); return MA_NO_BACKEND; } @@ -30246,7 +30246,7 @@ static ma_result ma_context_init__alsa(ma_context* pContext, const ma_context_co pCallbacks->onDeviceStop = ma_device_stop__alsa; pCallbacks->onDeviceRead = ma_device_read__alsa; pCallbacks->onDeviceWrite = ma_device_write__alsa; - pCallbacks->onDeviceDataLoop = NULL; + pCallbacks->onDeviceDataLoop = nullptr; pCallbacks->onDeviceDataLoopWakeup = ma_device_data_loop_wakeup__alsa; return MA_SUCCESS; @@ -31131,8 +31131,8 @@ static ma_result ma_wait_for_operation__pulse(ma_context* pContext, ma_ptr pMain int resultPA; ma_pa_operation_state_t state; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pOP != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pOP != nullptr); for (;;) { state = ((ma_pa_operation_get_state_proc)pContext->pulse.pa_operation_get_state)(pOP); @@ -31140,7 +31140,7 @@ static ma_result ma_wait_for_operation__pulse(ma_context* pContext, ma_ptr pMain break; /* Done. */ } - resultPA = ((ma_pa_mainloop_iterate_proc)pContext->pulse.pa_mainloop_iterate)((ma_pa_mainloop*)pMainLoop, 1, NULL); + resultPA = ((ma_pa_mainloop_iterate_proc)pContext->pulse.pa_mainloop_iterate)((ma_pa_mainloop*)pMainLoop, 1, nullptr); if (resultPA < 0) { return ma_result_from_pulse(resultPA); } @@ -31153,7 +31153,7 @@ static ma_result ma_wait_for_operation_and_unref__pulse(ma_context* pContext, ma { ma_result result; - if (pOP == NULL) { + if (pOP == nullptr) { return MA_INVALID_ARGS; } @@ -31179,7 +31179,7 @@ static ma_result ma_wait_for_pa_context_to_connect__pulse(ma_context* pContext, return MA_ERROR; } - resultPA = ((ma_pa_mainloop_iterate_proc)pContext->pulse.pa_mainloop_iterate)((ma_pa_mainloop*)pMainLoop, 1, NULL); + resultPA = ((ma_pa_mainloop_iterate_proc)pContext->pulse.pa_mainloop_iterate)((ma_pa_mainloop*)pMainLoop, 1, nullptr); if (resultPA < 0) { return ma_result_from_pulse(resultPA); } @@ -31205,7 +31205,7 @@ static ma_result ma_wait_for_pa_stream_to_connect__pulse(ma_context* pContext, m return MA_ERROR; } - resultPA = ((ma_pa_mainloop_iterate_proc)pContext->pulse.pa_mainloop_iterate)((ma_pa_mainloop*)pMainLoop, 1, NULL); + resultPA = ((ma_pa_mainloop_iterate_proc)pContext->pulse.pa_mainloop_iterate)((ma_pa_mainloop*)pMainLoop, 1, nullptr); if (resultPA < 0) { return ma_result_from_pulse(resultPA); } @@ -31221,25 +31221,25 @@ static ma_result ma_init_pa_mainloop_and_pa_context__pulse(ma_context* pContext, ma_ptr pMainLoop; ma_ptr pPulseContext; - MA_ASSERT(ppMainLoop != NULL); - MA_ASSERT(ppPulseContext != NULL); + MA_ASSERT(ppMainLoop != nullptr); + MA_ASSERT(ppPulseContext != nullptr); /* The PulseAudio context maps well to miniaudio's notion of a context. The pa_context object will be initialized as part of the ma_context. */ pMainLoop = ((ma_pa_mainloop_new_proc)pContext->pulse.pa_mainloop_new)(); - if (pMainLoop == NULL) { + if (pMainLoop == nullptr) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to create mainloop."); return MA_FAILED_TO_INIT_BACKEND; } pPulseContext = ((ma_pa_context_new_proc)pContext->pulse.pa_context_new)(((ma_pa_mainloop_get_api_proc)pContext->pulse.pa_mainloop_get_api)((ma_pa_mainloop*)pMainLoop), pApplicationName); - if (pPulseContext == NULL) { + if (pPulseContext == nullptr) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to create PulseAudio context."); ((ma_pa_mainloop_free_proc)pContext->pulse.pa_mainloop_free)((ma_pa_mainloop*)(pMainLoop)); return MA_FAILED_TO_INIT_BACKEND; } /* Now we need to connect to the context. Everything is asynchronous so we need to wait for it to connect before returning. */ - result = ma_result_from_pulse(((ma_pa_context_connect_proc)pContext->pulse.pa_context_connect)((ma_pa_context*)pPulseContext, pServerName, (tryAutoSpawn) ? MA_PA_CONTEXT_NOFLAGS : MA_PA_CONTEXT_NOAUTOSPAWN, NULL)); + result = ma_result_from_pulse(((ma_pa_context_connect_proc)pContext->pulse.pa_context_connect)((ma_pa_context*)pPulseContext, pServerName, (tryAutoSpawn) ? MA_PA_CONTEXT_NOFLAGS : MA_PA_CONTEXT_NOAUTOSPAWN, nullptr)); if (result != MA_SUCCESS) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to connect PulseAudio context."); ((ma_pa_context_unref_proc)pContext->pulse.pa_context_unref)((ma_pa_context*)(pPulseContext)); @@ -31275,12 +31275,12 @@ static void ma_device_sink_info_callback(ma_pa_context* pPulseContext, const ma_ There has been a report that indicates that pInfo can be null which results in a null pointer dereference below. We'll check for this for safety. */ - if (pInfo == NULL) { + if (pInfo == nullptr) { return; } pInfoOut = (ma_pa_sink_info*)pUserData; - MA_ASSERT(pInfoOut != NULL); + MA_ASSERT(pInfoOut != nullptr); *pInfoOut = *pInfo; @@ -31299,12 +31299,12 @@ static void ma_device_source_info_callback(ma_pa_context* pPulseContext, const m There has been a report that indicates that pInfo can be null which results in a null pointer dereference below. We'll check for this for safety. */ - if (pInfo == NULL) { + if (pInfo == nullptr) { return; } pInfoOut = (ma_pa_source_info*)pUserData; - MA_ASSERT(pInfoOut != NULL); + MA_ASSERT(pInfoOut != nullptr); *pInfoOut = *pInfo; @@ -31321,7 +31321,7 @@ static void ma_device_sink_name_callback(ma_pa_context* pPulseContext, const ma_ } pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_strncpy_s(pDevice->playback.name, sizeof(pDevice->playback.name), pInfo->description, (size_t)-1); @@ -31337,7 +31337,7 @@ static void ma_device_source_name_callback(ma_pa_context* pPulseContext, const m } pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_strncpy_s(pDevice->capture.name, sizeof(pDevice->capture.name), pInfo->description, (size_t)-1); @@ -31350,7 +31350,7 @@ static ma_result ma_context_get_sink_info__pulse(ma_context* pContext, const cha ma_pa_operation* pOP; pOP = ((ma_pa_context_get_sink_info_by_name_proc)pContext->pulse.pa_context_get_sink_info_by_name)((ma_pa_context*)pContext->pulse.pPulseContext, pDeviceName, ma_device_sink_info_callback, pSinkInfo); - if (pOP == NULL) { + if (pOP == nullptr) { return MA_ERROR; } @@ -31362,7 +31362,7 @@ static ma_result ma_context_get_source_info__pulse(ma_context* pContext, const c ma_pa_operation* pOP; pOP = ((ma_pa_context_get_source_info_by_name_proc)pContext->pulse.pa_context_get_source_info_by_name)((ma_pa_context*)pContext->pulse.pPulseContext, pDeviceName, ma_device_source_info_callback, pSourceInfo); - if (pOP == NULL) { + if (pOP == nullptr) { return MA_ERROR; } @@ -31373,33 +31373,33 @@ static ma_result ma_context_get_default_device_index__pulse(ma_context* pContext { ma_result result; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pIndex != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pIndex != nullptr); - if (pIndex != NULL) { + if (pIndex != nullptr) { *pIndex = (ma_uint32)-1; } if (deviceType == ma_device_type_playback) { ma_pa_sink_info sinkInfo; - result = ma_context_get_sink_info__pulse(pContext, NULL, &sinkInfo); + result = ma_context_get_sink_info__pulse(pContext, nullptr, &sinkInfo); if (result != MA_SUCCESS) { return result; } - if (pIndex != NULL) { + if (pIndex != nullptr) { *pIndex = sinkInfo.index; } } if (deviceType == ma_device_type_capture) { ma_pa_source_info sourceInfo; - result = ma_context_get_source_info__pulse(pContext, NULL, &sourceInfo); + result = ma_context_get_source_info__pulse(pContext, nullptr, &sourceInfo); if (result != MA_SUCCESS) { return result; } - if (pIndex != NULL) { + if (pIndex != nullptr) { *pIndex = sourceInfo.index; } } @@ -31423,7 +31423,7 @@ static void ma_context_enumerate_devices_sink_callback__pulse(ma_pa_context* pPu ma_context_enumerate_devices_callback_data__pulse* pData = (ma_context_enumerate_devices_callback_data__pulse*)pUserData; ma_device_info deviceInfo; - MA_ASSERT(pData != NULL); + MA_ASSERT(pData != nullptr); if (endOfList || pData->isTerminated) { return; @@ -31432,12 +31432,12 @@ static void ma_context_enumerate_devices_sink_callback__pulse(ma_pa_context* pPu MA_ZERO_OBJECT(&deviceInfo); /* The name from PulseAudio is the ID for miniaudio. */ - if (pSinkInfo->name != NULL) { + if (pSinkInfo->name != nullptr) { ma_strncpy_s(deviceInfo.id.pulse, sizeof(deviceInfo.id.pulse), pSinkInfo->name, (size_t)-1); } /* The description from PulseAudio is the name for miniaudio. */ - if (pSinkInfo->description != NULL) { + if (pSinkInfo->description != nullptr) { ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), pSinkInfo->description, (size_t)-1); } @@ -31455,7 +31455,7 @@ static void ma_context_enumerate_devices_source_callback__pulse(ma_pa_context* p ma_context_enumerate_devices_callback_data__pulse* pData = (ma_context_enumerate_devices_callback_data__pulse*)pUserData; ma_device_info deviceInfo; - MA_ASSERT(pData != NULL); + MA_ASSERT(pData != nullptr); if (endOfList || pData->isTerminated) { return; @@ -31464,12 +31464,12 @@ static void ma_context_enumerate_devices_source_callback__pulse(ma_pa_context* p MA_ZERO_OBJECT(&deviceInfo); /* The name from PulseAudio is the ID for miniaudio. */ - if (pSourceInfo->name != NULL) { + if (pSourceInfo->name != nullptr) { ma_strncpy_s(deviceInfo.id.pulse, sizeof(deviceInfo.id.pulse), pSourceInfo->name, (size_t)-1); } /* The description from PulseAudio is the name for miniaudio. */ - if (pSourceInfo->description != NULL) { + if (pSourceInfo->description != nullptr) { ma_strncpy_s(deviceInfo.name, sizeof(deviceInfo.name), pSourceInfo->description, (size_t)-1); } @@ -31486,10 +31486,10 @@ static ma_result ma_context_enumerate_devices__pulse(ma_context* pContext, ma_en { ma_result result = MA_SUCCESS; ma_context_enumerate_devices_callback_data__pulse callbackData; - ma_pa_operation* pOP = NULL; + ma_pa_operation* pOP = nullptr; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); callbackData.pContext = pContext; callbackData.callback = callback; @@ -31505,7 +31505,7 @@ static ma_result ma_context_enumerate_devices__pulse(ma_context* pContext, ma_en /* Playback. */ if (!callbackData.isTerminated) { pOP = ((ma_pa_context_get_sink_info_list_proc)pContext->pulse.pa_context_get_sink_info_list)((ma_pa_context*)(pContext->pulse.pPulseContext), ma_context_enumerate_devices_sink_callback__pulse, &callbackData); - if (pOP == NULL) { + if (pOP == nullptr) { result = MA_ERROR; goto done; } @@ -31522,7 +31522,7 @@ static ma_result ma_context_enumerate_devices__pulse(ma_context* pContext, ma_en /* Capture. */ if (!callbackData.isTerminated) { pOP = ((ma_pa_context_get_source_info_list_proc)pContext->pulse.pa_context_get_source_info_list)((ma_pa_context*)(pContext->pulse.pPulseContext), ma_context_enumerate_devices_source_callback__pulse, &callbackData); - if (pOP == NULL) { + if (pOP == nullptr) { result = MA_ERROR; goto done; } @@ -31555,14 +31555,14 @@ static void ma_context_get_device_info_sink_callback__pulse(ma_pa_context* pPuls return; } - MA_ASSERT(pData != NULL); + MA_ASSERT(pData != nullptr); pData->foundDevice = MA_TRUE; - if (pInfo->name != NULL) { + if (pInfo->name != nullptr) { ma_strncpy_s(pData->pDeviceInfo->id.pulse, sizeof(pData->pDeviceInfo->id.pulse), pInfo->name, (size_t)-1); } - if (pInfo->description != NULL) { + if (pInfo->description != nullptr) { ma_strncpy_s(pData->pDeviceInfo->name, sizeof(pData->pDeviceInfo->name), pInfo->description, (size_t)-1); } @@ -31592,14 +31592,14 @@ static void ma_context_get_device_info_source_callback__pulse(ma_pa_context* pPu return; } - MA_ASSERT(pData != NULL); + MA_ASSERT(pData != nullptr); pData->foundDevice = MA_TRUE; - if (pInfo->name != NULL) { + if (pInfo->name != nullptr) { ma_strncpy_s(pData->pDeviceInfo->id.pulse, sizeof(pData->pDeviceInfo->id.pulse), pInfo->name, (size_t)-1); } - if (pInfo->description != NULL) { + if (pInfo->description != nullptr) { ma_strncpy_s(pData->pDeviceInfo->name, sizeof(pData->pDeviceInfo->name), pInfo->description, (size_t)-1); } @@ -31625,18 +31625,18 @@ static ma_result ma_context_get_device_info__pulse(ma_context* pContext, ma_devi { ma_result result = MA_SUCCESS; ma_context_get_device_info_callback_data__pulse callbackData; - ma_pa_operation* pOP = NULL; - const char* pDeviceName = NULL; + ma_pa_operation* pOP = nullptr; + const char* pDeviceName = nullptr; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); callbackData.pDeviceInfo = pDeviceInfo; callbackData.foundDevice = MA_FALSE; - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { pDeviceName = pDeviceID->pulse; } else { - pDeviceName = NULL; + pDeviceName = nullptr; } result = ma_context_get_default_device_index__pulse(pContext, deviceType, &callbackData.defaultDeviceIndex); @@ -31647,7 +31647,7 @@ static ma_result ma_context_get_device_info__pulse(ma_context* pContext, ma_devi pOP = ((ma_pa_context_get_source_info_by_name_proc)pContext->pulse.pa_context_get_source_info_by_name)((ma_pa_context*)(pContext->pulse.pPulseContext), pDeviceName, ma_context_get_device_info_source_callback__pulse, &callbackData); } - if (pOP != NULL) { + if (pOP != nullptr) { ma_wait_for_operation_and_unref__pulse(pContext, pContext->pulse.pMainLoop, pOP); } else { result = MA_ERROR; @@ -31667,10 +31667,10 @@ static ma_result ma_device_uninit__pulse(ma_device* pDevice) { ma_context* pContext; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); pContext = pDevice->pContext; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { ((ma_pa_stream_disconnect_proc)pContext->pulse.pa_stream_disconnect)((ma_pa_stream*)pDevice->pulse.pStreamCapture); @@ -31710,7 +31710,7 @@ static ma_pa_stream* ma_device__pa_stream_new__pulse(ma_device* pDevice, const c static ma_atomic_uint32 g_StreamCounter = { 0 }; char actualStreamName[256]; - if (pStreamName != NULL) { + if (pStreamName != nullptr) { ma_strncpy_s(actualStreamName, sizeof(actualStreamName), pStreamName, (size_t)-1); } else { const char* pBaseName = "miniaudio:"; @@ -31732,7 +31732,7 @@ static void ma_device_on_read__pulse(ma_pa_stream* pStream, size_t byteCount, vo ma_uint64 frameCount; ma_uint64 framesProcessed; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Don't do anything if the device isn't initialized yet. Yes, this can happen because PulseAudio @@ -31761,8 +31761,8 @@ static void ma_device_on_read__pulse(ma_pa_stream* pStream, size_t byteCount, vo framesMapped = bytesMapped / bpf; if (framesMapped > 0) { - if (pMappedPCMFrames != NULL) { - ma_device_handle_backend_data_callback(pDevice, NULL, pMappedPCMFrames, framesMapped); + if (pMappedPCMFrames != nullptr) { + ma_device_handle_backend_data_callback(pDevice, nullptr, pMappedPCMFrames, framesMapped); } else { /* It's a hole. */ ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[PulseAudio] ma_device_on_read__pulse: Hole.\n"); @@ -31790,8 +31790,8 @@ static ma_result ma_device_write_to_stream__pulse(ma_device* pDevice, ma_pa_stre ma_uint32 bpf; ma_uint32 deviceState; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pStream != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pStream != nullptr); bpf = ma_get_bytes_per_frame(pDevice->playback.internalFormat, pDevice->playback.internalChannels); MA_ASSERT(bpf > 0); @@ -31812,13 +31812,13 @@ static ma_result ma_device_write_to_stream__pulse(ma_device* pDevice, ma_pa_stre framesMapped = bytesMapped / bpf; if (deviceState == ma_device_state_started || deviceState == ma_device_state_starting) { /* Check for starting state just in case this is being used to do the initial fill. */ - ma_device_handle_backend_data_callback(pDevice, pMappedPCMFrames, NULL, framesMapped); + ma_device_handle_backend_data_callback(pDevice, pMappedPCMFrames, nullptr, framesMapped); } else { /* Device is not started. Write silence. */ ma_silence_pcm_frames(pMappedPCMFrames, framesMapped, pDevice->playback.format, pDevice->playback.channels); } - pulseResult = ((ma_pa_stream_write_proc)pDevice->pContext->pulse.pa_stream_write)(pStream, pMappedPCMFrames, bytesMapped, NULL, 0, MA_PA_SEEK_RELATIVE); + pulseResult = ((ma_pa_stream_write_proc)pDevice->pContext->pulse.pa_stream_write)(pStream, pMappedPCMFrames, bytesMapped, nullptr, 0, MA_PA_SEEK_RELATIVE); if (pulseResult < 0) { result = ma_result_from_pulse(pulseResult); goto done; /* Failed to write data to stream. */ @@ -31835,7 +31835,7 @@ static ma_result ma_device_write_to_stream__pulse(ma_device* pDevice, ma_pa_stre } done: - if (pFramesProcessed != NULL) { + if (pFramesProcessed != nullptr) { *pFramesProcessed = framesProcessed; } @@ -31851,7 +31851,7 @@ static void ma_device_on_write__pulse(ma_pa_stream* pStream, size_t byteCount, v ma_uint32 deviceState; ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Don't do anything if the device isn't initialized yet. Yes, this can happen because PulseAudio @@ -31960,8 +31960,8 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ma_result result = MA_SUCCESS; int error = 0; - const char* devPlayback = NULL; - const char* devCapture = NULL; + const char* devPlayback = nullptr; + const char* devCapture = nullptr; ma_format format = ma_format_unknown; ma_uint32 channels = 0; ma_uint32 sampleRate = 0; @@ -31970,13 +31970,13 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ma_pa_sample_spec ss; ma_pa_channel_map cmap; ma_pa_buffer_attr attr; - const ma_pa_sample_spec* pActualSS = NULL; - const ma_pa_buffer_attr* pActualAttr = NULL; - const ma_pa_channel_map* pActualChannelMap = NULL; + const ma_pa_sample_spec* pActualSS = nullptr; + const ma_pa_buffer_attr* pActualAttr = nullptr; + const ma_pa_channel_map* pActualChannelMap = nullptr; ma_uint32 iChannel; int streamFlags; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->pulse); if (pConfig->deviceType == ma_device_type_loopback) { @@ -31990,7 +31990,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi } if (pConfig->deviceType == ma_device_type_playback || pConfig->deviceType == ma_device_type_duplex) { - if (pDescriptorPlayback->pDeviceID != NULL) { + if (pDescriptorPlayback->pDeviceID != nullptr) { devPlayback = pDescriptorPlayback->pDeviceID->pulse; } @@ -32000,7 +32000,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi } if (pConfig->deviceType == ma_device_type_capture || pConfig->deviceType == ma_device_type_duplex) { - if (pDescriptorCapture->pDeviceID != NULL) { + if (pDescriptorCapture->pDeviceID != nullptr) { devCapture = pDescriptorCapture->pDeviceID->pulse; } @@ -32073,7 +32073,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Capture attr: maxlength=%d, tlength=%d, prebuf=%d, minreq=%d, fragsize=%d; periodSizeInFrames=%d\n", attr.maxlength, attr.tlength, attr.prebuf, attr.minreq, attr.fragsize, pDescriptorCapture->periodSizeInFrames); pDevice->pulse.pStreamCapture = ma_device__pa_stream_new__pulse(pDevice, pConfig->pulse.pStreamNameCapture, &ss, &cmap); - if (pDevice->pulse.pStreamCapture == NULL) { + if (pDevice->pulse.pStreamCapture == nullptr) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to create PulseAudio capture stream.\n"); result = MA_ERROR; goto on_error0; @@ -32091,7 +32091,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Connect after we've got all of our internal state set up. */ - if (devCapture != NULL) { + if (devCapture != nullptr) { streamFlags |= MA_PA_STREAM_DONT_MOVE; } @@ -32110,7 +32110,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Internal format. */ pActualSS = ((ma_pa_stream_get_sample_spec_proc)pDevice->pContext->pulse.pa_stream_get_sample_spec)((ma_pa_stream*)pDevice->pulse.pStreamCapture); - if (pActualSS != NULL) { + if (pActualSS != nullptr) { ss = *pActualSS; ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Capture sample spec: format=%s, channels=%d, rate=%d\n", ma_get_format_name(ma_format_from_pulse(ss.format)), ss.channels, ss.rate); } else { @@ -32130,7 +32130,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Internal channel map. */ pActualChannelMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamCapture); - if (pActualChannelMap == NULL) { + if (pActualChannelMap == nullptr) { pActualChannelMap = &cmap; /* Fallback just in case. */ } @@ -32160,7 +32160,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Buffer. */ pActualAttr = ((ma_pa_stream_get_buffer_attr_proc)pDevice->pContext->pulse.pa_stream_get_buffer_attr)((ma_pa_stream*)pDevice->pulse.pStreamCapture); - if (pActualAttr != NULL) { + if (pActualAttr != nullptr) { attr = *pActualAttr; } @@ -32232,7 +32232,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Playback attr: maxlength=%d, tlength=%d, prebuf=%d, minreq=%d, fragsize=%d; periodSizeInFrames=%d\n", attr.maxlength, attr.tlength, attr.prebuf, attr.minreq, attr.fragsize, pDescriptorPlayback->periodSizeInFrames); pDevice->pulse.pStreamPlayback = ma_device__pa_stream_new__pulse(pDevice, pConfig->pulse.pStreamNamePlayback, &ss, &cmap); - if (pDevice->pulse.pStreamPlayback == NULL) { + if (pDevice->pulse.pStreamPlayback == nullptr) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to create PulseAudio playback stream.\n"); result = MA_ERROR; goto on_error2; @@ -32253,11 +32253,11 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Connect after we've got all of our internal state set up. */ - if (devPlayback != NULL) { + if (devPlayback != nullptr) { streamFlags |= MA_PA_STREAM_DONT_MOVE; } - error = ((ma_pa_stream_connect_playback_proc)pDevice->pContext->pulse.pa_stream_connect_playback)((ma_pa_stream*)pDevice->pulse.pStreamPlayback, devPlayback, &attr, (ma_pa_stream_flags_t)streamFlags, NULL, NULL); + error = ((ma_pa_stream_connect_playback_proc)pDevice->pContext->pulse.pa_stream_connect_playback)((ma_pa_stream*)pDevice->pulse.pStreamPlayback, devPlayback, &attr, (ma_pa_stream_flags_t)streamFlags, nullptr, nullptr); if (error != MA_PA_OK) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to connect PulseAudio playback stream."); result = ma_result_from_pulse(error); @@ -32272,7 +32272,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Internal format. */ pActualSS = ((ma_pa_stream_get_sample_spec_proc)pDevice->pContext->pulse.pa_stream_get_sample_spec)((ma_pa_stream*)pDevice->pulse.pStreamPlayback); - if (pActualSS != NULL) { + if (pActualSS != nullptr) { ss = *pActualSS; ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Playback sample spec: format=%s, channels=%d, rate=%d\n", ma_get_format_name(ma_format_from_pulse(ss.format)), ss.channels, ss.rate); } else { @@ -32292,7 +32292,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Internal channel map. */ pActualChannelMap = ((ma_pa_stream_get_channel_map_proc)pDevice->pContext->pulse.pa_stream_get_channel_map)((ma_pa_stream*)pDevice->pulse.pStreamPlayback); - if (pActualChannelMap == NULL) { + if (pActualChannelMap == nullptr) { pActualChannelMap = &cmap; /* Fallback just in case. */ } @@ -32322,7 +32322,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi /* Buffer. */ pActualAttr = ((ma_pa_stream_get_buffer_attr_proc)pDevice->pContext->pulse.pa_stream_get_buffer_attr)((ma_pa_stream*)pDevice->pulse.pStreamPlayback); - if (pActualAttr != NULL) { + if (pActualAttr != nullptr) { attr = *pActualAttr; } @@ -32341,7 +32341,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi We need a ring buffer for handling duplex mode. We can use the main duplex ring buffer in the main part of the ma_device struct. We cannot, however, depend on ma_device_init() initializing this for us later on because that will only do it if it's a fully asynchronous backend - i.e. the - onDeviceDataLoop callback is NULL, which is not the case for PulseAudio. + onDeviceDataLoop callback is nullptr, which is not the case for PulseAudio. */ if (pConfig->deviceType == ma_device_type_duplex) { ma_format rbFormat = (format != ma_format_unknown) ? format : pDescriptorCapture->format; @@ -32382,7 +32382,7 @@ on_error0: static void ma_pulse_operation_complete_callback(ma_pa_stream* pStream, int success, void* pUserData) { ma_bool32* pIsSuccessful = (ma_bool32*)pUserData; - MA_ASSERT(pIsSuccessful != NULL); + MA_ASSERT(pIsSuccessful != nullptr); *pIsSuccessful = (ma_bool32)success; @@ -32405,10 +32405,10 @@ static ma_result ma_device__cork_stream__pulse(ma_device* pDevice, ma_device_typ wasSuccessful = MA_FALSE; pStream = (ma_pa_stream*)((deviceType == ma_device_type_capture) ? pDevice->pulse.pStreamCapture : pDevice->pulse.pStreamPlayback); - MA_ASSERT(pStream != NULL); + MA_ASSERT(pStream != nullptr); pOP = ((ma_pa_stream_cork_proc)pContext->pulse.pa_stream_cork)(pStream, cork, ma_pulse_operation_complete_callback, &wasSuccessful); - if (pOP == NULL) { + if (pOP == nullptr) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[PulseAudio] Failed to cork PulseAudio stream."); return MA_ERROR; } @@ -32431,7 +32431,7 @@ static ma_result ma_device_start__pulse(ma_device* pDevice) { ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { result = ma_device__cork_stream__pulse(pDevice, ma_device_type_capture, 0); @@ -32446,7 +32446,7 @@ static ma_result ma_device_start__pulse(ma_device* pDevice) never getting fired. We're not going to abort if writing fails because I still want the device to get uncorked. */ - ma_device_write_to_stream__pulse(pDevice, (ma_pa_stream*)(pDevice->pulse.pStreamPlayback), NULL); /* No need to check the result here. Always want to fall through an uncork.*/ + ma_device_write_to_stream__pulse(pDevice, (ma_pa_stream*)(pDevice->pulse.pStreamPlayback), nullptr); /* No need to check the result here. Always want to fall through an uncork.*/ result = ma_device__cork_stream__pulse(pDevice, ma_device_type_playback, 0); if (result != MA_SUCCESS) { @@ -32461,7 +32461,7 @@ static ma_result ma_device_stop__pulse(ma_device* pDevice) { ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { result = ma_device__cork_stream__pulse(pDevice, ma_device_type_capture, 1); @@ -32495,7 +32495,7 @@ static ma_result ma_device_data_loop__pulse(ma_device* pDevice) { int resultPA; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* NOTE: Don't start the device here. It'll be done at a higher level. */ @@ -32504,7 +32504,7 @@ static ma_result ma_device_data_loop__pulse(ma_device* pDevice) the callbacks deal with it. */ while (ma_device_get_state(pDevice) == ma_device_state_started) { - resultPA = ((ma_pa_mainloop_iterate_proc)pDevice->pContext->pulse.pa_mainloop_iterate)((ma_pa_mainloop*)pDevice->pulse.pMainLoop, 1, NULL); + resultPA = ((ma_pa_mainloop_iterate_proc)pDevice->pContext->pulse.pa_mainloop_iterate)((ma_pa_mainloop*)pDevice->pulse.pMainLoop, 1, nullptr); if (resultPA < 0) { break; } @@ -32516,7 +32516,7 @@ static ma_result ma_device_data_loop__pulse(ma_device* pDevice) static ma_result ma_device_data_loop_wakeup__pulse(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ((ma_pa_mainloop_wakeup_proc)pDevice->pContext->pulse.pa_mainloop_wakeup)((ma_pa_mainloop*)pDevice->pulse.pMainLoop); @@ -32525,7 +32525,7 @@ static ma_result ma_device_data_loop_wakeup__pulse(ma_device* pDevice) static ma_result ma_context_uninit__pulse(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_pulseaudio); ((ma_pa_context_disconnect_proc)pContext->pulse.pa_context_disconnect)((ma_pa_context*)pContext->pulse.pPulseContext); @@ -32554,12 +32554,12 @@ static ma_result ma_context_init__pulse(ma_context* pContext, const ma_context_c for (i = 0; i < ma_countof(libpulseNames); ++i) { pContext->pulse.pulseSO = ma_dlopen(ma_context_get_log(pContext), libpulseNames[i]); - if (pContext->pulse.pulseSO != NULL) { + if (pContext->pulse.pulseSO != nullptr) { break; } } - if (pContext->pulse.pulseSO == NULL) { + if (pContext->pulse.pulseSO == nullptr) { return MA_NO_BACKEND; } @@ -32753,12 +32753,12 @@ static ma_result ma_context_init__pulse(ma_context* pContext, const ma_context_c /* We need to make a copy of the application and server names so we can pass them to the pa_context of each device. */ pContext->pulse.pApplicationName = ma_copy_string(pConfig->pulse.pApplicationName, &pContext->allocationCallbacks); - if (pContext->pulse.pApplicationName == NULL && pConfig->pulse.pApplicationName != NULL) { + if (pContext->pulse.pApplicationName == nullptr && pConfig->pulse.pApplicationName != nullptr) { return MA_OUT_OF_MEMORY; } pContext->pulse.pServerName = ma_copy_string(pConfig->pulse.pServerName, &pContext->allocationCallbacks); - if (pContext->pulse.pServerName == NULL && pConfig->pulse.pServerName != NULL) { + if (pContext->pulse.pServerName == nullptr && pConfig->pulse.pServerName != nullptr) { ma_free(pContext->pulse.pApplicationName, &pContext->allocationCallbacks); return MA_OUT_OF_MEMORY; } @@ -32782,8 +32782,8 @@ static ma_result ma_context_init__pulse(ma_context* pContext, const ma_context_c pCallbacks->onDeviceUninit = ma_device_uninit__pulse; pCallbacks->onDeviceStart = ma_device_start__pulse; pCallbacks->onDeviceStop = ma_device_stop__pulse; - pCallbacks->onDeviceRead = NULL; /* Not used because we're implementing onDeviceDataLoop. */ - pCallbacks->onDeviceWrite = NULL; /* Not used because we're implementing onDeviceDataLoop. */ + pCallbacks->onDeviceRead = nullptr; /* Not used because we're implementing onDeviceDataLoop. */ + pCallbacks->onDeviceWrite = nullptr; /* Not used because we're implementing onDeviceDataLoop. */ pCallbacks->onDeviceDataLoop = ma_device_data_loop__pulse; pCallbacks->onDeviceDataLoopWakeup = ma_device_data_loop_wakeup__pulse; @@ -32858,18 +32858,18 @@ static ma_result ma_context_open_client__jack(ma_context* pContext, ma_jack_clie ma_jack_status_t status; ma_jack_client_t* pClient; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppClient != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppClient != nullptr); if (ppClient) { - *ppClient = NULL; + *ppClient = nullptr; } maxClientNameSize = ((ma_jack_client_name_size_proc)pContext->jack.jack_client_name_size)(); /* Includes null terminator. */ - ma_strncpy_s(clientName, ma_min(sizeof(clientName), maxClientNameSize), (pContext->jack.pClientName != NULL) ? pContext->jack.pClientName : "miniaudio", (size_t)-1); + ma_strncpy_s(clientName, ma_min(sizeof(clientName), maxClientNameSize), (pContext->jack.pClientName != nullptr) ? pContext->jack.pClientName : "miniaudio", (size_t)-1); - pClient = ((ma_jack_client_open_proc)pContext->jack.jack_client_open)(clientName, (pContext->jack.tryStartServer) ? ma_JackNullOption : ma_JackNoStartServer, &status, NULL); - if (pClient == NULL) { + pClient = ((ma_jack_client_open_proc)pContext->jack.jack_client_open)(clientName, (pContext->jack.tryStartServer) ? ma_JackNullOption : ma_JackNoStartServer, &status, nullptr); + if (pClient == nullptr) { return MA_FAILED_TO_OPEN_BACKEND_DEVICE; } @@ -32885,8 +32885,8 @@ static ma_result ma_context_enumerate_devices__jack(ma_context* pContext, ma_enu { ma_bool32 cbResult = MA_TRUE; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); /* Playback. */ if (cbResult) { @@ -32917,9 +32917,9 @@ static ma_result ma_context_get_device_info__jack(ma_context* pContext, ma_devic ma_result result; const char** ppPorts; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); - if (pDeviceID != NULL && pDeviceID->jack != 0) { + if (pDeviceID != nullptr && pDeviceID->jack != 0) { return MA_NO_DEVICE; /* Don't know the device. */ } @@ -32946,14 +32946,14 @@ static ma_result ma_context_get_device_info__jack(ma_context* pContext, ma_devic pDeviceInfo->nativeDataFormats[0].sampleRate = ((ma_jack_get_sample_rate_proc)pContext->jack.jack_get_sample_rate)((ma_jack_client_t*)pClient); pDeviceInfo->nativeDataFormats[0].channels = 0; - ppPorts = ((ma_jack_get_ports_proc)pContext->jack.jack_get_ports)((ma_jack_client_t*)pClient, NULL, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ((deviceType == ma_device_type_playback) ? ma_JackPortIsInput : ma_JackPortIsOutput)); - if (ppPorts == NULL) { + ppPorts = ((ma_jack_get_ports_proc)pContext->jack.jack_get_ports)((ma_jack_client_t*)pClient, nullptr, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ((deviceType == ma_device_type_playback) ? ma_JackPortIsInput : ma_JackPortIsOutput)); + if (ppPorts == nullptr) { ((ma_jack_client_close_proc)pContext->jack.jack_client_close)((ma_jack_client_t*)pClient); ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[JACK] Failed to query physical ports."); return MA_FAILED_TO_OPEN_BACKEND_DEVICE; } - while (ppPorts[pDeviceInfo->nativeDataFormats[0].channels] != NULL) { + while (ppPorts[pDeviceInfo->nativeDataFormats[0].channels] != nullptr) { pDeviceInfo->nativeDataFormats[0].channels += 1; } @@ -32972,12 +32972,12 @@ static ma_result ma_device_uninit__jack(ma_device* pDevice) { ma_context* pContext; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); pContext = pDevice->pContext; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); - if (pDevice->jack.pClient != NULL) { + if (pDevice->jack.pClient != nullptr) { ((ma_jack_client_close_proc)pContext->jack.jack_client_close)((ma_jack_client_t*)pDevice->jack.pClient); } @@ -32998,7 +32998,7 @@ static void ma_device__jack_shutdown_callback(void* pUserData) { /* JACK died. Stop the device. */ ma_device* pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_device_stop(pDevice); } @@ -33006,12 +33006,12 @@ static void ma_device__jack_shutdown_callback(void* pUserData) static int ma_device__jack_buffer_size_callback(ma_jack_nframes_t frameCount, void* pUserData) { ma_device* pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { size_t newBufferSize = frameCount * (pDevice->capture.internalChannels * ma_get_bytes_per_sample(pDevice->capture.internalFormat)); float* pNewBuffer = (float*)ma_calloc(newBufferSize, &pDevice->pContext->allocationCallbacks); - if (pNewBuffer == NULL) { + if (pNewBuffer == nullptr) { return MA_OUT_OF_MEMORY; } @@ -33024,7 +33024,7 @@ static int ma_device__jack_buffer_size_callback(ma_jack_nframes_t frameCount, vo if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { size_t newBufferSize = frameCount * (pDevice->playback.internalChannels * ma_get_bytes_per_sample(pDevice->playback.internalFormat)); float* pNewBuffer = (float*)ma_calloc(newBufferSize, &pDevice->pContext->allocationCallbacks); - if (pNewBuffer == NULL) { + if (pNewBuffer == nullptr) { return MA_OUT_OF_MEMORY; } @@ -33044,16 +33044,16 @@ static int ma_device__jack_process_callback(ma_jack_nframes_t frameCount, void* ma_uint32 iChannel; pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); pContext = pDevice->pContext; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { /* Channels need to be interleaved. */ for (iChannel = 0; iChannel < pDevice->capture.internalChannels; ++iChannel) { const float* pSrc = (const float*)((ma_jack_port_get_buffer_proc)pContext->jack.jack_port_get_buffer)((ma_jack_port_t*)pDevice->jack.ppPortsCapture[iChannel], frameCount); - if (pSrc != NULL) { + if (pSrc != nullptr) { float* pDst = pDevice->jack.pIntermediaryBufferCapture + iChannel; ma_jack_nframes_t iFrame; for (iFrame = 0; iFrame < frameCount; ++iFrame) { @@ -33065,16 +33065,16 @@ static int ma_device__jack_process_callback(ma_jack_nframes_t frameCount, void* } } - ma_device_handle_backend_data_callback(pDevice, NULL, pDevice->jack.pIntermediaryBufferCapture, frameCount); + ma_device_handle_backend_data_callback(pDevice, nullptr, pDevice->jack.pIntermediaryBufferCapture, frameCount); } if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { - ma_device_handle_backend_data_callback(pDevice, pDevice->jack.pIntermediaryBufferPlayback, NULL, frameCount); + ma_device_handle_backend_data_callback(pDevice, pDevice->jack.pIntermediaryBufferPlayback, nullptr, frameCount); /* Channels need to be deinterleaved. */ for (iChannel = 0; iChannel < pDevice->playback.internalChannels; ++iChannel) { float* pDst = (float*)((ma_jack_port_get_buffer_proc)pContext->jack.jack_port_get_buffer)((ma_jack_port_t*)pDevice->jack.ppPortsPlayback[iChannel], frameCount); - if (pDst != NULL) { + if (pDst != nullptr) { const float* pSrc = pDevice->jack.pIntermediaryBufferPlayback + iChannel; ma_jack_nframes_t iFrame; for (iFrame = 0; iFrame < frameCount; ++iFrame) { @@ -33095,8 +33095,8 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config ma_result result; ma_uint32 periodSizeInFrames; - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDevice != nullptr); if (pConfig->deviceType == ma_device_type_loopback) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[JACK] Loopback mode not supported."); @@ -33104,8 +33104,8 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config } /* Only supporting default devices with JACK. */ - if (((pConfig->deviceType == ma_device_type_playback || pConfig->deviceType == ma_device_type_duplex) && pDescriptorPlayback->pDeviceID != NULL && pDescriptorPlayback->pDeviceID->jack != 0) || - ((pConfig->deviceType == ma_device_type_capture || pConfig->deviceType == ma_device_type_duplex) && pDescriptorCapture->pDeviceID != NULL && pDescriptorCapture->pDeviceID->jack != 0)) { + if (((pConfig->deviceType == ma_device_type_playback || pConfig->deviceType == ma_device_type_duplex) && pDescriptorPlayback->pDeviceID != nullptr && pDescriptorPlayback->pDeviceID->jack != 0) || + ((pConfig->deviceType == ma_device_type_capture || pConfig->deviceType == ma_device_type_duplex) && pDescriptorCapture->pDeviceID != nullptr && pDescriptorCapture->pDeviceID->jack != 0)) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[JACK] Only default devices are supported."); return MA_NO_DEVICE; } @@ -33149,19 +33149,19 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config pDescriptorCapture->sampleRate = ((ma_jack_get_sample_rate_proc)pDevice->pContext->jack.jack_get_sample_rate)((ma_jack_client_t*)pDevice->jack.pClient); ma_channel_map_init_standard(ma_standard_channel_map_alsa, pDescriptorCapture->channelMap, ma_countof(pDescriptorCapture->channelMap), pDescriptorCapture->channels); - ppPorts = ((ma_jack_get_ports_proc)pDevice->pContext->jack.jack_get_ports)((ma_jack_client_t*)pDevice->jack.pClient, NULL, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ma_JackPortIsOutput); - if (ppPorts == NULL) { + ppPorts = ((ma_jack_get_ports_proc)pDevice->pContext->jack.jack_get_ports)((ma_jack_client_t*)pDevice->jack.pClient, nullptr, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ma_JackPortIsOutput); + if (ppPorts == nullptr) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[JACK] Failed to query physical ports."); return MA_FAILED_TO_OPEN_BACKEND_DEVICE; } /* Need to count the number of ports first so we can allocate some memory. */ - while (ppPorts[pDescriptorCapture->channels] != NULL) { + while (ppPorts[pDescriptorCapture->channels] != nullptr) { pDescriptorCapture->channels += 1; } pDevice->jack.ppPortsCapture = (ma_ptr*)ma_malloc(sizeof(*pDevice->jack.ppPortsCapture) * pDescriptorCapture->channels, &pDevice->pContext->allocationCallbacks); - if (pDevice->jack.ppPortsCapture == NULL) { + if (pDevice->jack.ppPortsCapture == nullptr) { return MA_OUT_OF_MEMORY; } @@ -33171,7 +33171,7 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config ma_itoa_s((int)iPort, name+7, sizeof(name)-7, 10); /* 7 = length of "capture" */ pDevice->jack.ppPortsCapture[iPort] = ((ma_jack_port_register_proc)pDevice->pContext->jack.jack_port_register)((ma_jack_client_t*)pDevice->jack.pClient, name, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsInput, 0); - if (pDevice->jack.ppPortsCapture[iPort] == NULL) { + if (pDevice->jack.ppPortsCapture[iPort] == nullptr) { ((ma_jack_free_proc)pDevice->pContext->jack.jack_free)((void*)ppPorts); ma_device_uninit__jack(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[JACK] Failed to register ports."); @@ -33185,7 +33185,7 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config pDescriptorCapture->periodCount = 1; /* There's no notion of a period in JACK. Just set to 1. */ pDevice->jack.pIntermediaryBufferCapture = (float*)ma_calloc(pDescriptorCapture->periodSizeInFrames * ma_get_bytes_per_frame(pDescriptorCapture->format, pDescriptorCapture->channels), &pDevice->pContext->allocationCallbacks); - if (pDevice->jack.pIntermediaryBufferCapture == NULL) { + if (pDevice->jack.pIntermediaryBufferCapture == nullptr) { ma_device_uninit__jack(pDevice); return MA_OUT_OF_MEMORY; } @@ -33200,19 +33200,19 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config pDescriptorPlayback->sampleRate = ((ma_jack_get_sample_rate_proc)pDevice->pContext->jack.jack_get_sample_rate)((ma_jack_client_t*)pDevice->jack.pClient); ma_channel_map_init_standard(ma_standard_channel_map_alsa, pDescriptorPlayback->channelMap, ma_countof(pDescriptorPlayback->channelMap), pDescriptorPlayback->channels); - ppPorts = ((ma_jack_get_ports_proc)pDevice->pContext->jack.jack_get_ports)((ma_jack_client_t*)pDevice->jack.pClient, NULL, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ma_JackPortIsInput); - if (ppPorts == NULL) { + ppPorts = ((ma_jack_get_ports_proc)pDevice->pContext->jack.jack_get_ports)((ma_jack_client_t*)pDevice->jack.pClient, nullptr, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ma_JackPortIsInput); + if (ppPorts == nullptr) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[JACK] Failed to query physical ports."); return MA_FAILED_TO_OPEN_BACKEND_DEVICE; } /* Need to count the number of ports first so we can allocate some memory. */ - while (ppPorts[pDescriptorPlayback->channels] != NULL) { + while (ppPorts[pDescriptorPlayback->channels] != nullptr) { pDescriptorPlayback->channels += 1; } pDevice->jack.ppPortsPlayback = (ma_ptr*)ma_malloc(sizeof(*pDevice->jack.ppPortsPlayback) * pDescriptorPlayback->channels, &pDevice->pContext->allocationCallbacks); - if (pDevice->jack.ppPortsPlayback == NULL) { + if (pDevice->jack.ppPortsPlayback == nullptr) { ma_free(pDevice->jack.ppPortsCapture, &pDevice->pContext->allocationCallbacks); return MA_OUT_OF_MEMORY; } @@ -33223,7 +33223,7 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config ma_itoa_s((int)iPort, name+8, sizeof(name)-8, 10); /* 8 = length of "playback" */ pDevice->jack.ppPortsPlayback[iPort] = ((ma_jack_port_register_proc)pDevice->pContext->jack.jack_port_register)((ma_jack_client_t*)pDevice->jack.pClient, name, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsOutput, 0); - if (pDevice->jack.ppPortsPlayback[iPort] == NULL) { + if (pDevice->jack.ppPortsPlayback[iPort] == nullptr) { ((ma_jack_free_proc)pDevice->pContext->jack.jack_free)((void*)ppPorts); ma_device_uninit__jack(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[JACK] Failed to register ports."); @@ -33237,7 +33237,7 @@ static ma_result ma_device_init__jack(ma_device* pDevice, const ma_device_config pDescriptorPlayback->periodCount = 1; /* There's no notion of a period in JACK. Just set to 1. */ pDevice->jack.pIntermediaryBufferPlayback = (float*)ma_calloc(pDescriptorPlayback->periodSizeInFrames * ma_get_bytes_per_frame(pDescriptorPlayback->format, pDescriptorPlayback->channels), &pDevice->pContext->allocationCallbacks); - if (pDevice->jack.pIntermediaryBufferPlayback == NULL) { + if (pDevice->jack.pIntermediaryBufferPlayback == nullptr) { ma_device_uninit__jack(pDevice); return MA_OUT_OF_MEMORY; } @@ -33260,14 +33260,14 @@ static ma_result ma_device_start__jack(ma_device* pDevice) } if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { - const char** ppServerPorts = ((ma_jack_get_ports_proc)pContext->jack.jack_get_ports)((ma_jack_client_t*)pDevice->jack.pClient, NULL, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ma_JackPortIsOutput); - if (ppServerPorts == NULL) { + const char** ppServerPorts = ((ma_jack_get_ports_proc)pContext->jack.jack_get_ports)((ma_jack_client_t*)pDevice->jack.pClient, nullptr, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ma_JackPortIsOutput); + if (ppServerPorts == nullptr) { ((ma_jack_deactivate_proc)pContext->jack.jack_deactivate)((ma_jack_client_t*)pDevice->jack.pClient); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[JACK] Failed to retrieve physical ports."); return MA_ERROR; } - for (i = 0; ppServerPorts[i] != NULL; ++i) { + for (i = 0; ppServerPorts[i] != nullptr; ++i) { const char* pServerPort = ppServerPorts[i]; const char* pClientPort = ((ma_jack_port_name_proc)pContext->jack.jack_port_name)((ma_jack_port_t*)pDevice->jack.ppPortsCapture[i]); @@ -33284,14 +33284,14 @@ static ma_result ma_device_start__jack(ma_device* pDevice) } if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { - const char** ppServerPorts = ((ma_jack_get_ports_proc)pContext->jack.jack_get_ports)((ma_jack_client_t*)pDevice->jack.pClient, NULL, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ma_JackPortIsInput); - if (ppServerPorts == NULL) { + const char** ppServerPorts = ((ma_jack_get_ports_proc)pContext->jack.jack_get_ports)((ma_jack_client_t*)pDevice->jack.pClient, nullptr, MA_JACK_DEFAULT_AUDIO_TYPE, ma_JackPortIsPhysical | ma_JackPortIsInput); + if (ppServerPorts == nullptr) { ((ma_jack_deactivate_proc)pContext->jack.jack_deactivate)((ma_jack_client_t*)pDevice->jack.pClient); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[JACK] Failed to retrieve physical ports."); return MA_ERROR; } - for (i = 0; ppServerPorts[i] != NULL; ++i) { + for (i = 0; ppServerPorts[i] != nullptr; ++i) { const char* pServerPort = ppServerPorts[i]; const char* pClientPort = ((ma_jack_port_name_proc)pContext->jack.jack_port_name)((ma_jack_port_t*)pDevice->jack.ppPortsPlayback[i]); @@ -33327,11 +33327,11 @@ static ma_result ma_device_stop__jack(ma_device* pDevice) static ma_result ma_context_uninit__jack(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_jack); ma_free(pContext->jack.pClientName, &pContext->allocationCallbacks); - pContext->jack.pClientName = NULL; + pContext->jack.pClientName = nullptr; #ifndef MA_NO_RUNTIME_LINKING ma_dlclose(ma_context_get_log(pContext), pContext->jack.jackSO); @@ -33357,12 +33357,12 @@ static ma_result ma_context_init__jack(ma_context* pContext, const ma_context_co for (i = 0; i < ma_countof(libjackNames); ++i) { pContext->jack.jackSO = ma_dlopen(ma_context_get_log(pContext), libjackNames[i]); - if (pContext->jack.jackSO != NULL) { + if (pContext->jack.jackSO != nullptr) { break; } } - if (pContext->jack.jackSO == NULL) { + if (pContext->jack.jackSO == nullptr) { return MA_NO_BACKEND; } @@ -33422,7 +33422,7 @@ static ma_result ma_context_init__jack(ma_context* pContext, const ma_context_co pContext->jack.jack_free = (ma_proc)_jack_free; #endif - if (pConfig->jack.pClientName != NULL) { + if (pConfig->jack.pClientName != nullptr) { pContext->jack.pClientName = ma_copy_string(pConfig->jack.pClientName, &pContext->allocationCallbacks); } pContext->jack.tryStartServer = pConfig->jack.tryStartServer; @@ -33454,9 +33454,9 @@ static ma_result ma_context_init__jack(ma_context* pContext, const ma_context_co pCallbacks->onDeviceUninit = ma_device_uninit__jack; pCallbacks->onDeviceStart = ma_device_start__jack; pCallbacks->onDeviceStop = ma_device_stop__jack; - pCallbacks->onDeviceRead = NULL; /* Not used because JACK is asynchronous. */ - pCallbacks->onDeviceWrite = NULL; /* Not used because JACK is asynchronous. */ - pCallbacks->onDeviceDataLoop = NULL; /* Not used because JACK is asynchronous. */ + pCallbacks->onDeviceRead = nullptr; /* Not used because JACK is asynchronous. */ + pCallbacks->onDeviceWrite = nullptr; /* Not used because JACK is asynchronous. */ + pCallbacks->onDeviceDataLoop = nullptr; /* Not used because JACK is asynchronous. */ return MA_SUCCESS; } @@ -33635,8 +33635,8 @@ static ma_channel ma_channel_from_AudioChannelBitmap(AudioChannelBitmap bit) static ma_result ma_format_from_AudioStreamBasicDescription(const AudioStreamBasicDescription* pDescription, ma_format* pFormatOut) { - MA_ASSERT(pDescription != NULL); - MA_ASSERT(pFormatOut != NULL); + MA_ASSERT(pDescription != nullptr); + MA_ASSERT(pFormatOut != nullptr); *pFormatOut = ma_format_unknown; /* Safety. */ @@ -33795,7 +33795,7 @@ static ma_channel ma_channel_from_AudioChannelLabel(AudioChannelLabel label) static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout* pChannelLayout, ma_channel* pChannelMap, size_t channelMapCap) { - MA_ASSERT(pChannelLayout != NULL); + MA_ASSERT(pChannelLayout != nullptr); if (pChannelLayout->mChannelLayoutTag == kAudioChannelLayoutTag_UseChannelDescriptions) { UInt32 iChannel; @@ -33899,29 +33899,29 @@ static ma_result ma_get_device_object_ids__coreaudio(ma_context* pContext, UInt3 OSStatus status; AudioObjectID* pDeviceObjectIDs; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pDeviceCount != NULL); - MA_ASSERT(ppDeviceObjectIDs != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pDeviceCount != nullptr); + MA_ASSERT(ppDeviceObjectIDs != nullptr); /* Safety. */ *pDeviceCount = 0; - *ppDeviceObjectIDs = NULL; + *ppDeviceObjectIDs = nullptr; propAddressDevices.mSelector = kAudioHardwarePropertyDevices; propAddressDevices.mScope = kAudioObjectPropertyScopeGlobal; propAddressDevices.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; - status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(kAudioObjectSystemObject, &propAddressDevices, 0, NULL, &deviceObjectsDataSize); + status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(kAudioObjectSystemObject, &propAddressDevices, 0, nullptr, &deviceObjectsDataSize); if (status != noErr) { return ma_result_from_OSStatus(status); } pDeviceObjectIDs = (AudioObjectID*)ma_malloc(deviceObjectsDataSize, &pContext->allocationCallbacks); - if (pDeviceObjectIDs == NULL) { + if (pDeviceObjectIDs == nullptr) { return MA_OUT_OF_MEMORY; } - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(kAudioObjectSystemObject, &propAddressDevices, 0, NULL, &deviceObjectsDataSize, pDeviceObjectIDs); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(kAudioObjectSystemObject, &propAddressDevices, 0, nullptr, &deviceObjectsDataSize, pDeviceObjectIDs); if (status != noErr) { ma_free(pDeviceObjectIDs, &pContext->allocationCallbacks); return ma_result_from_OSStatus(status); @@ -33939,14 +33939,14 @@ static ma_result ma_get_AudioObject_uid_as_CFStringRef(ma_context* pContext, Aud UInt32 dataSize; OSStatus status; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); propAddress.mSelector = kAudioDevicePropertyDeviceUID; propAddress.mScope = kAudioObjectPropertyScopeGlobal; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; dataSize = sizeof(*pUID); - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(objectID, &propAddress, 0, NULL, &dataSize, pUID); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(objectID, &propAddress, 0, nullptr, &dataSize, pUID); if (status != noErr) { return ma_result_from_OSStatus(status); } @@ -33959,7 +33959,7 @@ static ma_result ma_get_AudioObject_uid(ma_context* pContext, AudioObjectID obje CFStringRef uid; ma_result result; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); result = ma_get_AudioObject_uid_as_CFStringRef(pContext, objectID, &uid); if (result != MA_SUCCESS) { @@ -33977,18 +33977,18 @@ static ma_result ma_get_AudioObject_uid(ma_context* pContext, AudioObjectID obje static ma_result ma_get_AudioObject_name(ma_context* pContext, AudioObjectID objectID, size_t bufferSize, char* bufferOut) { AudioObjectPropertyAddress propAddress; - CFStringRef deviceName = NULL; + CFStringRef deviceName = nullptr; UInt32 dataSize; OSStatus status; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); propAddress.mSelector = kAudioDevicePropertyDeviceNameCFString; propAddress.mScope = kAudioObjectPropertyScopeGlobal; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; dataSize = sizeof(deviceName); - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(objectID, &propAddress, 0, NULL, &dataSize, &deviceName); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(objectID, &propAddress, 0, nullptr, &dataSize, &deviceName); if (status != noErr) { return ma_result_from_OSStatus(status); } @@ -34009,24 +34009,24 @@ static ma_bool32 ma_does_AudioObject_support_scope(ma_context* pContext, AudioOb AudioBufferList* pBufferList; ma_bool32 isSupported; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); /* To know whether or not a device is an input device we need ot look at the stream configuration. If it has an output channel it's a playback device. */ propAddress.mSelector = kAudioDevicePropertyStreamConfiguration; propAddress.mScope = scope; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; - status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize); + status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, nullptr, &dataSize); if (status != noErr) { return MA_FALSE; } pBufferList = (AudioBufferList*)ma_malloc(dataSize, &pContext->allocationCallbacks); - if (pBufferList == NULL) { + if (pBufferList == nullptr) { return MA_FALSE; /* Out of memory. */ } - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, NULL, &dataSize, pBufferList); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, nullptr, &dataSize, pBufferList); if (status != noErr) { ma_free(pBufferList, &pContext->allocationCallbacks); return MA_FALSE; @@ -34059,9 +34059,9 @@ static ma_result ma_get_AudioObject_stream_descriptions(ma_context* pContext, Au OSStatus status; AudioStreamRangedDescription* pDescriptions; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pDescriptionCount != NULL); - MA_ASSERT(ppDescriptions != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pDescriptionCount != nullptr); + MA_ASSERT(ppDescriptions != nullptr); /* TODO: Experiment with kAudioStreamPropertyAvailablePhysicalFormats instead of (or in addition to) kAudioStreamPropertyAvailableVirtualFormats. My @@ -34071,17 +34071,17 @@ static ma_result ma_get_AudioObject_stream_descriptions(ma_context* pContext, Au propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; - status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize); + status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, nullptr, &dataSize); if (status != noErr) { return ma_result_from_OSStatus(status); } pDescriptions = (AudioStreamRangedDescription*)ma_malloc(dataSize, &pContext->allocationCallbacks); - if (pDescriptions == NULL) { + if (pDescriptions == nullptr) { return MA_OUT_OF_MEMORY; } - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, NULL, &dataSize, pDescriptions); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, nullptr, &dataSize, pDescriptions); if (status != noErr) { ma_free(pDescriptions, &pContext->allocationCallbacks); return ma_result_from_OSStatus(status); @@ -34100,26 +34100,26 @@ static ma_result ma_get_AudioObject_channel_layout(ma_context* pContext, AudioOb OSStatus status; AudioChannelLayout* pChannelLayout; - MA_ASSERT(pContext != NULL); - MA_ASSERT(ppChannelLayout != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(ppChannelLayout != nullptr); - *ppChannelLayout = NULL; /* Safety. */ + *ppChannelLayout = nullptr; /* Safety. */ propAddress.mSelector = kAudioDevicePropertyPreferredChannelLayout; propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; - status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize); + status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, nullptr, &dataSize); if (status != noErr) { return ma_result_from_OSStatus(status); } pChannelLayout = (AudioChannelLayout*)ma_malloc(dataSize, &pContext->allocationCallbacks); - if (pChannelLayout == NULL) { + if (pChannelLayout == nullptr) { return MA_OUT_OF_MEMORY; } - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, NULL, &dataSize, pChannelLayout); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, nullptr, &dataSize, pChannelLayout); if (status != noErr) { ma_free(pChannelLayout, &pContext->allocationCallbacks); return ma_result_from_OSStatus(status); @@ -34134,8 +34134,8 @@ static ma_result ma_get_AudioObject_channel_count(ma_context* pContext, AudioObj AudioChannelLayout* pChannelLayout; ma_result result; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pChannelCount != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pChannelCount != nullptr); *pChannelCount = 0; /* Safety. */ @@ -34162,7 +34162,7 @@ static ma_result ma_get_AudioObject_channel_map(ma_context* pContext, AudioObjec AudioChannelLayout* pChannelLayout; ma_result result; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); result = ma_get_AudioObject_channel_layout(pContext, deviceObjectID, deviceType, &pChannelLayout); if (result != MA_SUCCESS) { @@ -34187,29 +34187,29 @@ static ma_result ma_get_AudioObject_sample_rates(ma_context* pContext, AudioObje OSStatus status; AudioValueRange* pSampleRateRanges; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pSampleRateRangesCount != NULL); - MA_ASSERT(ppSampleRateRanges != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pSampleRateRangesCount != nullptr); + MA_ASSERT(ppSampleRateRanges != nullptr); /* Safety. */ *pSampleRateRangesCount = 0; - *ppSampleRateRanges = NULL; + *ppSampleRateRanges = nullptr; propAddress.mSelector = kAudioDevicePropertyAvailableNominalSampleRates; propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; - status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize); + status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, nullptr, &dataSize); if (status != noErr) { return ma_result_from_OSStatus(status); } pSampleRateRanges = (AudioValueRange*)ma_malloc(dataSize, &pContext->allocationCallbacks); - if (pSampleRateRanges == NULL) { + if (pSampleRateRanges == nullptr) { return MA_OUT_OF_MEMORY; } - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, NULL, &dataSize, pSampleRateRanges); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, nullptr, &dataSize, pSampleRateRanges); if (status != noErr) { ma_free(pSampleRateRanges, &pContext->allocationCallbacks); return ma_result_from_OSStatus(status); @@ -34227,8 +34227,8 @@ static ma_result ma_get_AudioObject_get_closest_sample_rate(ma_context* pContext AudioValueRange* pSampleRateRanges; ma_result result; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pSampleRateOut != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pSampleRateOut != nullptr); *pSampleRateOut = 0; /* Safety. */ @@ -34312,8 +34312,8 @@ static ma_result ma_get_AudioObject_closest_buffer_size_in_frames(ma_context* pC UInt32 dataSize; OSStatus status; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pBufferSizeInFramesOut != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pBufferSizeInFramesOut != nullptr); *pBufferSizeInFramesOut = 0; /* Safety. */ @@ -34322,7 +34322,7 @@ static ma_result ma_get_AudioObject_closest_buffer_size_in_frames(ma_context* pC propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; dataSize = sizeof(bufferSizeRange); - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, NULL, &dataSize, &bufferSizeRange); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, nullptr, &dataSize, &bufferSizeRange); if (status != noErr) { return ma_result_from_OSStatus(status); } @@ -34347,7 +34347,7 @@ static ma_result ma_set_AudioObject_buffer_size_in_frames(ma_context* pContext, UInt32 dataSize; OSStatus status; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); result = ma_get_AudioObject_closest_buffer_size_in_frames(pContext, deviceObjectID, deviceType, *pPeriodSizeInOut, &chosenBufferSizeInFrames); if (result != MA_SUCCESS) { @@ -34359,11 +34359,11 @@ static ma_result ma_set_AudioObject_buffer_size_in_frames(ma_context* pContext, propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; - ((ma_AudioObjectSetPropertyData_proc)pContext->coreaudio.AudioObjectSetPropertyData)(deviceObjectID, &propAddress, 0, NULL, sizeof(chosenBufferSizeInFrames), &chosenBufferSizeInFrames); + ((ma_AudioObjectSetPropertyData_proc)pContext->coreaudio.AudioObjectSetPropertyData)(deviceObjectID, &propAddress, 0, nullptr, sizeof(chosenBufferSizeInFrames), &chosenBufferSizeInFrames); /* Get the actual size of the buffer. */ dataSize = sizeof(*pPeriodSizeInOut); - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, NULL, &dataSize, &chosenBufferSizeInFrames); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, nullptr, &dataSize, &chosenBufferSizeInFrames); if (status != noErr) { return ma_result_from_OSStatus(status); } @@ -34379,8 +34379,8 @@ static ma_result ma_find_default_AudioObjectID(ma_context* pContext, ma_device_t AudioObjectID defaultDeviceObjectID; OSStatus status; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pDeviceObjectID != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pDeviceObjectID != nullptr); /* Safety. */ *pDeviceObjectID = 0; @@ -34394,7 +34394,7 @@ static ma_result ma_find_default_AudioObjectID(ma_context* pContext, ma_device_t } defaultDeviceObjectIDSize = sizeof(AudioObjectID); - status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(kAudioObjectSystemObject, &propAddressDefaultDevice, 0, NULL, &defaultDeviceObjectIDSize, &defaultDeviceObjectID); + status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(kAudioObjectSystemObject, &propAddressDefaultDevice, 0, nullptr, &defaultDeviceObjectIDSize, &defaultDeviceObjectID); if (status == noErr) { *pDeviceObjectID = defaultDeviceObjectID; return MA_SUCCESS; @@ -34406,13 +34406,13 @@ static ma_result ma_find_default_AudioObjectID(ma_context* pContext, ma_device_t static ma_result ma_find_AudioObjectID(ma_context* pContext, ma_device_type deviceType, const ma_device_id* pDeviceID, AudioObjectID* pDeviceObjectID) { - MA_ASSERT(pContext != NULL); - MA_ASSERT(pDeviceObjectID != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pDeviceObjectID != nullptr); /* Safety. */ *pDeviceObjectID = 0; - if (pDeviceID == NULL) { + if (pDeviceID == nullptr) { /* Default device. */ return ma_find_default_AudioObjectID(pContext, deviceType, pDeviceObjectID); } else { @@ -34651,7 +34651,7 @@ static ma_result ma_get_AudioUnit_channel_map(ma_context* pContext, AudioUnit au AudioChannelLayout* pChannelLayout; ma_result result; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); if (deviceType == ma_device_type_playback) { deviceScope = kAudioUnitScope_Input; @@ -34661,13 +34661,13 @@ static ma_result ma_get_AudioUnit_channel_map(ma_context* pContext, AudioUnit au deviceBus = MA_COREAUDIO_INPUT_BUS; } - status = ((ma_AudioUnitGetPropertyInfo_proc)pContext->coreaudio.AudioUnitGetPropertyInfo)(audioUnit, kAudioUnitProperty_AudioChannelLayout, deviceScope, deviceBus, &channelLayoutSize, NULL); + status = ((ma_AudioUnitGetPropertyInfo_proc)pContext->coreaudio.AudioUnitGetPropertyInfo)(audioUnit, kAudioUnitProperty_AudioChannelLayout, deviceScope, deviceBus, &channelLayoutSize, nullptr); if (status != noErr) { return ma_result_from_OSStatus(status); } pChannelLayout = (AudioChannelLayout*)ma_malloc(channelLayoutSize, &pContext->allocationCallbacks); - if (pChannelLayout == NULL) { + if (pChannelLayout == nullptr) { return MA_OUT_OF_MEMORY; } @@ -34776,7 +34776,7 @@ static ma_result ma_context_get_device_info__coreaudio(ma_context* pContext, ma_ { ma_result result; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); #if defined(MA_APPLE_DESKTOP) /* Desktop */ @@ -34919,7 +34919,7 @@ static ma_result ma_context_get_device_info__coreaudio(ma_context* pContext, ma_ UInt32 propSize; /* We want to ensure we use a consistent device name to device enumeration. */ - if (pDeviceID != NULL && pDeviceID->coreaudio[0] != '\0') { + if (pDeviceID != nullptr && pDeviceID->coreaudio[0] != '\0') { ma_bool32 found = MA_FALSE; if (deviceType == ma_device_type_playback) { NSArray *pOutputs = [[[AVAudioSession sharedInstance] currentRoute] outputs]; @@ -34964,8 +34964,8 @@ static ma_result ma_context_get_device_info__coreaudio(ma_context* pContext, ma_ desc.componentFlags = 0; desc.componentFlagsMask = 0; - component = ((ma_AudioComponentFindNext_proc)pContext->coreaudio.AudioComponentFindNext)(NULL, &desc); - if (component == NULL) { + component = ((ma_AudioComponentFindNext_proc)pContext->coreaudio.AudioComponentFindNext)(nullptr, &desc); + if (component == nullptr) { return MA_FAILED_TO_INIT_BACKEND; } @@ -34985,7 +34985,7 @@ static ma_result ma_context_get_device_info__coreaudio(ma_context* pContext, ma_ } ((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(audioUnit); - audioUnit = NULL; + audioUnit = nullptr; /* Only a single format is being reported for iOS. */ pDeviceInfo->nativeDataFormatCount = 1; @@ -35003,7 +35003,7 @@ static ma_result ma_context_get_device_info__coreaudio(ma_context* pContext, ma_ */ @autoreleasepool { AVAudioSession* pAudioSession = [AVAudioSession sharedInstance]; - MA_ASSERT(pAudioSession != NULL); + MA_ASSERT(pAudioSession != nullptr); pDeviceInfo->nativeDataFormats[0].sampleRate = (ma_uint32)pAudioSession.sampleRate; } @@ -35036,8 +35036,8 @@ static AudioBufferList* ma_allocate_AudioBufferList__coreaudio(ma_uint32 sizeInF allocationSize += sizeInFrames * ma_get_bytes_per_frame(format, channels); pBufferList = (AudioBufferList*)ma_malloc(allocationSize, pAllocationCallbacks); - if (pBufferList == NULL) { - return NULL; + if (pBufferList == nullptr) { + return nullptr; } audioBufferSizeInBytes = (UInt32)(sizeInFrames * ma_get_bytes_per_sample(format)); @@ -35062,7 +35062,7 @@ static AudioBufferList* ma_allocate_AudioBufferList__coreaudio(ma_uint32 sizeInF static ma_result ma_device_realloc_AudioBufferList__coreaudio(ma_device* pDevice, ma_uint32 sizeInFrames, ma_format format, ma_uint32 channels, ma_stream_layout layout) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(format != ma_format_unknown); MA_ASSERT(channels > 0); @@ -35071,7 +35071,7 @@ static ma_result ma_device_realloc_AudioBufferList__coreaudio(ma_device* pDevice AudioBufferList* pNewAudioBufferList; pNewAudioBufferList = ma_allocate_AudioBufferList__coreaudio(sizeInFrames, format, channels, layout, &pDevice->pContext->allocationCallbacks); - if (pNewAudioBufferList == NULL) { + if (pNewAudioBufferList == nullptr) { return MA_OUT_OF_MEMORY; } @@ -35091,7 +35091,7 @@ static OSStatus ma_on_output__coreaudio(void* pUserData, AudioUnitRenderActionFl ma_device* pDevice = (ma_device*)pUserData; ma_stream_layout layout; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /*ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "INFO: Output Callback: busNumber=%d, frameCount=%d, mNumberBuffers=%d\n", (int)busNumber, (int)frameCount, (int)pBufferList->mNumberBuffers);*/ @@ -35108,7 +35108,7 @@ static OSStatus ma_on_output__coreaudio(void* pUserData, AudioUnitRenderActionFl if (pBufferList->mBuffers[iBuffer].mNumberChannels == pDevice->playback.internalChannels) { ma_uint32 frameCountForThisBuffer = pBufferList->mBuffers[iBuffer].mDataByteSize / ma_get_bytes_per_frame(pDevice->playback.internalFormat, pDevice->playback.internalChannels); if (frameCountForThisBuffer > 0) { - ma_device_handle_backend_data_callback(pDevice, pBufferList->mBuffers[iBuffer].mData, NULL, frameCountForThisBuffer); + ma_device_handle_backend_data_callback(pDevice, pBufferList->mBuffers[iBuffer].mData, nullptr, frameCountForThisBuffer); } /*a_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " frameCount=%d, mNumberChannels=%d, mDataByteSize=%d\n", (int)frameCount, (int)pBufferList->mBuffers[iBuffer].mNumberChannels, (int)pBufferList->mBuffers[iBuffer].mDataByteSize);*/ @@ -35146,7 +35146,7 @@ static OSStatus ma_on_output__coreaudio(void* pUserData, AudioUnitRenderActionFl framesToRead = framesRemaining; } - ma_device_handle_backend_data_callback(pDevice, tempBuffer, NULL, framesToRead); + ma_device_handle_backend_data_callback(pDevice, tempBuffer, nullptr, framesToRead); for (iChannel = 0; iChannel < pDevice->playback.internalChannels; ++iChannel) { ppDeinterleavedBuffers[iChannel] = (void*)ma_offset_ptr(pBufferList->mBuffers[iBuffer+iChannel].mData, (frameCountPerBuffer - framesRemaining) * ma_get_bytes_per_sample(pDevice->playback.internalFormat)); @@ -35177,7 +35177,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla ma_uint32 iBuffer; OSStatus status; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); pRenderedBufferList = (AudioBufferList*)pDevice->coreaudio.pAudioBufferList; MA_ASSERT(pRenderedBufferList); @@ -35227,7 +35227,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla if (layout == ma_stream_layout_interleaved) { for (iBuffer = 0; iBuffer < pRenderedBufferList->mNumberBuffers; ++iBuffer) { if (pRenderedBufferList->mBuffers[iBuffer].mNumberChannels == pDevice->capture.internalChannels) { - ma_device_handle_backend_data_callback(pDevice, NULL, pRenderedBufferList->mBuffers[iBuffer].mData, frameCount); + ma_device_handle_backend_data_callback(pDevice, nullptr, pRenderedBufferList->mBuffers[iBuffer].mData, frameCount); /*ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, " mDataByteSize=%d.\n", (int)pRenderedBufferList->mBuffers[iBuffer].mDataByteSize);*/ } else { /* @@ -35246,7 +35246,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla framesToSend = framesRemaining; } - ma_device_handle_backend_data_callback(pDevice, NULL, silentBuffer, framesToSend); + ma_device_handle_backend_data_callback(pDevice, nullptr, silentBuffer, framesToSend); framesRemaining -= framesToSend; } @@ -35279,7 +35279,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla } ma_interleave_pcm_frames(pDevice->capture.internalFormat, pDevice->capture.internalChannels, framesToSend, (const void**)ppDeinterleavedBuffers, tempBuffer); - ma_device_handle_backend_data_callback(pDevice, NULL, tempBuffer, framesToSend); + ma_device_handle_backend_data_callback(pDevice, nullptr, tempBuffer, framesToSend); framesRemaining -= framesToSend; } @@ -35299,7 +35299,7 @@ static OSStatus ma_on_input__coreaudio(void* pUserData, AudioUnitRenderActionFla static void on_start_stop__coreaudio(void* pUserData, AudioUnit audioUnit, AudioUnitPropertyID propertyID, AudioUnitScope scope, AudioUnitElement element) { ma_device* pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Don't do anything if it looks like we're just reinitializing due to a device switch. */ if (((audioUnit == pDevice->coreaudio.audioUnitPlayback) && pDevice->coreaudio.isSwitchingPlaybackDevice) || @@ -35371,7 +35371,7 @@ done: static ma_spinlock g_DeviceTrackingInitLock_CoreAudio = 0; /* A spinlock for mutal exclusion of the init/uninit of the global tracking data. Initialization to 0 is what we need. */ static ma_uint32 g_DeviceTrackingInitCounter_CoreAudio = 0; static ma_mutex g_DeviceTrackingMutex_CoreAudio; -static ma_device** g_ppTrackedDevices_CoreAudio = NULL; +static ma_device** g_ppTrackedDevices_CoreAudio = nullptr; static ma_uint32 g_TrackedDeviceCap_CoreAudio = 0; static ma_uint32 g_TrackedDeviceCount_CoreAudio = 0; @@ -35452,7 +35452,7 @@ static OSStatus ma_default_device_changed__coreaudio(AudioObjectID objectID, UIn static ma_result ma_context__init_device_tracking__coreaudio(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); ma_spinlock_lock(&g_DeviceTrackingInitLock_CoreAudio); { @@ -35465,10 +35465,10 @@ static ma_result ma_context__init_device_tracking__coreaudio(ma_context* pContex ma_mutex_init(&g_DeviceTrackingMutex_CoreAudio); propAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; - ((ma_AudioObjectAddPropertyListener_proc)pContext->coreaudio.AudioObjectAddPropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, NULL); + ((ma_AudioObjectAddPropertyListener_proc)pContext->coreaudio.AudioObjectAddPropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, nullptr); propAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice; - ((ma_AudioObjectAddPropertyListener_proc)pContext->coreaudio.AudioObjectAddPropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, NULL); + ((ma_AudioObjectAddPropertyListener_proc)pContext->coreaudio.AudioObjectAddPropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, nullptr); } g_DeviceTrackingInitCounter_CoreAudio += 1; @@ -35480,7 +35480,7 @@ static ma_result ma_context__init_device_tracking__coreaudio(ma_context* pContex static ma_result ma_context__uninit_device_tracking__coreaudio(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); ma_spinlock_lock(&g_DeviceTrackingInitLock_CoreAudio); { @@ -35493,13 +35493,13 @@ static ma_result ma_context__uninit_device_tracking__coreaudio(ma_context* pCont propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; propAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; - ((ma_AudioObjectRemovePropertyListener_proc)pContext->coreaudio.AudioObjectRemovePropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, NULL); + ((ma_AudioObjectRemovePropertyListener_proc)pContext->coreaudio.AudioObjectRemovePropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, nullptr); propAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice; - ((ma_AudioObjectRemovePropertyListener_proc)pContext->coreaudio.AudioObjectRemovePropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, NULL); + ((ma_AudioObjectRemovePropertyListener_proc)pContext->coreaudio.AudioObjectRemovePropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, nullptr); /* At this point there should be no tracked devices. If not there's an error somewhere. */ - if (g_ppTrackedDevices_CoreAudio != NULL) { + if (g_ppTrackedDevices_CoreAudio != nullptr) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_WARNING, "You have uninitialized all contexts while an associated device is still active."); ma_spinlock_unlock(&g_DeviceTrackingInitLock_CoreAudio); return MA_INVALID_OPERATION; @@ -35515,7 +35515,7 @@ static ma_result ma_context__uninit_device_tracking__coreaudio(ma_context* pCont static ma_result ma_device__track__coreaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_mutex_lock(&g_DeviceTrackingMutex_CoreAudio); { @@ -35530,7 +35530,7 @@ static ma_result ma_device__track__coreaudio(ma_device* pDevice) } ppNewDevices = (ma_device**)ma_realloc(g_ppTrackedDevices_CoreAudio, sizeof(*g_ppTrackedDevices_CoreAudio)*newCap, &pDevice->pContext->allocationCallbacks); - if (ppNewDevices == NULL) { + if (ppNewDevices == nullptr) { ma_mutex_unlock(&g_DeviceTrackingMutex_CoreAudio); return MA_OUT_OF_MEMORY; } @@ -35549,7 +35549,7 @@ static ma_result ma_device__track__coreaudio(ma_device* pDevice) static ma_result ma_device__untrack__coreaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_mutex_lock(&g_DeviceTrackingMutex_CoreAudio); { @@ -35567,7 +35567,7 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice) /* If there's nothing else in the list we need to free memory. */ if (g_TrackedDeviceCount_CoreAudio == 0) { ma_free(g_ppTrackedDevices_CoreAudio, &pDevice->pContext->allocationCallbacks); - g_ppTrackedDevices_CoreAudio = NULL; + g_ppTrackedDevices_CoreAudio = nullptr; g_TrackedDeviceCap_CoreAudio = 0; } @@ -35703,7 +35703,7 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice) static ma_result ma_device_uninit__coreaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(ma_device_get_state(pDevice) == ma_device_state_uninitialized); #if defined(MA_APPLE_DESKTOP) @@ -35714,16 +35714,16 @@ static ma_result ma_device_uninit__coreaudio(ma_device* pDevice) ma_device__untrack__coreaudio(pDevice); #endif #if defined(MA_APPLE_MOBILE) - if (pDevice->coreaudio.pNotificationHandler != NULL) { + if (pDevice->coreaudio.pNotificationHandler != nullptr) { ma_ios_notification_handler* pNotificationHandler = (MA_BRIDGE_TRANSFER ma_ios_notification_handler*)pDevice->coreaudio.pNotificationHandler; [pNotificationHandler remove_handler]; } #endif - if (pDevice->coreaudio.audioUnitCapture != NULL) { + if (pDevice->coreaudio.audioUnitCapture != nullptr) { ((ma_AudioComponentInstanceDispose_proc)pDevice->pContext->coreaudio.AudioComponentInstanceDispose)((AudioUnit)pDevice->coreaudio.audioUnitCapture); } - if (pDevice->coreaudio.audioUnitPlayback != NULL) { + if (pDevice->coreaudio.audioUnitPlayback != nullptr) { ((ma_AudioComponentInstanceDispose_proc)pDevice->pContext->coreaudio.AudioComponentInstanceDispose)((AudioUnit)pDevice->coreaudio.audioUnitPlayback); } @@ -35783,15 +35783,15 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev return MA_INVALID_ARGS; } - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(deviceType == ma_device_type_playback || deviceType == ma_device_type_capture); #if defined(MA_APPLE_DESKTOP) pData->deviceObjectID = 0; #endif - pData->component = NULL; - pData->audioUnit = NULL; - pData->pAudioBufferList = NULL; + pData->component = nullptr; + pData->audioUnit = nullptr; + pData->pAudioBufferList = nullptr; #if defined(MA_APPLE_DESKTOP) result = ma_find_AudioObjectID(pContext, deviceType, pDeviceID, &deviceObjectID); @@ -35851,7 +35851,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev For some reason it looks like Apple is only allowing selection of the input device. There does not appear to be any way to change the default output route. I have no idea why this is like this, but for now we'll only be able to configure capture devices. */ - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { if (deviceType == ma_device_type_capture) { ma_bool32 found = MA_FALSE; NSArray *pInputs = [[[AVAudioSession sharedInstance] currentRoute] inputs]; @@ -35943,7 +35943,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT; - status = ((ma_AudioObjectSetPropertyData_proc)pContext->coreaudio.AudioObjectSetPropertyData)(deviceObjectID, &propAddress, 0, NULL, sizeof(sampleRateRange), &sampleRateRange); + status = ((ma_AudioObjectSetPropertyData_proc)pContext->coreaudio.AudioObjectSetPropertyData)(deviceObjectID, &propAddress, 0, nullptr, sizeof(sampleRateRange), &sampleRateRange); if (status != noErr) { bestFormat.mSampleRate = origFormat.mSampleRate; } @@ -35967,7 +35967,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev */ @autoreleasepool { AVAudioSession* pAudioSession = [AVAudioSession sharedInstance]; - MA_ASSERT(pAudioSession != NULL); + MA_ASSERT(pAudioSession != nullptr); [pAudioSession setPreferredSampleRate:(double)pData->sampleRateIn error:nil]; bestFormat.mSampleRate = pAudioSession.sampleRate; @@ -36079,7 +36079,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev */ @autoreleasepool { AVAudioSession* pAudioSession = [AVAudioSession sharedInstance]; - MA_ASSERT(pAudioSession != NULL); + MA_ASSERT(pAudioSession != nullptr); [pAudioSession setPreferredIOBufferDuration:((float)actualPeriodSizeInFrames / pAudioSession.sampleRate) error:nil]; actualPeriodSizeInFrames = ma_next_power_of_2((ma_uint32)(pAudioSession.IOBufferDuration * pAudioSession.sampleRate)); @@ -36109,7 +36109,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev AudioBufferList* pBufferList; pBufferList = ma_allocate_AudioBufferList__coreaudio(pData->periodSizeInFramesOut, pData->formatOut, pData->channelsOut, (isInterleaved) ? ma_stream_layout_interleaved : ma_stream_layout_deinterleaved, &pContext->allocationCallbacks); - if (pBufferList == NULL) { + if (pBufferList == nullptr) { ((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(pData->audioUnit); return MA_OUT_OF_MEMORY; } @@ -36148,7 +36148,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev status = ((ma_AudioUnitInitialize_proc)pContext->coreaudio.AudioUnitInitialize)(pData->audioUnit); if (status != noErr) { ma_free(pData->pAudioBufferList, &pContext->allocationCallbacks); - pData->pAudioBufferList = NULL; + pData->pAudioBufferList = nullptr; ((ma_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)(pData->audioUnit); return ma_result_from_OSStatus(status); } @@ -36219,7 +36219,7 @@ static ma_result ma_device_reinit_internal__coreaudio(ma_device* pDevice, ma_dev data.periodsIn = 3; } - result = ma_device_init_internal__coreaudio(pDevice->pContext, deviceType, NULL, &data, (void*)pDevice); + result = ma_device_init_internal__coreaudio(pDevice->pContext, deviceType, nullptr, &data, (void*)pDevice); if (result != MA_SUCCESS) { return result; } @@ -36262,8 +36262,8 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c { ma_result result; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pConfig != nullptr); if (pConfig->deviceType == ma_device_type_loopback) { return MA_DEVICE_TYPE_NOT_SUPPORTED; @@ -36300,7 +36300,7 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c return result; } - pDevice->coreaudio.isDefaultCaptureDevice = (pConfig->capture.pDeviceID == NULL); + pDevice->coreaudio.isDefaultCaptureDevice = (pConfig->capture.pDeviceID == nullptr); #if defined(MA_APPLE_DESKTOP) pDevice->coreaudio.deviceObjectIDCapture = (ma_uint32)data.deviceObjectID; #endif @@ -36326,7 +36326,7 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c If we are using the default device we'll need to listen for changes to the system's default device so we can seamlessly switch the device in the background. */ - if (pConfig->capture.pDeviceID == NULL) { + if (pConfig->capture.pDeviceID == nullptr) { ma_device__track__coreaudio(pDevice); } #endif @@ -36366,7 +36366,7 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c return result; } - pDevice->coreaudio.isDefaultPlaybackDevice = (pConfig->playback.pDeviceID == NULL); + pDevice->coreaudio.isDefaultPlaybackDevice = (pConfig->playback.pDeviceID == nullptr); #if defined(MA_APPLE_DESKTOP) pDevice->coreaudio.deviceObjectIDPlayback = (ma_uint32)data.deviceObjectID; #endif @@ -36390,7 +36390,7 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c If we are using the default device we'll need to listen for changes to the system's default device so we can seamlessly switch the device in the background. */ - if (pDescriptorPlayback->pDeviceID == NULL && (pConfig->deviceType != ma_device_type_duplex || pDescriptorCapture->pDeviceID != NULL)) { + if (pDescriptorPlayback->pDeviceID == nullptr && (pConfig->deviceType != ma_device_type_duplex || pDescriptorCapture->pDeviceID != nullptr)) { ma_device__track__coreaudio(pDevice); } #endif @@ -36418,7 +36418,7 @@ static ma_result ma_device_init__coreaudio(ma_device* pDevice, const ma_device_c static ma_result ma_device_start__coreaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { OSStatus status = ((ma_AudioOutputUnitStart_proc)pDevice->pContext->coreaudio.AudioOutputUnitStart)((AudioUnit)pDevice->coreaudio.audioUnitCapture); @@ -36442,7 +36442,7 @@ static ma_result ma_device_start__coreaudio(ma_device* pDevice) static ma_result ma_device_stop__coreaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* It's not clear from the documentation whether or not AudioOutputUnitStop() actually drains the device or not. */ @@ -36468,7 +36468,7 @@ static ma_result ma_device_stop__coreaudio(ma_device* pDevice) static ma_result ma_context_uninit__coreaudio(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_coreaudio); #if defined(MA_APPLE_MOBILE) @@ -36521,15 +36521,15 @@ static ma_result ma_context_init__coreaudio(ma_context* pContext, const ma_conte ma_result result; #endif - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pContext != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pContext != nullptr); #if defined(MA_APPLE_MOBILE) @autoreleasepool { AVAudioSession* pAudioSession = [AVAudioSession sharedInstance]; AVAudioSessionCategoryOptions options = pConfig->coreaudio.sessionCategoryOptions; - MA_ASSERT(pAudioSession != NULL); + MA_ASSERT(pAudioSession != nullptr); if (pConfig->coreaudio.sessionCategory == ma_ios_session_category_default) { /* @@ -36573,7 +36573,7 @@ static ma_result ma_context_init__coreaudio(ma_context* pContext, const ma_conte #if !defined(MA_NO_RUNTIME_LINKING) && !defined(MA_APPLE_MOBILE) pContext->coreaudio.hCoreFoundation = ma_dlopen(ma_context_get_log(pContext), "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"); - if (pContext->coreaudio.hCoreFoundation == NULL) { + if (pContext->coreaudio.hCoreFoundation == nullptr) { return MA_API_NOT_FOUND; } @@ -36582,7 +36582,7 @@ static ma_result ma_context_init__coreaudio(ma_context* pContext, const ma_conte pContext->coreaudio.hCoreAudio = ma_dlopen(ma_context_get_log(pContext), "/System/Library/Frameworks/CoreAudio.framework/CoreAudio"); - if (pContext->coreaudio.hCoreAudio == NULL) { + if (pContext->coreaudio.hCoreAudio == nullptr) { ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hCoreFoundation); return MA_API_NOT_FOUND; } @@ -36600,17 +36600,17 @@ static ma_result ma_context_init__coreaudio(ma_context* pContext, const ma_conte AudioToolbox. */ pContext->coreaudio.hAudioUnit = ma_dlopen(ma_context_get_log(pContext), "/System/Library/Frameworks/AudioUnit.framework/AudioUnit"); - if (pContext->coreaudio.hAudioUnit == NULL) { + if (pContext->coreaudio.hAudioUnit == nullptr) { ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hCoreAudio); ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hCoreFoundation); return MA_API_NOT_FOUND; } - if (ma_dlsym(ma_context_get_log(pContext), pContext->coreaudio.hAudioUnit, "AudioComponentFindNext") == NULL) { + if (ma_dlsym(ma_context_get_log(pContext), pContext->coreaudio.hAudioUnit, "AudioComponentFindNext") == nullptr) { /* Couldn't find the required symbols in AudioUnit, so fall back to AudioToolbox. */ ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hAudioUnit); pContext->coreaudio.hAudioUnit = ma_dlopen(ma_context_get_log(pContext), "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"); - if (pContext->coreaudio.hAudioUnit == NULL) { + if (pContext->coreaudio.hAudioUnit == nullptr) { ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hCoreAudio); ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hCoreFoundation); return MA_API_NOT_FOUND; @@ -36666,8 +36666,8 @@ static ma_result ma_context_init__coreaudio(ma_context* pContext, const ma_conte desc.componentFlags = 0; desc.componentFlagsMask = 0; - pContext->coreaudio.component = ((ma_AudioComponentFindNext_proc)pContext->coreaudio.AudioComponentFindNext)(NULL, &desc); - if (pContext->coreaudio.component == NULL) { + pContext->coreaudio.component = ((ma_AudioComponentFindNext_proc)pContext->coreaudio.AudioComponentFindNext)(nullptr, &desc); + if (pContext->coreaudio.component == nullptr) { #if !defined(MA_NO_RUNTIME_LINKING) && !defined(MA_APPLE_MOBILE) ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hAudioUnit); ma_dlclose(ma_context_get_log(pContext), pContext->coreaudio.hCoreAudio); @@ -36699,9 +36699,9 @@ static ma_result ma_context_init__coreaudio(ma_context* pContext, const ma_conte pCallbacks->onDeviceUninit = ma_device_uninit__coreaudio; pCallbacks->onDeviceStart = ma_device_start__coreaudio; pCallbacks->onDeviceStop = ma_device_stop__coreaudio; - pCallbacks->onDeviceRead = NULL; - pCallbacks->onDeviceWrite = NULL; - pCallbacks->onDeviceDataLoop = NULL; + pCallbacks->onDeviceRead = nullptr; + pCallbacks->onDeviceWrite = nullptr; + pCallbacks->onDeviceDataLoop = nullptr; return MA_SUCCESS; } @@ -36842,7 +36842,7 @@ static ma_format ma_find_best_format_from_sio_cap__sndio(struct ma_sio_cap* caps ma_format bestFormat; unsigned int iConfig; - MA_ASSERT(caps != NULL); + MA_ASSERT(caps != nullptr); bestFormat = ma_format_unknown; for (iConfig = 0; iConfig < caps->nconf; iConfig += 1) { @@ -36887,7 +36887,7 @@ static ma_uint32 ma_find_best_channels_from_sio_cap__sndio(struct ma_sio_cap* ca ma_uint32 maxChannels; unsigned int iConfig; - MA_ASSERT(caps != NULL); + MA_ASSERT(caps != nullptr); MA_ASSERT(requiredFormat != ma_format_unknown); /* Just pick whatever configuration has the most channels. */ @@ -36955,7 +36955,7 @@ static ma_uint32 ma_find_best_sample_rate_from_sio_cap__sndio(struct ma_sio_cap* ma_uint32 bestSampleRate; unsigned int iConfig; - MA_ASSERT(caps != NULL); + MA_ASSERT(caps != nullptr); MA_ASSERT(requiredFormat != ma_format_unknown); MA_ASSERT(requiredChannels > 0); MA_ASSERT(requiredChannels <= MA_MAX_CHANNELS); @@ -37052,15 +37052,15 @@ static ma_result ma_context_enumerate_devices__sndio(ma_context* pContext, ma_en ma_bool32 isTerminating = MA_FALSE; struct ma_sio_hdl* handle; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); /* sndio doesn't seem to have a good device enumeration API, so I'm therefore only enumerating over default devices for now. */ /* Playback. */ if (!isTerminating) { handle = ((ma_sio_open_proc)pContext->sndio.sio_open)(MA_SIO_DEVANY, MA_SIO_PLAY, 0); - if (handle != NULL) { + if (handle != nullptr) { /* Supports playback. */ ma_device_info deviceInfo; MA_ZERO_OBJECT(&deviceInfo); @@ -37076,7 +37076,7 @@ static ma_result ma_context_enumerate_devices__sndio(ma_context* pContext, ma_en /* Capture. */ if (!isTerminating) { handle = ((ma_sio_open_proc)pContext->sndio.sio_open)(MA_SIO_DEVANY, MA_SIO_REC, 0); - if (handle != NULL) { + if (handle != nullptr) { /* Supports capture. */ ma_device_info deviceInfo; MA_ZERO_OBJECT(&deviceInfo); @@ -37099,10 +37099,10 @@ static ma_result ma_context_get_device_info__sndio(ma_context* pContext, ma_devi struct ma_sio_cap caps; unsigned int iConfig; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); /* We need to open the device before we can get information about it. */ - if (pDeviceID == NULL) { + if (pDeviceID == nullptr) { ma_strcpy_s(devid, sizeof(devid), MA_SIO_DEVANY); ma_strcpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), (deviceType == ma_device_type_playback) ? MA_DEFAULT_PLAYBACK_DEVICE_NAME : MA_DEFAULT_CAPTURE_DEVICE_NAME); } else { @@ -37111,7 +37111,7 @@ static ma_result ma_context_get_device_info__sndio(ma_context* pContext, ma_devi } handle = ((ma_sio_open_proc)pContext->sndio.sio_open)(devid, (deviceType == ma_device_type_playback) ? MA_SIO_PLAY : MA_SIO_REC, 0); - if (handle == NULL) { + if (handle == nullptr) { return MA_NO_DEVICE; } @@ -37191,7 +37191,7 @@ static ma_result ma_context_get_device_info__sndio(ma_context* pContext, ma_devi static ma_result ma_device_uninit__sndio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { ((ma_sio_close_proc)pDevice->pContext->sndio.sio_close)((struct ma_sio_hdl*)pDevice->sndio.handleCapture); @@ -37221,9 +37221,9 @@ static ma_result ma_device_init_handle__sndio(ma_device* pDevice, const ma_devic ma_uint32 internalPeriodSizeInFrames; ma_uint32 internalPeriods; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); MA_ASSERT(deviceType != ma_device_type_duplex); - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (deviceType == ma_device_type_capture) { openFlags = MA_SIO_REC; @@ -37237,12 +37237,12 @@ static ma_result ma_device_init_handle__sndio(ma_device* pDevice, const ma_devic sampleRate = pDescriptor->sampleRate; pDeviceName = MA_SIO_DEVANY; - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { pDeviceName = pDeviceID->sndio; } handle = (ma_ptr)((ma_sio_open_proc)pDevice->pContext->sndio.sio_open)(pDeviceName, openFlags, 0); - if (handle == NULL) { + if (handle == nullptr) { ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[sndio] Failed to open device."); return MA_FAILED_TO_OPEN_BACKEND_DEVICE; } @@ -37379,7 +37379,7 @@ static ma_result ma_device_init_handle__sndio(ma_device* pDevice, const ma_devic static ma_result ma_device_init__sndio(ma_device* pDevice, const ma_device_config* pConfig, ma_device_descriptor* pDescriptorPlayback, ma_device_descriptor* pDescriptorCapture) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->sndio); @@ -37406,7 +37406,7 @@ static ma_result ma_device_init__sndio(ma_device* pDevice, const ma_device_confi static ma_result ma_device_start__sndio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { ((ma_sio_start_proc)pDevice->pContext->sndio.sio_start)((struct ma_sio_hdl*)pDevice->sndio.handleCapture); @@ -37421,7 +37421,7 @@ static ma_result ma_device_start__sndio(ma_device* pDevice) static ma_result ma_device_stop__sndio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* From the documentation: @@ -37448,7 +37448,7 @@ static ma_result ma_device_write__sndio(ma_device* pDevice, const void* pPCMFram { int result; - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = 0; } @@ -37458,7 +37458,7 @@ static ma_result ma_device_write__sndio(ma_device* pDevice, const void* pPCMFram return MA_IO_ERROR; } - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = frameCount; } @@ -37469,7 +37469,7 @@ static ma_result ma_device_read__sndio(ma_device* pDevice, void* pPCMFrames, ma_ { int result; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -37479,7 +37479,7 @@ static ma_result ma_device_read__sndio(ma_device* pDevice, void* pPCMFrames, ma_ return MA_IO_ERROR; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = frameCount; } @@ -37488,7 +37488,7 @@ static ma_result ma_device_read__sndio(ma_device* pDevice, void* pPCMFrames, ma_ static ma_result ma_context_uninit__sndio(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_sndio); (void)pContext; @@ -37505,12 +37505,12 @@ static ma_result ma_context_init__sndio(ma_context* pContext, const ma_context_c for (i = 0; i < ma_countof(libsndioNames); ++i) { pContext->sndio.sndioSO = ma_dlopen(ma_context_get_log(pContext), libsndioNames[i]); - if (pContext->sndio.sndioSO != NULL) { + if (pContext->sndio.sndioSO != nullptr) { break; } } - if (pContext->sndio.sndioSO == NULL) { + if (pContext->sndio.sndioSO == nullptr) { return MA_NO_BACKEND; } @@ -37547,7 +37547,7 @@ static ma_result ma_context_init__sndio(ma_context* pContext, const ma_context_c pCallbacks->onDeviceStop = ma_device_stop__sndio; pCallbacks->onDeviceRead = ma_device_read__sndio; pCallbacks->onDeviceWrite = ma_device_write__sndio; - pCallbacks->onDeviceDataLoop = NULL; + pCallbacks->onDeviceDataLoop = nullptr; (void)pConfig; return MA_SUCCESS; @@ -37585,7 +37585,7 @@ static void ma_construct_device_id__audio4(char* id, size_t idSize, const char* { size_t baseLen; - MA_ASSERT(id != NULL); + MA_ASSERT(id != nullptr); MA_ASSERT(idSize > 0); MA_ASSERT(deviceIndex >= 0); @@ -37602,9 +37602,9 @@ static ma_result ma_extract_device_index_from_id__audio4(const char* id, const c size_t baseLen; const char* deviceIndexStr; - MA_ASSERT(id != NULL); - MA_ASSERT(base != NULL); - MA_ASSERT(pIndexOut != NULL); + MA_ASSERT(id != nullptr); + MA_ASSERT(base != nullptr); + MA_ASSERT(pIndexOut != nullptr); idLen = strlen(id); baseLen = strlen(base); @@ -37659,8 +37659,8 @@ static ma_format ma_format_from_encoding__audio4(unsigned int encoding, unsigned static void ma_encoding_from_format__audio4(ma_format format, unsigned int* pEncoding, unsigned int* pPrecision) { - MA_ASSERT(pEncoding != NULL); - MA_ASSERT(pPrecision != NULL); + MA_ASSERT(pEncoding != nullptr); + MA_ASSERT(pPrecision != nullptr); switch (format) { @@ -37772,9 +37772,9 @@ static ma_result ma_context_get_device_info_from_fd__audio4(ma_context* pContext { audio_device_t fdDevice; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(fd >= 0); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pDeviceInfo != nullptr); (void)pContext; (void)deviceType; @@ -37869,8 +37869,8 @@ static ma_result ma_context_enumerate_devices__audio4(ma_context* pContext, ma_e char devpath[256]; int iDevice; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); /* Every device will be named "/dev/audioN", with a "/dev/audioctlN" equivalent. We use the "/dev/audioctlN" @@ -37937,13 +37937,13 @@ static ma_result ma_context_get_device_info__audio4(ma_context* pContext, ma_dev char ctlid[256]; ma_result result; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); /* We need to open the "/dev/audioctlN" device to get the info. To do this we need to extract the number from the device ID which will be in "/dev/audioN" format. */ - if (pDeviceID == NULL) { + if (pDeviceID == nullptr) { /* Default device. */ ma_strcpy_s(ctlid, sizeof(ctlid), "/dev/audioctl"); } else { @@ -37975,7 +37975,7 @@ static ma_result ma_context_get_device_info__audio4(ma_context* pContext, ma_dev static ma_result ma_device_uninit__audio4(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { close(pDevice->audio4.fdCapture); @@ -38007,9 +38007,9 @@ static ma_result ma_device_init_fd__audio4(ma_device* pDevice, const ma_device_c ma_uint32 internalPeriodSizeInFrames; ma_uint32 internalPeriods; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); MA_ASSERT(deviceType != ma_device_type_duplex); - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* The first thing to do is open the file. */ if (deviceType == ma_device_type_capture) { @@ -38020,7 +38020,7 @@ static ma_result ma_device_init_fd__audio4(ma_device* pDevice, const ma_device_c /*fdFlags |= O_NONBLOCK;*/ /* Find the index of the default device as a start. We'll use this index later. Set it to (size_t)-1 otherwise. */ - if (pDescriptor->pDeviceID == NULL) { + if (pDescriptor->pDeviceID == nullptr) { /* Default device. */ for (iDefaultDevice = 0; iDefaultDevice < ma_countof(pDefaultDeviceNames); ++iDefaultDevice) { fd = open(pDefaultDeviceNames[iDefaultDevice], fdFlags, 0); @@ -38262,7 +38262,7 @@ static ma_result ma_device_init_fd__audio4(ma_device* pDevice, const ma_device_c static ma_result ma_device_init__audio4(ma_device* pDevice, const ma_device_config* pConfig, ma_device_descriptor* pDescriptorPlayback, ma_device_descriptor* pDescriptorCapture) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->audio4); @@ -38310,7 +38310,7 @@ static ma_result ma_device_init__audio4(ma_device* pDevice, const ma_device_conf static ma_result ma_device_start__audio4(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { if (pDevice->audio4.fdCapture == -1) { @@ -38350,7 +38350,7 @@ static ma_result ma_device_stop_fd__audio4(ma_device* pDevice, int fd) static ma_result ma_device_stop__audio4(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { ma_result result; @@ -38383,7 +38383,7 @@ static ma_result ma_device_write__audio4(ma_device* pDevice, const void* pPCMFra { int result; - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = 0; } @@ -38393,7 +38393,7 @@ static ma_result ma_device_write__audio4(ma_device* pDevice, const void* pPCMFra return ma_result_from_errno(errno); } - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = (ma_uint32)result / ma_get_bytes_per_frame(pDevice->playback.internalFormat, pDevice->playback.internalChannels); } @@ -38404,7 +38404,7 @@ static ma_result ma_device_read__audio4(ma_device* pDevice, void* pPCMFrames, ma { int result; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -38414,7 +38414,7 @@ static ma_result ma_device_read__audio4(ma_device* pDevice, void* pPCMFrames, ma return ma_result_from_errno(errno); } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = (ma_uint32)result / ma_get_bytes_per_frame(pDevice->capture.internalFormat, pDevice->capture.internalChannels); } @@ -38423,7 +38423,7 @@ static ma_result ma_device_read__audio4(ma_device* pDevice, void* pPCMFrames, ma static ma_result ma_context_uninit__audio4(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_audio4); (void)pContext; @@ -38432,7 +38432,7 @@ static ma_result ma_context_uninit__audio4(ma_context* pContext) static ma_result ma_context_init__audio4(ma_context* pContext, const ma_context_config* pConfig, ma_backend_callbacks* pCallbacks) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); (void)pConfig; @@ -38446,7 +38446,7 @@ static ma_result ma_context_init__audio4(ma_context* pContext, const ma_context_ pCallbacks->onDeviceStop = ma_device_stop__audio4; pCallbacks->onDeviceRead = ma_device_read__audio4; pCallbacks->onDeviceWrite = ma_device_write__audio4; - pCallbacks->onDeviceDataLoop = NULL; + pCallbacks->onDeviceDataLoop = nullptr; return MA_SUCCESS; } @@ -38486,8 +38486,8 @@ static ma_result ma_context_open_device__oss(ma_context* pContext, ma_device_typ const char* deviceName; int flags; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pfd != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pfd != nullptr); (void)pContext; *pfd = -1; @@ -38498,7 +38498,7 @@ static ma_result ma_context_open_device__oss(ma_context* pContext, ma_device_typ } deviceName = MA_OSS_DEFAULT_DEVICE_NAME; - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { deviceName = pDeviceID->oss; } @@ -38521,8 +38521,8 @@ static ma_result ma_context_enumerate_devices__oss(ma_context* pContext, ma_enum oss_sysinfo si; int result; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); fd = ma_open_temp_device__oss(); if (fd == -1) { @@ -38588,9 +38588,9 @@ static void ma_context_add_native_data_format__oss(ma_context* pContext, oss_aud unsigned int maxChannels; unsigned int iRate; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pAudioInfo != NULL); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pAudioInfo != nullptr); + MA_ASSERT(pDeviceInfo != nullptr); /* If we support all channels we just report 0. */ minChannels = ma_clamp(pAudioInfo->min_channels, MA_MIN_CHANNELS, MA_MAX_CHANNELS); @@ -38639,10 +38639,10 @@ static ma_result ma_context_get_device_info__oss(ma_context* pContext, ma_device oss_sysinfo si; int result; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); /* Handle the default device a little differently. */ - if (pDeviceID == NULL) { + if (pDeviceID == nullptr) { if (deviceType == ma_device_type_playback) { ma_strncpy_s(pDeviceInfo->name, sizeof(pDeviceInfo->name), MA_DEFAULT_PLAYBACK_DEVICE_NAME, (size_t)-1); } else { @@ -38733,7 +38733,7 @@ static ma_result ma_context_get_device_info__oss(ma_context* pContext, ma_device static ma_result ma_device_uninit__oss(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { close(pDevice->oss.fdCapture); @@ -38789,15 +38789,15 @@ static ma_result ma_device_init_fd__oss(ma_device* pDevice, const ma_device_conf ma_result result; int ossResult; int fd; - const ma_device_id* pDeviceID = NULL; + const ma_device_id* pDeviceID = nullptr; ma_share_mode shareMode; int ossFormat; int ossChannels; int ossSampleRate; int ossFragment; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pConfig != nullptr); MA_ASSERT(deviceType != ma_device_type_duplex); pDeviceID = pDescriptor->pDeviceID; @@ -38903,8 +38903,8 @@ static ma_result ma_device_init_fd__oss(ma_device* pDevice, const ma_device_conf static ma_result ma_device_init__oss(ma_device* pDevice, const ma_device_config* pConfig, ma_device_descriptor* pDescriptorPlayback, ma_device_descriptor* pDescriptorCapture) { - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pConfig != nullptr); MA_ZERO_OBJECT(&pDevice->oss); @@ -38952,7 +38952,7 @@ When starting the device, OSS will automatically start it when write() or read() */ static ma_result ma_device_start__oss(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* The device is automatically started with reading and writing. */ (void)pDevice; @@ -38962,7 +38962,7 @@ static ma_result ma_device_start__oss(ma_device* pDevice) static ma_result ma_device_stop__oss(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* See note above on why this is empty. */ (void)pDevice; @@ -38975,7 +38975,7 @@ static ma_result ma_device_write__oss(ma_device* pDevice, const void* pPCMFrames int resultOSS; ma_uint32 deviceState; - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = 0; } @@ -38991,7 +38991,7 @@ static ma_result ma_device_write__oss(ma_device* pDevice, const void* pPCMFrames return ma_result_from_errno(errno); } - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = (ma_uint32)resultOSS / ma_get_bytes_per_frame(pDevice->playback.internalFormat, pDevice->playback.internalChannels); } @@ -39003,7 +39003,7 @@ static ma_result ma_device_read__oss(ma_device* pDevice, void* pPCMFrames, ma_ui int resultOSS; ma_uint32 deviceState; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -39019,7 +39019,7 @@ static ma_result ma_device_read__oss(ma_device* pDevice, void* pPCMFrames, ma_ui return ma_result_from_errno(errno); } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = (ma_uint32)resultOSS / ma_get_bytes_per_frame(pDevice->capture.internalFormat, pDevice->capture.internalChannels); } @@ -39028,7 +39028,7 @@ static ma_result ma_device_read__oss(ma_device* pDevice, void* pPCMFrames, ma_ui static ma_result ma_context_uninit__oss(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_oss); (void)pContext; @@ -39041,7 +39041,7 @@ static ma_result ma_context_init__oss(ma_context* pContext, const ma_context_con int ossVersion; int result; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); (void)pConfig; @@ -39077,7 +39077,7 @@ static ma_result ma_context_init__oss(ma_context* pContext, const ma_context_con pCallbacks->onDeviceStop = ma_device_stop__oss; pCallbacks->onDeviceRead = ma_device_read__oss; pCallbacks->onDeviceWrite = ma_device_write__oss; - pCallbacks->onDeviceDataLoop = NULL; + pCallbacks->onDeviceDataLoop = nullptr; return MA_SUCCESS; } @@ -39306,7 +39306,7 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs ma_result result; ma_job job; ma_device* pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); (void)error; ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[AAudio] ERROR CALLBACK: error=%d, AAudioStream_getState()=%d\n", error, ((MA_PFN_AAudioStream_getState)pDevice->pContext->aaudio.AAudioStream_getState)(pStream)); @@ -39340,10 +39340,10 @@ static void ma_stream_error_callback__aaudio(ma_AAudioStream* pStream, void* pUs static ma_aaudio_data_callback_result_t ma_stream_data_callback_capture__aaudio(ma_AAudioStream* pStream, void* pUserData, void* pAudioData, int32_t frameCount) { ma_device* pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (frameCount > 0) { - ma_device_handle_backend_data_callback(pDevice, NULL, pAudioData, (ma_uint32)frameCount); + ma_device_handle_backend_data_callback(pDevice, nullptr, pAudioData, (ma_uint32)frameCount); } (void)pStream; @@ -39353,7 +39353,7 @@ static ma_aaudio_data_callback_result_t ma_stream_data_callback_capture__aaudio( static ma_aaudio_data_callback_result_t ma_stream_data_callback_playback__aaudio(ma_AAudioStream* pStream, void* pUserData, void* pAudioData, int32_t frameCount) { ma_device* pDevice = (ma_device*)pUserData; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* I've had a report that AAudio can sometimes post a frame count of 0. We need to check for that here @@ -39361,7 +39361,7 @@ static ma_aaudio_data_callback_result_t ma_stream_data_callback_playback__aaudio though I've not yet had any reports about that one. */ if (frameCount > 0) { - ma_device_handle_backend_data_callback(pDevice, pAudioData, NULL, (ma_uint32)frameCount); + ma_device_handle_backend_data_callback(pDevice, pAudioData, nullptr, (ma_uint32)frameCount); } (void)pStream; @@ -39374,14 +39374,14 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context* ma_aaudio_result_t resultAA; /* Safety. */ - *ppBuilder = NULL; + *ppBuilder = nullptr; resultAA = ((MA_PFN_AAudio_createStreamBuilder)pContext->aaudio.AAudio_createStreamBuilder)(&pBuilder); if (resultAA != MA_AAUDIO_OK) { return ma_result_from_aaudio(resultAA); } - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { ((MA_PFN_AAudioStreamBuilder_setDeviceId)pContext->aaudio.AAudioStreamBuilder_setDeviceId)(pBuilder, pDeviceID->aaudio); } @@ -39390,8 +39390,8 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context* /* If we have a device descriptor make sure we configure the stream builder to take our requested parameters. */ - if (pDescriptor != NULL) { - MA_ASSERT(pConfig != NULL); /* We must have a device config if we also have a descriptor. The config is required for AAudio specific configuration options. */ + if (pDescriptor != nullptr) { + MA_ASSERT(pConfig != nullptr); /* We must have a device config if we also have a descriptor. The config is required for AAudio specific configuration options. */ if (pDescriptor->sampleRate != 0) { ((MA_PFN_AAudioStreamBuilder_setSampleRate)pContext->aaudio.AAudioStreamBuilder_setSampleRate)(pBuilder, pDescriptor->sampleRate); @@ -39428,21 +39428,21 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context* } if (deviceType == ma_device_type_capture) { - if (pConfig->aaudio.inputPreset != ma_aaudio_input_preset_default && pContext->aaudio.AAudioStreamBuilder_setInputPreset != NULL) { + if (pConfig->aaudio.inputPreset != ma_aaudio_input_preset_default && pContext->aaudio.AAudioStreamBuilder_setInputPreset != nullptr) { ((MA_PFN_AAudioStreamBuilder_setInputPreset)pContext->aaudio.AAudioStreamBuilder_setInputPreset)(pBuilder, ma_to_input_preset__aaudio(pConfig->aaudio.inputPreset)); } ((MA_PFN_AAudioStreamBuilder_setDataCallback)pContext->aaudio.AAudioStreamBuilder_setDataCallback)(pBuilder, ma_stream_data_callback_capture__aaudio, (void*)pDevice); } else { - if (pConfig->aaudio.usage != ma_aaudio_usage_default && pContext->aaudio.AAudioStreamBuilder_setUsage != NULL) { + if (pConfig->aaudio.usage != ma_aaudio_usage_default && pContext->aaudio.AAudioStreamBuilder_setUsage != nullptr) { ((MA_PFN_AAudioStreamBuilder_setUsage)pContext->aaudio.AAudioStreamBuilder_setUsage)(pBuilder, ma_to_usage__aaudio(pConfig->aaudio.usage)); } - if (pConfig->aaudio.contentType != ma_aaudio_content_type_default && pContext->aaudio.AAudioStreamBuilder_setContentType != NULL) { + if (pConfig->aaudio.contentType != ma_aaudio_content_type_default && pContext->aaudio.AAudioStreamBuilder_setContentType != nullptr) { ((MA_PFN_AAudioStreamBuilder_setContentType)pContext->aaudio.AAudioStreamBuilder_setContentType)(pBuilder, ma_to_content_type__aaudio(pConfig->aaudio.contentType)); } - if (pConfig->aaudio.allowedCapturePolicy != ma_aaudio_allow_capture_default && pContext->aaudio.AAudioStreamBuilder_setAllowedCapturePolicy != NULL) { + if (pConfig->aaudio.allowedCapturePolicy != ma_aaudio_allow_capture_default && pContext->aaudio.AAudioStreamBuilder_setAllowedCapturePolicy != nullptr) { ((MA_PFN_AAudioStreamBuilder_setAllowedCapturePolicy)pContext->aaudio.AAudioStreamBuilder_setAllowedCapturePolicy)(pBuilder, ma_to_allowed_capture_policy__aaudio(pConfig->aaudio.allowedCapturePolicy)); } @@ -39457,7 +39457,7 @@ static ma_result ma_create_and_configure_AAudioStreamBuilder__aaudio(ma_context* ((MA_PFN_AAudioStreamBuilder_setPerformanceMode)pContext->aaudio.AAudioStreamBuilder_setPerformanceMode)(pBuilder, (pConfig->performanceProfile == ma_performance_profile_low_latency) ? MA_AAUDIO_PERFORMANCE_MODE_LOW_LATENCY : MA_AAUDIO_PERFORMANCE_MODE_NONE); /* We need to set an error callback to detect device changes. */ - if (pDevice != NULL) { /* <-- pDevice should never be null if pDescriptor is not null, which is always the case if we hit this branch. Check anyway for safety. */ + if (pDevice != nullptr) { /* <-- pDevice should never be null if pDescriptor is not null, which is always the case if we hit this branch. Check anyway for safety. */ ((MA_PFN_AAudioStreamBuilder_setErrorCallback)pContext->aaudio.AAudioStreamBuilder_setErrorCallback)(pBuilder, ma_stream_error_callback__aaudio, (void*)pDevice); } } @@ -39482,9 +39482,9 @@ static ma_result ma_open_stream_basic__aaudio(ma_context* pContext, const ma_dev ma_result result; ma_AAudioStreamBuilder* pBuilder; - *ppStream = NULL; + *ppStream = nullptr; - result = ma_create_and_configure_AAudioStreamBuilder__aaudio(pContext, pDeviceID, deviceType, shareMode, NULL, NULL, NULL, &pBuilder); + result = ma_create_and_configure_AAudioStreamBuilder__aaudio(pContext, pDeviceID, deviceType, shareMode, nullptr, nullptr, nullptr, &pBuilder); if (result != MA_SUCCESS) { return result; } @@ -39500,11 +39500,11 @@ static ma_result ma_open_stream__aaudio(ma_device* pDevice, const ma_device_conf ma_result result; ma_AAudioStreamBuilder* pBuilder; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pDescriptor != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pDescriptor != nullptr); MA_ASSERT(deviceType != ma_device_type_duplex); /* This function should not be called for a full-duplex device type. */ - *ppStream = NULL; + *ppStream = nullptr; result = ma_create_and_configure_AAudioStreamBuilder__aaudio(pDevice->pContext, pDescriptor->pDeviceID, deviceType, pDescriptor->shareMode, pDescriptor, pConfig, pDevice, &pBuilder); if (result != MA_SUCCESS) { @@ -39516,7 +39516,7 @@ static ma_result ma_open_stream__aaudio(ma_device* pDevice, const ma_device_conf static ma_result ma_close_stream__aaudio(ma_context* pContext, ma_AAudioStream* pStream) { - if (pStream == NULL) { + if (pStream == nullptr) { return MA_INVALID_ARGS; } @@ -39527,7 +39527,7 @@ static ma_bool32 ma_has_default_device__aaudio(ma_context* pContext, ma_device_t { /* The only way to know this is to try creating a stream. */ ma_AAudioStream* pStream; - ma_result result = ma_open_stream_basic__aaudio(pContext, NULL, deviceType, ma_share_mode_shared, &pStream); + ma_result result = ma_open_stream_basic__aaudio(pContext, nullptr, deviceType, ma_share_mode_shared, &pStream); if (result != MA_SUCCESS) { return MA_FALSE; } @@ -39556,8 +39556,8 @@ static ma_result ma_context_enumerate_devices__aaudio(ma_context* pContext, ma_e { ma_bool32 cbResult = MA_TRUE; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); /* Unfortunately AAudio does not have an enumeration API. Therefore I'm only going to report default devices, but only if it can instantiate a stream. */ @@ -39590,9 +39590,9 @@ static ma_result ma_context_enumerate_devices__aaudio(ma_context* pContext, ma_e static void ma_context_add_native_data_format_from_AAudioStream_ex__aaudio(ma_context* pContext, ma_AAudioStream* pStream, ma_format format, ma_uint32 flags, ma_device_info* pDeviceInfo) { - MA_ASSERT(pContext != NULL); - MA_ASSERT(pStream != NULL); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pStream != nullptr); + MA_ASSERT(pDeviceInfo != nullptr); pDeviceInfo->nativeDataFormats[pDeviceInfo->nativeDataFormatCount].format = format; pDeviceInfo->nativeDataFormats[pDeviceInfo->nativeDataFormatCount].channels = ((MA_PFN_AAudioStream_getChannelCount)pContext->aaudio.AAudioStream_getChannelCount)(pStream); @@ -39613,10 +39613,10 @@ static ma_result ma_context_get_device_info__aaudio(ma_context* pContext, ma_dev ma_AAudioStream* pStream; ma_result result; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); /* ID */ - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { pDeviceInfo->id.aaudio = pDeviceID->aaudio; } else { pDeviceInfo->id.aaudio = MA_AAUDIO_UNSPECIFIED; @@ -39641,23 +39641,23 @@ static ma_result ma_context_get_device_info__aaudio(ma_context* pContext, ma_dev ma_context_add_native_data_format_from_AAudioStream__aaudio(pContext, pStream, 0, pDeviceInfo); ma_close_stream__aaudio(pContext, pStream); - pStream = NULL; + pStream = nullptr; return MA_SUCCESS; } static ma_result ma_close_streams__aaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* When rerouting, streams may have been closed and never re-opened. Hence the extra checks below. */ if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { ma_close_stream__aaudio(pDevice->pContext, (ma_AAudioStream*)pDevice->aaudio.pStreamCapture); - pDevice->aaudio.pStreamCapture = NULL; + pDevice->aaudio.pStreamCapture = nullptr; } if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { ma_close_stream__aaudio(pDevice->pContext, (ma_AAudioStream*)pDevice->aaudio.pStreamPlayback); - pDevice->aaudio.pStreamPlayback = NULL; + pDevice->aaudio.pStreamPlayback = nullptr; } return MA_SUCCESS; @@ -39665,7 +39665,7 @@ static ma_result ma_close_streams__aaudio(ma_device* pDevice) static ma_result ma_device_uninit__aaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* Note: Closing the streams may cause a timeout error, which would then trigger rerouting in our error callback. @@ -39693,11 +39693,11 @@ static ma_result ma_device_init_by_type__aaudio(ma_device* pDevice, const ma_dev int32_t framesPerDataCallback; ma_AAudioStream* pStream; - MA_ASSERT(pDevice != NULL); - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDescriptor != NULL); + MA_ASSERT(pDevice != nullptr); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDescriptor != nullptr); - *ppStream = NULL; /* Safety. */ + *ppStream = nullptr; /* Safety. */ /* First step is to open the stream. From there we'll be able to extract the internal configuration. */ result = ma_open_stream__aaudio(pDevice, pConfig, deviceType, pDescriptor, &pStream); @@ -39737,7 +39737,7 @@ static ma_result ma_device_init_streams__aaudio(ma_device* pDevice, const ma_dev { ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pConfig->deviceType == ma_device_type_loopback) { return MA_DEVICE_TYPE_NOT_SUPPORTED; @@ -39770,7 +39770,7 @@ static ma_result ma_device_init__aaudio(ma_device* pDevice, const ma_device_conf { ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); result = ma_device_init_streams__aaudio(pDevice, pConfig, pDescriptorPlayback, pDescriptorCapture); if (result != MA_SUCCESS) { @@ -39790,9 +39790,9 @@ static ma_result ma_device_start_stream__aaudio(ma_device* pDevice, ma_AAudioStr ma_aaudio_result_t resultAA; ma_aaudio_stream_state_t currentState; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); - if (pStream == NULL) { + if (pStream == nullptr) { return MA_INVALID_ARGS; } @@ -39826,9 +39826,9 @@ static ma_result ma_device_stop_stream__aaudio(ma_device* pDevice, ma_AAudioStre ma_aaudio_result_t resultAA; ma_aaudio_stream_state_t currentState; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); - if (pStream == NULL) { + if (pStream == nullptr) { return MA_INVALID_ARGS; } @@ -39869,7 +39869,7 @@ static ma_result ma_device_stop_stream__aaudio(ma_device* pDevice, ma_AAudioStre static ma_result ma_device_start__aaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { ma_result result = ma_device_start_stream__aaudio(pDevice, (ma_AAudioStream*)pDevice->aaudio.pStreamCapture); @@ -39893,7 +39893,7 @@ static ma_result ma_device_start__aaudio(ma_device* pDevice) static ma_result ma_device_stop__aaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { ma_result result = ma_device_stop_stream__aaudio(pDevice, (ma_AAudioStream*)pDevice->aaudio.pStreamCapture); @@ -39921,7 +39921,7 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev ma_result result; ma_int32 iAttempt; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* We got disconnected! Retry a few times, until we find a connected device! */ iAttempt = 0; @@ -39941,11 +39941,11 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev ma_device_descriptor descriptorCapture; deviceConfig = ma_device_config_init(deviceType); - deviceConfig.playback.pDeviceID = NULL; /* Only doing rerouting with default devices. */ + deviceConfig.playback.pDeviceID = nullptr; /* Only doing rerouting with default devices. */ deviceConfig.playback.shareMode = pDevice->playback.shareMode; deviceConfig.playback.format = pDevice->playback.format; deviceConfig.playback.channels = pDevice->playback.channels; - deviceConfig.capture.pDeviceID = NULL; /* Only doing rerouting with default devices. */ + deviceConfig.capture.pDeviceID = nullptr; /* Only doing rerouting with default devices. */ deviceConfig.capture.shareMode = pDevice->capture.shareMode; deviceConfig.capture.format = pDevice->capture.format; deviceConfig.capture.channels = pDevice->capture.channels; @@ -40029,11 +40029,11 @@ static ma_result ma_device_reinit__aaudio(ma_device* pDevice, ma_device_type dev static ma_result ma_device_get_info__aaudio(ma_device* pDevice, ma_device_type type, ma_device_info* pDeviceInfo) { - ma_AAudioStream* pStream = NULL; + ma_AAudioStream* pStream = nullptr; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(type != ma_device_type_duplex); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pDeviceInfo != nullptr); if (type == ma_device_type_capture) { pStream = (ma_AAudioStream*)pDevice->aaudio.pStreamCapture; @@ -40047,7 +40047,7 @@ static ma_result ma_device_get_info__aaudio(ma_device* pDevice, ma_device_type t } /* Safety. Should never happen. */ - if (pStream == NULL) { + if (pStream == nullptr) { return MA_INVALID_OPERATION; } @@ -40060,13 +40060,13 @@ static ma_result ma_device_get_info__aaudio(ma_device* pDevice, ma_device_type t static ma_result ma_context_uninit__aaudio(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_aaudio); ma_device_job_thread_uninit(&pContext->aaudio.jobThread, &pContext->allocationCallbacks); ma_dlclose(ma_context_get_log(pContext), pContext->aaudio.hAAudio); - pContext->aaudio.hAAudio = NULL; + pContext->aaudio.hAAudio = nullptr; return MA_SUCCESS; } @@ -40081,12 +40081,12 @@ static ma_result ma_context_init__aaudio(ma_context* pContext, const ma_context_ for (i = 0; i < ma_countof(libNames); ++i) { pContext->aaudio.hAAudio = ma_dlopen(ma_context_get_log(pContext), libNames[i]); - if (pContext->aaudio.hAAudio != NULL) { + if (pContext->aaudio.hAAudio != nullptr) { break; } } - if (pContext->aaudio.hAAudio == NULL) { + if (pContext->aaudio.hAAudio == nullptr) { return MA_FAILED_TO_INIT_BACKEND; } @@ -40161,9 +40161,9 @@ static ma_result ma_context_init__aaudio(ma_context* pContext, const ma_context_ pCallbacks->onDeviceUninit = ma_device_uninit__aaudio; pCallbacks->onDeviceStart = ma_device_start__aaudio; pCallbacks->onDeviceStop = ma_device_stop__aaudio; - pCallbacks->onDeviceRead = NULL; /* Not used because AAudio is asynchronous. */ - pCallbacks->onDeviceWrite = NULL; /* Not used because AAudio is asynchronous. */ - pCallbacks->onDeviceDataLoop = NULL; /* Not used because AAudio is asynchronous. */ + pCallbacks->onDeviceRead = nullptr; /* Not used because AAudio is asynchronous. */ + pCallbacks->onDeviceWrite = nullptr; /* Not used because AAudio is asynchronous. */ + pCallbacks->onDeviceDataLoop = nullptr; /* Not used because AAudio is asynchronous. */ pCallbacks->onDeviceGetInfo = ma_device_get_info__aaudio; @@ -40177,7 +40177,7 @@ static ma_result ma_context_init__aaudio(ma_context* pContext, const ma_context_ result = ma_device_job_thread_init(&jobThreadConfig, &pContext->allocationCallbacks, &pContext->aaudio.jobThread); if (result != MA_SUCCESS) { ma_dlclose(ma_context_get_log(pContext), pContext->aaudio.hAAudio); - pContext->aaudio.hAAudio = NULL; + pContext->aaudio.hAAudio = nullptr; return result; } } @@ -40192,10 +40192,10 @@ static ma_result ma_job_process__device__aaudio_reroute(ma_job* pJob) ma_result result = MA_SUCCESS; ma_device* pDevice; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pDevice = (ma_device*)pJob->data.device.aaudio.reroute.pDevice; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); ma_mutex_lock(&pDevice->aaudio.rerouteLock); { @@ -40237,8 +40237,8 @@ OpenSL|ES Backend typedef SLresult (SLAPIENTRY * ma_slCreateEngine_proc)(SLObjectItf* pEngine, SLuint32 numOptions, SLEngineOption* pEngineOptions, SLuint32 numInterfaces, SLInterfaceID* pInterfaceIds, SLboolean* pInterfaceRequired); /* OpenSL|ES has one-per-application objects :( */ -static SLObjectItf g_maEngineObjectSL = NULL; -static SLEngineItf g_maEngineSL = NULL; +static SLObjectItf g_maEngineObjectSL = nullptr; +static SLEngineItf g_maEngineSL = nullptr; static ma_uint32 g_maOpenSLInitCounter = 0; static ma_spinlock g_maOpenSLSpinlock = 0; /* For init/uninit. */ @@ -40456,8 +40456,8 @@ static ma_result ma_context_enumerate_devices__opensl(ma_context* pContext, ma_e { ma_bool32 cbResult; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); MA_ASSERT(g_maOpenSLInitCounter > 0); /* <-- If you trigger this it means you've either not initialized the context, or you've uninitialized it and then attempted to enumerate devices. */ if (g_maOpenSLInitCounter == 0) { @@ -40565,8 +40565,8 @@ return_default_device:; static void ma_context_add_data_format_ex__opensl(ma_context* pContext, ma_format format, ma_uint32 channels, ma_uint32 sampleRate, ma_device_info* pDeviceInfo) { - MA_ASSERT(pContext != NULL); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pDeviceInfo != nullptr); pDeviceInfo->nativeDataFormats[pDeviceInfo->nativeDataFormatCount].format = format; pDeviceInfo->nativeDataFormats[pDeviceInfo->nativeDataFormatCount].channels = channels; @@ -40584,8 +40584,8 @@ static void ma_context_add_data_format__opensl(ma_context* pContext, ma_format f ma_uint32 iChannel; ma_uint32 iSampleRate; - MA_ASSERT(pContext != NULL); - MA_ASSERT(pDeviceInfo != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(pDeviceInfo != nullptr); /* Each sample format can support mono and stereo, and we'll support a small subset of standard @@ -40603,7 +40603,7 @@ static void ma_context_add_data_format__opensl(ma_context* pContext, ma_format f static ma_result ma_context_get_device_info__opensl(ma_context* pContext, ma_device_type deviceType, const ma_device_id* pDeviceID, ma_device_info* pDeviceInfo) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(g_maOpenSLInitCounter > 0); /* <-- If you trigger this it means you've either not initialized the context, or you've uninitialized it and then attempted to get device info. */ if (g_maOpenSLInitCounter == 0) { @@ -40647,7 +40647,7 @@ static ma_result ma_context_get_device_info__opensl(ma_context* pContext, ma_dev #endif return_default_device: - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { if ((deviceType == ma_device_type_playback && pDeviceID->opensl != SL_DEFAULTDEVICEID_AUDIOOUTPUT) || (deviceType == ma_device_type_capture && pDeviceID->opensl != SL_DEFAULTDEVICEID_AUDIOINPUT)) { return MA_NO_DEVICE; /* Don't know the device. */ @@ -40695,7 +40695,7 @@ static void ma_buffer_queue_callback_capture__opensl_android(SLAndroidSimpleBuff ma_uint8* pBuffer; SLresult resultSL; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); (void)pBufferQueue; @@ -40718,7 +40718,7 @@ static void ma_buffer_queue_callback_capture__opensl_android(SLAndroidSimpleBuff periodSizeInBytes = pDevice->capture.internalPeriodSizeInFrames * ma_get_bytes_per_frame(pDevice->capture.internalFormat, pDevice->capture.internalChannels); pBuffer = pDevice->opensl.pBufferCapture + (pDevice->opensl.currentBufferIndexCapture * periodSizeInBytes); - ma_device_handle_backend_data_callback(pDevice, NULL, pBuffer, pDevice->capture.internalPeriodSizeInFrames); + ma_device_handle_backend_data_callback(pDevice, nullptr, pBuffer, pDevice->capture.internalPeriodSizeInFrames); resultSL = MA_OPENSL_BUFFERQUEUE(pDevice->opensl.pBufferQueueCapture)->Enqueue((SLAndroidSimpleBufferQueueItf)pDevice->opensl.pBufferQueueCapture, pBuffer, periodSizeInBytes); if (resultSL != SL_RESULT_SUCCESS) { @@ -40735,7 +40735,7 @@ static void ma_buffer_queue_callback_playback__opensl_android(SLAndroidSimpleBuf ma_uint8* pBuffer; SLresult resultSL; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); (void)pBufferQueue; @@ -40752,7 +40752,7 @@ static void ma_buffer_queue_callback_playback__opensl_android(SLAndroidSimpleBuf periodSizeInBytes = pDevice->playback.internalPeriodSizeInFrames * ma_get_bytes_per_frame(pDevice->playback.internalFormat, pDevice->playback.internalChannels); pBuffer = pDevice->opensl.pBufferPlayback + (pDevice->opensl.currentBufferIndexPlayback * periodSizeInBytes); - ma_device_handle_backend_data_callback(pDevice, pBuffer, NULL, pDevice->playback.internalPeriodSizeInFrames); + ma_device_handle_backend_data_callback(pDevice, pBuffer, nullptr, pDevice->playback.internalPeriodSizeInFrames); resultSL = MA_OPENSL_BUFFERQUEUE(pDevice->opensl.pBufferQueuePlayback)->Enqueue((SLAndroidSimpleBufferQueueItf)pDevice->opensl.pBufferQueuePlayback, pBuffer, periodSizeInBytes); if (resultSL != SL_RESULT_SUCCESS) { @@ -40765,7 +40765,7 @@ static void ma_buffer_queue_callback_playback__opensl_android(SLAndroidSimpleBuf static ma_result ma_device_uninit__opensl(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(g_maOpenSLInitCounter > 0); /* <-- If you trigger this it means you've either not initialized the context, or you've uninitialized it before uninitializing the device. */ if (g_maOpenSLInitCounter == 0) { @@ -40937,7 +40937,7 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf } /* Now we can start initializing the device properly. */ - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ZERO_OBJECT(&pDevice->opensl); queue.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; @@ -40954,10 +40954,10 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf locatorDevice.locatorType = SL_DATALOCATOR_IODEVICE; locatorDevice.deviceType = SL_IODEVICE_AUDIOINPUT; locatorDevice.deviceID = SL_DEFAULTDEVICEID_AUDIOINPUT; /* Must always use the default device with Android. */ - locatorDevice.device = NULL; + locatorDevice.device = nullptr; source.pLocator = &locatorDevice; - source.pFormat = NULL; + source.pFormat = nullptr; queue.numBuffers = pDescriptorCapture->periodCount; @@ -41032,7 +41032,7 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf bufferSizeInBytes = pDescriptorCapture->periodSizeInFrames * ma_get_bytes_per_frame(pDescriptorCapture->format, pDescriptorCapture->channels) * pDescriptorCapture->periodCount; pDevice->opensl.pBufferCapture = (ma_uint8*)ma_calloc(bufferSizeInBytes, &pDevice->pContext->allocationCallbacks); - if (pDevice->opensl.pBufferCapture == NULL) { + if (pDevice->opensl.pBufferCapture == nullptr) { ma_device_uninit__opensl(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[OpenSL] Failed to allocate memory for data buffer."); return MA_OUT_OF_MEMORY; @@ -41049,7 +41049,7 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf ma_SLDataFormat_PCM_init__opensl(pDescriptorPlayback->format, pDescriptorPlayback->channels, pDescriptorPlayback->sampleRate, pDescriptorPlayback->channelMap, &pcm); - resultSL = (*g_maEngineSL)->CreateOutputMix(g_maEngineSL, (SLObjectItf*)&pDevice->opensl.pOutputMixObj, 0, NULL, NULL); + resultSL = (*g_maEngineSL)->CreateOutputMix(g_maEngineSL, (SLObjectItf*)&pDevice->opensl.pOutputMixObj, 0, nullptr, nullptr); if (resultSL != SL_RESULT_SUCCESS) { ma_device_uninit__opensl(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[OpenSL] Failed to create output mix."); @@ -41071,7 +41071,7 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf } /* Set the output device. */ - if (pDescriptorPlayback->pDeviceID != NULL) { + if (pDescriptorPlayback->pDeviceID != nullptr) { SLuint32 deviceID_OpenSL = pDescriptorPlayback->pDeviceID->opensl; MA_OPENSL_OUTPUTMIX(pDevice->opensl.pOutputMix)->ReRoute((SLOutputMixItf)pDevice->opensl.pOutputMix, 1, &deviceID_OpenSL); } @@ -41085,7 +41085,7 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf outmixLocator.outputMix = (SLObjectItf)pDevice->opensl.pOutputMixObj; sink.pLocator = &outmixLocator; - sink.pFormat = NULL; + sink.pFormat = nullptr; resultSL = (*g_maEngineSL)->CreateAudioPlayer(g_maEngineSL, (SLObjectItf*)&pDevice->opensl.pAudioPlayerObj, &source, &sink, ma_countof(itfIDs), itfIDs, itfIDsRequired); if (resultSL == SL_RESULT_CONTENT_UNSUPPORTED || resultSL == SL_RESULT_PARAMETER_INVALID) { @@ -41155,7 +41155,7 @@ static ma_result ma_device_init__opensl(ma_device* pDevice, const ma_device_conf bufferSizeInBytes = pDescriptorPlayback->periodSizeInFrames * ma_get_bytes_per_frame(pDescriptorPlayback->format, pDescriptorPlayback->channels) * pDescriptorPlayback->periodCount; pDevice->opensl.pBufferPlayback = (ma_uint8*)ma_calloc(bufferSizeInBytes, &pDevice->pContext->allocationCallbacks); - if (pDevice->opensl.pBufferPlayback == NULL) { + if (pDevice->opensl.pBufferPlayback == nullptr) { ma_device_uninit__opensl(pDevice); ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[OpenSL] Failed to allocate memory for data buffer."); return MA_OUT_OF_MEMORY; @@ -41175,7 +41175,7 @@ static ma_result ma_device_start__opensl(ma_device* pDevice) size_t periodSizeInBytes; ma_uint32 iPeriod; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(g_maOpenSLInitCounter > 0); /* <-- If you trigger this it means you've either not initialized the context, or you've uninitialized it and then attempted to start the device. */ if (g_maOpenSLInitCounter == 0) { @@ -41266,7 +41266,7 @@ static ma_result ma_device_stop__opensl(ma_device* pDevice) { SLresult resultSL; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); MA_ASSERT(g_maOpenSLInitCounter > 0); /* <-- If you trigger this it means you've either not initialized the context, or you've uninitialized it before stopping/uninitializing the device. */ if (g_maOpenSLInitCounter == 0) { @@ -41306,7 +41306,7 @@ static ma_result ma_device_stop__opensl(ma_device* pDevice) static ma_result ma_context_uninit__opensl(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_opensl); (void)pContext; @@ -41329,7 +41329,7 @@ static ma_result ma_dlsym_SLInterfaceID__opensl(ma_context* pContext, const char { /* We need to return an error if the symbol cannot be found. This is important because there have been reports that some symbols do not exist. */ ma_handle* p = (ma_handle*)ma_dlsym(ma_context_get_log(pContext), pContext->opensl.libOpenSLES, pName); - if (p == NULL) { + if (p == nullptr) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_INFO, "[OpenSL] Cannot find symbol %s", pName); return MA_NO_BACKEND; } @@ -41344,7 +41344,7 @@ static ma_result ma_context_init_engine_nolock__opensl(ma_context* pContext) if (g_maOpenSLInitCounter == 1) { SLresult resultSL; - resultSL = ((ma_slCreateEngine_proc)pContext->opensl.slCreateEngine)(&g_maEngineObjectSL, 0, NULL, 0, NULL, NULL); + resultSL = ((ma_slCreateEngine_proc)pContext->opensl.slCreateEngine)(&g_maEngineObjectSL, 0, nullptr, 0, nullptr, nullptr); if (resultSL != SL_RESULT_SUCCESS) { g_maOpenSLInitCounter -= 1; return ma_result_from_OpenSL(resultSL); @@ -41374,7 +41374,7 @@ static ma_result ma_context_init__opensl(ma_context* pContext, const ma_context_ }; #endif - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); (void)pConfig; @@ -41387,12 +41387,12 @@ static ma_result ma_context_init__opensl(ma_context* pContext, const ma_context_ */ for (i = 0; i < ma_countof(libOpenSLESNames); i += 1) { pContext->opensl.libOpenSLES = ma_dlopen(ma_context_get_log(pContext), libOpenSLESNames[i]); - if (pContext->opensl.libOpenSLES != NULL) { + if (pContext->opensl.libOpenSLES != nullptr) { break; } } - if (pContext->opensl.libOpenSLES == NULL) { + if (pContext->opensl.libOpenSLES == nullptr) { ma_log_post(ma_context_get_log(pContext), MA_LOG_LEVEL_INFO, "[OpenSL] Could not find libOpenSLES.so"); return MA_NO_BACKEND; } @@ -41440,7 +41440,7 @@ static ma_result ma_context_init__opensl(ma_context* pContext, const ma_context_ } pContext->opensl.slCreateEngine = (ma_proc)ma_dlsym(ma_context_get_log(pContext), pContext->opensl.libOpenSLES, "slCreateEngine"); - if (pContext->opensl.slCreateEngine == NULL) { + if (pContext->opensl.slCreateEngine == nullptr) { ma_dlclose(ma_context_get_log(pContext), pContext->opensl.libOpenSLES); ma_log_post(ma_context_get_log(pContext), MA_LOG_LEVEL_INFO, "[OpenSL] Cannot find symbol slCreateEngine."); return MA_NO_BACKEND; @@ -41478,9 +41478,9 @@ static ma_result ma_context_init__opensl(ma_context* pContext, const ma_context_ pCallbacks->onDeviceUninit = ma_device_uninit__opensl; pCallbacks->onDeviceStart = ma_device_start__opensl; pCallbacks->onDeviceStop = ma_device_stop__opensl; - pCallbacks->onDeviceRead = NULL; /* Not needed because OpenSL|ES is asynchronous. */ - pCallbacks->onDeviceWrite = NULL; /* Not needed because OpenSL|ES is asynchronous. */ - pCallbacks->onDeviceDataLoop = NULL; /* Not needed because OpenSL|ES is asynchronous. */ + pCallbacks->onDeviceRead = nullptr; /* Not needed because OpenSL|ES is asynchronous. */ + pCallbacks->onDeviceWrite = nullptr; /* Not needed because OpenSL|ES is asynchronous. */ + pCallbacks->onDeviceDataLoop = nullptr; /* Not needed because OpenSL|ES is asynchronous. */ return MA_SUCCESS; } @@ -41544,12 +41544,12 @@ void EMSCRIPTEN_KEEPALIVE ma_free_emscripten(void* p, const ma_allocation_callba void EMSCRIPTEN_KEEPALIVE ma_device_process_pcm_frames_capture__webaudio(ma_device* pDevice, int frameCount, float* pFrames) { - ma_device_handle_backend_data_callback(pDevice, NULL, pFrames, (ma_uint32)frameCount); + ma_device_handle_backend_data_callback(pDevice, nullptr, pFrames, (ma_uint32)frameCount); } void EMSCRIPTEN_KEEPALIVE ma_device_process_pcm_frames_playback__webaudio(ma_device* pDevice, int frameCount, float* pFrames) { - ma_device_handle_backend_data_callback(pDevice, pFrames, NULL, (ma_uint32)frameCount); + ma_device_handle_backend_data_callback(pDevice, pFrames, nullptr, (ma_uint32)frameCount); } #ifdef __cplusplus } @@ -41559,8 +41559,8 @@ static ma_result ma_context_enumerate_devices__webaudio(ma_context* pContext, ma { ma_bool32 cbResult = MA_TRUE; - MA_ASSERT(pContext != NULL); - MA_ASSERT(callback != NULL); + MA_ASSERT(pContext != nullptr); + MA_ASSERT(callback != nullptr); /* Only supporting default devices for now. */ @@ -41589,7 +41589,7 @@ static ma_result ma_context_enumerate_devices__webaudio(ma_context* pContext, ma static ma_result ma_context_get_device_info__webaudio(ma_context* pContext, ma_device_type deviceType, const ma_device_id* pDeviceID, ma_device_info* pDeviceInfo) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); if (deviceType == ma_device_type_capture && !ma_is_capture_supported__webaudio()) { return MA_NO_DEVICE; @@ -41634,7 +41634,7 @@ static ma_result ma_context_get_device_info__webaudio(ma_context* pContext, ma_d static ma_result ma_device_uninit__webaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); #if defined(MA_USE_AUDIO_WORKLETS) { @@ -41872,7 +41872,7 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a #endif pParameters->pDevice->webaudio.pIntermediaryBuffer = (float*)ma_malloc(intermediaryBufferSizeInFrames * (ma_uint32)channels * sizeof(float), &pParameters->pDevice->pContext->allocationCallbacks); - if (pParameters->pDevice->webaudio.pIntermediaryBuffer == NULL) { + if (pParameters->pDevice->webaudio.pIntermediaryBuffer == nullptr) { pParameters->pDevice->webaudio.initResult = MA_OUT_OF_MEMORY; ma_free(pParameters, &pParameters->pDevice->pContext->allocationCallbacks); return; @@ -41931,7 +41931,7 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a /* We need to update the descriptors so that they reflect the internal data format. Both capture and playback should be the same. */ sampleRate = EM_ASM_INT({ return emscriptenGetAudioObject($0).sampleRate; }, audioContext); - if (pParameters->pDescriptorCapture != NULL) { + if (pParameters->pDescriptorCapture != nullptr) { pParameters->pDescriptorCapture->format = ma_format_f32; pParameters->pDescriptorCapture->channels = (ma_uint32)channels; pParameters->pDescriptorCapture->sampleRate = (ma_uint32)sampleRate; @@ -41940,7 +41940,7 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a pParameters->pDescriptorCapture->periodCount = 1; } - if (pParameters->pDescriptorPlayback != NULL) { + if (pParameters->pDescriptorPlayback != nullptr) { pParameters->pDescriptorPlayback->format = ma_format_f32; pParameters->pDescriptorPlayback->channels = (ma_uint32)channels; pParameters->pDescriptorPlayback->sampleRate = (ma_uint32)sampleRate; @@ -41960,7 +41960,7 @@ static void ma_audio_worklet_thread_initialized__webaudio(EMSCRIPTEN_WEBAUDIO_T ma_audio_worklet_thread_initialized_data* pParameters = (ma_audio_worklet_thread_initialized_data*)pUserData; WebAudioWorkletProcessorCreateOptions workletProcessorOptions; - MA_ASSERT(pParameters != NULL); + MA_ASSERT(pParameters != nullptr); if (success == EM_FALSE) { pParameters->pDevice->webaudio.initResult = MA_ERROR; @@ -42028,14 +42028,14 @@ static ma_result ma_device_init__webaudio(ma_device* pDevice, const ma_device_co allocate this on the heap to keep it simple. */ pStackBuffer = ma_aligned_malloc(MA_AUDIO_WORKLETS_THREAD_STACK_SIZE, 16, &pDevice->pContext->allocationCallbacks); - if (pStackBuffer == NULL) { + if (pStackBuffer == nullptr) { emscripten_destroy_audio_context(pDevice->webaudio.audioContext); return MA_OUT_OF_MEMORY; } /* Our thread initialization parameters need to be allocated on the heap so they don't go out of scope. */ pInitParameters = (ma_audio_worklet_thread_initialized_data*)ma_malloc(sizeof(*pInitParameters), &pDevice->pContext->allocationCallbacks); - if (pInitParameters == NULL) { + if (pInitParameters == nullptr) { ma_free(pStackBuffer, &pDevice->pContext->allocationCallbacks); emscripten_destroy_audio_context(pDevice->webaudio.audioContext); return MA_OUT_OF_MEMORY; @@ -42108,7 +42108,7 @@ static ma_result ma_device_init__webaudio(ma_device* pDevice, const ma_device_co /* We need an intermediary buffer for doing interleaving and deinterleaving. */ pDevice->webaudio.pIntermediaryBuffer = (float*)ma_malloc(periodSizeInFrames * channels * sizeof(float), &pDevice->pContext->allocationCallbacks); - if (pDevice->webaudio.pIntermediaryBuffer == NULL) { + if (pDevice->webaudio.pIntermediaryBuffer == nullptr) { return MA_OUT_OF_MEMORY; } @@ -42219,7 +42219,7 @@ static ma_result ma_device_init__webaudio(ma_device* pDevice, const ma_device_co /* Grab the sample rate from the audio context directly. */ sampleRate = (ma_uint32)EM_ASM_INT({ return window.miniaudio.get_device_by_index($0).webaudio.sampleRate; }, deviceIndex); - if (pDescriptorCapture != NULL) { + if (pDescriptorCapture != nullptr) { pDescriptorCapture->format = ma_format_f32; pDescriptorCapture->channels = channels; pDescriptorCapture->sampleRate = sampleRate; @@ -42228,7 +42228,7 @@ static ma_result ma_device_init__webaudio(ma_device* pDevice, const ma_device_co pDescriptorCapture->periodCount = 1; } - if (pDescriptorPlayback != NULL) { + if (pDescriptorPlayback != nullptr) { pDescriptorPlayback->format = ma_format_f32; pDescriptorPlayback->channels = channels; pDescriptorPlayback->sampleRate = sampleRate; @@ -42244,7 +42244,7 @@ static ma_result ma_device_init__webaudio(ma_device* pDevice, const ma_device_co static ma_result ma_device_start__webaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); EM_ASM({ var device = window.miniaudio.get_device_by_index($0); @@ -42257,7 +42257,7 @@ static ma_result ma_device_start__webaudio(ma_device* pDevice) static ma_result ma_device_stop__webaudio(ma_device* pDevice) { - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); /* From the WebAudio API documentation for AudioContext.suspend(): @@ -42281,7 +42281,7 @@ static ma_result ma_device_stop__webaudio(ma_device* pDevice) static ma_result ma_context_uninit__webaudio(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); MA_ASSERT(pContext->backend == ma_backend_webaudio); (void)pContext; /* Unused. */ @@ -42307,7 +42307,7 @@ static ma_result ma_context_init__webaudio(ma_context* pContext, const ma_contex { int resultFromJS; - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); (void)pConfig; /* Unused. */ @@ -42422,9 +42422,9 @@ static ma_result ma_context_init__webaudio(ma_context* pContext, const ma_contex pCallbacks->onDeviceUninit = ma_device_uninit__webaudio; pCallbacks->onDeviceStart = ma_device_start__webaudio; pCallbacks->onDeviceStop = ma_device_stop__webaudio; - pCallbacks->onDeviceRead = NULL; /* Not needed because WebAudio is asynchronous. */ - pCallbacks->onDeviceWrite = NULL; /* Not needed because WebAudio is asynchronous. */ - pCallbacks->onDeviceDataLoop = NULL; /* Not needed because WebAudio is asynchronous. */ + pCallbacks->onDeviceRead = nullptr; /* Not needed because WebAudio is asynchronous. */ + pCallbacks->onDeviceWrite = nullptr; /* Not needed because WebAudio is asynchronous. */ + pCallbacks->onDeviceDataLoop = nullptr; /* Not needed because WebAudio is asynchronous. */ return MA_SUCCESS; } @@ -42435,7 +42435,7 @@ static ma_result ma_context_init__webaudio(ma_context* pContext, const ma_contex static ma_bool32 ma__is_channel_map_valid(const ma_channel* pChannelMap, ma_uint32 channels) { /* A blank channel map should be allowed, in which case it should use an appropriate default which will depend on context. */ - if (pChannelMap != NULL && pChannelMap[0] != MA_CHANNEL_NONE) { + if (pChannelMap != nullptr && pChannelMap[0] != MA_CHANNEL_NONE) { ma_uint32 iChannel; if (channels == 0 || channels > MA_MAX_CHANNELS) { @@ -42459,10 +42459,10 @@ static ma_bool32 ma__is_channel_map_valid(const ma_channel* pChannelMap, ma_uint static ma_bool32 ma_context_is_backend_asynchronous(ma_context* pContext) { - MA_ASSERT(pContext != NULL); + MA_ASSERT(pContext != nullptr); - if (pContext->callbacks.onDeviceRead == NULL && pContext->callbacks.onDeviceWrite == NULL) { - if (pContext->callbacks.onDeviceDataLoop == NULL) { + if (pContext->callbacks.onDeviceRead == nullptr && pContext->callbacks.onDeviceWrite == nullptr) { + if (pContext->callbacks.onDeviceDataLoop == nullptr) { return MA_TRUE; } else { return MA_FALSE; @@ -42477,7 +42477,7 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d { ma_result result; - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); if (deviceType == ma_device_type_capture || deviceType == ma_device_type_duplex || deviceType == ma_device_type_loopback) { if (pDevice->capture.format == ma_format_unknown) { @@ -42629,15 +42629,15 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d newInputCacheSizeInBytes = newInputCacheCap * ma_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels); if (newInputCacheSizeInBytes > MA_SIZE_MAX) { ma_free(pDevice->playback.pInputCache, &pDevice->pContext->allocationCallbacks); - pDevice->playback.pInputCache = NULL; + pDevice->playback.pInputCache = nullptr; pDevice->playback.inputCacheCap = 0; return MA_OUT_OF_MEMORY; /* Allocation too big. Should never hit this, but makes the cast below safer for 32-bit builds. */ } pNewInputCache = ma_realloc(pDevice->playback.pInputCache, (size_t)newInputCacheSizeInBytes, &pDevice->pContext->allocationCallbacks); - if (pNewInputCache == NULL) { + if (pNewInputCache == nullptr) { ma_free(pDevice->playback.pInputCache, &pDevice->pContext->allocationCallbacks); - pDevice->playback.pInputCache = NULL; + pDevice->playback.pInputCache = nullptr; pDevice->playback.inputCacheCap = 0; return MA_OUT_OF_MEMORY; } @@ -42647,7 +42647,7 @@ static ma_result ma_device__post_init_setup(ma_device* pDevice, ma_device_type d } else { /* Heap allocation not required. Make sure we clear out the old cache just in case this function was called in response to a route change. */ ma_free(pDevice->playback.pInputCache, &pDevice->pContext->allocationCallbacks); - pDevice->playback.pInputCache = NULL; + pDevice->playback.pInputCache = nullptr; pDevice->playback.inputCacheCap = 0; } } @@ -42659,7 +42659,7 @@ MA_API ma_result ma_device_post_init(ma_device* pDevice, ma_device_type deviceTy { ma_result result; - if (pDevice == NULL) { + if (pDevice == nullptr) { return MA_INVALID_ARGS; } @@ -42712,7 +42712,7 @@ MA_API ma_result ma_device_post_init(ma_device* pDevice, ma_device_type deviceTy ma_strncpy_s(pDevice->capture.name, sizeof(pDevice->capture.name), deviceInfo.name, (size_t)-1); } else { /* We failed to retrieve the device info. Fall back to a default name. */ - if (pDescriptorCapture->pDeviceID == NULL) { + if (pDescriptorCapture->pDeviceID == nullptr) { ma_strncpy_s(pDevice->capture.name, sizeof(pDevice->capture.name), MA_DEFAULT_CAPTURE_DEVICE_NAME, (size_t)-1); } else { ma_strncpy_s(pDevice->capture.name, sizeof(pDevice->capture.name), "Capture Device", (size_t)-1); @@ -42726,7 +42726,7 @@ MA_API ma_result ma_device_post_init(ma_device* pDevice, ma_device_type deviceTy ma_strncpy_s(pDevice->playback.name, sizeof(pDevice->playback.name), deviceInfo.name, (size_t)-1); } else { /* We failed to retrieve the device info. Fall back to a default name. */ - if (pDescriptorPlayback->pDeviceID == NULL) { + if (pDescriptorPlayback->pDeviceID == nullptr) { ma_strncpy_s(pDevice->playback.name, sizeof(pDevice->playback.name), MA_DEFAULT_PLAYBACK_DEVICE_NAME, (size_t)-1); } else { ma_strncpy_s(pDevice->playback.name, sizeof(pDevice->playback.name), "Playback Device", (size_t)-1); @@ -42747,10 +42747,10 @@ static ma_thread_result MA_THREADCALL ma_worker_thread(void* pData) HRESULT CoInitializeResult; #endif - MA_ASSERT(pDevice != NULL); + MA_ASSERT(pDevice != nullptr); #if defined(MA_WIN32) && !defined(MA_XBOX) - CoInitializeResult = ma_CoInitializeEx(pDevice->pContext, NULL, MA_COINIT_VALUE); + CoInitializeResult = ma_CoInitializeEx(pDevice->pContext, nullptr, MA_COINIT_VALUE); #endif /* @@ -42785,7 +42785,7 @@ static ma_thread_result MA_THREADCALL ma_worker_thread(void* pData) MA_ASSERT(ma_device_get_state(pDevice) == ma_device_state_starting); /* If the device has a start callback, start it now. */ - if (pDevice->pContext->callbacks.onDeviceStart != NULL) { + if (pDevice->pContext->callbacks.onDeviceStart != nullptr) { startResult = pDevice->pContext->callbacks.onDeviceStart(pDevice); } else { startResult = MA_SUCCESS; @@ -42807,7 +42807,7 @@ static ma_thread_result MA_THREADCALL ma_worker_thread(void* pData) ma_device__on_notification_started(pDevice); - if (pDevice->pContext->callbacks.onDeviceDataLoop != NULL) { + if (pDevice->pContext->callbacks.onDeviceDataLoop != nullptr) { pDevice->pContext->callbacks.onDeviceDataLoop(pDevice); } else { /* The backend is not using a custom main loop implementation, so now fall back to the blocking read-write implementation. */ @@ -42815,7 +42815,7 @@ static ma_thread_result MA_THREADCALL ma_worker_thread(void* pData) } /* Getting here means we have broken from the main loop which happens the application has requested that device be stopped. */ - if (pDevice->pContext->callbacks.onDeviceStop != NULL) { + if (pDevice->pContext->callbacks.onDeviceStop != nullptr) { stopResult = pDevice->pContext->callbacks.onDeviceStop(pDevice); } else { stopResult = MA_SUCCESS; /* No stop callback with the backend. Just assume successful. */ @@ -42853,7 +42853,7 @@ static ma_thread_result MA_THREADCALL ma_worker_thread(void* pData) /* Helper for determining whether or not the given device is initialized. */ static ma_bool32 ma_device__is_initialized(ma_device* pDevice) { - if (pDevice == NULL) { + if (pDevice == nullptr) { return MA_FALSE; } @@ -42904,7 +42904,7 @@ static ma_result ma_context_init_backend_apis__win32(ma_context* pContext) { /* User32.dll */ pContext->win32.hUser32DLL = ma_dlopen(ma_context_get_log(pContext), "user32.dll"); - if (pContext->win32.hUser32DLL == NULL) { + if (pContext->win32.hUser32DLL == nullptr) { return MA_FAILED_TO_INIT_BACKEND; } @@ -42914,7 +42914,7 @@ static ma_result ma_context_init_backend_apis__win32(ma_context* pContext) /* Advapi32.dll */ pContext->win32.hAdvapi32DLL = ma_dlopen(ma_context_get_log(pContext), "advapi32.dll"); - if (pContext->win32.hAdvapi32DLL == NULL) { + if (pContext->win32.hAdvapi32DLL == nullptr) { return MA_FAILED_TO_INIT_BACKEND; } @@ -42926,7 +42926,7 @@ static ma_result ma_context_init_backend_apis__win32(ma_context* pContext) /* Ole32.dll */ pContext->win32.hOle32DLL = ma_dlopen(ma_context_get_log(pContext), "ole32.dll"); - if (pContext->win32.hOle32DLL == NULL) { + if (pContext->win32.hOle32DLL == nullptr) { return MA_FAILED_TO_INIT_BACKEND; } @@ -42947,7 +42947,7 @@ static ma_result ma_context_init_backend_apis__win32(ma_context* pContext) /* TODO: Remove this once the new single threaded backend system is in place in 0.12. */ #if !defined(MA_XBOX) { - pContext->win32.CoInitializeResult = ma_CoInitializeEx(pContext, NULL, MA_COINIT_VALUE); + pContext->win32.CoInitializeResult = ma_CoInitializeEx(pContext, nullptr, MA_COINIT_VALUE); } #endif @@ -43015,7 +43015,7 @@ MA_API ma_device_job_thread_config ma_device_job_thread_config_init(void) static ma_thread_result MA_THREADCALL ma_device_job_thread_entry(void* pUserData) { ma_device_job_thread* pJobThread = (ma_device_job_thread*)pUserData; - MA_ASSERT(pJobThread != NULL); + MA_ASSERT(pJobThread != nullptr); for (;;) { ma_result result; @@ -43041,13 +43041,13 @@ MA_API ma_result ma_device_job_thread_init(const ma_device_job_thread_config* pC ma_result result; ma_job_queue_config jobQueueConfig; - if (pJobThread == NULL) { + if (pJobThread == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pJobThread); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -43080,7 +43080,7 @@ MA_API ma_result ma_device_job_thread_init(const ma_device_job_thread_config* pC MA_API void ma_device_job_thread_uninit(ma_device_job_thread* pJobThread, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pJobThread == NULL) { + if (pJobThread == nullptr) { return; } @@ -43101,7 +43101,7 @@ MA_API void ma_device_job_thread_uninit(ma_device_job_thread* pJobThread, const MA_API ma_result ma_device_job_thread_post(ma_device_job_thread* pJobThread, const ma_job* pJob) { - if (pJobThread == NULL || pJob == NULL) { + if (pJobThread == nullptr || pJob == nullptr) { return MA_INVALID_ARGS; } @@ -43110,13 +43110,13 @@ MA_API ma_result ma_device_job_thread_post(ma_device_job_thread* pJobThread, con MA_API ma_result ma_device_job_thread_next(ma_device_job_thread* pJobThread, ma_job* pJob) { - if (pJob == NULL) { + if (pJob == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pJob); - if (pJobThread == NULL) { + if (pJobThread == nullptr) { return MA_INVALID_ARGS; } @@ -43128,7 +43128,7 @@ MA_API ma_bool32 ma_device_id_equal(const ma_device_id* pA, const ma_device_id* { size_t i; - if (pA == NULL || pB == NULL) { + if (pA == nullptr || pB == nullptr) { return MA_FALSE; } @@ -43160,14 +43160,14 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC ma_backend* pBackendsToIterate; ma_uint32 backendsToIterateCount; - if (pContext == NULL) { + if (pContext == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pContext); /* Always make sure the config is set first to ensure properties are available as soon as possible. */ - if (pConfig == NULL) { + if (pConfig == nullptr) { defaultConfig = ma_context_config_init(); pConfig = &defaultConfig; } @@ -43179,14 +43179,14 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC } /* Get a lot set up first so we can start logging ASAP. */ - if (pConfig->pLog != NULL) { + if (pConfig->pLog != nullptr) { pContext->pLog = pConfig->pLog; } else { result = ma_log_init(&pContext->allocationCallbacks, &pContext->log); if (result == MA_SUCCESS) { pContext->pLog = &pContext->log; } else { - pContext->pLog = NULL; /* Logging is not available. */ + pContext->pLog = nullptr; /* Logging is not available. */ } } @@ -43206,12 +43206,12 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC pBackendsToIterate = (ma_backend*)backends; backendsToIterateCount = backendCount; - if (pBackendsToIterate == NULL) { + if (pBackendsToIterate == nullptr) { pBackendsToIterate = (ma_backend*)defaultBackends; backendsToIterateCount = ma_countof(defaultBackends); } - MA_ASSERT(pBackendsToIterate != NULL); + MA_ASSERT(pBackendsToIterate != nullptr); for (iBackend = 0; iBackend < backendsToIterateCount; iBackend += 1) { ma_backend backend = pBackendsToIterate[iBackend]; @@ -43320,7 +43320,7 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC default: break; } - if (pContext->callbacks.onContextInit != NULL) { + if (pContext->callbacks.onContextInit != nullptr) { ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_DEBUG, "Attempting to initialize %s backend...\n", ma_get_backend_name(backend)); result = pContext->callbacks.onContextInit(pContext, pConfig, &pContext->callbacks); } else { @@ -43372,11 +43372,11 @@ MA_API ma_result ma_context_init(const ma_backend backends[], ma_uint32 backendC MA_API ma_result ma_context_uninit(ma_context* pContext) { - if (pContext == NULL) { + if (pContext == nullptr) { return MA_INVALID_ARGS; } - if (pContext->callbacks.onContextUninit != NULL) { + if (pContext->callbacks.onContextUninit != nullptr) { pContext->callbacks.onContextUninit(pContext); } @@ -43400,8 +43400,8 @@ MA_API size_t ma_context_sizeof(void) MA_API ma_log* ma_context_get_log(ma_context* pContext) { - if (pContext == NULL) { - return NULL; + if (pContext == nullptr) { + return nullptr; } return pContext->pLog; @@ -43412,11 +43412,11 @@ MA_API ma_result ma_context_enumerate_devices(ma_context* pContext, ma_enum_devi { ma_result result; - if (pContext == NULL || callback == NULL) { + if (pContext == nullptr || callback == nullptr) { return MA_INVALID_ARGS; } - if (pContext->callbacks.onContextEnumerateDevices == NULL) { + if (pContext->callbacks.onContextEnumerateDevices == nullptr) { return MA_INVALID_OPERATION; } @@ -43447,7 +43447,7 @@ static ma_bool32 ma_context_get_devices__enum_callback(ma_context* pContext, ma_ if (totalDeviceInfoCount >= pContext->deviceInfoCapacity) { ma_uint32 newCapacity = pContext->deviceInfoCapacity + bufferExpansionCount; ma_device_info* pNewInfos = (ma_device_info*)ma_realloc(pContext->pDeviceInfos, sizeof(*pContext->pDeviceInfos)*newCapacity, &pContext->allocationCallbacks); - if (pNewInfos == NULL) { + if (pNewInfos == nullptr) { return MA_FALSE; /* Out of memory. */ } @@ -43483,16 +43483,16 @@ MA_API ma_result ma_context_get_devices(ma_context* pContext, ma_device_info** p ma_result result; /* Safety. */ - if (ppPlaybackDeviceInfos != NULL) *ppPlaybackDeviceInfos = NULL; - if (pPlaybackDeviceCount != NULL) *pPlaybackDeviceCount = 0; - if (ppCaptureDeviceInfos != NULL) *ppCaptureDeviceInfos = NULL; - if (pCaptureDeviceCount != NULL) *pCaptureDeviceCount = 0; + if (ppPlaybackDeviceInfos != nullptr) *ppPlaybackDeviceInfos = nullptr; + if (pPlaybackDeviceCount != nullptr) *pPlaybackDeviceCount = 0; + if (ppCaptureDeviceInfos != nullptr) *ppCaptureDeviceInfos = nullptr; + if (pCaptureDeviceCount != nullptr) *pCaptureDeviceCount = 0; - if (pContext == NULL) { + if (pContext == nullptr) { return MA_INVALID_ARGS; } - if (pContext->callbacks.onContextEnumerateDevices == NULL) { + if (pContext->callbacks.onContextEnumerateDevices == nullptr) { return MA_INVALID_OPERATION; } @@ -43504,26 +43504,26 @@ MA_API ma_result ma_context_get_devices(ma_context* pContext, ma_device_info** p pContext->captureDeviceInfoCount = 0; /* Now enumerate over available devices. */ - result = pContext->callbacks.onContextEnumerateDevices(pContext, ma_context_get_devices__enum_callback, NULL); + result = pContext->callbacks.onContextEnumerateDevices(pContext, ma_context_get_devices__enum_callback, nullptr); if (result == MA_SUCCESS) { /* Playback devices. */ - if (ppPlaybackDeviceInfos != NULL) { + if (ppPlaybackDeviceInfos != nullptr) { *ppPlaybackDeviceInfos = pContext->pDeviceInfos; } - if (pPlaybackDeviceCount != NULL) { + if (pPlaybackDeviceCount != nullptr) { *pPlaybackDeviceCount = pContext->playbackDeviceInfoCount; } /* Capture devices. */ - if (ppCaptureDeviceInfos != NULL) { + if (ppCaptureDeviceInfos != nullptr) { *ppCaptureDeviceInfos = pContext->pDeviceInfos; /* Capture devices come after playback devices. */ if (pContext->playbackDeviceInfoCount > 0) { - /* Conditional, because NULL+0 is undefined behavior. */ + /* Conditional, because nullptr+0 is undefined behavior. */ *ppCaptureDeviceInfos += pContext->playbackDeviceInfoCount; } } - if (pCaptureDeviceCount != NULL) { + if (pCaptureDeviceCount != nullptr) { *pCaptureDeviceCount = pContext->captureDeviceInfoCount; } } @@ -43539,18 +43539,18 @@ MA_API ma_result ma_context_get_device_info(ma_context* pContext, ma_device_type ma_device_info deviceInfo; /* NOTE: Do not clear pDeviceInfo on entry. The reason is the pDeviceID may actually point to pDeviceInfo->id which will break things. */ - if (pContext == NULL || pDeviceInfo == NULL) { + if (pContext == nullptr || pDeviceInfo == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(&deviceInfo); /* Help the backend out by copying over the device ID if we have one. */ - if (pDeviceID != NULL) { + if (pDeviceID != nullptr) { MA_COPY_MEMORY(&deviceInfo.id, pDeviceID, sizeof(*pDeviceID)); } - if (pContext->callbacks.onContextGetDeviceInfo == NULL) { + if (pContext->callbacks.onContextGetDeviceInfo == nullptr) { return MA_INVALID_OPERATION; } @@ -43566,7 +43566,7 @@ MA_API ma_result ma_context_get_device_info(ma_context* pContext, ma_device_type MA_API ma_bool32 ma_context_is_loopback_supported(ma_context* pContext) { - if (pContext == NULL) { + if (pContext == nullptr) { return MA_FALSE; } @@ -43591,22 +43591,22 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC ma_device_descriptor descriptorCapture; /* The context can be null, in which case we self-manage it. */ - if (pContext == NULL) { - return ma_device_init_ex(NULL, 0, NULL, pConfig, pDevice); + if (pContext == nullptr) { + return ma_device_init_ex(nullptr, 0, nullptr, pConfig, pDevice); } - if (pDevice == NULL) { + if (pDevice == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pDevice); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } /* Check that we have our callbacks defined. */ - if (pContext->callbacks.onDeviceInit == NULL) { + if (pContext->callbacks.onDeviceInit == nullptr) { return MA_INVALID_OPERATION; } @@ -43639,18 +43639,18 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC pDevice->onNotification = pConfig->notificationCallback; pDevice->onStop = pConfig->stopCallback; - if (pConfig->playback.pDeviceID != NULL) { + if (pConfig->playback.pDeviceID != nullptr) { MA_COPY_MEMORY(&pDevice->playback.id, pConfig->playback.pDeviceID, sizeof(pDevice->playback.id)); pDevice->playback.pID = &pDevice->playback.id; } else { - pDevice->playback.pID = NULL; + pDevice->playback.pID = nullptr; } - if (pConfig->capture.pDeviceID != NULL) { + if (pConfig->capture.pDeviceID != nullptr) { MA_COPY_MEMORY(&pDevice->capture.id, pConfig->capture.pDeviceID, sizeof(pDevice->capture.id)); pDevice->capture.pID = &pDevice->capture.id; } else { - pDevice->capture.pID = NULL; + pDevice->capture.pID = nullptr; } pDevice->noPreSilencedOutputBuffer = pConfig->noPreSilencedOutputBuffer; @@ -43809,7 +43809,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC ma_strncpy_s(pDevice->capture.name, sizeof(pDevice->capture.name), deviceInfo.name, (size_t)-1); } else { /* We failed to retrieve the device info. Fall back to a default name. */ - if (descriptorCapture.pDeviceID == NULL) { + if (descriptorCapture.pDeviceID == nullptr) { ma_strncpy_s(pDevice->capture.name, sizeof(pDevice->capture.name), MA_DEFAULT_CAPTURE_DEVICE_NAME, (size_t)-1); } else { ma_strncpy_s(pDevice->capture.name, sizeof(pDevice->capture.name), "Capture Device", (size_t)-1); @@ -43823,7 +43823,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC ma_strncpy_s(pDevice->playback.name, sizeof(pDevice->playback.name), deviceInfo.name, (size_t)-1); } else { /* We failed to retrieve the device info. Fall back to a default name. */ - if (descriptorPlayback.pDeviceID == NULL) { + if (descriptorPlayback.pDeviceID == nullptr) { ma_strncpy_s(pDevice->playback.name, sizeof(pDevice->playback.name), MA_DEFAULT_PLAYBACK_DEVICE_NAME, (size_t)-1); } else { ma_strncpy_s(pDevice->playback.name, sizeof(pDevice->playback.name), "Playback Device", (size_t)-1); @@ -43866,7 +43866,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC intermediaryBufferSizeInBytes = pDevice->capture.intermediaryBufferCap * ma_get_bytes_per_frame(pDevice->capture.format, pDevice->capture.channels); pDevice->capture.pIntermediaryBuffer = ma_malloc((size_t)intermediaryBufferSizeInBytes, &pContext->allocationCallbacks); - if (pDevice->capture.pIntermediaryBuffer == NULL) { + if (pDevice->capture.pIntermediaryBuffer == nullptr) { ma_device_uninit(pDevice); return MA_OUT_OF_MEMORY; } @@ -43892,7 +43892,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC intermediaryBufferSizeInBytes = pDevice->playback.intermediaryBufferCap * ma_get_bytes_per_frame(pDevice->playback.format, pDevice->playback.channels); pDevice->playback.pIntermediaryBuffer = ma_malloc((size_t)intermediaryBufferSizeInBytes, &pContext->allocationCallbacks); - if (pDevice->playback.pIntermediaryBuffer == NULL) { + if (pDevice->playback.pIntermediaryBuffer == nullptr) { ma_device_uninit(pDevice); return MA_OUT_OF_MEMORY; } @@ -43941,7 +43941,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[%s]\n", ma_get_backend_name(pDevice->pContext->backend)); if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex || pDevice->type == ma_device_type_loopback) { char name[MA_MAX_DEVICE_NAME_LENGTH + 1]; - ma_device_get_name(pDevice, ma_device_type_capture, name, sizeof(name), NULL); + ma_device_get_name(pDevice, ma_device_type_capture, name, sizeof(name), nullptr); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, " %s (%s)\n", name, "Capture"); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, " Format: %s -> %s\n", ma_get_format_name(pDevice->capture.internalFormat), ma_get_format_name(pDevice->capture.format)); @@ -43965,7 +43965,7 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC } if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) { char name[MA_MAX_DEVICE_NAME_LENGTH + 1]; - ma_device_get_name(pDevice, ma_device_type_playback, name, sizeof(name), NULL); + ma_device_get_name(pDevice, ma_device_type_playback, name, sizeof(name), nullptr); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, " %s (%s)\n", name, "Playback"); ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, " Format: %s -> %s\n", ma_get_format_name(pDevice->playback.format), ma_get_format_name(pDevice->playback.internalFormat)); @@ -44003,11 +44003,11 @@ MA_API ma_result ma_device_init_ex(const ma_backend backends[], ma_uint32 backen ma_uint32 backendsToIterateCount; ma_allocation_callbacks allocationCallbacks; - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - if (pContextConfig != NULL) { + if (pContextConfig != nullptr) { result = ma_allocation_callbacks_init_copy(&allocationCallbacks, &pContextConfig->allocationCallbacks); if (result != MA_SUCCESS) { return result; @@ -44017,7 +44017,7 @@ MA_API ma_result ma_device_init_ex(const ma_backend backends[], ma_uint32 backen } pContext = (ma_context*)ma_malloc(sizeof(*pContext), &allocationCallbacks); - if (pContext == NULL) { + if (pContext == nullptr) { return MA_OUT_OF_MEMORY; } @@ -44027,7 +44027,7 @@ MA_API ma_result ma_device_init_ex(const ma_backend backends[], ma_uint32 backen pBackendsToIterate = (ma_backend*)backends; backendsToIterateCount = backendCount; - if (pBackendsToIterate == NULL) { + if (pBackendsToIterate == nullptr) { pBackendsToIterate = (ma_backend*)defaultBackends; backendsToIterateCount = ma_countof(defaultBackends); } @@ -44037,13 +44037,13 @@ MA_API ma_result ma_device_init_ex(const ma_backend backends[], ma_uint32 backen for (iBackend = 0; iBackend < backendsToIterateCount; ++iBackend) { /* This is a hack for iOS. If the context config is null, there's a good chance the - `ma_device_init(NULL, &deviceConfig, pDevice);` pattern is being used. In this + `ma_device_init(nullptr, &deviceConfig, pDevice);` pattern is being used. In this case, set the session category based on the device type. */ #if defined(MA_APPLE_MOBILE) ma_context_config contextConfig; - if (pContextConfig == NULL) { + if (pContextConfig == nullptr) { contextConfig = ma_context_config_init(); switch (pConfig->deviceType) { case ma_device_type_duplex: { @@ -44115,7 +44115,7 @@ MA_API void ma_device_uninit(ma_device* pDevice) ma_thread_wait(&pDevice->thread); } - if (pDevice->pContext->callbacks.onDeviceUninit != NULL) { + if (pDevice->pContext->callbacks.onDeviceUninit != nullptr) { pDevice->pContext->callbacks.onDeviceUninit(pDevice); } @@ -44138,14 +44138,14 @@ MA_API void ma_device_uninit(ma_device* pDevice) ma_data_converter_uninit(&pDevice->playback.converter, &pDevice->pContext->allocationCallbacks); } - if (pDevice->playback.pInputCache != NULL) { + if (pDevice->playback.pInputCache != nullptr) { ma_free(pDevice->playback.pInputCache, &pDevice->pContext->allocationCallbacks); } - if (pDevice->capture.pIntermediaryBuffer != NULL) { + if (pDevice->capture.pIntermediaryBuffer != nullptr) { ma_free(pDevice->capture.pIntermediaryBuffer, &pDevice->pContext->allocationCallbacks); } - if (pDevice->playback.pIntermediaryBuffer != NULL) { + if (pDevice->playback.pIntermediaryBuffer != nullptr) { ma_free(pDevice->playback.pIntermediaryBuffer, &pDevice->pContext->allocationCallbacks); } @@ -44161,8 +44161,8 @@ MA_API void ma_device_uninit(ma_device* pDevice) MA_API ma_context* ma_device_get_context(ma_device* pDevice) { - if (pDevice == NULL) { - return NULL; + if (pDevice == nullptr) { + return nullptr; } return pDevice->pContext; @@ -44175,18 +44175,18 @@ MA_API ma_log* ma_device_get_log(ma_device* pDevice) MA_API ma_result ma_device_get_info(ma_device* pDevice, ma_device_type type, ma_device_info* pDeviceInfo) { - if (pDeviceInfo == NULL) { + if (pDeviceInfo == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pDeviceInfo); - if (pDevice == NULL) { + if (pDevice == nullptr) { return MA_INVALID_ARGS; } /* If the onDeviceGetInfo() callback is set, use that. Otherwise we'll fall back to ma_context_get_device_info(). */ - if (pDevice->pContext->callbacks.onDeviceGetInfo != NULL) { + if (pDevice->pContext->callbacks.onDeviceGetInfo != nullptr) { return pDevice->pContext->callbacks.onDeviceGetInfo(pDevice, type, pDeviceInfo); } @@ -44201,7 +44201,7 @@ MA_API ma_result ma_device_get_info(ma_device* pDevice, ma_device_type type, ma_ capture device, where in fact for loopback we want the default *playback* device. We'll do a bit of a hack here to make sure we get the correct info. */ - if (pDevice->type == ma_device_type_loopback && pDevice->capture.pID == NULL) { + if (pDevice->type == ma_device_type_loopback && pDevice->capture.pID == nullptr) { type = ma_device_type_playback; } @@ -44214,11 +44214,11 @@ MA_API ma_result ma_device_get_name(ma_device* pDevice, ma_device_type type, cha ma_result result; ma_device_info deviceInfo; - if (pLengthNotIncludingNullTerminator != NULL) { + if (pLengthNotIncludingNullTerminator != nullptr) { *pLengthNotIncludingNullTerminator = 0; } - if (pName != NULL && nameCap > 0) { + if (pName != nullptr && nameCap > 0) { pName[0] = '\0'; } @@ -44227,7 +44227,7 @@ MA_API ma_result ma_device_get_name(ma_device* pDevice, ma_device_type type, cha return result; } - if (pName != NULL) { + if (pName != nullptr) { ma_strncpy_s(pName, nameCap, deviceInfo.name, (size_t)-1); /* @@ -44235,12 +44235,12 @@ MA_API ma_result ma_device_get_name(ma_device* pDevice, ma_device_type type, cha source. Otherwise the caller might assume the output buffer contains more content than it actually does. */ - if (pLengthNotIncludingNullTerminator != NULL) { + if (pLengthNotIncludingNullTerminator != nullptr) { *pLengthNotIncludingNullTerminator = strlen(pName); } } else { /* Name not specified. Just report the length of the source string. */ - if (pLengthNotIncludingNullTerminator != NULL) { + if (pLengthNotIncludingNullTerminator != nullptr) { *pLengthNotIncludingNullTerminator = strlen(deviceInfo.name); } } @@ -44252,7 +44252,7 @@ MA_API ma_result ma_device_start(ma_device* pDevice) { ma_result result; - if (pDevice == NULL) { + if (pDevice == nullptr) { return MA_INVALID_ARGS; } @@ -44282,7 +44282,7 @@ MA_API ma_result ma_device_start(ma_device* pDevice) /* Asynchronous backends need to be handled differently. */ if (ma_context_is_backend_asynchronous(pDevice->pContext)) { - if (pDevice->pContext->callbacks.onDeviceStart != NULL) { + if (pDevice->pContext->callbacks.onDeviceStart != nullptr) { result = pDevice->pContext->callbacks.onDeviceStart(pDevice); } else { result = MA_INVALID_OPERATION; @@ -44321,7 +44321,7 @@ MA_API ma_result ma_device_stop(ma_device* pDevice) { ma_result result; - if (pDevice == NULL) { + if (pDevice == nullptr) { return MA_INVALID_ARGS; } @@ -44352,7 +44352,7 @@ MA_API ma_result ma_device_stop(ma_device* pDevice) /* Asynchronous backends need to be handled differently. */ if (ma_context_is_backend_asynchronous(pDevice->pContext)) { /* Asynchronous backends must have a stop operation. */ - if (pDevice->pContext->callbacks.onDeviceStop != NULL) { + if (pDevice->pContext->callbacks.onDeviceStop != nullptr) { result = pDevice->pContext->callbacks.onDeviceStop(pDevice); } else { result = MA_INVALID_OPERATION; @@ -44368,7 +44368,7 @@ MA_API ma_result ma_device_stop(ma_device* pDevice) */ MA_ASSERT(ma_device_get_state(pDevice) != ma_device_state_started); - if (pDevice->pContext->callbacks.onDeviceDataLoopWakeup != NULL) { + if (pDevice->pContext->callbacks.onDeviceDataLoopWakeup != nullptr) { pDevice->pContext->callbacks.onDeviceDataLoopWakeup(pDevice); } @@ -44401,7 +44401,7 @@ MA_API ma_bool32 ma_device_is_started(const ma_device* pDevice) MA_API ma_device_state ma_device_get_state(const ma_device* pDevice) { - if (pDevice == NULL) { + if (pDevice == nullptr) { return ma_device_state_uninitialized; } @@ -44410,7 +44410,7 @@ MA_API ma_device_state ma_device_get_state(const ma_device* pDevice) MA_API ma_result ma_device_set_master_volume(ma_device* pDevice, float volume) { - if (pDevice == NULL) { + if (pDevice == nullptr) { return MA_INVALID_ARGS; } @@ -44425,11 +44425,11 @@ MA_API ma_result ma_device_set_master_volume(ma_device* pDevice, float volume) MA_API ma_result ma_device_get_master_volume(ma_device* pDevice, float* pVolume) { - if (pVolume == NULL) { + if (pVolume == nullptr) { return MA_INVALID_ARGS; } - if (pDevice == NULL) { + if (pDevice == nullptr) { *pVolume = 0; return MA_INVALID_ARGS; } @@ -44453,7 +44453,7 @@ MA_API ma_result ma_device_get_master_volume_db(ma_device* pDevice, float* pGain float factor; ma_result result; - if (pGainDB == NULL) { + if (pGainDB == nullptr) { return MA_INVALID_ARGS; } @@ -44471,11 +44471,11 @@ MA_API ma_result ma_device_get_master_volume_db(ma_device* pDevice, float* pGain MA_API ma_result ma_device_handle_backend_data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount) { - if (pDevice == NULL) { + if (pDevice == nullptr) { return MA_INVALID_ARGS; } - if (pOutput == NULL && pInput == NULL) { + if (pOutput == nullptr && pInput == nullptr) { return MA_INVALID_ARGS; } @@ -44489,16 +44489,16 @@ MA_API ma_result ma_device_handle_backend_data_callback(ma_device* pDevice, void } if (pDevice->type == ma_device_type_duplex) { - if (pInput != NULL) { + if (pInput != nullptr) { ma_device__handle_duplex_callback_capture(pDevice, frameCount, pInput, &pDevice->duplexRB.rb); } - if (pOutput != NULL) { + if (pOutput != nullptr) { ma_device__handle_duplex_callback_playback(pDevice, frameCount, pOutput, &pDevice->duplexRB.rb); } } else { if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_loopback) { - if (pInput == NULL) { + if (pInput == nullptr) { return MA_INVALID_ARGS; } @@ -44506,7 +44506,7 @@ MA_API ma_result ma_device_handle_backend_data_callback(ma_device* pDevice, void } if (pDevice->type == ma_device_type_playback) { - if (pOutput == NULL) { + if (pOutput == nullptr) { return MA_INVALID_ARGS; } @@ -44519,7 +44519,7 @@ MA_API ma_result ma_device_handle_backend_data_callback(ma_device* pDevice, void MA_API ma_uint32 ma_calculate_buffer_size_in_frames_from_descriptor(const ma_device_descriptor* pDescriptor, ma_uint32 nativeSampleRate, ma_performance_profile performanceProfile) { - if (pDescriptor == NULL) { + if (pDescriptor == nullptr) { return 0; } @@ -44612,8 +44612,8 @@ MA_API void ma_clip_samples_u8(ma_uint8* pDst, const ma_int16* pSrc, ma_uint64 c { ma_uint64 iSample; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); for (iSample = 0; iSample < count; iSample += 1) { pDst[iSample] = ma_clip_u8(pSrc[iSample]); @@ -44624,8 +44624,8 @@ MA_API void ma_clip_samples_s16(ma_int16* pDst, const ma_int32* pSrc, ma_uint64 { ma_uint64 iSample; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); for (iSample = 0; iSample < count; iSample += 1) { pDst[iSample] = ma_clip_s16(pSrc[iSample]); @@ -44636,8 +44636,8 @@ MA_API void ma_clip_samples_s24(ma_uint8* pDst, const ma_int64* pSrc, ma_uint64 { ma_uint64 iSample; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); for (iSample = 0; iSample < count; iSample += 1) { ma_int64 s = ma_clip_s24(pSrc[iSample]); @@ -44651,8 +44651,8 @@ MA_API void ma_clip_samples_s32(ma_int32* pDst, const ma_int64* pSrc, ma_uint64 { ma_uint64 iSample; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); for (iSample = 0; iSample < count; iSample += 1) { pDst[iSample] = ma_clip_s32(pSrc[iSample]); @@ -44663,8 +44663,8 @@ MA_API void ma_clip_samples_f32(float* pDst, const float* pSrc, ma_uint64 count) { ma_uint64 iSample; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); for (iSample = 0; iSample < count; iSample += 1) { pDst[iSample] = ma_clip_f32(pSrc[iSample]); @@ -44675,8 +44675,8 @@ MA_API void ma_clip_pcm_frames(void* pDst, const void* pSrc, ma_uint64 frameCoun { ma_uint64 sampleCount; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); sampleCount = frameCount * channels; @@ -44699,7 +44699,7 @@ MA_API void ma_copy_and_apply_volume_factor_u8(ma_uint8* pSamplesOut, const ma_u { ma_uint64 iSample; - if (pSamplesOut == NULL || pSamplesIn == NULL) { + if (pSamplesOut == nullptr || pSamplesIn == nullptr) { return; } @@ -44712,7 +44712,7 @@ MA_API void ma_copy_and_apply_volume_factor_s16(ma_int16* pSamplesOut, const ma_ { ma_uint64 iSample; - if (pSamplesOut == NULL || pSamplesIn == NULL) { + if (pSamplesOut == nullptr || pSamplesIn == nullptr) { return; } @@ -44727,7 +44727,7 @@ MA_API void ma_copy_and_apply_volume_factor_s24(void* pSamplesOut, const void* p ma_uint8* pSamplesOut8; ma_uint8* pSamplesIn8; - if (pSamplesOut == NULL || pSamplesIn == NULL) { + if (pSamplesOut == nullptr || pSamplesIn == nullptr) { return; } @@ -44750,7 +44750,7 @@ MA_API void ma_copy_and_apply_volume_factor_s32(ma_int32* pSamplesOut, const ma_ { ma_uint64 iSample; - if (pSamplesOut == NULL || pSamplesIn == NULL) { + if (pSamplesOut == nullptr || pSamplesIn == nullptr) { return; } @@ -44763,7 +44763,7 @@ MA_API void ma_copy_and_apply_volume_factor_f32(float* pSamplesOut, const float* { ma_uint64 iSample; - if (pSamplesOut == NULL || pSamplesIn == NULL) { + if (pSamplesOut == nullptr || pSamplesIn == nullptr) { return; } @@ -44926,8 +44926,8 @@ MA_API void ma_copy_and_apply_volume_and_clip_samples_u8(ma_uint8* pDst, const m ma_uint64 iSample; ma_int16 volumeFixed; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); volumeFixed = ma_float_to_fixed_16(volume); @@ -44941,8 +44941,8 @@ MA_API void ma_copy_and_apply_volume_and_clip_samples_s16(ma_int16* pDst, const ma_uint64 iSample; ma_int16 volumeFixed; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); volumeFixed = ma_float_to_fixed_16(volume); @@ -44956,8 +44956,8 @@ MA_API void ma_copy_and_apply_volume_and_clip_samples_s24(ma_uint8* pDst, const ma_uint64 iSample; ma_int16 volumeFixed; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); volumeFixed = ma_float_to_fixed_16(volume); @@ -44974,8 +44974,8 @@ MA_API void ma_copy_and_apply_volume_and_clip_samples_s32(ma_int32* pDst, const ma_uint64 iSample; ma_int16 volumeFixed; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); volumeFixed = ma_float_to_fixed_16(volume); @@ -44988,8 +44988,8 @@ MA_API void ma_copy_and_apply_volume_and_clip_samples_f32(float* pDst, const flo { ma_uint64 iSample; - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); /* For the f32 case we need to make sure this supports in-place processing where the input and output buffers are the same. */ @@ -45000,8 +45000,8 @@ MA_API void ma_copy_and_apply_volume_and_clip_samples_f32(float* pDst, const flo MA_API void ma_copy_and_apply_volume_and_clip_pcm_frames(void* pDst, const void* pSrc, ma_uint64 frameCount, ma_format format, ma_uint32 channels, float volume) { - MA_ASSERT(pDst != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(pDst != nullptr); + MA_ASSERT(pSrc != nullptr); if (volume == 1) { ma_clip_pcm_frames(pDst, pSrc, frameCount, format, channels); /* Optimized case for volume = 1. */ @@ -45043,7 +45043,7 @@ MA_API ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 ma_uint64 iSample; ma_uint64 sampleCount; - if (pDst == NULL || pSrc == NULL || channels == 0) { + if (pDst == nullptr || pSrc == nullptr || channels == 0) { return MA_INVALID_ARGS; } @@ -47035,7 +47035,7 @@ MA_API void ma_convert_pcm_frames_format(void* pOut, ma_format formatOut, const MA_API void ma_deinterleave_pcm_frames(ma_format format, ma_uint32 channels, ma_uint64 frameCount, const void* pInterleavedPCMFrames, void** ppDeinterleavedPCMFrames) { - if (pInterleavedPCMFrames == NULL || ppDeinterleavedPCMFrames == NULL) { + if (pInterleavedPCMFrames == nullptr || ppDeinterleavedPCMFrames == nullptr) { return; /* Invalid args. */ } @@ -47171,11 +47171,11 @@ typedef struct static ma_result ma_biquad_get_heap_layout(const ma_biquad_config* pConfig, ma_biquad_heap_layout* pHeapLayout) { - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -47204,7 +47204,7 @@ MA_API ma_result ma_biquad_get_heap_size(const ma_biquad_config* pConfig, size_t ma_result result; ma_biquad_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -47225,7 +47225,7 @@ MA_API ma_result ma_biquad_init_preallocated(const ma_biquad_config* pConfig, vo ma_result result; ma_biquad_heap_layout heapLayout; - if (pBQ == NULL) { + if (pBQ == nullptr) { return MA_INVALID_ARGS; } @@ -47258,11 +47258,11 @@ MA_API ma_result ma_biquad_init(const ma_biquad_config* pConfig, const ma_alloca if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_biquad_init_preallocated(pConfig, pHeap, pBQ); @@ -47277,7 +47277,7 @@ MA_API ma_result ma_biquad_init(const ma_biquad_config* pConfig, const ma_alloca MA_API void ma_biquad_uninit(ma_biquad* pBQ, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pBQ == NULL) { + if (pBQ == nullptr) { return; } @@ -47288,7 +47288,7 @@ MA_API void ma_biquad_uninit(ma_biquad* pBQ, const ma_allocation_callbacks* pAll MA_API ma_result ma_biquad_reinit(const ma_biquad_config* pConfig, ma_biquad* pBQ) { - if (pBQ == NULL || pConfig == NULL) { + if (pBQ == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -47335,7 +47335,7 @@ MA_API ma_result ma_biquad_reinit(const ma_biquad_config* pConfig, ma_biquad* pB MA_API ma_result ma_biquad_clear_cache(ma_biquad* pBQ) { - if (pBQ == NULL) { + if (pBQ == nullptr) { return MA_INVALID_ARGS; } @@ -47418,7 +47418,7 @@ MA_API ma_result ma_biquad_process_pcm_frames(ma_biquad* pBQ, void* pFramesOut, { ma_uint32 n; - if (pBQ == NULL || pFramesOut == NULL || pFramesIn == NULL) { + if (pBQ == nullptr || pFramesOut == nullptr || pFramesIn == nullptr) { return MA_INVALID_ARGS; } @@ -47452,7 +47452,7 @@ MA_API ma_result ma_biquad_process_pcm_frames(ma_biquad* pBQ, void* pFramesOut, MA_API ma_uint32 ma_biquad_get_latency(const ma_biquad* pBQ) { - if (pBQ == NULL) { + if (pBQ == nullptr) { return 0; } @@ -47507,11 +47507,11 @@ typedef struct static ma_result ma_lpf1_get_heap_layout(const ma_lpf1_config* pConfig, ma_lpf1_heap_layout* pHeapLayout) { - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -47536,7 +47536,7 @@ MA_API ma_result ma_lpf1_get_heap_size(const ma_lpf1_config* pConfig, size_t* pH ma_result result; ma_lpf1_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -47555,7 +47555,7 @@ MA_API ma_result ma_lpf1_init_preallocated(const ma_lpf1_config* pConfig, void* ma_result result; ma_lpf1_heap_layout heapLayout; - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -47587,11 +47587,11 @@ MA_API ma_result ma_lpf1_init(const ma_lpf1_config* pConfig, const ma_allocation if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_lpf1_init_preallocated(pConfig, pHeap, pLPF); @@ -47606,7 +47606,7 @@ MA_API ma_result ma_lpf1_init(const ma_lpf1_config* pConfig, const ma_allocation MA_API void ma_lpf1_uninit(ma_lpf1* pLPF, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return; } @@ -47619,7 +47619,7 @@ MA_API ma_result ma_lpf1_reinit(const ma_lpf1_config* pConfig, ma_lpf1* pLPF) { double a; - if (pLPF == NULL || pConfig == NULL) { + if (pLPF == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -47653,7 +47653,7 @@ MA_API ma_result ma_lpf1_reinit(const ma_lpf1_config* pConfig, ma_lpf1* pLPF) MA_API ma_result ma_lpf1_clear_cache(ma_lpf1* pLPF) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -47710,7 +47710,7 @@ MA_API ma_result ma_lpf1_process_pcm_frames(ma_lpf1* pLPF, void* pFramesOut, con { ma_uint32 n; - if (pLPF == NULL || pFramesOut == NULL || pFramesIn == NULL) { + if (pLPF == nullptr || pFramesOut == nullptr || pFramesIn == nullptr) { return MA_INVALID_ARGS; } @@ -47744,7 +47744,7 @@ MA_API ma_result ma_lpf1_process_pcm_frames(ma_lpf1* pLPF, void* pFramesOut, con MA_API ma_uint32 ma_lpf1_get_latency(const ma_lpf1* pLPF) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return 0; } @@ -47761,7 +47761,7 @@ static MA_INLINE ma_biquad_config ma_lpf2__get_biquad_config(const ma_lpf2_confi double c; double a; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); q = pConfig->q; w = 2 * MA_PI_D * pConfig->cutoffFrequency / pConfig->sampleRate; @@ -47795,13 +47795,13 @@ MA_API ma_result ma_lpf2_init_preallocated(const ma_lpf2_config* pConfig, void* ma_result result; ma_biquad_config bqConfig; - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pLPF); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -47827,11 +47827,11 @@ MA_API ma_result ma_lpf2_init(const ma_lpf2_config* pConfig, const ma_allocation if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_lpf2_init_preallocated(pConfig, pHeap, pLPF); @@ -47846,7 +47846,7 @@ MA_API ma_result ma_lpf2_init(const ma_lpf2_config* pConfig, const ma_allocation MA_API void ma_lpf2_uninit(ma_lpf2* pLPF, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return; } @@ -47858,7 +47858,7 @@ MA_API ma_result ma_lpf2_reinit(const ma_lpf2_config* pConfig, ma_lpf2* pLPF) ma_result result; ma_biquad_config bqConfig; - if (pLPF == NULL || pConfig == NULL) { + if (pLPF == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -47873,7 +47873,7 @@ MA_API ma_result ma_lpf2_reinit(const ma_lpf2_config* pConfig, ma_lpf2* pLPF) MA_API ma_result ma_lpf2_clear_cache(ma_lpf2* pLPF) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -47894,7 +47894,7 @@ static MA_INLINE void ma_lpf2_process_pcm_frame_f32(ma_lpf2* pLPF, float* pFrame MA_API ma_result ma_lpf2_process_pcm_frames(ma_lpf2* pLPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -47903,7 +47903,7 @@ MA_API ma_result ma_lpf2_process_pcm_frames(ma_lpf2* pLPF, void* pFramesOut, con MA_API ma_uint32 ma_lpf2_get_latency(const ma_lpf2* pLPF) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return 0; } @@ -47935,8 +47935,8 @@ typedef struct static void ma_lpf_calculate_sub_lpf_counts(ma_uint32 order, ma_uint32* pLPF1Count, ma_uint32* pLPF2Count) { - MA_ASSERT(pLPF1Count != NULL); - MA_ASSERT(pLPF2Count != NULL); + MA_ASSERT(pLPF1Count != nullptr); + MA_ASSERT(pLPF2Count != nullptr); *pLPF1Count = order % 2; *pLPF2Count = order / 2; @@ -47950,11 +47950,11 @@ static ma_result ma_lpf_get_heap_layout(const ma_lpf_config* pConfig, ma_lpf_hea ma_uint32 ilpf1; ma_uint32 ilpf2; - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -48013,7 +48013,7 @@ static ma_result ma_lpf_reinit__internal(const ma_lpf_config* pConfig, void* pHe ma_uint32 ilpf2; ma_lpf_heap_layout heapLayout; /* Only used if isNew is true. */ - if (pLPF == NULL || pConfig == NULL) { + if (pLPF == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -48078,7 +48078,7 @@ static ma_result ma_lpf_reinit__internal(const ma_lpf_config* pConfig, void* pHe ma_uint32 jlpf1; for (jlpf1 = 0; jlpf1 < ilpf1; jlpf1 += 1) { - ma_lpf1_uninit(&pLPF->pLPF1[jlpf1], NULL); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ + ma_lpf1_uninit(&pLPF->pLPF1[jlpf1], nullptr); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ } return result; @@ -48116,11 +48116,11 @@ static ma_result ma_lpf_reinit__internal(const ma_lpf_config* pConfig, void* pHe ma_uint32 jlpf2; for (jlpf1 = 0; jlpf1 < lpf1Count; jlpf1 += 1) { - ma_lpf1_uninit(&pLPF->pLPF1[jlpf1], NULL); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ + ma_lpf1_uninit(&pLPF->pLPF1[jlpf1], nullptr); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ } for (jlpf2 = 0; jlpf2 < ilpf2; jlpf2 += 1) { - ma_lpf2_uninit(&pLPF->pLPF2[jlpf2], NULL); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ + ma_lpf2_uninit(&pLPF->pLPF2[jlpf2], nullptr); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ } return result; @@ -48141,7 +48141,7 @@ MA_API ma_result ma_lpf_get_heap_size(const ma_lpf_config* pConfig, size_t* pHea ma_result result; ma_lpf_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -48159,7 +48159,7 @@ MA_API ma_result ma_lpf_get_heap_size(const ma_lpf_config* pConfig, size_t* pHea MA_API ma_result ma_lpf_init_preallocated(const ma_lpf_config* pConfig, void* pHeap, ma_lpf* pLPF) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -48181,11 +48181,11 @@ MA_API ma_result ma_lpf_init(const ma_lpf_config* pConfig, const ma_allocation_c if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_lpf_init_preallocated(pConfig, pHeap, pLPF); @@ -48203,7 +48203,7 @@ MA_API void ma_lpf_uninit(ma_lpf* pLPF, const ma_allocation_callbacks* pAllocati ma_uint32 ilpf1; ma_uint32 ilpf2; - if (pLPF == NULL) { + if (pLPF == nullptr) { return; } @@ -48222,7 +48222,7 @@ MA_API void ma_lpf_uninit(ma_lpf* pLPF, const ma_allocation_callbacks* pAllocati MA_API ma_result ma_lpf_reinit(const ma_lpf_config* pConfig, ma_lpf* pLPF) { - return ma_lpf_reinit__internal(pConfig, NULL, pLPF, /*isNew*/MA_FALSE); + return ma_lpf_reinit__internal(pConfig, nullptr, pLPF, /*isNew*/MA_FALSE); } MA_API ma_result ma_lpf_clear_cache(ma_lpf* pLPF) @@ -48230,7 +48230,7 @@ MA_API ma_result ma_lpf_clear_cache(ma_lpf* pLPF) ma_uint32 ilpf1; ma_uint32 ilpf2; - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -48287,7 +48287,7 @@ MA_API ma_result ma_lpf_process_pcm_frames(ma_lpf* pLPF, void* pFramesOut, const ma_uint32 ilpf1; ma_uint32 ilpf2; - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -48341,7 +48341,7 @@ MA_API ma_result ma_lpf_process_pcm_frames(ma_lpf* pLPF, void* pFramesOut, const MA_API ma_uint32 ma_lpf_get_latency(const ma_lpf* pLPF) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return 0; } @@ -48395,11 +48395,11 @@ typedef struct static ma_result ma_hpf1_get_heap_layout(const ma_hpf1_config* pConfig, ma_hpf1_heap_layout* pHeapLayout) { - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -48424,7 +48424,7 @@ MA_API ma_result ma_hpf1_get_heap_size(const ma_hpf1_config* pConfig, size_t* pH ma_result result; ma_hpf1_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -48443,7 +48443,7 @@ MA_API ma_result ma_hpf1_init_preallocated(const ma_hpf1_config* pConfig, void* ma_result result; ma_hpf1_heap_layout heapLayout; - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -48475,11 +48475,11 @@ MA_API ma_result ma_hpf1_init(const ma_hpf1_config* pConfig, const ma_allocation if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_hpf1_init_preallocated(pConfig, pHeap, pLPF); @@ -48494,7 +48494,7 @@ MA_API ma_result ma_hpf1_init(const ma_hpf1_config* pConfig, const ma_allocation MA_API void ma_hpf1_uninit(ma_hpf1* pHPF, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pHPF == NULL) { + if (pHPF == nullptr) { return; } @@ -48507,7 +48507,7 @@ MA_API ma_result ma_hpf1_reinit(const ma_hpf1_config* pConfig, ma_hpf1* pHPF) { double a; - if (pHPF == NULL || pConfig == NULL) { + if (pHPF == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -48583,7 +48583,7 @@ MA_API ma_result ma_hpf1_process_pcm_frames(ma_hpf1* pHPF, void* pFramesOut, con { ma_uint32 n; - if (pHPF == NULL || pFramesOut == NULL || pFramesIn == NULL) { + if (pHPF == nullptr || pFramesOut == nullptr || pFramesIn == nullptr) { return MA_INVALID_ARGS; } @@ -48617,7 +48617,7 @@ MA_API ma_result ma_hpf1_process_pcm_frames(ma_hpf1* pHPF, void* pFramesOut, con MA_API ma_uint32 ma_hpf1_get_latency(const ma_hpf1* pHPF) { - if (pHPF == NULL) { + if (pHPF == nullptr) { return 0; } @@ -48634,7 +48634,7 @@ static MA_INLINE ma_biquad_config ma_hpf2__get_biquad_config(const ma_hpf2_confi double c; double a; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); q = pConfig->q; w = 2 * MA_PI_D * pConfig->cutoffFrequency / pConfig->sampleRate; @@ -48668,13 +48668,13 @@ MA_API ma_result ma_hpf2_init_preallocated(const ma_hpf2_config* pConfig, void* ma_result result; ma_biquad_config bqConfig; - if (pHPF == NULL) { + if (pHPF == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pHPF); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -48700,11 +48700,11 @@ MA_API ma_result ma_hpf2_init(const ma_hpf2_config* pConfig, const ma_allocation if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_hpf2_init_preallocated(pConfig, pHeap, pHPF); @@ -48719,7 +48719,7 @@ MA_API ma_result ma_hpf2_init(const ma_hpf2_config* pConfig, const ma_allocation MA_API void ma_hpf2_uninit(ma_hpf2* pHPF, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pHPF == NULL) { + if (pHPF == nullptr) { return; } @@ -48731,7 +48731,7 @@ MA_API ma_result ma_hpf2_reinit(const ma_hpf2_config* pConfig, ma_hpf2* pHPF) ma_result result; ma_biquad_config bqConfig; - if (pHPF == NULL || pConfig == NULL) { + if (pHPF == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -48756,7 +48756,7 @@ static MA_INLINE void ma_hpf2_process_pcm_frame_f32(ma_hpf2* pHPF, float* pFrame MA_API ma_result ma_hpf2_process_pcm_frames(ma_hpf2* pHPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pHPF == NULL) { + if (pHPF == nullptr) { return MA_INVALID_ARGS; } @@ -48765,7 +48765,7 @@ MA_API ma_result ma_hpf2_process_pcm_frames(ma_hpf2* pHPF, void* pFramesOut, con MA_API ma_uint32 ma_hpf2_get_latency(const ma_hpf2* pHPF) { - if (pHPF == NULL) { + if (pHPF == nullptr) { return 0; } @@ -48797,8 +48797,8 @@ typedef struct static void ma_hpf_calculate_sub_hpf_counts(ma_uint32 order, ma_uint32* pHPF1Count, ma_uint32* pHPF2Count) { - MA_ASSERT(pHPF1Count != NULL); - MA_ASSERT(pHPF2Count != NULL); + MA_ASSERT(pHPF1Count != nullptr); + MA_ASSERT(pHPF2Count != nullptr); *pHPF1Count = order % 2; *pHPF2Count = order / 2; @@ -48812,11 +48812,11 @@ static ma_result ma_hpf_get_heap_layout(const ma_hpf_config* pConfig, ma_hpf_hea ma_uint32 ihpf1; ma_uint32 ihpf2; - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -48875,7 +48875,7 @@ static ma_result ma_hpf_reinit__internal(const ma_hpf_config* pConfig, void* pHe ma_uint32 ihpf2; ma_hpf_heap_layout heapLayout; /* Only used if isNew is true. */ - if (pHPF == NULL || pConfig == NULL) { + if (pHPF == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -48940,7 +48940,7 @@ static ma_result ma_hpf_reinit__internal(const ma_hpf_config* pConfig, void* pHe ma_uint32 jhpf1; for (jhpf1 = 0; jhpf1 < ihpf1; jhpf1 += 1) { - ma_hpf1_uninit(&pHPF->pHPF1[jhpf1], NULL); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ + ma_hpf1_uninit(&pHPF->pHPF1[jhpf1], nullptr); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ } return result; @@ -48978,11 +48978,11 @@ static ma_result ma_hpf_reinit__internal(const ma_hpf_config* pConfig, void* pHe ma_uint32 jhpf2; for (jhpf1 = 0; jhpf1 < hpf1Count; jhpf1 += 1) { - ma_hpf1_uninit(&pHPF->pHPF1[jhpf1], NULL); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ + ma_hpf1_uninit(&pHPF->pHPF1[jhpf1], nullptr); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ } for (jhpf2 = 0; jhpf2 < ihpf2; jhpf2 += 1) { - ma_hpf2_uninit(&pHPF->pHPF2[jhpf2], NULL); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ + ma_hpf2_uninit(&pHPF->pHPF2[jhpf2], nullptr); /* No need for allocation callbacks here since we used a preallocated heap allocation. */ } return result; @@ -49003,7 +49003,7 @@ MA_API ma_result ma_hpf_get_heap_size(const ma_hpf_config* pConfig, size_t* pHea ma_result result; ma_hpf_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -49021,7 +49021,7 @@ MA_API ma_result ma_hpf_get_heap_size(const ma_hpf_config* pConfig, size_t* pHea MA_API ma_result ma_hpf_init_preallocated(const ma_hpf_config* pConfig, void* pHeap, ma_hpf* pLPF) { - if (pLPF == NULL) { + if (pLPF == nullptr) { return MA_INVALID_ARGS; } @@ -49043,11 +49043,11 @@ MA_API ma_result ma_hpf_init(const ma_hpf_config* pConfig, const ma_allocation_c if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_hpf_init_preallocated(pConfig, pHeap, pHPF); @@ -49065,7 +49065,7 @@ MA_API void ma_hpf_uninit(ma_hpf* pHPF, const ma_allocation_callbacks* pAllocati ma_uint32 ihpf1; ma_uint32 ihpf2; - if (pHPF == NULL) { + if (pHPF == nullptr) { return; } @@ -49084,7 +49084,7 @@ MA_API void ma_hpf_uninit(ma_hpf* pHPF, const ma_allocation_callbacks* pAllocati MA_API ma_result ma_hpf_reinit(const ma_hpf_config* pConfig, ma_hpf* pHPF) { - return ma_hpf_reinit__internal(pConfig, NULL, pHPF, /*isNew*/MA_FALSE); + return ma_hpf_reinit__internal(pConfig, nullptr, pHPF, /*isNew*/MA_FALSE); } MA_API ma_result ma_hpf_process_pcm_frames(ma_hpf* pHPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) @@ -49093,7 +49093,7 @@ MA_API ma_result ma_hpf_process_pcm_frames(ma_hpf* pHPF, void* pFramesOut, const ma_uint32 ihpf1; ma_uint32 ihpf2; - if (pHPF == NULL) { + if (pHPF == nullptr) { return MA_INVALID_ARGS; } @@ -49165,7 +49165,7 @@ MA_API ma_result ma_hpf_process_pcm_frames(ma_hpf* pHPF, void* pFramesOut, const MA_API ma_uint32 ma_hpf_get_latency(const ma_hpf* pHPF) { - if (pHPF == NULL) { + if (pHPF == nullptr) { return 0; } @@ -49207,7 +49207,7 @@ static MA_INLINE ma_biquad_config ma_bpf2__get_biquad_config(const ma_bpf2_confi double c; double a; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); q = pConfig->q; w = 2 * MA_PI_D * pConfig->cutoffFrequency / pConfig->sampleRate; @@ -49241,13 +49241,13 @@ MA_API ma_result ma_bpf2_init_preallocated(const ma_bpf2_config* pConfig, void* ma_result result; ma_biquad_config bqConfig; - if (pBPF == NULL) { + if (pBPF == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pBPF); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -49273,11 +49273,11 @@ MA_API ma_result ma_bpf2_init(const ma_bpf2_config* pConfig, const ma_allocation if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_bpf2_init_preallocated(pConfig, pHeap, pBPF); @@ -49292,7 +49292,7 @@ MA_API ma_result ma_bpf2_init(const ma_bpf2_config* pConfig, const ma_allocation MA_API void ma_bpf2_uninit(ma_bpf2* pBPF, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pBPF == NULL) { + if (pBPF == nullptr) { return; } @@ -49304,7 +49304,7 @@ MA_API ma_result ma_bpf2_reinit(const ma_bpf2_config* pConfig, ma_bpf2* pBPF) ma_result result; ma_biquad_config bqConfig; - if (pBPF == NULL || pConfig == NULL) { + if (pBPF == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -49329,7 +49329,7 @@ static MA_INLINE void ma_bpf2_process_pcm_frame_f32(ma_bpf2* pBPF, float* pFrame MA_API ma_result ma_bpf2_process_pcm_frames(ma_bpf2* pBPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pBPF == NULL) { + if (pBPF == nullptr) { return MA_INVALID_ARGS; } @@ -49338,7 +49338,7 @@ MA_API ma_result ma_bpf2_process_pcm_frames(ma_bpf2* pBPF, void* pFramesOut, con MA_API ma_uint32 ma_bpf2_get_latency(const ma_bpf2* pBPF) { - if (pBPF == NULL) { + if (pBPF == nullptr) { return 0; } @@ -49373,11 +49373,11 @@ static ma_result ma_bpf_get_heap_layout(const ma_bpf_config* pConfig, ma_bpf_hea ma_uint32 bpf2Count; ma_uint32 ibpf2; - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -49421,7 +49421,7 @@ static ma_result ma_bpf_reinit__internal(const ma_bpf_config* pConfig, void* pHe ma_uint32 ibpf2; ma_bpf_heap_layout heapLayout; /* Only used if isNew is true. */ - if (pBPF == NULL || pConfig == NULL) { + if (pBPF == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -49510,7 +49510,7 @@ MA_API ma_result ma_bpf_get_heap_size(const ma_bpf_config* pConfig, size_t* pHea ma_result result; ma_bpf_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -49528,7 +49528,7 @@ MA_API ma_result ma_bpf_get_heap_size(const ma_bpf_config* pConfig, size_t* pHea MA_API ma_result ma_bpf_init_preallocated(const ma_bpf_config* pConfig, void* pHeap, ma_bpf* pBPF) { - if (pBPF == NULL) { + if (pBPF == nullptr) { return MA_INVALID_ARGS; } @@ -49550,11 +49550,11 @@ MA_API ma_result ma_bpf_init(const ma_bpf_config* pConfig, const ma_allocation_c if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_bpf_init_preallocated(pConfig, pHeap, pBPF); @@ -49571,7 +49571,7 @@ MA_API void ma_bpf_uninit(ma_bpf* pBPF, const ma_allocation_callbacks* pAllocati { ma_uint32 ibpf2; - if (pBPF == NULL) { + if (pBPF == nullptr) { return; } @@ -49586,7 +49586,7 @@ MA_API void ma_bpf_uninit(ma_bpf* pBPF, const ma_allocation_callbacks* pAllocati MA_API ma_result ma_bpf_reinit(const ma_bpf_config* pConfig, ma_bpf* pBPF) { - return ma_bpf_reinit__internal(pConfig, NULL, pBPF, /*isNew*/MA_FALSE); + return ma_bpf_reinit__internal(pConfig, nullptr, pBPF, /*isNew*/MA_FALSE); } MA_API ma_result ma_bpf_process_pcm_frames(ma_bpf* pBPF, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) @@ -49594,7 +49594,7 @@ MA_API ma_result ma_bpf_process_pcm_frames(ma_bpf* pBPF, void* pFramesOut, const ma_result result; ma_uint32 ibpf2; - if (pBPF == NULL) { + if (pBPF == nullptr) { return MA_INVALID_ARGS; } @@ -49651,7 +49651,7 @@ MA_API ma_result ma_bpf_process_pcm_frames(ma_bpf* pBPF, void* pFramesOut, const MA_API ma_uint32 ma_bpf_get_latency(const ma_bpf* pBPF) { - if (pBPF == NULL) { + if (pBPF == nullptr) { return 0; } @@ -49692,7 +49692,7 @@ static MA_INLINE ma_biquad_config ma_notch2__get_biquad_config(const ma_notch2_c double c; double a; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); q = pConfig->q; w = 2 * MA_PI_D * pConfig->frequency / pConfig->sampleRate; @@ -49726,13 +49726,13 @@ MA_API ma_result ma_notch2_init_preallocated(const ma_notch2_config* pConfig, vo ma_result result; ma_biquad_config bqConfig; - if (pFilter == NULL) { + if (pFilter == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pFilter); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -49758,11 +49758,11 @@ MA_API ma_result ma_notch2_init(const ma_notch2_config* pConfig, const ma_alloca if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_notch2_init_preallocated(pConfig, pHeap, pFilter); @@ -49777,7 +49777,7 @@ MA_API ma_result ma_notch2_init(const ma_notch2_config* pConfig, const ma_alloca MA_API void ma_notch2_uninit(ma_notch2* pFilter, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return; } @@ -49789,7 +49789,7 @@ MA_API ma_result ma_notch2_reinit(const ma_notch2_config* pConfig, ma_notch2* pF ma_result result; ma_biquad_config bqConfig; - if (pFilter == NULL || pConfig == NULL) { + if (pFilter == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -49814,7 +49814,7 @@ static MA_INLINE void ma_notch2_process_pcm_frame_f32(ma_notch2* pFilter, float* MA_API ma_result ma_notch2_process_pcm_frames(ma_notch2* pFilter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return MA_INVALID_ARGS; } @@ -49823,7 +49823,7 @@ MA_API ma_result ma_notch2_process_pcm_frames(ma_notch2* pFilter, void* pFramesO MA_API ma_uint32 ma_notch2_get_latency(const ma_notch2* pFilter) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return 0; } @@ -49867,7 +49867,7 @@ static MA_INLINE ma_biquad_config ma_peak2__get_biquad_config(const ma_peak2_con double a; double A; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); q = pConfig->q; w = 2 * MA_PI_D * pConfig->frequency / pConfig->sampleRate; @@ -49902,13 +49902,13 @@ MA_API ma_result ma_peak2_init_preallocated(const ma_peak2_config* pConfig, void ma_result result; ma_biquad_config bqConfig; - if (pFilter == NULL) { + if (pFilter == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pFilter); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -49934,11 +49934,11 @@ MA_API ma_result ma_peak2_init(const ma_peak2_config* pConfig, const ma_allocati if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_peak2_init_preallocated(pConfig, pHeap, pFilter); @@ -49953,7 +49953,7 @@ MA_API ma_result ma_peak2_init(const ma_peak2_config* pConfig, const ma_allocati MA_API void ma_peak2_uninit(ma_peak2* pFilter, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return; } @@ -49965,7 +49965,7 @@ MA_API ma_result ma_peak2_reinit(const ma_peak2_config* pConfig, ma_peak2* pFilt ma_result result; ma_biquad_config bqConfig; - if (pFilter == NULL || pConfig == NULL) { + if (pFilter == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -49990,7 +49990,7 @@ static MA_INLINE void ma_peak2_process_pcm_frame_f32(ma_peak2* pFilter, float* p MA_API ma_result ma_peak2_process_pcm_frames(ma_peak2* pFilter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return MA_INVALID_ARGS; } @@ -49999,7 +49999,7 @@ MA_API ma_result ma_peak2_process_pcm_frames(ma_peak2* pFilter, void* pFramesOut MA_API ma_uint32 ma_peak2_get_latency(const ma_peak2* pFilter) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return 0; } @@ -50039,7 +50039,7 @@ static MA_INLINE ma_biquad_config ma_loshelf2__get_biquad_config(const ma_loshel double a; double sqrtA; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); w = 2 * MA_PI_D * pConfig->frequency / pConfig->sampleRate; s = ma_sind(w); @@ -50075,13 +50075,13 @@ MA_API ma_result ma_loshelf2_init_preallocated(const ma_loshelf2_config* pConfig ma_result result; ma_biquad_config bqConfig; - if (pFilter == NULL) { + if (pFilter == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pFilter); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -50107,11 +50107,11 @@ MA_API ma_result ma_loshelf2_init(const ma_loshelf2_config* pConfig, const ma_al if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_loshelf2_init_preallocated(pConfig, pHeap, pFilter); @@ -50126,7 +50126,7 @@ MA_API ma_result ma_loshelf2_init(const ma_loshelf2_config* pConfig, const ma_al MA_API void ma_loshelf2_uninit(ma_loshelf2* pFilter, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return; } @@ -50138,7 +50138,7 @@ MA_API ma_result ma_loshelf2_reinit(const ma_loshelf2_config* pConfig, ma_loshel ma_result result; ma_biquad_config bqConfig; - if (pFilter == NULL || pConfig == NULL) { + if (pFilter == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -50163,7 +50163,7 @@ static MA_INLINE void ma_loshelf2_process_pcm_frame_f32(ma_loshelf2* pFilter, fl MA_API ma_result ma_loshelf2_process_pcm_frames(ma_loshelf2* pFilter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return MA_INVALID_ARGS; } @@ -50172,7 +50172,7 @@ MA_API ma_result ma_loshelf2_process_pcm_frames(ma_loshelf2* pFilter, void* pFra MA_API ma_uint32 ma_loshelf2_get_latency(const ma_loshelf2* pFilter) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return 0; } @@ -50212,7 +50212,7 @@ static MA_INLINE ma_biquad_config ma_hishelf2__get_biquad_config(const ma_hishel double a; double sqrtA; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); w = 2 * MA_PI_D * pConfig->frequency / pConfig->sampleRate; s = ma_sind(w); @@ -50248,13 +50248,13 @@ MA_API ma_result ma_hishelf2_init_preallocated(const ma_hishelf2_config* pConfig ma_result result; ma_biquad_config bqConfig; - if (pFilter == NULL) { + if (pFilter == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pFilter); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -50280,11 +50280,11 @@ MA_API ma_result ma_hishelf2_init(const ma_hishelf2_config* pConfig, const ma_al if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_hishelf2_init_preallocated(pConfig, pHeap, pFilter); @@ -50299,7 +50299,7 @@ MA_API ma_result ma_hishelf2_init(const ma_hishelf2_config* pConfig, const ma_al MA_API void ma_hishelf2_uninit(ma_hishelf2* pFilter, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return; } @@ -50311,7 +50311,7 @@ MA_API ma_result ma_hishelf2_reinit(const ma_hishelf2_config* pConfig, ma_hishel ma_result result; ma_biquad_config bqConfig; - if (pFilter == NULL || pConfig == NULL) { + if (pFilter == nullptr || pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -50336,7 +50336,7 @@ static MA_INLINE void ma_hishelf2_process_pcm_frame_f32(ma_hishelf2* pFilter, fl MA_API ma_result ma_hishelf2_process_pcm_frames(ma_hishelf2* pFilter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return MA_INVALID_ARGS; } @@ -50345,7 +50345,7 @@ MA_API ma_result ma_hishelf2_process_pcm_frames(ma_hishelf2* pFilter, void* pFra MA_API ma_uint32 ma_hishelf2_get_latency(const ma_hishelf2* pFilter) { - if (pFilter == NULL) { + if (pFilter == nullptr) { return 0; } @@ -50376,13 +50376,13 @@ MA_API ma_delay_config ma_delay_config_init(ma_uint32 channels, ma_uint32 sample MA_API ma_result ma_delay_init(const ma_delay_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_delay* pDelay) { - if (pDelay == NULL) { + if (pDelay == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pDelay); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -50395,7 +50395,7 @@ MA_API ma_result ma_delay_init(const ma_delay_config* pConfig, const ma_allocati pDelay->cursor = 0; pDelay->pBuffer = (float*)ma_malloc((size_t)(pDelay->bufferSizeInFrames * ma_get_bytes_per_frame(ma_format_f32, pConfig->channels)), pAllocationCallbacks); - if (pDelay->pBuffer == NULL) { + if (pDelay->pBuffer == nullptr) { return MA_OUT_OF_MEMORY; } @@ -50406,7 +50406,7 @@ MA_API ma_result ma_delay_init(const ma_delay_config* pConfig, const ma_allocati MA_API void ma_delay_uninit(ma_delay* pDelay, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pDelay == NULL) { + if (pDelay == nullptr) { return; } @@ -50420,7 +50420,7 @@ MA_API ma_result ma_delay_process_pcm_frames(ma_delay* pDelay, void* pFramesOut, float* pFramesOutF32 = (float*)pFramesOut; const float* pFramesInF32 = (const float*)pFramesIn; - if (pDelay == NULL || pFramesOut == NULL || pFramesIn == NULL) { + if (pDelay == nullptr || pFramesOut == nullptr || pFramesIn == nullptr) { return MA_INVALID_ARGS; } @@ -50458,7 +50458,7 @@ MA_API ma_result ma_delay_process_pcm_frames(ma_delay* pDelay, void* pFramesOut, MA_API void ma_delay_set_wet(ma_delay* pDelay, float value) { - if (pDelay == NULL) { + if (pDelay == nullptr) { return; } @@ -50467,7 +50467,7 @@ MA_API void ma_delay_set_wet(ma_delay* pDelay, float value) MA_API float ma_delay_get_wet(const ma_delay* pDelay) { - if (pDelay == NULL) { + if (pDelay == nullptr) { return 0; } @@ -50476,7 +50476,7 @@ MA_API float ma_delay_get_wet(const ma_delay* pDelay) MA_API void ma_delay_set_dry(ma_delay* pDelay, float value) { - if (pDelay == NULL) { + if (pDelay == nullptr) { return; } @@ -50485,7 +50485,7 @@ MA_API void ma_delay_set_dry(ma_delay* pDelay, float value) MA_API float ma_delay_get_dry(const ma_delay* pDelay) { - if (pDelay == NULL) { + if (pDelay == nullptr) { return 0; } @@ -50494,7 +50494,7 @@ MA_API float ma_delay_get_dry(const ma_delay* pDelay) MA_API void ma_delay_set_decay(ma_delay* pDelay, float value) { - if (pDelay == NULL) { + if (pDelay == nullptr) { return; } @@ -50503,7 +50503,7 @@ MA_API void ma_delay_set_decay(ma_delay* pDelay, float value) MA_API float ma_delay_get_decay(const ma_delay* pDelay) { - if (pDelay == NULL) { + if (pDelay == nullptr) { return 0; } @@ -50532,11 +50532,11 @@ typedef struct static ma_result ma_gainer_get_heap_layout(const ma_gainer_config* pConfig, ma_gainer_heap_layout* pHeapLayout) { - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -50566,7 +50566,7 @@ MA_API ma_result ma_gainer_get_heap_size(const ma_gainer_config* pConfig, size_t ma_result result; ma_gainer_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -50589,13 +50589,13 @@ MA_API ma_result ma_gainer_init_preallocated(const ma_gainer_config* pConfig, vo ma_gainer_heap_layout heapLayout; ma_uint32 iChannel; - if (pGainer == NULL) { + if (pGainer == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pGainer); - if (pConfig == NULL || pHeap == NULL) { + if (pConfig == nullptr || pHeap == nullptr) { return MA_INVALID_ARGS; } @@ -50635,11 +50635,11 @@ MA_API ma_result ma_gainer_init(const ma_gainer_config* pConfig, const ma_alloca if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_gainer_init_preallocated(pConfig, pHeap, pGainer); @@ -50654,7 +50654,7 @@ MA_API ma_result ma_gainer_init(const ma_gainer_config* pConfig, const ma_alloca MA_API void ma_gainer_uninit(ma_gainer* pGainer, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pGainer == NULL) { + if (pGainer == nullptr) { return; } @@ -50675,7 +50675,7 @@ static /*__attribute__((noinline))*/ ma_result ma_gainer_process_pcm_frames_inte ma_uint32 iChannel; ma_uint64 interpolatedFrameCount; - MA_ASSERT(pGainer != NULL); + MA_ASSERT(pGainer != nullptr); /* We don't necessarily need to apply a linear interpolation for the entire frameCount frames. When @@ -50701,7 +50701,7 @@ static /*__attribute__((noinline))*/ ma_result ma_gainer_process_pcm_frames_inte */ if (interpolatedFrameCount > 0) { /* We can allow the input and output buffers to be null in which case we'll just update the internal timer. */ - if (pFramesOut != NULL && pFramesIn != NULL) { + if (pFramesOut != nullptr && pFramesIn != nullptr) { /* All we're really doing here is moving the old gains towards the new gains. We don't want to be modifying the gains inside the ma_gainer object because that will break things. Instead @@ -50891,7 +50891,7 @@ static /*__attribute__((noinline))*/ ma_result ma_gainer_process_pcm_frames_inte } /* All we need to do here is apply the new gains using an optimized path. */ - if (pFramesOut != NULL && pFramesIn != NULL) { + if (pFramesOut != nullptr && pFramesIn != nullptr) { if (pGainer->config.channels <= 32) { float gains[32]; for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) { @@ -50928,7 +50928,7 @@ static /*__attribute__((noinline))*/ ma_result ma_gainer_process_pcm_frames_inte /* Slow path. Need to interpolate the gain for each channel individually. */ /* We can allow the input and output buffers to be null in which case we'll just update the internal timer. */ - if (pFramesOut != NULL && pFramesIn != NULL) { + if (pFramesOut != nullptr && pFramesIn != nullptr) { float a = (float)pGainer->t / pGainer->config.smoothTimeInFrames; float d = 1.0f / pGainer->config.smoothTimeInFrames; ma_uint32 channelCount = pGainer->config.channels; @@ -50953,7 +50953,7 @@ static /*__attribute__((noinline))*/ ma_result ma_gainer_process_pcm_frames_inte #if 0 /* Reference implementation. */ for (iFrame = 0; iFrame < frameCount; iFrame += 1) { /* We can allow the input and output buffers to be null in which case we'll just update the internal timer. */ - if (pFramesOut != NULL && pFramesIn != NULL) { + if (pFramesOut != nullptr && pFramesIn != nullptr) { for (iChannel = 0; iChannel < pGainer->config.channels; iChannel += 1) { pFramesOutF32[iFrame * pGainer->config.channels + iChannel] = pFramesInF32[iFrame * pGainer->config.channels + iChannel] * ma_gainer_calculate_current_gain(pGainer, iChannel) * pGainer->masterVolume; } @@ -50971,7 +50971,7 @@ static /*__attribute__((noinline))*/ ma_result ma_gainer_process_pcm_frames_inte MA_API ma_result ma_gainer_process_pcm_frames(ma_gainer* pGainer, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pGainer == NULL) { + if (pGainer == nullptr) { return MA_INVALID_ARGS; } @@ -51001,7 +51001,7 @@ MA_API ma_result ma_gainer_set_gain(ma_gainer* pGainer, float newGain) { ma_uint32 iChannel; - if (pGainer == NULL) { + if (pGainer == nullptr) { return MA_INVALID_ARGS; } @@ -51019,7 +51019,7 @@ MA_API ma_result ma_gainer_set_gains(ma_gainer* pGainer, float* pNewGains) { ma_uint32 iChannel; - if (pGainer == NULL || pNewGains == NULL) { + if (pGainer == nullptr || pNewGains == nullptr) { return MA_INVALID_ARGS; } @@ -51035,7 +51035,7 @@ MA_API ma_result ma_gainer_set_gains(ma_gainer* pGainer, float* pNewGains) MA_API ma_result ma_gainer_set_master_volume(ma_gainer* pGainer, float volume) { - if (pGainer == NULL) { + if (pGainer == nullptr) { return MA_INVALID_ARGS; } @@ -51046,7 +51046,7 @@ MA_API ma_result ma_gainer_set_master_volume(ma_gainer* pGainer, float volume) MA_API ma_result ma_gainer_get_master_volume(const ma_gainer* pGainer, float* pVolume) { - if (pGainer == NULL || pVolume == NULL) { + if (pGainer == nullptr || pVolume == nullptr) { return MA_INVALID_ARGS; } @@ -51072,13 +51072,13 @@ MA_API ma_panner_config ma_panner_config_init(ma_format format, ma_uint32 channe MA_API ma_result ma_panner_init(const ma_panner_config* pConfig, ma_panner* pPanner) { - if (pPanner == NULL) { + if (pPanner == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pPanner); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -51201,7 +51201,7 @@ static void ma_stereo_pan_pcm_frames(void* pFramesOut, const void* pFramesIn, ma MA_API ma_result ma_panner_process_pcm_frames(ma_panner* pPanner, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pPanner == NULL || pFramesOut == NULL || pFramesIn == NULL) { + if (pPanner == nullptr || pFramesOut == nullptr || pFramesIn == nullptr) { return MA_INVALID_ARGS; } @@ -51227,7 +51227,7 @@ MA_API ma_result ma_panner_process_pcm_frames(ma_panner* pPanner, void* pFramesO MA_API void ma_panner_set_mode(ma_panner* pPanner, ma_pan_mode mode) { - if (pPanner == NULL) { + if (pPanner == nullptr) { return; } @@ -51236,7 +51236,7 @@ MA_API void ma_panner_set_mode(ma_panner* pPanner, ma_pan_mode mode) MA_API ma_pan_mode ma_panner_get_mode(const ma_panner* pPanner) { - if (pPanner == NULL) { + if (pPanner == nullptr) { return ma_pan_mode_balance; } @@ -51245,7 +51245,7 @@ MA_API ma_pan_mode ma_panner_get_mode(const ma_panner* pPanner) MA_API void ma_panner_set_pan(ma_panner* pPanner, float pan) { - if (pPanner == NULL) { + if (pPanner == nullptr) { return; } @@ -51254,7 +51254,7 @@ MA_API void ma_panner_set_pan(ma_panner* pPanner, float pan) MA_API float ma_panner_get_pan(const ma_panner* pPanner) { - if (pPanner == NULL) { + if (pPanner == nullptr) { return 0; } @@ -51279,13 +51279,13 @@ MA_API ma_fader_config ma_fader_config_init(ma_format format, ma_uint32 channels MA_API ma_result ma_fader_init(const ma_fader_config* pConfig, ma_fader* pFader) { - if (pFader == NULL) { + if (pFader == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pFader); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -51305,7 +51305,7 @@ MA_API ma_result ma_fader_init(const ma_fader_config* pConfig, ma_fader* pFader) MA_API ma_result ma_fader_process_pcm_frames(ma_fader* pFader, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pFader == NULL) { + if (pFader == nullptr) { return MA_INVALID_ARGS; } @@ -51379,19 +51379,19 @@ MA_API ma_result ma_fader_process_pcm_frames(ma_fader* pFader, void* pFramesOut, MA_API void ma_fader_get_data_format(const ma_fader* pFader, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate) { - if (pFader == NULL) { + if (pFader == nullptr) { return; } - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = pFader->config.format; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = pFader->config.channels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = pFader->config.sampleRate; } } @@ -51403,7 +51403,7 @@ MA_API void ma_fader_set_fade(ma_fader* pFader, float volumeBeg, float volumeEnd MA_API void ma_fader_set_fade_ex(ma_fader* pFader, float volumeBeg, float volumeEnd, ma_uint64 lengthInFrames, ma_int64 startOffsetInFrames) { - if (pFader == NULL) { + if (pFader == nullptr) { return; } @@ -51433,7 +51433,7 @@ MA_API void ma_fader_set_fade_ex(ma_fader* pFader, float volumeBeg, float volume MA_API float ma_fader_get_current_volume(const ma_fader* pFader) { - if (pFader == NULL) { + if (pFader == nullptr) { return 0.0f; } @@ -51730,7 +51730,7 @@ MA_API ma_spatializer_listener_config ma_spatializer_listener_config_init(ma_uin MA_ZERO_OBJECT(&config); config.channelsOut = channelsOut; - config.pChannelMapOut = NULL; + config.pChannelMapOut = nullptr; config.handedness = ma_handedness_right; config.worldUp = ma_vec3f_init_3f(0, 1, 0); config.coneInnerAngleInRadians = 6.283185f; /* 360 degrees. */ @@ -51750,11 +51750,11 @@ typedef struct static ma_result ma_spatializer_listener_get_heap_layout(const ma_spatializer_listener_config* pConfig, ma_spatializer_listener_heap_layout* pHeapLayout) { - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -51777,7 +51777,7 @@ MA_API ma_result ma_spatializer_listener_get_heap_size(const ma_spatializer_list ma_result result; ma_spatializer_listener_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -51798,7 +51798,7 @@ MA_API ma_result ma_spatializer_listener_init_preallocated(const ma_spatializer_ ma_result result; ma_spatializer_listener_heap_layout heapLayout; - if (pListener == NULL) { + if (pListener == nullptr) { return MA_INVALID_ARGS; } @@ -51829,7 +51829,7 @@ MA_API ma_result ma_spatializer_listener_init_preallocated(const ma_spatializer_ pListener->config.pChannelMapOut = (ma_channel*)ma_offset_ptr(pHeap, heapLayout.channelMapOutOffset); /* Use a slightly different default channel map for stereo. */ - if (pConfig->pChannelMapOut == NULL) { + if (pConfig->pChannelMapOut == nullptr) { ma_get_default_channel_map_for_spatializer(pListener->config.pChannelMapOut, pConfig->channelsOut, pConfig->channelsOut); } else { ma_channel_map_copy_or_default(pListener->config.pChannelMapOut, pConfig->channelsOut, pConfig->pChannelMapOut, pConfig->channelsOut); @@ -51851,11 +51851,11 @@ MA_API ma_result ma_spatializer_listener_init(const ma_spatializer_listener_conf if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_spatializer_listener_init_preallocated(pConfig, pHeap, pListener); @@ -51870,7 +51870,7 @@ MA_API ma_result ma_spatializer_listener_init(const ma_spatializer_listener_conf MA_API void ma_spatializer_listener_uninit(ma_spatializer_listener* pListener, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } @@ -51881,8 +51881,8 @@ MA_API void ma_spatializer_listener_uninit(ma_spatializer_listener* pListener, c MA_API ma_channel* ma_spatializer_listener_get_channel_map(ma_spatializer_listener* pListener) { - if (pListener == NULL) { - return NULL; + if (pListener == nullptr) { + return nullptr; } return pListener->config.pChannelMapOut; @@ -51890,7 +51890,7 @@ MA_API ma_channel* ma_spatializer_listener_get_channel_map(ma_spatializer_listen MA_API void ma_spatializer_listener_set_cone(ma_spatializer_listener* pListener, float innerAngleInRadians, float outerAngleInRadians, float outerGain) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } @@ -51901,26 +51901,26 @@ MA_API void ma_spatializer_listener_set_cone(ma_spatializer_listener* pListener, MA_API void ma_spatializer_listener_get_cone(const ma_spatializer_listener* pListener, float* pInnerAngleInRadians, float* pOuterAngleInRadians, float* pOuterGain) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } - if (pInnerAngleInRadians != NULL) { + if (pInnerAngleInRadians != nullptr) { *pInnerAngleInRadians = pListener->config.coneInnerAngleInRadians; } - if (pOuterAngleInRadians != NULL) { + if (pOuterAngleInRadians != nullptr) { *pOuterAngleInRadians = pListener->config.coneOuterAngleInRadians; } - if (pOuterGain != NULL) { + if (pOuterGain != nullptr) { *pOuterGain = pListener->config.coneOuterGain; } } MA_API void ma_spatializer_listener_set_position(ma_spatializer_listener* pListener, float x, float y, float z) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } @@ -51929,7 +51929,7 @@ MA_API void ma_spatializer_listener_set_position(ma_spatializer_listener* pListe MA_API ma_vec3f ma_spatializer_listener_get_position(const ma_spatializer_listener* pListener) { - if (pListener == NULL) { + if (pListener == nullptr) { return ma_vec3f_init_3f(0, 0, 0); } @@ -51938,7 +51938,7 @@ MA_API ma_vec3f ma_spatializer_listener_get_position(const ma_spatializer_listen MA_API void ma_spatializer_listener_set_direction(ma_spatializer_listener* pListener, float x, float y, float z) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } @@ -51947,7 +51947,7 @@ MA_API void ma_spatializer_listener_set_direction(ma_spatializer_listener* pList MA_API ma_vec3f ma_spatializer_listener_get_direction(const ma_spatializer_listener* pListener) { - if (pListener == NULL) { + if (pListener == nullptr) { return ma_vec3f_init_3f(0, 0, -1); } @@ -51956,7 +51956,7 @@ MA_API ma_vec3f ma_spatializer_listener_get_direction(const ma_spatializer_liste MA_API void ma_spatializer_listener_set_velocity(ma_spatializer_listener* pListener, float x, float y, float z) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } @@ -51965,7 +51965,7 @@ MA_API void ma_spatializer_listener_set_velocity(ma_spatializer_listener* pListe MA_API ma_vec3f ma_spatializer_listener_get_velocity(const ma_spatializer_listener* pListener) { - if (pListener == NULL) { + if (pListener == nullptr) { return ma_vec3f_init_3f(0, 0, 0); } @@ -51974,7 +51974,7 @@ MA_API ma_vec3f ma_spatializer_listener_get_velocity(const ma_spatializer_listen MA_API void ma_spatializer_listener_set_speed_of_sound(ma_spatializer_listener* pListener, float speedOfSound) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } @@ -51983,7 +51983,7 @@ MA_API void ma_spatializer_listener_set_speed_of_sound(ma_spatializer_listener* MA_API float ma_spatializer_listener_get_speed_of_sound(const ma_spatializer_listener* pListener) { - if (pListener == NULL) { + if (pListener == nullptr) { return 0; } @@ -51992,7 +51992,7 @@ MA_API float ma_spatializer_listener_get_speed_of_sound(const ma_spatializer_lis MA_API void ma_spatializer_listener_set_world_up(ma_spatializer_listener* pListener, float x, float y, float z) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } @@ -52001,7 +52001,7 @@ MA_API void ma_spatializer_listener_set_world_up(ma_spatializer_listener* pListe MA_API ma_vec3f ma_spatializer_listener_get_world_up(const ma_spatializer_listener* pListener) { - if (pListener == NULL) { + if (pListener == nullptr) { return ma_vec3f_init_3f(0, 1, 0); } @@ -52010,7 +52010,7 @@ MA_API ma_vec3f ma_spatializer_listener_get_world_up(const ma_spatializer_listen MA_API void ma_spatializer_listener_set_enabled(ma_spatializer_listener* pListener, ma_bool32 isEnabled) { - if (pListener == NULL) { + if (pListener == nullptr) { return; } @@ -52019,7 +52019,7 @@ MA_API void ma_spatializer_listener_set_enabled(ma_spatializer_listener* pListen MA_API ma_bool32 ma_spatializer_listener_is_enabled(const ma_spatializer_listener* pListener) { - if (pListener == NULL) { + if (pListener == nullptr) { return MA_FALSE; } @@ -52036,7 +52036,7 @@ MA_API ma_spatializer_config ma_spatializer_config_init(ma_uint32 channelsIn, ma MA_ZERO_OBJECT(&config); config.channelsIn = channelsIn; config.channelsOut = channelsOut; - config.pChannelMapIn = NULL; + config.pChannelMapIn = nullptr; config.attenuationModel = ma_attenuation_model_inverse; config.positioning = ma_positioning_absolute; config.handedness = ma_handedness_right; @@ -52059,13 +52059,13 @@ MA_API ma_spatializer_config ma_spatializer_config_init(ma_uint32 channelsIn, ma static ma_gainer_config ma_spatializer_gainer_config_init(const ma_spatializer_config* pConfig) { - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); return ma_gainer_config_init(pConfig->channelsOut, pConfig->gainSmoothTimeInFrames); } static ma_result ma_spatializer_validate_config(const ma_spatializer_config* pConfig) { - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); if (pConfig->channelsIn == 0 || pConfig->channelsOut == 0) { return MA_INVALID_ARGS; @@ -52086,11 +52086,11 @@ static ma_result ma_spatializer_get_heap_layout(const ma_spatializer_config* pCo { ma_result result; - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -52103,7 +52103,7 @@ static ma_result ma_spatializer_get_heap_layout(const ma_spatializer_config* pCo /* Channel map. */ pHeapLayout->channelMapInOffset = MA_SIZE_MAX; /* <-- MA_SIZE_MAX indicates no allocation necessary. */ - if (pConfig->pChannelMapIn != NULL) { + if (pConfig->pChannelMapIn != nullptr) { pHeapLayout->channelMapInOffset = pHeapLayout->sizeInBytes; pHeapLayout->sizeInBytes += ma_align_64(sizeof(*pConfig->pChannelMapIn) * pConfig->channelsIn); } @@ -52136,7 +52136,7 @@ MA_API ma_result ma_spatializer_get_heap_size(const ma_spatializer_config* pConf ma_result result; ma_spatializer_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -52159,13 +52159,13 @@ MA_API ma_result ma_spatializer_init_preallocated(const ma_spatializer_config* p ma_spatializer_heap_layout heapLayout; ma_gainer_config gainerConfig; - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pSpatializer); - if (pConfig == NULL || pHeap == NULL) { + if (pConfig == nullptr || pHeap == nullptr) { return MA_INVALID_ARGS; } @@ -52206,7 +52206,7 @@ MA_API ma_result ma_spatializer_init_preallocated(const ma_spatializer_config* p } /* Channel map. This will be on the heap. */ - if (pConfig->pChannelMapIn != NULL) { + if (pConfig->pChannelMapIn != nullptr) { pSpatializer->pChannelMapIn = (ma_channel*)ma_offset_ptr(pHeap, heapLayout.channelMapInOffset); ma_channel_map_copy_or_default(pSpatializer->pChannelMapIn, pSpatializer->channelsIn, pConfig->pChannelMapIn, pSpatializer->channelsIn); } @@ -52239,11 +52239,11 @@ MA_API ma_result ma_spatializer_init(const ma_spatializer_config* pConfig, const if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_spatializer_init_preallocated(pConfig, pHeap, pSpatializer); @@ -52258,7 +52258,7 @@ MA_API ma_result ma_spatializer_init(const ma_spatializer_config* pConfig, const MA_API void ma_spatializer_uninit(ma_spatializer* pSpatializer, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52318,7 +52318,7 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer, ma_channel* pChannelMapIn; ma_channel* pChannelMapOut; - if (pSpatializer == NULL || pListener == NULL) { + if (pSpatializer == nullptr || pListener == nullptr) { return MA_INVALID_ARGS; } @@ -52444,7 +52444,7 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer, We're supporting angular gain on the listener as well for those who want to reduce the volume of sounds that are positioned behind the listener. On default settings, this will have no effect. */ - if (pListener != NULL && pListener->config.coneInnerAngleInRadians < 6.283185f) { + if (pListener != nullptr && pListener->config.coneInnerAngleInRadians < 6.283185f) { ma_vec3f listenerDirection; float listenerInnerAngle; float listenerOuterAngle; @@ -52498,7 +52498,7 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer, /*printf("distance=%f; gain=%f\n", distance, gain);*/ /* We must have a valid channel map here to ensure we spatialize properly. */ - MA_ASSERT(pChannelMapOut != NULL); + MA_ASSERT(pChannelMapOut != nullptr); /* We're not converting to mono so we'll want to apply some panning. This is where the feeling of something being @@ -52621,7 +52621,7 @@ MA_API ma_result ma_spatializer_process_pcm_frames(ma_spatializer* pSpatializer, MA_API ma_result ma_spatializer_set_master_volume(ma_spatializer* pSpatializer, float volume) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return MA_INVALID_ARGS; } @@ -52630,7 +52630,7 @@ MA_API ma_result ma_spatializer_set_master_volume(ma_spatializer* pSpatializer, MA_API ma_result ma_spatializer_get_master_volume(const ma_spatializer* pSpatializer, float* pVolume) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return MA_INVALID_ARGS; } @@ -52639,7 +52639,7 @@ MA_API ma_result ma_spatializer_get_master_volume(const ma_spatializer* pSpatial MA_API ma_uint32 ma_spatializer_get_input_channels(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 0; } @@ -52648,7 +52648,7 @@ MA_API ma_uint32 ma_spatializer_get_input_channels(const ma_spatializer* pSpatia MA_API ma_uint32 ma_spatializer_get_output_channels(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 0; } @@ -52657,7 +52657,7 @@ MA_API ma_uint32 ma_spatializer_get_output_channels(const ma_spatializer* pSpati MA_API void ma_spatializer_set_attenuation_model(ma_spatializer* pSpatializer, ma_attenuation_model attenuationModel) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52666,7 +52666,7 @@ MA_API void ma_spatializer_set_attenuation_model(ma_spatializer* pSpatializer, m MA_API ma_attenuation_model ma_spatializer_get_attenuation_model(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return ma_attenuation_model_none; } @@ -52675,7 +52675,7 @@ MA_API ma_attenuation_model ma_spatializer_get_attenuation_model(const ma_spatia MA_API void ma_spatializer_set_positioning(ma_spatializer* pSpatializer, ma_positioning positioning) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52684,7 +52684,7 @@ MA_API void ma_spatializer_set_positioning(ma_spatializer* pSpatializer, ma_posi MA_API ma_positioning ma_spatializer_get_positioning(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return ma_positioning_absolute; } @@ -52693,7 +52693,7 @@ MA_API ma_positioning ma_spatializer_get_positioning(const ma_spatializer* pSpat MA_API void ma_spatializer_set_rolloff(ma_spatializer* pSpatializer, float rolloff) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52702,7 +52702,7 @@ MA_API void ma_spatializer_set_rolloff(ma_spatializer* pSpatializer, float rollo MA_API float ma_spatializer_get_rolloff(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 0; } @@ -52711,7 +52711,7 @@ MA_API float ma_spatializer_get_rolloff(const ma_spatializer* pSpatializer) MA_API void ma_spatializer_set_min_gain(ma_spatializer* pSpatializer, float minGain) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52720,7 +52720,7 @@ MA_API void ma_spatializer_set_min_gain(ma_spatializer* pSpatializer, float minG MA_API float ma_spatializer_get_min_gain(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 0; } @@ -52729,7 +52729,7 @@ MA_API float ma_spatializer_get_min_gain(const ma_spatializer* pSpatializer) MA_API void ma_spatializer_set_max_gain(ma_spatializer* pSpatializer, float maxGain) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52738,7 +52738,7 @@ MA_API void ma_spatializer_set_max_gain(ma_spatializer* pSpatializer, float maxG MA_API float ma_spatializer_get_max_gain(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 0; } @@ -52747,7 +52747,7 @@ MA_API float ma_spatializer_get_max_gain(const ma_spatializer* pSpatializer) MA_API void ma_spatializer_set_min_distance(ma_spatializer* pSpatializer, float minDistance) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52756,7 +52756,7 @@ MA_API void ma_spatializer_set_min_distance(ma_spatializer* pSpatializer, float MA_API float ma_spatializer_get_min_distance(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 0; } @@ -52765,7 +52765,7 @@ MA_API float ma_spatializer_get_min_distance(const ma_spatializer* pSpatializer) MA_API void ma_spatializer_set_max_distance(ma_spatializer* pSpatializer, float maxDistance) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52774,7 +52774,7 @@ MA_API void ma_spatializer_set_max_distance(ma_spatializer* pSpatializer, float MA_API float ma_spatializer_get_max_distance(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 0; } @@ -52783,7 +52783,7 @@ MA_API float ma_spatializer_get_max_distance(const ma_spatializer* pSpatializer) MA_API void ma_spatializer_set_cone(ma_spatializer* pSpatializer, float innerAngleInRadians, float outerAngleInRadians, float outerGain) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52794,26 +52794,26 @@ MA_API void ma_spatializer_set_cone(ma_spatializer* pSpatializer, float innerAng MA_API void ma_spatializer_get_cone(const ma_spatializer* pSpatializer, float* pInnerAngleInRadians, float* pOuterAngleInRadians, float* pOuterGain) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } - if (pInnerAngleInRadians != NULL) { + if (pInnerAngleInRadians != nullptr) { *pInnerAngleInRadians = ma_atomic_load_f32(&pSpatializer->coneInnerAngleInRadians); } - if (pOuterAngleInRadians != NULL) { + if (pOuterAngleInRadians != nullptr) { *pOuterAngleInRadians = ma_atomic_load_f32(&pSpatializer->coneOuterAngleInRadians); } - if (pOuterGain != NULL) { + if (pOuterGain != nullptr) { *pOuterGain = ma_atomic_load_f32(&pSpatializer->coneOuterGain); } } MA_API void ma_spatializer_set_doppler_factor(ma_spatializer* pSpatializer, float dopplerFactor) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52822,7 +52822,7 @@ MA_API void ma_spatializer_set_doppler_factor(ma_spatializer* pSpatializer, floa MA_API float ma_spatializer_get_doppler_factor(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 1; } @@ -52831,7 +52831,7 @@ MA_API float ma_spatializer_get_doppler_factor(const ma_spatializer* pSpatialize MA_API void ma_spatializer_set_directional_attenuation_factor(ma_spatializer* pSpatializer, float directionalAttenuationFactor) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52840,7 +52840,7 @@ MA_API void ma_spatializer_set_directional_attenuation_factor(ma_spatializer* pS MA_API float ma_spatializer_get_directional_attenuation_factor(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return 1; } @@ -52849,7 +52849,7 @@ MA_API float ma_spatializer_get_directional_attenuation_factor(const ma_spatiali MA_API void ma_spatializer_set_position(ma_spatializer* pSpatializer, float x, float y, float z) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52858,7 +52858,7 @@ MA_API void ma_spatializer_set_position(ma_spatializer* pSpatializer, float x, f MA_API ma_vec3f ma_spatializer_get_position(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return ma_vec3f_init_3f(0, 0, 0); } @@ -52867,7 +52867,7 @@ MA_API ma_vec3f ma_spatializer_get_position(const ma_spatializer* pSpatializer) MA_API void ma_spatializer_set_direction(ma_spatializer* pSpatializer, float x, float y, float z) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52876,7 +52876,7 @@ MA_API void ma_spatializer_set_direction(ma_spatializer* pSpatializer, float x, MA_API ma_vec3f ma_spatializer_get_direction(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return ma_vec3f_init_3f(0, 0, -1); } @@ -52885,7 +52885,7 @@ MA_API ma_vec3f ma_spatializer_get_direction(const ma_spatializer* pSpatializer) MA_API void ma_spatializer_set_velocity(ma_spatializer* pSpatializer, float x, float y, float z) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } @@ -52894,7 +52894,7 @@ MA_API void ma_spatializer_set_velocity(ma_spatializer* pSpatializer, float x, f MA_API ma_vec3f ma_spatializer_get_velocity(const ma_spatializer* pSpatializer) { - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return ma_vec3f_init_3f(0, 0, 0); } @@ -52903,28 +52903,28 @@ MA_API ma_vec3f ma_spatializer_get_velocity(const ma_spatializer* pSpatializer) MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatializer* pSpatializer, const ma_spatializer_listener* pListener, ma_vec3f* pRelativePos, ma_vec3f* pRelativeDir) { - if (pRelativePos != NULL) { + if (pRelativePos != nullptr) { pRelativePos->x = 0; pRelativePos->y = 0; pRelativePos->z = 0; } - if (pRelativeDir != NULL) { + if (pRelativeDir != nullptr) { pRelativeDir->x = 0; pRelativeDir->y = 0; pRelativeDir->z = -1; } - if (pSpatializer == NULL) { + if (pSpatializer == nullptr) { return; } - if (pListener == NULL || ma_spatializer_get_positioning(pSpatializer) == ma_positioning_relative) { + if (pListener == nullptr || ma_spatializer_get_positioning(pSpatializer) == ma_positioning_relative) { /* There's no listener or we're using relative positioning. */ - if (pRelativePos != NULL) { + if (pRelativePos != nullptr) { *pRelativePos = ma_spatializer_get_position(pSpatializer); } - if (pRelativeDir != NULL) { + if (pRelativeDir != nullptr) { *pRelativeDir = ma_spatializer_get_direction(pSpatializer); } } else { @@ -52982,7 +52982,7 @@ MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatiali space. This allows calculations to work based on the sound being relative to the origin which makes things simpler. */ - if (pRelativePos != NULL) { + if (pRelativePos != nullptr) { v = spatializerPosition; pRelativePos->x = m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * 1; pRelativePos->y = m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * 1; @@ -52993,7 +52993,7 @@ MA_API void ma_spatializer_get_relative_position_and_direction(const ma_spatiali The direction of the sound needs to also be transformed so that it's relative to the rotation of the listener. */ - if (pRelativeDir != NULL) { + if (pRelativeDir != nullptr) { v = spatializerDirection; pRelativeDir->x = m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z; pRelativeDir->y = m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z; @@ -53061,7 +53061,7 @@ static ma_result ma_linear_resampler_set_rate_internal(ma_linear_resampler* pRes ma_lpf_config lpfConfig; ma_uint32 oldSampleRateOut; /* Required for adjusting time advance down the bottom. */ - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -53115,11 +53115,11 @@ static ma_result ma_linear_resampler_set_rate_internal(ma_linear_resampler* pRes static ma_result ma_linear_resampler_get_heap_layout(const ma_linear_resampler_config* pConfig, ma_linear_resampler_heap_layout* pHeapLayout) { - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -53175,7 +53175,7 @@ MA_API ma_result ma_linear_resampler_get_heap_size(const ma_linear_resampler_con ma_result result; ma_linear_resampler_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -53196,7 +53196,7 @@ MA_API ma_result ma_linear_resampler_init_preallocated(const ma_linear_resampler ma_result result; ma_linear_resampler_heap_layout heapLayout; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -53245,11 +53245,11 @@ MA_API ma_result ma_linear_resampler_init(const ma_linear_resampler_config* pCon if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_linear_resampler_init_preallocated(pConfig, pHeap, pResampler); @@ -53264,7 +53264,7 @@ MA_API ma_result ma_linear_resampler_init(const ma_linear_resampler_config* pCon MA_API void ma_linear_resampler_uninit(ma_linear_resampler* pResampler, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return; } @@ -53297,8 +53297,8 @@ static void ma_linear_resampler_interpolate_frame_s16(ma_linear_resampler* pResa const ma_uint32 channels = pResampler->config.channels; const ma_uint32 shift = 12; - MA_ASSERT(pResampler != NULL); - MA_ASSERT(pFrameOut != NULL); + MA_ASSERT(pResampler != nullptr); + MA_ASSERT(pFrameOut != nullptr); a = (pResampler->inTimeFrac << shift) / pResampler->config.sampleRateOut; @@ -53316,8 +53316,8 @@ static void ma_linear_resampler_interpolate_frame_f32(ma_linear_resampler* pResa float a; const ma_uint32 channels = pResampler->config.channels; - MA_ASSERT(pResampler != NULL); - MA_ASSERT(pFrameOut != NULL); + MA_ASSERT(pResampler != nullptr); + MA_ASSERT(pFrameOut != nullptr); a = (float)pResampler->inTimeFrac / pResampler->config.sampleRateOut; @@ -53337,9 +53337,9 @@ static ma_result ma_linear_resampler_process_pcm_frames_s16_downsample(ma_linear ma_uint64 framesProcessedIn; ma_uint64 framesProcessedOut; - MA_ASSERT(pResampler != NULL); - MA_ASSERT(pFrameCountIn != NULL); - MA_ASSERT(pFrameCountOut != NULL); + MA_ASSERT(pResampler != nullptr); + MA_ASSERT(pFrameCountIn != nullptr); + MA_ASSERT(pFrameCountOut != nullptr); pFramesInS16 = (const ma_int16*)pFramesIn; pFramesOutS16 = ( ma_int16*)pFramesOut; @@ -53353,7 +53353,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_s16_downsample(ma_linear while (pResampler->inTimeInt > 0 && frameCountIn > framesProcessedIn) { ma_uint32 iChannel; - if (pFramesInS16 != NULL) { + if (pFramesInS16 != nullptr) { for (iChannel = 0; iChannel < pResampler->config.channels; iChannel += 1) { pResampler->x0.s16[iChannel] = pResampler->x1.s16[iChannel]; pResampler->x1.s16[iChannel] = pFramesInS16[iChannel]; @@ -53380,7 +53380,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_s16_downsample(ma_linear } /* Getting here means the frames have been loaded and filtered and we can generate the next output frame. */ - if (pFramesOutS16 != NULL) { + if (pFramesOutS16 != nullptr) { MA_ASSERT(pResampler->inTimeInt == 0); ma_linear_resampler_interpolate_frame_s16(pResampler, pFramesOutS16); @@ -53413,9 +53413,9 @@ static ma_result ma_linear_resampler_process_pcm_frames_s16_upsample(ma_linear_r ma_uint64 framesProcessedIn; ma_uint64 framesProcessedOut; - MA_ASSERT(pResampler != NULL); - MA_ASSERT(pFrameCountIn != NULL); - MA_ASSERT(pFrameCountOut != NULL); + MA_ASSERT(pResampler != nullptr); + MA_ASSERT(pFrameCountIn != nullptr); + MA_ASSERT(pFrameCountOut != nullptr); pFramesInS16 = (const ma_int16*)pFramesIn; pFramesOutS16 = ( ma_int16*)pFramesOut; @@ -53429,7 +53429,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_s16_upsample(ma_linear_r while (pResampler->inTimeInt > 0 && frameCountIn > framesProcessedIn) { ma_uint32 iChannel; - if (pFramesInS16 != NULL) { + if (pFramesInS16 != nullptr) { for (iChannel = 0; iChannel < pResampler->config.channels; iChannel += 1) { pResampler->x0.s16[iChannel] = pResampler->x1.s16[iChannel]; pResampler->x1.s16[iChannel] = pFramesInS16[iChannel]; @@ -53451,7 +53451,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_s16_upsample(ma_linear_r } /* Getting here means the frames have been loaded and we can generate the next output frame. */ - if (pFramesOutS16 != NULL) { + if (pFramesOutS16 != nullptr) { MA_ASSERT(pResampler->inTimeInt == 0); ma_linear_resampler_interpolate_frame_s16(pResampler, pFramesOutS16); @@ -53482,7 +53482,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_s16_upsample(ma_linear_r static ma_result ma_linear_resampler_process_pcm_frames_s16(ma_linear_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut) { - MA_ASSERT(pResampler != NULL); + MA_ASSERT(pResampler != nullptr); if (pResampler->config.sampleRateIn > pResampler->config.sampleRateOut) { return ma_linear_resampler_process_pcm_frames_s16_downsample(pResampler, pFramesIn, pFrameCountIn, pFramesOut, pFrameCountOut); @@ -53501,9 +53501,9 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_downsample(ma_linear ma_uint64 framesProcessedIn; ma_uint64 framesProcessedOut; - MA_ASSERT(pResampler != NULL); - MA_ASSERT(pFrameCountIn != NULL); - MA_ASSERT(pFrameCountOut != NULL); + MA_ASSERT(pResampler != nullptr); + MA_ASSERT(pFrameCountIn != nullptr); + MA_ASSERT(pFrameCountOut != nullptr); pFramesInF32 = (const float*)pFramesIn; pFramesOutF32 = ( float*)pFramesOut; @@ -53517,7 +53517,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_downsample(ma_linear while (pResampler->inTimeInt > 0 && frameCountIn > framesProcessedIn) { ma_uint32 iChannel; - if (pFramesInF32 != NULL) { + if (pFramesInF32 != nullptr) { for (iChannel = 0; iChannel < pResampler->config.channels; iChannel += 1) { pResampler->x0.f32[iChannel] = pResampler->x1.f32[iChannel]; pResampler->x1.f32[iChannel] = pFramesInF32[iChannel]; @@ -53544,7 +53544,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_downsample(ma_linear } /* Getting here means the frames have been loaded and filtered and we can generate the next output frame. */ - if (pFramesOutF32 != NULL) { + if (pFramesOutF32 != nullptr) { MA_ASSERT(pResampler->inTimeInt == 0); ma_linear_resampler_interpolate_frame_f32(pResampler, pFramesOutF32); @@ -53577,9 +53577,9 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_upsample(ma_linear_r ma_uint64 framesProcessedIn; ma_uint64 framesProcessedOut; - MA_ASSERT(pResampler != NULL); - MA_ASSERT(pFrameCountIn != NULL); - MA_ASSERT(pFrameCountOut != NULL); + MA_ASSERT(pResampler != nullptr); + MA_ASSERT(pFrameCountIn != nullptr); + MA_ASSERT(pFrameCountOut != nullptr); pFramesInF32 = (const float*)pFramesIn; pFramesOutF32 = ( float*)pFramesOut; @@ -53593,7 +53593,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_upsample(ma_linear_r while (pResampler->inTimeInt > 0 && frameCountIn > framesProcessedIn) { ma_uint32 iChannel; - if (pFramesInF32 != NULL) { + if (pFramesInF32 != nullptr) { for (iChannel = 0; iChannel < pResampler->config.channels; iChannel += 1) { pResampler->x0.f32[iChannel] = pResampler->x1.f32[iChannel]; pResampler->x1.f32[iChannel] = pFramesInF32[iChannel]; @@ -53615,7 +53615,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_upsample(ma_linear_r } /* Getting here means the frames have been loaded and we can generate the next output frame. */ - if (pFramesOutF32 != NULL) { + if (pFramesOutF32 != nullptr) { MA_ASSERT(pResampler->inTimeInt == 0); ma_linear_resampler_interpolate_frame_f32(pResampler, pFramesOutF32); @@ -53646,7 +53646,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32_upsample(ma_linear_r static ma_result ma_linear_resampler_process_pcm_frames_f32(ma_linear_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut) { - MA_ASSERT(pResampler != NULL); + MA_ASSERT(pResampler != nullptr); if (pResampler->config.sampleRateIn > pResampler->config.sampleRateOut) { return ma_linear_resampler_process_pcm_frames_f32_downsample(pResampler, pFramesIn, pFrameCountIn, pFramesOut, pFrameCountOut); @@ -53658,7 +53658,7 @@ static ma_result ma_linear_resampler_process_pcm_frames_f32(ma_linear_resampler* MA_API ma_result ma_linear_resampler_process_pcm_frames(ma_linear_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -53676,7 +53676,7 @@ MA_API ma_result ma_linear_resampler_process_pcm_frames(ma_linear_resampler* pRe MA_API ma_result ma_linear_resampler_set_rate(ma_linear_resampler* pResampler, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut) { - return ma_linear_resampler_set_rate_internal(pResampler, NULL, NULL, sampleRateIn, sampleRateOut, /* isResamplerAlreadyInitialized = */ MA_TRUE); + return ma_linear_resampler_set_rate_internal(pResampler, nullptr, nullptr, sampleRateIn, sampleRateOut, /* isResamplerAlreadyInitialized = */ MA_TRUE); } MA_API ma_result ma_linear_resampler_set_rate_ratio(ma_linear_resampler* pResampler, float ratioInOut) @@ -53684,7 +53684,7 @@ MA_API ma_result ma_linear_resampler_set_rate_ratio(ma_linear_resampler* pResamp ma_uint32 n; ma_uint32 d; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -53706,7 +53706,7 @@ MA_API ma_result ma_linear_resampler_set_rate_ratio(ma_linear_resampler* pResamp MA_API ma_uint64 ma_linear_resampler_get_input_latency(const ma_linear_resampler* pResampler) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return 0; } @@ -53715,7 +53715,7 @@ MA_API ma_uint64 ma_linear_resampler_get_input_latency(const ma_linear_resampler MA_API ma_uint64 ma_linear_resampler_get_output_latency(const ma_linear_resampler* pResampler) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return 0; } @@ -53726,13 +53726,13 @@ MA_API ma_result ma_linear_resampler_get_required_input_frame_count(const ma_lin { ma_uint64 inputFrameCount; - if (pInputFrameCount == NULL) { + if (pInputFrameCount == nullptr) { return MA_INVALID_ARGS; } *pInputFrameCount = 0; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -53759,13 +53759,13 @@ MA_API ma_result ma_linear_resampler_get_expected_output_frame_count(const ma_li ma_uint64 preliminaryInputFrameCountFromFrac; ma_uint64 preliminaryInputFrameCount; - if (pOutputFrameCount == NULL) { + if (pOutputFrameCount == nullptr) { return MA_INVALID_ARGS; } *pOutputFrameCount = 0; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -53802,7 +53802,7 @@ MA_API ma_result ma_linear_resampler_reset(ma_linear_resampler* pResampler) { ma_uint32 iChannel; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -53964,13 +53964,13 @@ MA_API ma_resampler_config ma_resampler_config_init(ma_format format, ma_uint32 static ma_result ma_resampler_get_vtable(const ma_resampler_config* pConfig, ma_resampler* pResampler, ma_resampling_backend_vtable** ppVTable, void** ppUserData) { - MA_ASSERT(pConfig != NULL); - MA_ASSERT(ppVTable != NULL); - MA_ASSERT(ppUserData != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(ppVTable != nullptr); + MA_ASSERT(ppUserData != nullptr); /* Safety. */ - *ppVTable = NULL; - *ppUserData = NULL; + *ppVTable = nullptr; + *ppUserData = nullptr; switch (pConfig->algorithm) { @@ -53998,22 +53998,22 @@ MA_API ma_result ma_resampler_get_heap_size(const ma_resampler_config* pConfig, ma_resampling_backend_vtable* pVTable; void* pVTableUserData; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } *pHeapSizeInBytes = 0; - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - result = ma_resampler_get_vtable(pConfig, NULL, &pVTable, &pVTableUserData); + result = ma_resampler_get_vtable(pConfig, nullptr, &pVTable, &pVTableUserData); if (result != MA_SUCCESS) { return result; } - if (pVTable == NULL || pVTable->onGetHeapSize == NULL) { + if (pVTable == nullptr || pVTable->onGetHeapSize == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -54029,13 +54029,13 @@ MA_API ma_result ma_resampler_init_preallocated(const ma_resampler_config* pConf { ma_result result; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pResampler); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -54050,7 +54050,7 @@ MA_API ma_result ma_resampler_init_preallocated(const ma_resampler_config* pConf return result; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onInit == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onInit == nullptr) { return MA_NOT_IMPLEMENTED; /* onInit not implemented. */ } @@ -54075,11 +54075,11 @@ MA_API ma_result ma_resampler_init(const ma_resampler_config* pConfig, const ma_ if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_resampler_init_preallocated(pConfig, pHeap, pResampler); @@ -54094,11 +54094,11 @@ MA_API ma_result ma_resampler_init(const ma_resampler_config* pConfig, const ma_ MA_API void ma_resampler_uninit(ma_resampler* pResampler, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onUninit == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onUninit == nullptr) { return; } @@ -54111,15 +54111,15 @@ MA_API void ma_resampler_uninit(ma_resampler* pResampler, const ma_allocation_ca MA_API ma_result ma_resampler_process_pcm_frames(ma_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } - if (pFrameCountOut == NULL && pFrameCountIn == NULL) { + if (pFrameCountOut == nullptr && pFrameCountIn == nullptr) { return MA_INVALID_ARGS; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onProcess == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onProcess == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -54130,7 +54130,7 @@ MA_API ma_result ma_resampler_set_rate(ma_resampler* pResampler, ma_uint32 sampl { ma_result result; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -54138,7 +54138,7 @@ MA_API ma_result ma_resampler_set_rate(ma_resampler* pResampler, ma_uint32 sampl return MA_INVALID_ARGS; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onSetRate == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onSetRate == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -54158,7 +54158,7 @@ MA_API ma_result ma_resampler_set_rate_ratio(ma_resampler* pResampler, float rat ma_uint32 n; ma_uint32 d; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } @@ -54180,11 +54180,11 @@ MA_API ma_result ma_resampler_set_rate_ratio(ma_resampler* pResampler, float rat MA_API ma_uint64 ma_resampler_get_input_latency(const ma_resampler* pResampler) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return 0; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onGetInputLatency == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onGetInputLatency == nullptr) { return 0; } @@ -54193,11 +54193,11 @@ MA_API ma_uint64 ma_resampler_get_input_latency(const ma_resampler* pResampler) MA_API ma_uint64 ma_resampler_get_output_latency(const ma_resampler* pResampler) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return 0; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onGetOutputLatency == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onGetOutputLatency == nullptr) { return 0; } @@ -54206,17 +54206,17 @@ MA_API ma_uint64 ma_resampler_get_output_latency(const ma_resampler* pResampler) MA_API ma_result ma_resampler_get_required_input_frame_count(const ma_resampler* pResampler, ma_uint64 outputFrameCount, ma_uint64* pInputFrameCount) { - if (pInputFrameCount == NULL) { + if (pInputFrameCount == nullptr) { return MA_INVALID_ARGS; } *pInputFrameCount = 0; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onGetRequiredInputFrameCount == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onGetRequiredInputFrameCount == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -54225,17 +54225,17 @@ MA_API ma_result ma_resampler_get_required_input_frame_count(const ma_resampler* MA_API ma_result ma_resampler_get_expected_output_frame_count(const ma_resampler* pResampler, ma_uint64 inputFrameCount, ma_uint64* pOutputFrameCount) { - if (pOutputFrameCount == NULL) { + if (pOutputFrameCount == nullptr) { return MA_INVALID_ARGS; } *pOutputFrameCount = 0; - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onGetExpectedOutputFrameCount == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onGetExpectedOutputFrameCount == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -54244,11 +54244,11 @@ MA_API ma_result ma_resampler_get_expected_output_frame_count(const ma_resampler MA_API ma_result ma_resampler_reset(ma_resampler* pResampler) { - if (pResampler == NULL) { + if (pResampler == nullptr) { return MA_INVALID_ARGS; } - if (pResampler->pBackendVTable == NULL || pResampler->pBackendVTable->onReset == NULL) { + if (pResampler->pBackendVTable == nullptr || pResampler->pBackendVTable->onReset == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -54394,7 +54394,7 @@ static ma_uint32 ma_channel_map_get_spatial_channel_count(const ma_channel* pCha ma_uint32 spatialChannelCount = 0; ma_uint32 iChannel; - MA_ASSERT(pChannelMap != NULL); + MA_ASSERT(pChannelMap != nullptr); MA_ASSERT(channels > 0); for (iChannel = 0; iChannel < channels; ++iChannel) { @@ -54443,11 +54443,11 @@ static ma_channel_conversion_path ma_channel_map_get_conversion_path(const ma_ch return ma_channel_conversion_path_passthrough; } - if (channelsOut == 1 && (pChannelMapOut == NULL || pChannelMapOut[0] == MA_CHANNEL_MONO)) { + if (channelsOut == 1 && (pChannelMapOut == nullptr || pChannelMapOut[0] == MA_CHANNEL_MONO)) { return ma_channel_conversion_path_mono_out; } - if (channelsIn == 1 && (pChannelMapIn == NULL || pChannelMapIn[0] == MA_CHANNEL_MONO)) { + if (channelsIn == 1 && (pChannelMapIn == nullptr || pChannelMapIn[0] == MA_CHANNEL_MONO)) { return ma_channel_conversion_path_mono_in; } @@ -54485,7 +54485,7 @@ static ma_result ma_channel_map_build_shuffle_table(const ma_channel* pChannelMa ma_uint32 iChannelIn; ma_uint32 iChannelOut; - if (pShuffleTable == NULL || channelCountIn == 0 || channelCountOut == 0) { + if (pShuffleTable == nullptr || channelCountIn == 0 || channelCountOut == 0) { return MA_INVALID_ARGS; } @@ -54658,7 +54658,7 @@ static void ma_channel_map_apply_shuffle_table_f32(float* pFramesOut, ma_uint32 static ma_result ma_channel_map_apply_shuffle_table(void* pFramesOut, ma_uint32 channelsOut, const void* pFramesIn, ma_uint32 channelsIn, ma_uint64 frameCount, const ma_uint8* pShuffleTable, ma_format format) { - if (pFramesOut == NULL || pFramesIn == NULL || channelsOut == 0 || pShuffleTable == NULL) { + if (pFramesOut == nullptr || pFramesIn == nullptr || channelsOut == 0 || pShuffleTable == nullptr) { return MA_INVALID_ARGS; } @@ -54701,7 +54701,7 @@ static ma_result ma_channel_map_apply_mono_out_f32(float* pFramesOut, const floa ma_uint32 iChannelIn; ma_uint32 accumulationCount; - if (pFramesOut == NULL || pFramesIn == NULL || channelsIn == 0) { + if (pFramesOut == nullptr || pFramesIn == nullptr || channelsIn == 0) { return MA_INVALID_ARGS; } @@ -54742,7 +54742,7 @@ static ma_result ma_channel_map_apply_mono_in_f32(float* MA_RESTRICT pFramesOut, ma_uint64 iFrame; ma_uint32 iChannelOut; - if (pFramesOut == NULL || channelsOut == 0 || pFramesIn == NULL) { + if (pFramesOut == nullptr || channelsOut == 0 || pFramesIn == nullptr) { return MA_INVALID_ARGS; } @@ -55167,9 +55167,9 @@ static ma_result ma_channel_converter_get_heap_layout(const ma_channel_converter { ma_channel_conversion_path conversionPath; - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -55189,13 +55189,13 @@ static ma_result ma_channel_converter_get_heap_layout(const ma_channel_converter /* Input channel map. Only need to allocate this if we have an input channel map (otherwise default channel map is assumed). */ pHeapLayout->channelMapInOffset = pHeapLayout->sizeInBytes; - if (pConfig->pChannelMapIn != NULL) { + if (pConfig->pChannelMapIn != nullptr) { pHeapLayout->sizeInBytes += sizeof(ma_channel) * pConfig->channelsIn; } /* Output channel map. Only need to allocate this if we have an output channel map (otherwise default channel map is assumed). */ pHeapLayout->channelMapOutOffset = pHeapLayout->sizeInBytes; - if (pConfig->pChannelMapOut != NULL) { + if (pConfig->pChannelMapOut != nullptr) { pHeapLayout->sizeInBytes += sizeof(ma_channel) * pConfig->channelsOut; } @@ -55229,7 +55229,7 @@ MA_API ma_result ma_channel_converter_get_heap_size(const ma_channel_converter_c ma_result result; ma_channel_converter_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -55250,7 +55250,7 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert ma_result result; ma_channel_converter_heap_layout heapLayout; - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } @@ -55269,18 +55269,18 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert pConverter->channelsOut = pConfig->channelsOut; pConverter->mixingMode = pConfig->mixingMode; - if (pConfig->pChannelMapIn != NULL) { + if (pConfig->pChannelMapIn != nullptr) { pConverter->pChannelMapIn = (ma_channel*)ma_offset_ptr(pHeap, heapLayout.channelMapInOffset); ma_channel_map_copy_or_default(pConverter->pChannelMapIn, pConfig->channelsIn, pConfig->pChannelMapIn, pConfig->channelsIn); } else { - pConverter->pChannelMapIn = NULL; /* Use default channel map. */ + pConverter->pChannelMapIn = nullptr; /* Use default channel map. */ } - if (pConfig->pChannelMapOut != NULL) { + if (pConfig->pChannelMapOut != nullptr) { pConverter->pChannelMapOut = (ma_channel*)ma_offset_ptr(pHeap, heapLayout.channelMapOutOffset); ma_channel_map_copy_or_default(pConverter->pChannelMapOut, pConfig->channelsOut, pConfig->pChannelMapOut, pConfig->channelsOut); } else { - pConverter->pChannelMapOut = NULL; /* Use default channel map. */ + pConverter->pChannelMapOut = nullptr; /* Use default channel map. */ } pConverter->conversionPath = ma_channel_converter_config_get_conversion_path(pConfig); @@ -55344,7 +55344,7 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert { case ma_channel_mix_mode_custom_weights: { - if (pConfig->ppWeights == NULL) { + if (pConfig->ppWeights == nullptr) { return MA_INVALID_ARGS; /* Config specified a custom weights mixing mode, but no custom weights have been specified. */ } @@ -55479,11 +55479,11 @@ MA_API ma_result ma_channel_converter_init(const ma_channel_converter_config* pC if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_channel_converter_init_preallocated(pConfig, pHeap, pConverter); @@ -55498,7 +55498,7 @@ MA_API ma_result ma_channel_converter_init(const ma_channel_converter_config* pC MA_API void ma_channel_converter_uninit(ma_channel_converter* pConverter, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return; } @@ -55509,9 +55509,9 @@ MA_API void ma_channel_converter_uninit(ma_channel_converter* pConverter, const static ma_result ma_channel_converter_process_pcm_frames__passthrough(ma_channel_converter* pConverter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - MA_ASSERT(pConverter != NULL); - MA_ASSERT(pFramesOut != NULL); - MA_ASSERT(pFramesIn != NULL); + MA_ASSERT(pConverter != nullptr); + MA_ASSERT(pFramesOut != nullptr); + MA_ASSERT(pFramesIn != nullptr); ma_copy_memory_64(pFramesOut, pFramesIn, frameCount * ma_get_bytes_per_frame(pConverter->format, pConverter->channelsOut)); return MA_SUCCESS; @@ -55519,9 +55519,9 @@ static ma_result ma_channel_converter_process_pcm_frames__passthrough(ma_channel static ma_result ma_channel_converter_process_pcm_frames__shuffle(ma_channel_converter* pConverter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - MA_ASSERT(pConverter != NULL); - MA_ASSERT(pFramesOut != NULL); - MA_ASSERT(pFramesIn != NULL); + MA_ASSERT(pConverter != nullptr); + MA_ASSERT(pFramesOut != nullptr); + MA_ASSERT(pFramesIn != nullptr); MA_ASSERT(pConverter->channelsIn == pConverter->channelsOut); return ma_channel_map_apply_shuffle_table(pFramesOut, pConverter->channelsOut, pFramesIn, pConverter->channelsIn, frameCount, pConverter->pShuffleTable, pConverter->format); @@ -55531,9 +55531,9 @@ static ma_result ma_channel_converter_process_pcm_frames__mono_in(ma_channel_con { ma_uint64 iFrame; - MA_ASSERT(pConverter != NULL); - MA_ASSERT(pFramesOut != NULL); - MA_ASSERT(pFramesIn != NULL); + MA_ASSERT(pConverter != nullptr); + MA_ASSERT(pFramesOut != nullptr); + MA_ASSERT(pFramesIn != nullptr); MA_ASSERT(pConverter->channelsIn == 1); switch (pConverter->format) @@ -55632,9 +55632,9 @@ static ma_result ma_channel_converter_process_pcm_frames__mono_out(ma_channel_co ma_uint64 iFrame; ma_uint32 iChannel; - MA_ASSERT(pConverter != NULL); - MA_ASSERT(pFramesOut != NULL); - MA_ASSERT(pFramesIn != NULL); + MA_ASSERT(pConverter != nullptr); + MA_ASSERT(pFramesOut != nullptr); + MA_ASSERT(pFramesIn != nullptr); MA_ASSERT(pConverter->channelsOut == 1); switch (pConverter->format) @@ -55726,9 +55726,9 @@ static ma_result ma_channel_converter_process_pcm_frames__weights(ma_channel_con ma_uint32 iChannelIn; ma_uint32 iChannelOut; - MA_ASSERT(pConverter != NULL); - MA_ASSERT(pFramesOut != NULL); - MA_ASSERT(pFramesIn != NULL); + MA_ASSERT(pConverter != nullptr); + MA_ASSERT(pFramesOut != nullptr); + MA_ASSERT(pFramesIn != nullptr); /* This is the more complicated case. Each of the output channels is accumulated with 0 or more input channels. */ @@ -55828,15 +55828,15 @@ static ma_result ma_channel_converter_process_pcm_frames__weights(ma_channel_con MA_API ma_result ma_channel_converter_process_pcm_frames(ma_channel_converter* pConverter, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } - if (pFramesOut == NULL) { + if (pFramesOut == nullptr) { return MA_INVALID_ARGS; } - if (pFramesIn == NULL) { + if (pFramesIn == nullptr) { ma_zero_memory_64(pFramesOut, frameCount * ma_get_bytes_per_frame(pConverter->format, pConverter->channelsOut)); return MA_SUCCESS; } @@ -55857,7 +55857,7 @@ MA_API ma_result ma_channel_converter_process_pcm_frames(ma_channel_converter* p MA_API ma_result ma_channel_converter_get_input_channel_map(const ma_channel_converter* pConverter, ma_channel* pChannelMap, size_t channelMapCap) { - if (pConverter == NULL || pChannelMap == NULL) { + if (pConverter == nullptr || pChannelMap == nullptr) { return MA_INVALID_ARGS; } @@ -55868,7 +55868,7 @@ MA_API ma_result ma_channel_converter_get_input_channel_map(const ma_channel_con MA_API ma_result ma_channel_converter_get_output_channel_map(const ma_channel_converter* pConverter, ma_channel* pChannelMap, size_t channelMapCap) { - if (pConverter == NULL || pChannelMap == NULL) { + if (pConverter == nullptr || pChannelMap == nullptr) { return MA_INVALID_ARGS; } @@ -55921,14 +55921,14 @@ typedef struct static ma_bool32 ma_data_converter_config_is_resampler_required(const ma_data_converter_config* pConfig) { - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); return pConfig->allowDynamicSampleRate || pConfig->sampleRateIn != pConfig->sampleRateOut; } static ma_format ma_data_converter_config_get_mid_format(const ma_data_converter_config* pConfig) { - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); /* We want to avoid as much data conversion as possible. The channel converter and linear @@ -55956,7 +55956,7 @@ static ma_channel_converter_config ma_channel_converter_config_init_from_data_co { ma_channel_converter_config channelConverterConfig; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); channelConverterConfig = ma_channel_converter_config_init(ma_data_converter_config_get_mid_format(pConfig), pConfig->channelsIn, pConfig->pChannelMapIn, pConfig->channelsOut, pConfig->pChannelMapOut, pConfig->channelMixMode); channelConverterConfig.ppWeights = pConfig->ppChannelWeights; @@ -55970,7 +55970,7 @@ static ma_resampler_config ma_resampler_config_init_from_data_converter_config(c ma_resampler_config resamplerConfig; ma_uint32 resamplerChannels; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); /* The resampler is the most expensive part of the conversion process, so we need to do it at the stage where the channel count is at it's lowest. */ if (pConfig->channelsIn < pConfig->channelsOut) { @@ -55991,11 +55991,11 @@ static ma_result ma_data_converter_get_heap_layout(const ma_data_converter_confi { ma_result result; - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -56044,7 +56044,7 @@ MA_API ma_result ma_data_converter_get_heap_size(const ma_data_converter_config* ma_result result; ma_data_converter_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -56067,7 +56067,7 @@ MA_API ma_result ma_data_converter_init_preallocated(const ma_data_converter_con ma_format midFormat; ma_bool32 isResamplingRequired; - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } @@ -56206,11 +56206,11 @@ MA_API ma_result ma_data_converter_init(const ma_data_converter_config* pConfig, if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_data_converter_init_preallocated(pConfig, pHeap, pConverter); @@ -56225,7 +56225,7 @@ MA_API ma_result ma_data_converter_init(const ma_data_converter_config* pConfig, MA_API void ma_data_converter_uninit(ma_data_converter* pConverter, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return; } @@ -56246,32 +56246,32 @@ static ma_result ma_data_converter_process_pcm_frames__passthrough(ma_data_conve ma_uint64 frameCountOut; ma_uint64 frameCount; - MA_ASSERT(pConverter != NULL); + MA_ASSERT(pConverter != nullptr); frameCountIn = 0; - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { frameCountIn = *pFrameCountIn; } frameCountOut = 0; - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { frameCountOut = *pFrameCountOut; } frameCount = ma_min(frameCountIn, frameCountOut); - if (pFramesOut != NULL) { - if (pFramesIn != NULL) { + if (pFramesOut != nullptr) { + if (pFramesIn != nullptr) { ma_copy_memory_64(pFramesOut, pFramesIn, frameCount * ma_get_bytes_per_frame(pConverter->formatOut, pConverter->channelsOut)); } else { ma_zero_memory_64(pFramesOut, frameCount * ma_get_bytes_per_frame(pConverter->formatOut, pConverter->channelsOut)); } } - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { *pFrameCountIn = frameCount; } - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = frameCount; } @@ -56284,32 +56284,32 @@ static ma_result ma_data_converter_process_pcm_frames__format_only(ma_data_conve ma_uint64 frameCountOut; ma_uint64 frameCount; - MA_ASSERT(pConverter != NULL); + MA_ASSERT(pConverter != nullptr); frameCountIn = 0; - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { frameCountIn = *pFrameCountIn; } frameCountOut = 0; - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { frameCountOut = *pFrameCountOut; } frameCount = ma_min(frameCountIn, frameCountOut); - if (pFramesOut != NULL) { - if (pFramesIn != NULL) { + if (pFramesOut != nullptr) { + if (pFramesIn != nullptr) { ma_convert_pcm_frames_format(pFramesOut, pConverter->formatOut, pFramesIn, pConverter->formatIn, frameCount, pConverter->channelsIn, pConverter->ditherMode); } else { ma_zero_memory_64(pFramesOut, frameCount * ma_get_bytes_per_frame(pConverter->formatOut, pConverter->channelsOut)); } } - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { *pFrameCountIn = frameCount; } - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = frameCount; } @@ -56325,15 +56325,15 @@ static ma_result ma_data_converter_process_pcm_frames__resample_with_format_conv ma_uint64 framesProcessedIn; ma_uint64 framesProcessedOut; - MA_ASSERT(pConverter != NULL); + MA_ASSERT(pConverter != nullptr); frameCountIn = 0; - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { frameCountIn = *pFrameCountIn; } frameCountOut = 0; - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { frameCountOut = *pFrameCountOut; } @@ -56348,16 +56348,16 @@ static ma_result ma_data_converter_process_pcm_frames__resample_with_format_conv ma_uint64 frameCountInThisIteration; ma_uint64 frameCountOutThisIteration; - if (pFramesIn != NULL) { + if (pFramesIn != nullptr) { pFramesInThisIteration = ma_offset_ptr(pFramesIn, framesProcessedIn * ma_get_bytes_per_frame(pConverter->formatIn, pConverter->channelsIn)); } else { - pFramesInThisIteration = NULL; + pFramesInThisIteration = nullptr; } - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { pFramesOutThisIteration = ma_offset_ptr(pFramesOut, framesProcessedOut * ma_get_bytes_per_frame(pConverter->formatOut, pConverter->channelsOut)); } else { - pFramesOutThisIteration = NULL; + pFramesOutThisIteration = nullptr; } /* Do a pre format conversion if necessary. */ @@ -56376,7 +56376,7 @@ static ma_result ma_data_converter_process_pcm_frames__resample_with_format_conv } } - if (pFramesInThisIteration != NULL) { + if (pFramesInThisIteration != nullptr) { ma_convert_pcm_frames_format(pTempBufferIn, pConverter->resampler.format, pFramesInThisIteration, pConverter->formatIn, frameCountInThisIteration, pConverter->channelsIn, pConverter->ditherMode); } else { MA_ZERO_MEMORY(pTempBufferIn, sizeof(pTempBufferIn)); @@ -56417,7 +56417,7 @@ static ma_result ma_data_converter_process_pcm_frames__resample_with_format_conv /* If we are doing a post format conversion we need to do that now. */ if (pConverter->hasPostFormatConversion) { - if (pFramesOutThisIteration != NULL) { + if (pFramesOutThisIteration != nullptr) { ma_convert_pcm_frames_format(pFramesOutThisIteration, pConverter->formatOut, pTempBufferOut, pConverter->resampler.format, frameCountOutThisIteration, pConverter->resampler.channels, pConverter->ditherMode); } } @@ -56433,10 +56433,10 @@ static ma_result ma_data_converter_process_pcm_frames__resample_with_format_conv } } - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { *pFrameCountIn = framesProcessedIn; } - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = framesProcessedOut; } @@ -56445,7 +56445,7 @@ static ma_result ma_data_converter_process_pcm_frames__resample_with_format_conv static ma_result ma_data_converter_process_pcm_frames__resample_only(ma_data_converter* pConverter, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut) { - MA_ASSERT(pConverter != NULL); + MA_ASSERT(pConverter != nullptr); if (pConverter->hasPreFormatConversion == MA_FALSE && pConverter->hasPostFormatConversion == MA_FALSE) { /* Neither pre- nor post-format required. This is simple case where only resampling is required. */ @@ -56463,15 +56463,15 @@ static ma_result ma_data_converter_process_pcm_frames__channels_only(ma_data_con ma_uint64 frameCountOut; ma_uint64 frameCount; - MA_ASSERT(pConverter != NULL); + MA_ASSERT(pConverter != nullptr); frameCountIn = 0; - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { frameCountIn = *pFrameCountIn; } frameCountOut = 0; - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { frameCountOut = *pFrameCountOut; } @@ -56494,16 +56494,16 @@ static ma_result ma_data_converter_process_pcm_frames__channels_only(ma_data_con /* */ void* pFramesOutThisIteration; ma_uint64 frameCountThisIteration; - if (pFramesIn != NULL) { + if (pFramesIn != nullptr) { pFramesInThisIteration = ma_offset_ptr(pFramesIn, framesProcessed * ma_get_bytes_per_frame(pConverter->formatIn, pConverter->channelsIn)); } else { - pFramesInThisIteration = NULL; + pFramesInThisIteration = nullptr; } - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { pFramesOutThisIteration = ma_offset_ptr(pFramesOut, framesProcessed * ma_get_bytes_per_frame(pConverter->formatOut, pConverter->channelsOut)); } else { - pFramesOutThisIteration = NULL; + pFramesOutThisIteration = nullptr; } /* Do a pre format conversion if necessary. */ @@ -56522,7 +56522,7 @@ static ma_result ma_data_converter_process_pcm_frames__channels_only(ma_data_con } } - if (pFramesInThisIteration != NULL) { + if (pFramesInThisIteration != nullptr) { ma_convert_pcm_frames_format(pTempBufferIn, pConverter->channelConverter.format, pFramesInThisIteration, pConverter->formatIn, frameCountThisIteration, pConverter->channelsIn, pConverter->ditherMode); } else { MA_ZERO_MEMORY(pTempBufferIn, sizeof(pTempBufferIn)); @@ -56556,7 +56556,7 @@ static ma_result ma_data_converter_process_pcm_frames__channels_only(ma_data_con /* If we are doing a post format conversion we need to do that now. */ if (pConverter->hasPostFormatConversion) { - if (pFramesOutThisIteration != NULL) { + if (pFramesOutThisIteration != nullptr) { ma_convert_pcm_frames_format(pFramesOutThisIteration, pConverter->formatOut, pTempBufferOut, pConverter->channelConverter.format, frameCountThisIteration, pConverter->channelConverter.channelsOut, pConverter->ditherMode); } } @@ -56565,10 +56565,10 @@ static ma_result ma_data_converter_process_pcm_frames__channels_only(ma_data_con } } - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { *pFrameCountIn = frameCount; } - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = frameCount; } @@ -56589,18 +56589,18 @@ static ma_result ma_data_converter_process_pcm_frames__resample_first(ma_data_co ma_uint8 pTempBufferOut[MA_DATA_CONVERTER_STACK_BUFFER_SIZE]; /* In channel converter output format. */ ma_uint64 tempBufferOutCap; - MA_ASSERT(pConverter != NULL); + MA_ASSERT(pConverter != nullptr); MA_ASSERT(pConverter->resampler.format == pConverter->channelConverter.format); MA_ASSERT(pConverter->resampler.channels == pConverter->channelConverter.channelsIn); MA_ASSERT(pConverter->resampler.channels < pConverter->channelConverter.channelsOut); frameCountIn = 0; - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { frameCountIn = *pFrameCountIn; } frameCountOut = 0; - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { frameCountOut = *pFrameCountOut; } @@ -56614,15 +56614,15 @@ static ma_result ma_data_converter_process_pcm_frames__resample_first(ma_data_co while (framesProcessedOut < frameCountOut) { ma_uint64 frameCountInThisIteration; ma_uint64 frameCountOutThisIteration; - const void* pRunningFramesIn = NULL; - void* pRunningFramesOut = NULL; + const void* pRunningFramesIn = nullptr; + void* pRunningFramesOut = nullptr; const void* pResampleBufferIn; void* pChannelsBufferOut; - if (pFramesIn != NULL) { + if (pFramesIn != nullptr) { pRunningFramesIn = ma_offset_ptr(pFramesIn, framesProcessedIn * ma_get_bytes_per_frame(pConverter->formatIn, pConverter->channelsIn)); } - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { pRunningFramesOut = ma_offset_ptr(pFramesOut, framesProcessedOut * ma_get_bytes_per_frame(pConverter->formatOut, pConverter->channelsOut)); } @@ -56671,11 +56671,11 @@ static ma_result ma_data_converter_process_pcm_frames__resample_first(ma_data_co #endif if (pConverter->hasPreFormatConversion) { - if (pFramesIn != NULL) { + if (pFramesIn != nullptr) { ma_convert_pcm_frames_format(pTempBufferIn, pConverter->resampler.format, pRunningFramesIn, pConverter->formatIn, frameCountInThisIteration, pConverter->channelsIn, pConverter->ditherMode); pResampleBufferIn = pTempBufferIn; } else { - pResampleBufferIn = NULL; + pResampleBufferIn = nullptr; } } else { pResampleBufferIn = pRunningFramesIn; @@ -56691,7 +56691,7 @@ static ma_result ma_data_converter_process_pcm_frames__resample_first(ma_data_co The input data has been resampled so now we need to run it through the channel converter. The input data is always contained in pTempBufferMid. We only need to do this part if we have an output buffer. */ - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { if (pConverter->hasPostFormatConversion) { pChannelsBufferOut = pTempBufferOut; } else { @@ -56721,10 +56721,10 @@ static ma_result ma_data_converter_process_pcm_frames__resample_first(ma_data_co } } - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { *pFrameCountIn = framesProcessedIn; } - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = framesProcessedOut; } @@ -56745,18 +56745,18 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co ma_uint8 pTempBufferOut[MA_DATA_CONVERTER_STACK_BUFFER_SIZE]; /* In channel converter output format. */ ma_uint64 tempBufferOutCap; - MA_ASSERT(pConverter != NULL); + MA_ASSERT(pConverter != nullptr); MA_ASSERT(pConverter->resampler.format == pConverter->channelConverter.format); MA_ASSERT(pConverter->resampler.channels == pConverter->channelConverter.channelsOut); MA_ASSERT(pConverter->resampler.channels <= pConverter->channelConverter.channelsIn); frameCountIn = 0; - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { frameCountIn = *pFrameCountIn; } frameCountOut = 0; - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { frameCountOut = *pFrameCountOut; } @@ -56770,15 +56770,15 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co while (framesProcessedOut < frameCountOut) { ma_uint64 frameCountInThisIteration; ma_uint64 frameCountOutThisIteration; - const void* pRunningFramesIn = NULL; - void* pRunningFramesOut = NULL; + const void* pRunningFramesIn = nullptr; + void* pRunningFramesOut = nullptr; const void* pChannelsBufferIn; void* pResampleBufferOut; - if (pFramesIn != NULL) { + if (pFramesIn != nullptr) { pRunningFramesIn = ma_offset_ptr(pFramesIn, framesProcessedIn * ma_get_bytes_per_frame(pConverter->formatIn, pConverter->channelsIn)); } - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { pRunningFramesOut = ma_offset_ptr(pFramesOut, framesProcessedOut * ma_get_bytes_per_frame(pConverter->formatOut, pConverter->channelsOut)); } @@ -56835,11 +56835,11 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co /* Pre format conversion. */ if (pConverter->hasPreFormatConversion) { - if (pRunningFramesIn != NULL) { + if (pRunningFramesIn != nullptr) { ma_convert_pcm_frames_format(pTempBufferIn, pConverter->channelConverter.format, pRunningFramesIn, pConverter->formatIn, frameCountInThisIteration, pConverter->channelsIn, pConverter->ditherMode); pChannelsBufferIn = pTempBufferIn; } else { - pChannelsBufferIn = NULL; + pChannelsBufferIn = nullptr; } } else { pChannelsBufferIn = pRunningFramesIn; @@ -56868,7 +56868,7 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co /* Post format conversion. */ if (pConverter->hasPostFormatConversion) { - if (pRunningFramesOut != NULL) { + if (pRunningFramesOut != nullptr) { ma_convert_pcm_frames_format(pRunningFramesOut, pConverter->formatOut, pResampleBufferOut, pConverter->resampler.format, frameCountOutThisIteration, pConverter->channelsOut, pConverter->ditherMode); } } @@ -56885,10 +56885,10 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co } } - if (pFrameCountIn != NULL) { + if (pFrameCountIn != nullptr) { *pFrameCountIn = framesProcessedIn; } - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = framesProcessedOut; } @@ -56897,7 +56897,7 @@ static ma_result ma_data_converter_process_pcm_frames__channels_first(ma_data_co MA_API ma_result ma_data_converter_process_pcm_frames(ma_data_converter* pConverter, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } @@ -56915,7 +56915,7 @@ MA_API ma_result ma_data_converter_process_pcm_frames(ma_data_converter* pConver MA_API ma_result ma_data_converter_set_rate(ma_data_converter* pConverter, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } @@ -56928,7 +56928,7 @@ MA_API ma_result ma_data_converter_set_rate(ma_data_converter* pConverter, ma_ui MA_API ma_result ma_data_converter_set_rate_ratio(ma_data_converter* pConverter, float ratioInOut) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } @@ -56941,7 +56941,7 @@ MA_API ma_result ma_data_converter_set_rate_ratio(ma_data_converter* pConverter, MA_API ma_uint64 ma_data_converter_get_input_latency(const ma_data_converter* pConverter) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return 0; } @@ -56954,7 +56954,7 @@ MA_API ma_uint64 ma_data_converter_get_input_latency(const ma_data_converter* pC MA_API ma_uint64 ma_data_converter_get_output_latency(const ma_data_converter* pConverter) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return 0; } @@ -56967,13 +56967,13 @@ MA_API ma_uint64 ma_data_converter_get_output_latency(const ma_data_converter* p MA_API ma_result ma_data_converter_get_required_input_frame_count(const ma_data_converter* pConverter, ma_uint64 outputFrameCount, ma_uint64* pInputFrameCount) { - if (pInputFrameCount == NULL) { + if (pInputFrameCount == nullptr) { return MA_INVALID_ARGS; } *pInputFrameCount = 0; - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } @@ -56987,13 +56987,13 @@ MA_API ma_result ma_data_converter_get_required_input_frame_count(const ma_data_ MA_API ma_result ma_data_converter_get_expected_output_frame_count(const ma_data_converter* pConverter, ma_uint64 inputFrameCount, ma_uint64* pOutputFrameCount) { - if (pOutputFrameCount == NULL) { + if (pOutputFrameCount == nullptr) { return MA_INVALID_ARGS; } *pOutputFrameCount = 0; - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } @@ -57007,7 +57007,7 @@ MA_API ma_result ma_data_converter_get_expected_output_frame_count(const ma_data MA_API ma_result ma_data_converter_get_input_channel_map(const ma_data_converter* pConverter, ma_channel* pChannelMap, size_t channelMapCap) { - if (pConverter == NULL || pChannelMap == NULL) { + if (pConverter == nullptr || pChannelMap == nullptr) { return MA_INVALID_ARGS; } @@ -57022,7 +57022,7 @@ MA_API ma_result ma_data_converter_get_input_channel_map(const ma_data_converter MA_API ma_result ma_data_converter_get_output_channel_map(const ma_data_converter* pConverter, ma_channel* pChannelMap, size_t channelMapCap) { - if (pConverter == NULL || pChannelMap == NULL) { + if (pConverter == nullptr || pChannelMap == nullptr) { return MA_INVALID_ARGS; } @@ -57037,7 +57037,7 @@ MA_API ma_result ma_data_converter_get_output_channel_map(const ma_data_converte MA_API ma_result ma_data_converter_reset(ma_data_converter* pConverter) { - if (pConverter == NULL) { + if (pConverter == nullptr) { return MA_INVALID_ARGS; } @@ -57060,7 +57060,7 @@ static ma_channel ma_channel_map_init_standard_channel(ma_standard_channel_map s MA_API ma_channel ma_channel_map_get_channel(const ma_channel* pChannelMap, ma_uint32 channelCount, ma_uint32 channelIndex) { - if (pChannelMap == NULL) { + if (pChannelMap == nullptr) { return ma_channel_map_init_standard_channel(ma_standard_channel_map_default, channelCount, channelIndex); } else { if (channelIndex >= channelCount) { @@ -57073,7 +57073,7 @@ MA_API ma_channel ma_channel_map_get_channel(const ma_channel* pChannelMap, ma_u MA_API void ma_channel_map_init_blank(ma_channel* pChannelMap, ma_uint32 channels) { - if (pChannelMap == NULL) { + if (pChannelMap == nullptr) { return; } @@ -57793,7 +57793,7 @@ MA_API void ma_channel_map_init_standard(ma_standard_channel_map standardChannel { ma_uint32 iChannel; - if (pChannelMap == NULL || channelMapCap == 0 || channels == 0) { + if (pChannelMap == nullptr || channelMapCap == 0 || channels == 0) { return; } @@ -57810,18 +57810,18 @@ MA_API void ma_channel_map_init_standard(ma_standard_channel_map standardChannel MA_API void ma_channel_map_copy(ma_channel* pOut, const ma_channel* pIn, ma_uint32 channels) { - if (pOut != NULL && pIn != NULL && channels > 0) { + if (pOut != nullptr && pIn != nullptr && channels > 0) { MA_COPY_MEMORY(pOut, pIn, sizeof(*pOut) * channels); } } MA_API void ma_channel_map_copy_or_default(ma_channel* pOut, size_t channelMapCapOut, const ma_channel* pIn, ma_uint32 channels) { - if (pOut == NULL || channels == 0) { + if (pOut == nullptr || channels == 0) { return; } - if (pIn != NULL) { + if (pIn != nullptr) { ma_channel_map_copy(pOut, pIn, channels); } else { ma_channel_map_init_standard(ma_standard_channel_map_default, pOut, channelMapCapOut, channels); @@ -57870,7 +57870,7 @@ MA_API ma_bool32 ma_channel_map_is_blank(const ma_channel* pChannelMap, ma_uint3 ma_uint32 iChannel; /* A null channel map is equivalent to the default channel map. */ - if (pChannelMap == NULL) { + if (pChannelMap == nullptr) { return MA_FALSE; } @@ -57885,20 +57885,20 @@ MA_API ma_bool32 ma_channel_map_is_blank(const ma_channel* pChannelMap, ma_uint3 MA_API ma_bool32 ma_channel_map_contains_channel_position(ma_uint32 channels, const ma_channel* pChannelMap, ma_channel channelPosition) { - return ma_channel_map_find_channel_position(channels, pChannelMap, channelPosition, NULL); + return ma_channel_map_find_channel_position(channels, pChannelMap, channelPosition, nullptr); } MA_API ma_bool32 ma_channel_map_find_channel_position(ma_uint32 channels, const ma_channel* pChannelMap, ma_channel channelPosition, ma_uint32* pChannelIndex) { ma_uint32 iChannel; - if (pChannelIndex != NULL) { + if (pChannelIndex != nullptr) { *pChannelIndex = (ma_uint32)-1; } for (iChannel = 0; iChannel < channels; ++iChannel) { if (ma_channel_map_get_channel(pChannelMap, channels, iChannel) == channelPosition) { - if (pChannelIndex != NULL) { + if (pChannelIndex != nullptr) { *pChannelIndex = iChannel; } @@ -57922,14 +57922,14 @@ MA_API size_t ma_channel_map_to_string(const ma_channel* pChannelMap, ma_uint32 size_t channelStrLen = strlen(pChannelStr); /* Append the string if necessary. */ - if (pBufferOut != NULL && bufferCap > len + channelStrLen) { + if (pBufferOut != nullptr && bufferCap > len + channelStrLen) { MA_COPY_MEMORY(pBufferOut + len, pChannelStr, channelStrLen); } len += channelStrLen; /* Append a space if it's not the last item. */ if (iChannel+1 < channels) { - if (pBufferOut != NULL && bufferCap > len + 1) { + if (pBufferOut != nullptr && bufferCap > len + 1) { pBufferOut[len] = ' '; } len += 1; @@ -57937,7 +57937,7 @@ MA_API size_t ma_channel_map_to_string(const ma_channel* pChannelMap, ma_uint32 } /* Null terminate. Don't increment the length here. */ - if (pBufferOut != NULL) { + if (pBufferOut != nullptr) { if (bufferCap > len) { pBufferOut[len] = '\0'; } else if (bufferCap > 0) { @@ -58032,16 +58032,16 @@ MA_API ma_uint64 ma_convert_frames_ex(void* pOut, ma_uint64 frameCountOut, const ma_result result; ma_data_converter converter; - if (frameCountIn == 0 || pConfig == NULL) { + if (frameCountIn == 0 || pConfig == nullptr) { return 0; } - result = ma_data_converter_init(pConfig, NULL, &converter); + result = ma_data_converter_init(pConfig, nullptr, &converter); if (result != MA_SUCCESS) { return 0; /* Failed to initialize the data converter. */ } - if (pOut == NULL) { + if (pOut == nullptr) { result = ma_data_converter_get_expected_output_frame_count(&converter, frameCountIn, &frameCountOut); if (result != MA_SUCCESS) { if (result == MA_NOT_IMPLEMENTED) { @@ -58052,7 +58052,7 @@ MA_API ma_uint64 ma_convert_frames_ex(void* pOut, ma_uint64 frameCountOut, const ma_uint64 framesProcessedIn = frameCountIn; ma_uint64 framesProcessedOut = 0xFFFFFFFF; - result = ma_data_converter_process_pcm_frames(&converter, pIn, &framesProcessedIn, NULL, &framesProcessedOut); + result = ma_data_converter_process_pcm_frames(&converter, pIn, &framesProcessedIn, nullptr, &framesProcessedOut); if (result != MA_SUCCESS) { break; } @@ -58068,7 +58068,7 @@ MA_API ma_uint64 ma_convert_frames_ex(void* pOut, ma_uint64 frameCountOut, const } } - ma_data_converter_uninit(&converter, NULL); + ma_data_converter_uninit(&converter, nullptr); return frameCountOut; } @@ -58090,13 +58090,13 @@ static MA_INLINE ma_uint32 ma_rb__extract_offset_loop_flag(ma_uint32 encodedOffs static MA_INLINE void* ma_rb__get_read_ptr(ma_rb* pRB) { - MA_ASSERT(pRB != NULL); + MA_ASSERT(pRB != nullptr); return ma_offset_ptr(pRB->pBuffer, ma_rb__extract_offset_in_bytes(ma_atomic_load_32(&pRB->encodedReadOffset))); } static MA_INLINE void* ma_rb__get_write_ptr(ma_rb* pRB) { - MA_ASSERT(pRB != NULL); + MA_ASSERT(pRB != nullptr); return ma_offset_ptr(pRB->pBuffer, ma_rb__extract_offset_in_bytes(ma_atomic_load_32(&pRB->encodedWriteOffset))); } @@ -58107,8 +58107,8 @@ static MA_INLINE ma_uint32 ma_rb__construct_offset(ma_uint32 offsetInBytes, ma_u static MA_INLINE void ma_rb__deconstruct_offset(ma_uint32 encodedOffset, ma_uint32* pOffsetInBytes, ma_uint32* pOffsetLoopFlag) { - MA_ASSERT(pOffsetInBytes != NULL); - MA_ASSERT(pOffsetLoopFlag != NULL); + MA_ASSERT(pOffsetInBytes != nullptr); + MA_ASSERT(pOffsetLoopFlag != nullptr); *pOffsetInBytes = ma_rb__extract_offset_in_bytes(encodedOffset); *pOffsetLoopFlag = ma_rb__extract_offset_loop_flag(encodedOffset); @@ -58120,7 +58120,7 @@ MA_API ma_result ma_rb_init_ex(size_t subbufferSizeInBytes, size_t subbufferCoun ma_result result; const ma_uint32 maxSubBufferSize = 0x7FFFFFFF - (MA_SIMD_ALIGNMENT-1); - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58143,7 +58143,7 @@ MA_API ma_result ma_rb_init_ex(size_t subbufferSizeInBytes, size_t subbufferCoun pRB->subbufferSizeInBytes = (ma_uint32)subbufferSizeInBytes; pRB->subbufferCount = (ma_uint32)subbufferCount; - if (pOptionalPreallocatedBuffer != NULL) { + if (pOptionalPreallocatedBuffer != nullptr) { pRB->subbufferStrideInBytes = (ma_uint32)subbufferStrideInBytes; pRB->pBuffer = pOptionalPreallocatedBuffer; } else { @@ -58157,7 +58157,7 @@ MA_API ma_result ma_rb_init_ex(size_t subbufferSizeInBytes, size_t subbufferCoun bufferSizeInBytes = (size_t)pRB->subbufferCount*pRB->subbufferStrideInBytes; pRB->pBuffer = ma_aligned_malloc(bufferSizeInBytes, MA_SIMD_ALIGNMENT, &pRB->allocationCallbacks); - if (pRB->pBuffer == NULL) { + if (pRB->pBuffer == nullptr) { return MA_OUT_OF_MEMORY; } @@ -58175,7 +58175,7 @@ MA_API ma_result ma_rb_init(size_t bufferSizeInBytes, void* pOptionalPreallocate MA_API void ma_rb_uninit(ma_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return; } @@ -58186,7 +58186,7 @@ MA_API void ma_rb_uninit(ma_rb* pRB) MA_API void ma_rb_reset(ma_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return; } @@ -58205,7 +58205,7 @@ MA_API ma_result ma_rb_acquire_read(ma_rb* pRB, size_t* pSizeInBytes, void** ppB size_t bytesAvailable; size_t bytesRequested; - if (pRB == NULL || pSizeInBytes == NULL || ppBufferOut == NULL) { + if (pRB == nullptr || pSizeInBytes == nullptr || ppBufferOut == nullptr) { return MA_INVALID_ARGS; } @@ -58245,7 +58245,7 @@ MA_API ma_result ma_rb_commit_read(ma_rb* pRB, size_t sizeInBytes) ma_uint32 newReadOffsetInBytes; ma_uint32 newReadOffsetLoopFlag; - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58281,7 +58281,7 @@ MA_API ma_result ma_rb_acquire_write(ma_rb* pRB, size_t* pSizeInBytes, void** pp size_t bytesAvailable; size_t bytesRequested; - if (pRB == NULL || pSizeInBytes == NULL || ppBufferOut == NULL) { + if (pRB == nullptr || pSizeInBytes == nullptr || ppBufferOut == nullptr) { return MA_INVALID_ARGS; } @@ -58327,7 +58327,7 @@ MA_API ma_result ma_rb_commit_write(ma_rb* pRB, size_t sizeInBytes) ma_uint32 newWriteOffsetInBytes; ma_uint32 newWriteOffsetLoopFlag; - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58363,7 +58363,7 @@ MA_API ma_result ma_rb_seek_read(ma_rb* pRB, size_t offsetInBytes) ma_uint32 newReadOffsetInBytes; ma_uint32 newReadOffsetLoopFlag; - if (pRB == NULL || offsetInBytes > pRB->subbufferSizeInBytes) { + if (pRB == nullptr || offsetInBytes > pRB->subbufferSizeInBytes) { return MA_INVALID_ARGS; } @@ -58407,7 +58407,7 @@ MA_API ma_result ma_rb_seek_write(ma_rb* pRB, size_t offsetInBytes) ma_uint32 newWriteOffsetInBytes; ma_uint32 newWriteOffsetLoopFlag; - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58449,7 +58449,7 @@ MA_API ma_int32 ma_rb_pointer_distance(ma_rb* pRB) ma_uint32 writeOffsetInBytes; ma_uint32 writeOffsetLoopFlag; - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58470,7 +58470,7 @@ MA_API ma_uint32 ma_rb_available_read(ma_rb* pRB) { ma_int32 dist; - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58484,7 +58484,7 @@ MA_API ma_uint32 ma_rb_available_read(ma_rb* pRB) MA_API ma_uint32 ma_rb_available_write(ma_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58493,7 +58493,7 @@ MA_API ma_uint32 ma_rb_available_write(ma_rb* pRB) MA_API size_t ma_rb_get_subbuffer_size(ma_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58502,7 +58502,7 @@ MA_API size_t ma_rb_get_subbuffer_size(ma_rb* pRB) MA_API size_t ma_rb_get_subbuffer_stride(ma_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58515,7 +58515,7 @@ MA_API size_t ma_rb_get_subbuffer_stride(ma_rb* pRB) MA_API size_t ma_rb_get_subbuffer_offset(ma_rb* pRB, size_t subbufferIndex) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58524,8 +58524,8 @@ MA_API size_t ma_rb_get_subbuffer_offset(ma_rb* pRB, size_t subbufferIndex) MA_API void* ma_rb_get_subbuffer_ptr(ma_rb* pRB, size_t subbufferIndex, void* pBuffer) { - if (pRB == NULL) { - return NULL; + if (pRB == nullptr) { + return nullptr; } return ma_offset_ptr(pBuffer, ma_rb_get_subbuffer_offset(pRB, subbufferIndex)); @@ -58540,7 +58540,7 @@ static ma_result ma_pcm_rb_data_source__on_read(ma_data_source* pDataSource, voi ma_result result; ma_uint64 totalFramesRead; - MA_ASSERT(pRB != NULL); + MA_ASSERT(pRB != nullptr); /* We need to run this in a loop since the ring buffer itself may loop. */ totalFramesRead = 0; @@ -58589,22 +58589,22 @@ static ma_result ma_pcm_rb_data_source__on_read(ma_data_source* pDataSource, voi static ma_result ma_pcm_rb_data_source__on_get_data_format(ma_data_source* pDataSource, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap) { ma_pcm_rb* pRB = (ma_pcm_rb*)pDataSource; - MA_ASSERT(pRB != NULL); + MA_ASSERT(pRB != nullptr); - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = pRB->format; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = pRB->channels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = pRB->sampleRate; } /* Just assume the default channel map. */ - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { ma_channel_map_init_standard(ma_standard_channel_map_default, pChannelMap, channelMapCap, pRB->channels); } @@ -58614,17 +58614,17 @@ static ma_result ma_pcm_rb_data_source__on_get_data_format(ma_data_source* pData static ma_data_source_vtable ma_gRBDataSourceVTable = { ma_pcm_rb_data_source__on_read, - NULL, /* onSeek */ + nullptr, /* onSeek */ ma_pcm_rb_data_source__on_get_data_format, - NULL, /* onGetCursor */ - NULL, /* onGetLength */ - NULL, /* onSetLooping */ + nullptr, /* onGetCursor */ + nullptr, /* onGetLength */ + nullptr, /* onSetLooping */ 0 }; static MA_INLINE ma_uint32 ma_pcm_rb_get_bpf(ma_pcm_rb* pRB) { - MA_ASSERT(pRB != NULL); + MA_ASSERT(pRB != nullptr); return ma_get_bytes_per_frame(pRB->format, pRB->channels); } @@ -58634,7 +58634,7 @@ MA_API ma_result ma_pcm_rb_init_ex(ma_format format, ma_uint32 channels, ma_uint ma_uint32 bpf; ma_result result; - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58676,7 +58676,7 @@ MA_API ma_result ma_pcm_rb_init(ma_format format, ma_uint32 channels, ma_uint32 MA_API void ma_pcm_rb_uninit(ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return; } @@ -58686,7 +58686,7 @@ MA_API void ma_pcm_rb_uninit(ma_pcm_rb* pRB) MA_API void ma_pcm_rb_reset(ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return; } @@ -58698,7 +58698,7 @@ MA_API ma_result ma_pcm_rb_acquire_read(ma_pcm_rb* pRB, ma_uint32* pSizeInFrames size_t sizeInBytes; ma_result result; - if (pRB == NULL || pSizeInFrames == NULL) { + if (pRB == nullptr || pSizeInFrames == nullptr) { return MA_INVALID_ARGS; } @@ -58715,7 +58715,7 @@ MA_API ma_result ma_pcm_rb_acquire_read(ma_pcm_rb* pRB, ma_uint32* pSizeInFrames MA_API ma_result ma_pcm_rb_commit_read(ma_pcm_rb* pRB, ma_uint32 sizeInFrames) { - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58727,7 +58727,7 @@ MA_API ma_result ma_pcm_rb_acquire_write(ma_pcm_rb* pRB, ma_uint32* pSizeInFrame size_t sizeInBytes; ma_result result; - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58744,7 +58744,7 @@ MA_API ma_result ma_pcm_rb_acquire_write(ma_pcm_rb* pRB, ma_uint32* pSizeInFrame MA_API ma_result ma_pcm_rb_commit_write(ma_pcm_rb* pRB, ma_uint32 sizeInFrames) { - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58753,7 +58753,7 @@ MA_API ma_result ma_pcm_rb_commit_write(ma_pcm_rb* pRB, ma_uint32 sizeInFrames) MA_API ma_result ma_pcm_rb_seek_read(ma_pcm_rb* pRB, ma_uint32 offsetInFrames) { - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58762,7 +58762,7 @@ MA_API ma_result ma_pcm_rb_seek_read(ma_pcm_rb* pRB, ma_uint32 offsetInFrames) MA_API ma_result ma_pcm_rb_seek_write(ma_pcm_rb* pRB, ma_uint32 offsetInFrames) { - if (pRB == NULL) { + if (pRB == nullptr) { return MA_INVALID_ARGS; } @@ -58771,7 +58771,7 @@ MA_API ma_result ma_pcm_rb_seek_write(ma_pcm_rb* pRB, ma_uint32 offsetInFrames) MA_API ma_int32 ma_pcm_rb_pointer_distance(ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58780,7 +58780,7 @@ MA_API ma_int32 ma_pcm_rb_pointer_distance(ma_pcm_rb* pRB) MA_API ma_uint32 ma_pcm_rb_available_read(ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58789,7 +58789,7 @@ MA_API ma_uint32 ma_pcm_rb_available_read(ma_pcm_rb* pRB) MA_API ma_uint32 ma_pcm_rb_available_write(ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58798,7 +58798,7 @@ MA_API ma_uint32 ma_pcm_rb_available_write(ma_pcm_rb* pRB) MA_API ma_uint32 ma_pcm_rb_get_subbuffer_size(ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58807,7 +58807,7 @@ MA_API ma_uint32 ma_pcm_rb_get_subbuffer_size(ma_pcm_rb* pRB) MA_API ma_uint32 ma_pcm_rb_get_subbuffer_stride(ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58816,7 +58816,7 @@ MA_API ma_uint32 ma_pcm_rb_get_subbuffer_stride(ma_pcm_rb* pRB) MA_API ma_uint32 ma_pcm_rb_get_subbuffer_offset(ma_pcm_rb* pRB, ma_uint32 subbufferIndex) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58825,8 +58825,8 @@ MA_API ma_uint32 ma_pcm_rb_get_subbuffer_offset(ma_pcm_rb* pRB, ma_uint32 subbuf MA_API void* ma_pcm_rb_get_subbuffer_ptr(ma_pcm_rb* pRB, ma_uint32 subbufferIndex, void* pBuffer) { - if (pRB == NULL) { - return NULL; + if (pRB == nullptr) { + return nullptr; } return ma_rb_get_subbuffer_ptr(&pRB->rb, subbufferIndex, pBuffer); @@ -58834,7 +58834,7 @@ MA_API void* ma_pcm_rb_get_subbuffer_ptr(ma_pcm_rb* pRB, ma_uint32 subbufferInde MA_API ma_format ma_pcm_rb_get_format(const ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return ma_format_unknown; } @@ -58843,7 +58843,7 @@ MA_API ma_format ma_pcm_rb_get_format(const ma_pcm_rb* pRB) MA_API ma_uint32 ma_pcm_rb_get_channels(const ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58852,7 +58852,7 @@ MA_API ma_uint32 ma_pcm_rb_get_channels(const ma_pcm_rb* pRB) MA_API ma_uint32 ma_pcm_rb_get_sample_rate(const ma_pcm_rb* pRB) { - if (pRB == NULL) { + if (pRB == nullptr) { return 0; } @@ -58861,7 +58861,7 @@ MA_API ma_uint32 ma_pcm_rb_get_sample_rate(const ma_pcm_rb* pRB) MA_API void ma_pcm_rb_set_sample_rate(ma_pcm_rb* pRB, ma_uint32 sampleRate) { - if (pRB == NULL) { + if (pRB == nullptr) { return; } @@ -58880,7 +58880,7 @@ MA_API ma_result ma_duplex_rb_init(ma_format captureFormat, ma_uint32 captureCha return MA_INVALID_ARGS; } - result = ma_pcm_rb_init(captureFormat, captureChannels, sizeInFrames, NULL, pAllocationCallbacks, &pRB->rb); + result = ma_pcm_rb_init(captureFormat, captureChannels, sizeInFrames, nullptr, pAllocationCallbacks, &pRB->rb); if (result != MA_SUCCESS) { return result; } @@ -58984,21 +58984,21 @@ MA_API const char* ma_result_description(ma_result result) MA_API void* ma_malloc(size_t sz, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks != NULL) { - if (pAllocationCallbacks->onMalloc != NULL) { + if (pAllocationCallbacks != nullptr) { + if (pAllocationCallbacks->onMalloc != nullptr) { return pAllocationCallbacks->onMalloc(sz, pAllocationCallbacks->pUserData); } else { - return NULL; /* Do not fall back to the default implementation. */ + return nullptr; /* Do not fall back to the default implementation. */ } } else { - return ma__malloc_default(sz, NULL); + return ma__malloc_default(sz, nullptr); } } MA_API void* ma_calloc(size_t sz, const ma_allocation_callbacks* pAllocationCallbacks) { void* p = ma_malloc(sz, pAllocationCallbacks); - if (p != NULL) { + if (p != nullptr) { MA_ZERO_MEMORY(p, sz); } @@ -59007,31 +59007,31 @@ MA_API void* ma_calloc(size_t sz, const ma_allocation_callbacks* pAllocationCall MA_API void* ma_realloc(void* p, size_t sz, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks != NULL) { - if (pAllocationCallbacks->onRealloc != NULL) { + if (pAllocationCallbacks != nullptr) { + if (pAllocationCallbacks->onRealloc != nullptr) { return pAllocationCallbacks->onRealloc(p, sz, pAllocationCallbacks->pUserData); } else { - return NULL; /* Do not fall back to the default implementation. */ + return nullptr; /* Do not fall back to the default implementation. */ } } else { - return ma__realloc_default(p, sz, NULL); + return ma__realloc_default(p, sz, nullptr); } } MA_API void ma_free(void* p, const ma_allocation_callbacks* pAllocationCallbacks) { - if (p == NULL) { + if (p == nullptr) { return; } - if (pAllocationCallbacks != NULL) { - if (pAllocationCallbacks->onFree != NULL) { + if (pAllocationCallbacks != nullptr) { + if (pAllocationCallbacks->onFree != nullptr) { pAllocationCallbacks->onFree(p, pAllocationCallbacks->pUserData); } else { return; /* Do no fall back to the default implementation. */ } } else { - ma__free_default(p, NULL); + ma__free_default(p, nullptr); } } @@ -59048,8 +59048,8 @@ MA_API void* ma_aligned_malloc(size_t sz, size_t alignment, const ma_allocation_ extraBytes = alignment-1 + sizeof(void*); pUnaligned = ma_malloc(sz + extraBytes, pAllocationCallbacks); - if (pUnaligned == NULL) { - return NULL; + if (pUnaligned == nullptr) { + return nullptr; } pAligned = (void*)(((ma_uintptr)pUnaligned + extraBytes) & ~((ma_uintptr)(alignment-1))); @@ -59120,17 +59120,17 @@ MA_API ma_result ma_data_source_init(const ma_data_source_config* pConfig, ma_da { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pDataSourceBase); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - if (pConfig->vtable == NULL) { + if (pConfig->vtable == nullptr) { return MA_INVALID_ARGS; } @@ -59140,15 +59140,15 @@ MA_API ma_result ma_data_source_init(const ma_data_source_config* pConfig, ma_da pDataSourceBase->loopBegInFrames = MA_DATA_SOURCE_DEFAULT_LOOP_POINT_BEG; pDataSourceBase->loopEndInFrames = MA_DATA_SOURCE_DEFAULT_LOOP_POINT_END; pDataSourceBase->pCurrent = pDataSource; /* Always read from ourself by default. */ - pDataSourceBase->pNext = NULL; - pDataSourceBase->onGetNext = NULL; + pDataSourceBase->pNext = nullptr; + pDataSourceBase->onGetNext = nullptr; return MA_SUCCESS; } MA_API void ma_data_source_uninit(ma_data_source* pDataSource) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return; } @@ -59162,16 +59162,16 @@ static ma_result ma_data_source_resolve_current(ma_data_source* pDataSource, ma_ { ma_data_source_base* pCurrentDataSource = (ma_data_source_base*)pDataSource; - MA_ASSERT(pDataSource != NULL); - MA_ASSERT(ppCurrentDataSource != NULL); + MA_ASSERT(pDataSource != nullptr); + MA_ASSERT(ppCurrentDataSource != nullptr); - if (pCurrentDataSource->pCurrent == NULL) { + if (pCurrentDataSource->pCurrent == nullptr) { /* - The current data source is NULL. If we're using this in the context of a chain we need to return NULL + The current data source is nullptr. If we're using this in the context of a chain we need to return nullptr here so that we don't end up looping. Otherwise we just return the data source itself. */ - if (pCurrentDataSource->pNext != NULL || pCurrentDataSource->onGetNext != NULL) { - pCurrentDataSource = NULL; + if (pCurrentDataSource->pNext != nullptr || pCurrentDataSource->onGetNext != nullptr) { + pCurrentDataSource = nullptr; } else { pCurrentDataSource = (ma_data_source_base*)pDataSource; /* Not being used in a chain. Make sure we just always read from the data source itself at all times. */ } @@ -59188,12 +59188,12 @@ static ma_result ma_data_source_read_pcm_frames_from_backend(ma_data_source* pDa { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - MA_ASSERT(pDataSourceBase != NULL); - MA_ASSERT(pDataSourceBase->vtable != NULL); - MA_ASSERT(pDataSourceBase->vtable->onRead != NULL); - MA_ASSERT(pFramesRead != NULL); + MA_ASSERT(pDataSourceBase != nullptr); + MA_ASSERT(pDataSourceBase->vtable != nullptr); + MA_ASSERT(pDataSourceBase->vtable->onRead != nullptr); + MA_ASSERT(pFramesRead != nullptr); - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { return pDataSourceBase->vtable->onRead(pDataSourceBase, pFramesOut, frameCount, pFramesRead); } else { /* @@ -59207,7 +59207,7 @@ static ma_result ma_data_source_read_pcm_frames_from_backend(ma_data_source* pDa ma_uint64 discardBufferCapInFrames; ma_uint8 pDiscardBuffer[4096]; - result = ma_data_source_get_data_format(pDataSource, &format, &channels, NULL, NULL, 0); + result = ma_data_source_get_data_format(pDataSource, &format, &channels, nullptr, nullptr, 0); if (result != MA_SUCCESS) { return result; } @@ -59243,7 +59243,7 @@ static ma_result ma_data_source_read_pcm_frames_within_range(ma_data_source* pDa ma_uint64 framesRead = 0; ma_bool32 loop = ma_data_source_is_looping(pDataSource); - if (pDataSourceBase == NULL) { + if (pDataSourceBase == nullptr) { return MA_AT_END; } @@ -59251,7 +59251,7 @@ static ma_result ma_data_source_read_pcm_frames_within_range(ma_data_source* pDa return MA_INVALID_ARGS; } - MA_ASSERT(pDataSourceBase->vtable != NULL); + MA_ASSERT(pDataSourceBase->vtable != nullptr); if ((pDataSourceBase->vtable->flags & MA_DATA_SOURCE_SELF_MANAGED_RANGE_AND_LOOP_POINT) != 0 || (pDataSourceBase->rangeEndInFrames == ~((ma_uint64)0) && (pDataSourceBase->loopEndInFrames == ~((ma_uint64)0) || loop == MA_FALSE))) { /* Either the data source is self-managing the range, or no range is set - just read like normal. The data source itself will tell us when the end is reached. */ @@ -59299,7 +59299,7 @@ static ma_result ma_data_source_read_pcm_frames_within_range(ma_data_source* pDa } } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = framesRead; } @@ -59323,7 +59323,7 @@ MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, voi ma_uint32 emptyLoopCounter = 0; /* Keeps track of how many times 0 frames have been read. For infinite loop detection of sounds with no audio data. */ ma_bool32 loop; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -59331,7 +59331,7 @@ MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, voi return MA_INVALID_ARGS; } - if (pDataSourceBase == NULL) { + if (pDataSourceBase == nullptr) { return MA_INVALID_ARGS; } @@ -59341,7 +59341,7 @@ MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, voi We need to know the data format so we can advance the output buffer as we read frames. If this fails, chaining will not work and we'll just read as much as we can from the current source. */ - if (ma_data_source_get_data_format(pDataSource, &format, &channels, NULL, NULL, 0) != MA_SUCCESS) { + if (ma_data_source_get_data_format(pDataSource, &format, &channels, nullptr, nullptr, 0) != MA_SUCCESS) { result = ma_data_source_resolve_current(pDataSource, (ma_data_source**)&pCurrentDataSource); if (result != MA_SUCCESS) { return result; @@ -59366,7 +59366,7 @@ MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, voi break; } - if (pCurrentDataSource == NULL) { + if (pCurrentDataSource == nullptr) { break; } @@ -59417,11 +59417,11 @@ MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, voi /* Don't return MA_AT_END for looping sounds. */ result = MA_SUCCESS; } else { - if (pCurrentDataSource->pNext != NULL) { + if (pCurrentDataSource->pNext != nullptr) { pDataSourceBase->pCurrent = pCurrentDataSource->pNext; - } else if (pCurrentDataSource->onGetNext != NULL) { + } else if (pCurrentDataSource->onGetNext != nullptr) { pDataSourceBase->pCurrent = pCurrentDataSource->onGetNext(pCurrentDataSource); - if (pDataSourceBase->pCurrent == NULL) { + if (pDataSourceBase->pCurrent == nullptr) { break; /* Our callback did not return a next data source. We're done. */ } } else { @@ -59437,12 +59437,12 @@ MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, voi } } - if (pRunningFramesOut != NULL) { + if (pRunningFramesOut != nullptr) { pRunningFramesOut = ma_offset_ptr(pRunningFramesOut, framesProcessed * ma_get_bytes_per_frame(format, channels)); } } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesProcessed; } @@ -59457,18 +59457,18 @@ MA_API ma_result ma_data_source_read_pcm_frames(ma_data_source* pDataSource, voi MA_API ma_result ma_data_source_seek_pcm_frames(ma_data_source* pDataSource, ma_uint64 frameCount, ma_uint64* pFramesSeeked) { - return ma_data_source_read_pcm_frames(pDataSource, NULL, frameCount, pFramesSeeked); + return ma_data_source_read_pcm_frames(pDataSource, nullptr, frameCount, pFramesSeeked); } MA_API ma_result ma_data_source_seek_to_pcm_frame(ma_data_source* pDataSource, ma_uint64 frameIndex) { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - if (pDataSourceBase == NULL) { + if (pDataSourceBase == nullptr) { return MA_INVALID_ARGS; } - if (pDataSourceBase->vtable->onSeek == NULL) { + if (pDataSourceBase->vtable->onSeek == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -59476,7 +59476,7 @@ MA_API ma_result ma_data_source_seek_to_pcm_frame(ma_data_source* pDataSource, m return MA_INVALID_OPERATION; /* Trying to seek too far forward. */ } - MA_ASSERT(pDataSourceBase->vtable != NULL); + MA_ASSERT(pDataSourceBase->vtable != nullptr); return pDataSourceBase->vtable->onSeek(pDataSource, pDataSourceBase->rangeBegInFrames + frameIndex); } @@ -59488,11 +59488,11 @@ MA_API ma_result ma_data_source_seek_seconds(ma_data_source* pDataSource, float ma_uint32 sampleRate; ma_result result; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } - result = ma_data_source_get_data_format(pDataSource, NULL, NULL, &sampleRate, NULL, 0); + result = ma_data_source_get_data_format(pDataSource, nullptr, nullptr, &sampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; } @@ -59513,11 +59513,11 @@ MA_API ma_result ma_data_source_seek_to_second(ma_data_source* pDataSource, floa ma_uint32 sampleRate; ma_result result; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } - result = ma_data_source_get_data_format(pDataSource, NULL, NULL, &sampleRate, NULL, 0); + result = ma_data_source_get_data_format(pDataSource, nullptr, nullptr, &sampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; } @@ -59537,26 +59537,26 @@ MA_API ma_result ma_data_source_get_data_format(ma_data_source* pDataSource, ma_ ma_uint32 sampleRate; /* Initialize to defaults for safety just in case the data source does not implement this callback. */ - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = ma_format_unknown; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = 0; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = 0; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { MA_ZERO_MEMORY(pChannelMap, sizeof(*pChannelMap) * channelMapCap); } - if (pDataSourceBase == NULL) { + if (pDataSourceBase == nullptr) { return MA_INVALID_ARGS; } - MA_ASSERT(pDataSourceBase->vtable != NULL); + MA_ASSERT(pDataSourceBase->vtable != nullptr); - if (pDataSourceBase->vtable->onGetDataFormat == NULL) { + if (pDataSourceBase->vtable->onGetDataFormat == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -59565,13 +59565,13 @@ MA_API ma_result ma_data_source_get_data_format(ma_data_source* pDataSource, ma_ return result; } - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = format; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = channels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = sampleRate; } @@ -59586,19 +59586,19 @@ MA_API ma_result ma_data_source_get_cursor_in_pcm_frames(ma_data_source* pDataSo ma_result result; ma_uint64 cursor; - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; - if (pDataSourceBase == NULL) { + if (pDataSourceBase == nullptr) { return MA_SUCCESS; } - MA_ASSERT(pDataSourceBase->vtable != NULL); + MA_ASSERT(pDataSourceBase->vtable != nullptr); - if (pDataSourceBase->vtable->onGetCursor == NULL) { + if (pDataSourceBase->vtable->onGetCursor == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -59621,17 +59621,17 @@ MA_API ma_result ma_data_source_get_length_in_pcm_frames(ma_data_source* pDataSo { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; - if (pDataSourceBase == NULL) { + if (pDataSourceBase == nullptr) { return MA_INVALID_ARGS; } - MA_ASSERT(pDataSourceBase->vtable != NULL); + MA_ASSERT(pDataSourceBase->vtable != nullptr); /* If we have a range defined we'll use that to determine the length. This is one of rare times @@ -59647,7 +59647,7 @@ MA_API ma_result ma_data_source_get_length_in_pcm_frames(ma_data_source* pDataSo Getting here means a range is not defined so we'll need to get the data source itself to tell us the length. */ - if (pDataSourceBase->vtable->onGetLength == NULL) { + if (pDataSourceBase->vtable->onGetLength == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -59660,7 +59660,7 @@ MA_API ma_result ma_data_source_get_cursor_in_seconds(ma_data_source* pDataSourc ma_uint64 cursorInPCMFrames; ma_uint32 sampleRate; - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } @@ -59671,7 +59671,7 @@ MA_API ma_result ma_data_source_get_cursor_in_seconds(ma_data_source* pDataSourc return result; } - result = ma_data_source_get_data_format(pDataSource, NULL, NULL, &sampleRate, NULL, 0); + result = ma_data_source_get_data_format(pDataSource, nullptr, nullptr, &sampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; } @@ -59688,7 +59688,7 @@ MA_API ma_result ma_data_source_get_length_in_seconds(ma_data_source* pDataSourc ma_uint64 lengthInPCMFrames; ma_uint32 sampleRate; - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } @@ -59699,7 +59699,7 @@ MA_API ma_result ma_data_source_get_length_in_seconds(ma_data_source* pDataSourc return result; } - result = ma_data_source_get_data_format(pDataSource, NULL, NULL, &sampleRate, NULL, 0); + result = ma_data_source_get_data_format(pDataSource, nullptr, nullptr, &sampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; } @@ -59714,16 +59714,16 @@ MA_API ma_result ma_data_source_set_looping(ma_data_source* pDataSource, ma_bool { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } ma_atomic_exchange_32(&pDataSourceBase->isLooping, isLooping); - MA_ASSERT(pDataSourceBase->vtable != NULL); + MA_ASSERT(pDataSourceBase->vtable != nullptr); /* If there's no callback for this just treat it as a successful no-op. */ - if (pDataSourceBase->vtable->onSetLooping == NULL) { + if (pDataSourceBase->vtable->onSetLooping == nullptr) { return MA_SUCCESS; } @@ -59734,7 +59734,7 @@ MA_API ma_bool32 ma_data_source_is_looping(const ma_data_source* pDataSource) { const ma_data_source_base* pDataSourceBase = (const ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_FALSE; } @@ -59749,7 +59749,7 @@ MA_API ma_result ma_data_source_set_range_in_pcm_frames(ma_data_source* pDataSou ma_uint64 absoluteCursor; ma_bool32 doSeekAdjustment = MA_FALSE; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -59812,22 +59812,22 @@ MA_API void ma_data_source_get_range_in_pcm_frames(const ma_data_source* pDataSo { const ma_data_source_base* pDataSourceBase = (const ma_data_source_base*)pDataSource; - if (pRangeBegInFrames != NULL) { + if (pRangeBegInFrames != nullptr) { *pRangeBegInFrames = 0; } - if (pRangeEndInFrames != NULL) { + if (pRangeEndInFrames != nullptr) { *pRangeEndInFrames = 0; } - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return; } - if (pRangeBegInFrames != NULL) { + if (pRangeBegInFrames != nullptr) { *pRangeBegInFrames = pDataSourceBase->rangeBegInFrames; } - if (pRangeEndInFrames != NULL) { + if (pRangeEndInFrames != nullptr) { *pRangeEndInFrames = pDataSourceBase->rangeEndInFrames; } } @@ -59836,7 +59836,7 @@ MA_API ma_result ma_data_source_set_loop_point_in_pcm_frames(ma_data_source* pDa { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -59863,22 +59863,22 @@ MA_API void ma_data_source_get_loop_point_in_pcm_frames(const ma_data_source* pD { const ma_data_source_base* pDataSourceBase = (const ma_data_source_base*)pDataSource; - if (pLoopBegInFrames != NULL) { + if (pLoopBegInFrames != nullptr) { *pLoopBegInFrames = 0; } - if (pLoopEndInFrames != NULL) { + if (pLoopEndInFrames != nullptr) { *pLoopEndInFrames = 0; } - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return; } - if (pLoopBegInFrames != NULL) { + if (pLoopBegInFrames != nullptr) { *pLoopBegInFrames = pDataSourceBase->loopBegInFrames; } - if (pLoopEndInFrames != NULL) { + if (pLoopEndInFrames != nullptr) { *pLoopEndInFrames = pDataSourceBase->loopEndInFrames; } } @@ -59887,7 +59887,7 @@ MA_API ma_result ma_data_source_set_current(ma_data_source* pDataSource, ma_data { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -59900,8 +59900,8 @@ MA_API ma_data_source* ma_data_source_get_current(const ma_data_source* pDataSou { const ma_data_source_base* pDataSourceBase = (const ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { - return NULL; + if (pDataSource == nullptr) { + return nullptr; } return pDataSourceBase->pCurrent; @@ -59911,7 +59911,7 @@ MA_API ma_result ma_data_source_set_next(ma_data_source* pDataSource, ma_data_so { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -59924,8 +59924,8 @@ MA_API ma_data_source* ma_data_source_get_next(const ma_data_source* pDataSource { const ma_data_source_base* pDataSourceBase = (const ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { - return NULL; + if (pDataSource == nullptr) { + return nullptr; } return pDataSourceBase->pNext; @@ -59935,7 +59935,7 @@ MA_API ma_result ma_data_source_set_next_callback(ma_data_source* pDataSource, m { ma_data_source_base* pDataSourceBase = (ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -59948,8 +59948,8 @@ MA_API ma_data_source_get_next_proc ma_data_source_get_next_callback(const ma_da { const ma_data_source_base* pDataSourceBase = (const ma_data_source_base*)pDataSource; - if (pDataSource == NULL) { - return NULL; + if (pDataSource == nullptr) { + return nullptr; } return pDataSourceBase->onGetNext; @@ -59961,7 +59961,7 @@ static ma_result ma_audio_buffer_ref__data_source_on_read(ma_data_source* pDataS ma_audio_buffer_ref* pAudioBufferRef = (ma_audio_buffer_ref*)pDataSource; ma_uint64 framesRead = ma_audio_buffer_ref_read_pcm_frames(pAudioBufferRef, pFramesOut, frameCount, MA_FALSE); - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = framesRead; } @@ -60014,7 +60014,7 @@ static ma_data_source_vtable g_ma_audio_buffer_ref_data_source_vtable = ma_audio_buffer_ref__data_source_on_get_data_format, ma_audio_buffer_ref__data_source_on_get_cursor, ma_audio_buffer_ref__data_source_on_get_length, - NULL, /* onSetLooping */ + nullptr, /* onSetLooping */ 0 }; @@ -60023,7 +60023,7 @@ MA_API ma_result ma_audio_buffer_ref_init(ma_format format, ma_uint32 channels, ma_result result; ma_data_source_config dataSourceConfig; - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return MA_INVALID_ARGS; } @@ -60049,7 +60049,7 @@ MA_API ma_result ma_audio_buffer_ref_init(ma_format format, ma_uint32 channels, MA_API void ma_audio_buffer_ref_uninit(ma_audio_buffer_ref* pAudioBufferRef) { - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return; } @@ -60058,7 +60058,7 @@ MA_API void ma_audio_buffer_ref_uninit(ma_audio_buffer_ref* pAudioBufferRef) MA_API ma_result ma_audio_buffer_ref_set_data(ma_audio_buffer_ref* pAudioBufferRef, const void* pData, ma_uint64 sizeInFrames) { - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return MA_INVALID_ARGS; } @@ -60073,7 +60073,7 @@ MA_API ma_uint64 ma_audio_buffer_ref_read_pcm_frames(ma_audio_buffer_ref* pAudio { ma_uint64 totalFramesRead = 0; - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return 0; } @@ -60091,7 +60091,7 @@ MA_API ma_uint64 ma_audio_buffer_ref_read_pcm_frames(ma_audio_buffer_ref* pAudio framesToRead = framesAvailable; } - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { ma_copy_pcm_frames(ma_offset_ptr(pFramesOut, totalFramesRead * ma_get_bytes_per_frame(pAudioBufferRef->format, pAudioBufferRef->channels)), ma_offset_ptr(pAudioBufferRef->pData, pAudioBufferRef->cursor * ma_get_bytes_per_frame(pAudioBufferRef->format, pAudioBufferRef->channels)), framesToRead, pAudioBufferRef->format, pAudioBufferRef->channels); } @@ -60114,7 +60114,7 @@ MA_API ma_uint64 ma_audio_buffer_ref_read_pcm_frames(ma_audio_buffer_ref* pAudio MA_API ma_result ma_audio_buffer_ref_seek_to_pcm_frame(ma_audio_buffer_ref* pAudioBufferRef, ma_uint64 frameIndex) { - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return MA_INVALID_ARGS; } @@ -60132,16 +60132,16 @@ MA_API ma_result ma_audio_buffer_ref_map(ma_audio_buffer_ref* pAudioBufferRef, v ma_uint64 framesAvailable; ma_uint64 frameCount = 0; - if (ppFramesOut != NULL) { - *ppFramesOut = NULL; /* Safety. */ + if (ppFramesOut != nullptr) { + *ppFramesOut = nullptr; /* Safety. */ } - if (pFrameCount != NULL) { + if (pFrameCount != nullptr) { frameCount = *pFrameCount; *pFrameCount = 0; /* Safety. */ } - if (pAudioBufferRef == NULL || ppFramesOut == NULL || pFrameCount == NULL) { + if (pAudioBufferRef == nullptr || ppFramesOut == nullptr || pFrameCount == nullptr) { return MA_INVALID_ARGS; } @@ -60160,7 +60160,7 @@ MA_API ma_result ma_audio_buffer_ref_unmap(ma_audio_buffer_ref* pAudioBufferRef, { ma_uint64 framesAvailable; - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return MA_INVALID_ARGS; } @@ -60180,7 +60180,7 @@ MA_API ma_result ma_audio_buffer_ref_unmap(ma_audio_buffer_ref* pAudioBufferRef, MA_API ma_bool32 ma_audio_buffer_ref_at_end(const ma_audio_buffer_ref* pAudioBufferRef) { - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return MA_FALSE; } @@ -60189,13 +60189,13 @@ MA_API ma_bool32 ma_audio_buffer_ref_at_end(const ma_audio_buffer_ref* pAudioBuf MA_API ma_result ma_audio_buffer_ref_get_cursor_in_pcm_frames(const ma_audio_buffer_ref* pAudioBufferRef, ma_uint64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return MA_INVALID_ARGS; } @@ -60206,13 +60206,13 @@ MA_API ma_result ma_audio_buffer_ref_get_cursor_in_pcm_frames(const ma_audio_buf MA_API ma_result ma_audio_buffer_ref_get_length_in_pcm_frames(const ma_audio_buffer_ref* pAudioBufferRef, ma_uint64* pLength) { - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return MA_INVALID_ARGS; } @@ -60223,13 +60223,13 @@ MA_API ma_result ma_audio_buffer_ref_get_length_in_pcm_frames(const ma_audio_buf MA_API ma_result ma_audio_buffer_ref_get_available_frames(const ma_audio_buffer_ref* pAudioBufferRef, ma_uint64* pAvailableFrames) { - if (pAvailableFrames == NULL) { + if (pAvailableFrames == nullptr) { return MA_INVALID_ARGS; } *pAvailableFrames = 0; - if (pAudioBufferRef == NULL) { + if (pAudioBufferRef == nullptr) { return MA_INVALID_ARGS; } @@ -60264,13 +60264,13 @@ static ma_result ma_audio_buffer_init_ex(const ma_audio_buffer_config* pConfig, { ma_result result; - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_MEMORY(pAudioBuffer, sizeof(*pAudioBuffer) - sizeof(pAudioBuffer->_pExtraData)); /* Safety. Don't overwrite the extra data. */ - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -60278,7 +60278,7 @@ static ma_result ma_audio_buffer_init_ex(const ma_audio_buffer_config* pConfig, return MA_INVALID_ARGS; /* Not allowing buffer sizes of 0 frames. */ } - result = ma_audio_buffer_ref_init(pConfig->format, pConfig->channels, NULL, 0, &pAudioBuffer->ref); + result = ma_audio_buffer_ref_init(pConfig->format, pConfig->channels, nullptr, 0, &pAudioBuffer->ref); if (result != MA_SUCCESS) { return result; } @@ -60298,11 +60298,11 @@ static ma_result ma_audio_buffer_init_ex(const ma_audio_buffer_config* pConfig, } pData = ma_malloc((size_t)allocationSizeInBytes, &pAudioBuffer->allocationCallbacks); /* Safe cast to size_t. */ - if (pData == NULL) { + if (pData == nullptr) { return MA_OUT_OF_MEMORY; } - if (pConfig->pData != NULL) { + if (pConfig->pData != nullptr) { ma_copy_pcm_frames(pData, pConfig->pData, pConfig->sizeInFrames, pConfig->format, pConfig->channels); } else { ma_silence_pcm_frames(pData, pConfig->sizeInFrames, pConfig->format, pConfig->channels); @@ -60320,7 +60320,7 @@ static ma_result ma_audio_buffer_init_ex(const ma_audio_buffer_config* pConfig, static void ma_audio_buffer_uninit_ex(ma_audio_buffer* pAudioBuffer, ma_bool32 doFree) { - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return; } @@ -60352,13 +60352,13 @@ MA_API ma_result ma_audio_buffer_alloc_and_init(const ma_audio_buffer_config* pC ma_audio_buffer_config innerConfig; /* We'll be making some changes to the config, so need to make a copy. */ ma_uint64 allocationSizeInBytes; - if (ppAudioBuffer == NULL) { + if (ppAudioBuffer == nullptr) { return MA_INVALID_ARGS; } - *ppAudioBuffer = NULL; /* Safety. */ + *ppAudioBuffer = nullptr; /* Safety. */ - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -60371,11 +60371,11 @@ MA_API ma_result ma_audio_buffer_alloc_and_init(const ma_audio_buffer_config* pC } pAudioBuffer = (ma_audio_buffer*)ma_malloc((size_t)allocationSizeInBytes, &innerConfig.allocationCallbacks); /* Safe cast to size_t. */ - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return MA_OUT_OF_MEMORY; } - if (pConfig->pData != NULL) { + if (pConfig->pData != nullptr) { ma_copy_pcm_frames(&pAudioBuffer->_pExtraData[0], pConfig->pData, pConfig->sizeInFrames, pConfig->format, pConfig->channels); } else { ma_silence_pcm_frames(&pAudioBuffer->_pExtraData[0], pConfig->sizeInFrames, pConfig->format, pConfig->channels); @@ -60406,7 +60406,7 @@ MA_API void ma_audio_buffer_uninit_and_free(ma_audio_buffer* pAudioBuffer) MA_API ma_uint64 ma_audio_buffer_read_pcm_frames(ma_audio_buffer* pAudioBuffer, void* pFramesOut, ma_uint64 frameCount, ma_bool32 loop) { - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return 0; } @@ -60415,7 +60415,7 @@ MA_API ma_uint64 ma_audio_buffer_read_pcm_frames(ma_audio_buffer* pAudioBuffer, MA_API ma_result ma_audio_buffer_seek_to_pcm_frame(ma_audio_buffer* pAudioBuffer, ma_uint64 frameIndex) { - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -60424,12 +60424,12 @@ MA_API ma_result ma_audio_buffer_seek_to_pcm_frame(ma_audio_buffer* pAudioBuffer MA_API ma_result ma_audio_buffer_map(ma_audio_buffer* pAudioBuffer, void** ppFramesOut, ma_uint64* pFrameCount) { - if (ppFramesOut != NULL) { - *ppFramesOut = NULL; /* Safety. */ + if (ppFramesOut != nullptr) { + *ppFramesOut = nullptr; /* Safety. */ } - if (pAudioBuffer == NULL) { - if (pFrameCount != NULL) { + if (pAudioBuffer == nullptr) { + if (pFrameCount != nullptr) { *pFrameCount = 0; } @@ -60441,7 +60441,7 @@ MA_API ma_result ma_audio_buffer_map(ma_audio_buffer* pAudioBuffer, void** ppFra MA_API ma_result ma_audio_buffer_unmap(ma_audio_buffer* pAudioBuffer, ma_uint64 frameCount) { - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -60450,7 +60450,7 @@ MA_API ma_result ma_audio_buffer_unmap(ma_audio_buffer* pAudioBuffer, ma_uint64 MA_API ma_bool32 ma_audio_buffer_at_end(const ma_audio_buffer* pAudioBuffer) { - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return MA_FALSE; } @@ -60459,7 +60459,7 @@ MA_API ma_bool32 ma_audio_buffer_at_end(const ma_audio_buffer* pAudioBuffer) MA_API ma_result ma_audio_buffer_get_cursor_in_pcm_frames(const ma_audio_buffer* pAudioBuffer, ma_uint64* pCursor) { - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -60468,7 +60468,7 @@ MA_API ma_result ma_audio_buffer_get_cursor_in_pcm_frames(const ma_audio_buffer* MA_API ma_result ma_audio_buffer_get_length_in_pcm_frames(const ma_audio_buffer* pAudioBuffer, ma_uint64* pLength) { - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -60477,13 +60477,13 @@ MA_API ma_result ma_audio_buffer_get_length_in_pcm_frames(const ma_audio_buffer* MA_API ma_result ma_audio_buffer_get_available_frames(const ma_audio_buffer* pAudioBuffer, ma_uint64* pAvailableFrames) { - if (pAvailableFrames == NULL) { + if (pAvailableFrames == nullptr) { return MA_INVALID_ARGS; } *pAvailableFrames = 0; - if (pAudioBuffer == NULL) { + if (pAudioBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -60496,7 +60496,7 @@ MA_API ma_result ma_audio_buffer_get_available_frames(const ma_audio_buffer* pAu MA_API ma_result ma_paged_audio_buffer_data_init(ma_format format, ma_uint32 channels, ma_paged_audio_buffer_data* pData) { - if (pData == NULL) { + if (pData == nullptr) { return MA_INVALID_ARGS; } @@ -60513,13 +60513,13 @@ MA_API void ma_paged_audio_buffer_data_uninit(ma_paged_audio_buffer_data* pData, { ma_paged_audio_buffer_page* pPage; - if (pData == NULL) { + if (pData == nullptr) { return; } /* All pages need to be freed. */ pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pData->head.pNext); - while (pPage != NULL) { + while (pPage != nullptr) { ma_paged_audio_buffer_page* pNext = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pPage->pNext); ma_free(pPage, pAllocationCallbacks); @@ -60529,8 +60529,8 @@ MA_API void ma_paged_audio_buffer_data_uninit(ma_paged_audio_buffer_data* pData, MA_API ma_paged_audio_buffer_page* ma_paged_audio_buffer_data_get_head(ma_paged_audio_buffer_data* pData) { - if (pData == NULL) { - return NULL; + if (pData == nullptr) { + return nullptr; } return &pData->head; @@ -60538,8 +60538,8 @@ MA_API ma_paged_audio_buffer_page* ma_paged_audio_buffer_data_get_head(ma_paged_ MA_API ma_paged_audio_buffer_page* ma_paged_audio_buffer_data_get_tail(ma_paged_audio_buffer_data* pData) { - if (pData == NULL) { - return NULL; + if (pData == nullptr) { + return nullptr; } return pData->pTail; @@ -60549,18 +60549,18 @@ MA_API ma_result ma_paged_audio_buffer_data_get_length_in_pcm_frames(ma_paged_au { ma_paged_audio_buffer_page* pPage; - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; - if (pData == NULL) { + if (pData == nullptr) { return MA_INVALID_ARGS; } /* Calculate the length from the linked list. */ - for (pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pData->head.pNext); pPage != NULL; pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pPage->pNext)) { + for (pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pData->head.pNext); pPage != nullptr; pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pPage->pNext)) { *pLength += pPage->sizeInFrames; } @@ -60572,13 +60572,13 @@ MA_API ma_result ma_paged_audio_buffer_data_allocate_page(ma_paged_audio_buffer_ ma_paged_audio_buffer_page* pPage; ma_uint64 allocationSize; - if (ppPage == NULL) { + if (ppPage == nullptr) { return MA_INVALID_ARGS; } - *ppPage = NULL; + *ppPage = nullptr; - if (pData == NULL) { + if (pData == nullptr) { return MA_INVALID_ARGS; } @@ -60588,14 +60588,14 @@ MA_API ma_result ma_paged_audio_buffer_data_allocate_page(ma_paged_audio_buffer_ } pPage = (ma_paged_audio_buffer_page*)ma_malloc((size_t)allocationSize, pAllocationCallbacks); /* Safe cast to size_t. */ - if (pPage == NULL) { + if (pPage == nullptr) { return MA_OUT_OF_MEMORY; } - pPage->pNext = NULL; + pPage->pNext = nullptr; pPage->sizeInFrames = pageSizeInFrames; - if (pInitialData != NULL) { + if (pInitialData != nullptr) { ma_copy_pcm_frames(pPage->pAudioData, pInitialData, pageSizeInFrames, pData->format, pData->channels); } @@ -60606,7 +60606,7 @@ MA_API ma_result ma_paged_audio_buffer_data_allocate_page(ma_paged_audio_buffer_ MA_API ma_result ma_paged_audio_buffer_data_free_page(ma_paged_audio_buffer_data* pData, ma_paged_audio_buffer_page* pPage, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pData == NULL || pPage == NULL) { + if (pData == nullptr || pPage == nullptr) { return MA_INVALID_ARGS; } @@ -60618,7 +60618,7 @@ MA_API ma_result ma_paged_audio_buffer_data_free_page(ma_paged_audio_buffer_data MA_API ma_result ma_paged_audio_buffer_data_append_page(ma_paged_audio_buffer_data* pData, ma_paged_audio_buffer_page* pPage) { - if (pData == NULL || pPage == NULL) { + if (pData == nullptr || pPage == nullptr) { return MA_INVALID_ARGS; } @@ -60703,7 +60703,7 @@ static ma_data_source_vtable g_ma_paged_audio_buffer_data_source_vtable = ma_paged_audio_buffer__data_source_on_get_data_format, ma_paged_audio_buffer__data_source_on_get_cursor, ma_paged_audio_buffer__data_source_on_get_length, - NULL, /* onSetLooping */ + nullptr, /* onSetLooping */ 0 }; @@ -60712,18 +60712,18 @@ MA_API ma_result ma_paged_audio_buffer_init(const ma_paged_audio_buffer_config* ma_result result; ma_data_source_config dataSourceConfig; - if (pPagedAudioBuffer == NULL) { + if (pPagedAudioBuffer == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pPagedAudioBuffer); /* A config is required for the format and channel count. */ - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - if (pConfig->pData == NULL) { + if (pConfig->pData == nullptr) { return MA_INVALID_ARGS; /* No underlying data specified. */ } @@ -60745,7 +60745,7 @@ MA_API ma_result ma_paged_audio_buffer_init(const ma_paged_audio_buffer_config* MA_API void ma_paged_audio_buffer_uninit(ma_paged_audio_buffer* pPagedAudioBuffer) { - if (pPagedAudioBuffer == NULL) { + if (pPagedAudioBuffer == nullptr) { return; } @@ -60759,7 +60759,7 @@ MA_API ma_result ma_paged_audio_buffer_read_pcm_frames(ma_paged_audio_buffer* pP ma_format format; ma_uint32 channels; - if (pPagedAudioBuffer == NULL) { + if (pPagedAudioBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -60767,12 +60767,12 @@ MA_API ma_result ma_paged_audio_buffer_read_pcm_frames(ma_paged_audio_buffer* pP channels = pPagedAudioBuffer->pData->channels; while (totalFramesRead < frameCount) { - /* Read from the current page. The buffer should never be in a state where this is NULL. */ + /* Read from the current page. The buffer should never be in a state where this is nullptr. */ ma_uint64 framesRemainingInCurrentPage; ma_uint64 framesRemainingToRead = frameCount - totalFramesRead; ma_uint64 framesToReadThisIteration; - MA_ASSERT(pPagedAudioBuffer->pCurrent != NULL); + MA_ASSERT(pPagedAudioBuffer->pCurrent != nullptr); framesRemainingInCurrentPage = pPagedAudioBuffer->pCurrent->sizeInFrames - pPagedAudioBuffer->relativeCursor; @@ -60789,7 +60789,7 @@ MA_API ma_result ma_paged_audio_buffer_read_pcm_frames(ma_paged_audio_buffer* pP if (pPagedAudioBuffer->relativeCursor == pPagedAudioBuffer->pCurrent->sizeInFrames) { /* We reached the end of the page. Need to move to the next. If there's no more pages, we're done. */ ma_paged_audio_buffer_page* pNext = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pPagedAudioBuffer->pCurrent->pNext); - if (pNext == NULL) { + if (pNext == nullptr) { result = MA_AT_END; break; /* We've reached the end. */ } else { @@ -60799,7 +60799,7 @@ MA_API ma_result ma_paged_audio_buffer_read_pcm_frames(ma_paged_audio_buffer* pP } } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesRead; } @@ -60808,7 +60808,7 @@ MA_API ma_result ma_paged_audio_buffer_read_pcm_frames(ma_paged_audio_buffer* pP MA_API ma_result ma_paged_audio_buffer_seek_to_pcm_frame(ma_paged_audio_buffer* pPagedAudioBuffer, ma_uint64 frameIndex) { - if (pPagedAudioBuffer == NULL) { + if (pPagedAudioBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -60830,7 +60830,7 @@ MA_API ma_result ma_paged_audio_buffer_seek_to_pcm_frame(ma_paged_audio_buffer* ma_paged_audio_buffer_page* pPage; ma_uint64 runningCursor = 0; - for (pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&ma_paged_audio_buffer_data_get_head(pPagedAudioBuffer->pData)->pNext); pPage != NULL; pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pPage->pNext)) { + for (pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&ma_paged_audio_buffer_data_get_head(pPagedAudioBuffer->pData)->pNext); pPage != nullptr; pPage = (ma_paged_audio_buffer_page*)ma_atomic_load_ptr(&pPage->pNext)) { ma_uint64 pageRangeBeg = runningCursor; ma_uint64 pageRangeEnd = pageRangeBeg + pPage->sizeInFrames; @@ -60856,13 +60856,13 @@ MA_API ma_result ma_paged_audio_buffer_seek_to_pcm_frame(ma_paged_audio_buffer* MA_API ma_result ma_paged_audio_buffer_get_cursor_in_pcm_frames(ma_paged_audio_buffer* pPagedAudioBuffer, ma_uint64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; /* Safety. */ - if (pPagedAudioBuffer == NULL) { + if (pPagedAudioBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -60887,17 +60887,17 @@ MA_API ma_result ma_vfs_open(ma_vfs* pVFS, const char* pFilePath, ma_uint32 open { ma_vfs_callbacks* pCallbacks = (ma_vfs_callbacks*)pVFS; - if (pFile == NULL) { + if (pFile == nullptr) { return MA_INVALID_ARGS; } - *pFile = NULL; + *pFile = nullptr; - if (pVFS == NULL || pFilePath == NULL || openMode == 0) { + if (pVFS == nullptr || pFilePath == nullptr || openMode == 0) { return MA_INVALID_ARGS; } - if (pCallbacks->onOpen == NULL) { + if (pCallbacks->onOpen == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -60908,17 +60908,17 @@ MA_API ma_result ma_vfs_open_w(ma_vfs* pVFS, const wchar_t* pFilePath, ma_uint32 { ma_vfs_callbacks* pCallbacks = (ma_vfs_callbacks*)pVFS; - if (pFile == NULL) { + if (pFile == nullptr) { return MA_INVALID_ARGS; } - *pFile = NULL; + *pFile = nullptr; - if (pVFS == NULL || pFilePath == NULL || openMode == 0) { + if (pVFS == nullptr || pFilePath == nullptr || openMode == 0) { return MA_INVALID_ARGS; } - if (pCallbacks->onOpenW == NULL) { + if (pCallbacks->onOpenW == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -60929,11 +60929,11 @@ MA_API ma_result ma_vfs_close(ma_vfs* pVFS, ma_vfs_file file) { ma_vfs_callbacks* pCallbacks = (ma_vfs_callbacks*)pVFS; - if (pVFS == NULL || file == NULL) { + if (pVFS == nullptr || file == nullptr) { return MA_INVALID_ARGS; } - if (pCallbacks->onClose == NULL) { + if (pCallbacks->onClose == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -60946,21 +60946,21 @@ MA_API ma_result ma_vfs_read(ma_vfs* pVFS, ma_vfs_file file, void* pDst, size_t ma_result result; size_t bytesRead = 0; - if (pBytesRead != NULL) { + if (pBytesRead != nullptr) { *pBytesRead = 0; } - if (pVFS == NULL || file == NULL || pDst == NULL) { + if (pVFS == nullptr || file == nullptr || pDst == nullptr) { return MA_INVALID_ARGS; } - if (pCallbacks->onRead == NULL) { + if (pCallbacks->onRead == nullptr) { return MA_NOT_IMPLEMENTED; } result = pCallbacks->onRead(pVFS, file, pDst, sizeInBytes, &bytesRead); - if (pBytesRead != NULL) { + if (pBytesRead != nullptr) { *pBytesRead = bytesRead; } @@ -60975,15 +60975,15 @@ MA_API ma_result ma_vfs_write(ma_vfs* pVFS, ma_vfs_file file, const void* pSrc, { ma_vfs_callbacks* pCallbacks = (ma_vfs_callbacks*)pVFS; - if (pBytesWritten != NULL) { + if (pBytesWritten != nullptr) { *pBytesWritten = 0; } - if (pVFS == NULL || file == NULL || pSrc == NULL) { + if (pVFS == nullptr || file == nullptr || pSrc == nullptr) { return MA_INVALID_ARGS; } - if (pCallbacks->onWrite == NULL) { + if (pCallbacks->onWrite == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -60994,11 +60994,11 @@ MA_API ma_result ma_vfs_seek(ma_vfs* pVFS, ma_vfs_file file, ma_int64 offset, ma { ma_vfs_callbacks* pCallbacks = (ma_vfs_callbacks*)pVFS; - if (pVFS == NULL || file == NULL) { + if (pVFS == nullptr || file == nullptr) { return MA_INVALID_ARGS; } - if (pCallbacks->onSeek == NULL) { + if (pCallbacks->onSeek == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -61009,17 +61009,17 @@ MA_API ma_result ma_vfs_tell(ma_vfs* pVFS, ma_vfs_file file, ma_int64* pCursor) { ma_vfs_callbacks* pCallbacks = (ma_vfs_callbacks*)pVFS; - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; - if (pVFS == NULL || file == NULL) { + if (pVFS == nullptr || file == nullptr) { return MA_INVALID_ARGS; } - if (pCallbacks->onTell == NULL) { + if (pCallbacks->onTell == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -61030,17 +61030,17 @@ MA_API ma_result ma_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_info* pInfo { ma_vfs_callbacks* pCallbacks = (ma_vfs_callbacks*)pVFS; - if (pInfo == NULL) { + if (pInfo == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pInfo); - if (pVFS == NULL || file == NULL) { + if (pVFS == nullptr || file == nullptr) { return MA_INVALID_ARGS; } - if (pCallbacks->onInfo == NULL) { + if (pCallbacks->onInfo == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -61063,17 +61063,17 @@ program and is left to the OS to uninitialize when the program terminates. typedef DWORD (__stdcall * ma_SetFilePointer_proc)(HANDLE hFile, LONG lDistanceToMove, LONG* lpDistanceToMoveHigh, DWORD dwMoveMethod); typedef BOOL (__stdcall * ma_SetFilePointerEx_proc)(HANDLE hFile, LARGE_INTEGER liDistanceToMove, LARGE_INTEGER* lpNewFilePointer, DWORD dwMoveMethod); -static ma_handle hKernel32DLL = NULL; -static ma_SetFilePointer_proc ma_SetFilePointer = NULL; -static ma_SetFilePointerEx_proc ma_SetFilePointerEx = NULL; +static ma_handle hKernel32DLL = nullptr; +static ma_SetFilePointer_proc ma_SetFilePointer = nullptr; +static ma_SetFilePointerEx_proc ma_SetFilePointerEx = nullptr; static void ma_win32_fileio_init(void) { - if (hKernel32DLL == NULL) { - hKernel32DLL = ma_dlopen(NULL, "kernel32.dll"); - if (hKernel32DLL != NULL) { - ma_SetFilePointer = (ma_SetFilePointer_proc) ma_dlsym(NULL, hKernel32DLL, "SetFilePointer"); - ma_SetFilePointerEx = (ma_SetFilePointerEx_proc)ma_dlsym(NULL, hKernel32DLL, "SetFilePointerEx"); + if (hKernel32DLL == nullptr) { + hKernel32DLL = ma_dlopen(nullptr, "kernel32.dll"); + if (hKernel32DLL != nullptr) { + ma_SetFilePointer = (ma_SetFilePointer_proc) ma_dlsym(nullptr, hKernel32DLL, "SetFilePointer"); + ma_SetFilePointerEx = (ma_SetFilePointerEx_proc)ma_dlsym(nullptr, hKernel32DLL, "SetFilePointerEx"); } } } @@ -61114,7 +61114,7 @@ static ma_result ma_default_vfs_open__win32(ma_vfs* pVFS, const char* pFilePath, ma_default_vfs__get_open_settings_win32(openMode, &dwDesiredAccess, &dwShareMode, &dwCreationDisposition); - hFile = CreateFileA(pFilePath, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFileA(pFilePath, dwDesiredAccess, dwShareMode, nullptr, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { return ma_result_from_GetLastError(GetLastError()); } @@ -61139,7 +61139,7 @@ static ma_result ma_default_vfs_open_w__win32(ma_vfs* pVFS, const wchar_t* pFile ma_default_vfs__get_open_settings_win32(openMode, &dwDesiredAccess, &dwShareMode, &dwCreationDisposition); - hFile = CreateFileW(pFilePath, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFileW(pFilePath, dwDesiredAccess, dwShareMode, nullptr, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { return ma_result_from_GetLastError(GetLastError()); } @@ -61188,7 +61188,7 @@ static ma_result ma_default_vfs_read__win32(ma_vfs* pVFS, ma_vfs_file file, void bytesToRead = (DWORD)bytesRemaining; } - readResult = ReadFile((HANDLE)file, ma_offset_ptr(pDst, totalBytesRead), bytesToRead, &bytesRead, NULL); + readResult = ReadFile((HANDLE)file, ma_offset_ptr(pDst, totalBytesRead), bytesToRead, &bytesRead, nullptr); if (readResult == 1 && bytesRead == 0) { result = MA_AT_END; break; /* EOF */ @@ -61206,7 +61206,7 @@ static ma_result ma_default_vfs_read__win32(ma_vfs* pVFS, ma_vfs_file file, void } } - if (pBytesRead != NULL) { + if (pBytesRead != nullptr) { *pBytesRead = totalBytesRead; } @@ -61234,7 +61234,7 @@ static ma_result ma_default_vfs_write__win32(ma_vfs* pVFS, ma_vfs_file file, con bytesToWrite = (DWORD)bytesRemaining; } - writeResult = WriteFile((HANDLE)file, ma_offset_ptr(pSrc, totalBytesWritten), bytesToWrite, &bytesWritten, NULL); + writeResult = WriteFile((HANDLE)file, ma_offset_ptr(pSrc, totalBytesWritten), bytesToWrite, &bytesWritten, nullptr); totalBytesWritten += bytesWritten; if (writeResult == 0) { @@ -61243,7 +61243,7 @@ static ma_result ma_default_vfs_write__win32(ma_vfs* pVFS, ma_vfs_file file, con } } - if (pBytesWritten != NULL) { + if (pBytesWritten != nullptr) { *pBytesWritten = totalBytesWritten; } @@ -61269,15 +61269,15 @@ static ma_result ma_default_vfs_seek__win32(ma_vfs* pVFS, ma_vfs_file file, ma_i dwMoveMethod = FILE_BEGIN; } - if (ma_SetFilePointerEx != NULL) { - result = ma_SetFilePointerEx((HANDLE)file, liDistanceToMove, NULL, dwMoveMethod); - } else if (ma_SetFilePointer != NULL) { + if (ma_SetFilePointerEx != nullptr) { + result = ma_SetFilePointerEx((HANDLE)file, liDistanceToMove, nullptr, dwMoveMethod); + } else if (ma_SetFilePointer != nullptr) { /* No SetFilePointerEx() so restrict to 31 bits. */ if (offset > 0x7FFFFFFF) { return MA_OUT_OF_RANGE; } - result = ma_SetFilePointer((HANDLE)file, (LONG)liDistanceToMove.QuadPart, NULL, dwMoveMethod); + result = ma_SetFilePointer((HANDLE)file, (LONG)liDistanceToMove.QuadPart, nullptr, dwMoveMethod); } else { return MA_NOT_IMPLEMENTED; } @@ -61299,9 +61299,9 @@ static ma_result ma_default_vfs_tell__win32(ma_vfs* pVFS, ma_vfs_file file, ma_i liZero.QuadPart = 0; - if (ma_SetFilePointerEx != NULL) { + if (ma_SetFilePointerEx != nullptr) { result = ma_SetFilePointerEx((HANDLE)file, liZero, &liTell, FILE_CURRENT); - } else if (ma_SetFilePointer != NULL) { + } else if (ma_SetFilePointer != nullptr) { LONG tell; result = ma_SetFilePointer((HANDLE)file, (LONG)liZero.QuadPart, &tell, FILE_CURRENT); @@ -61314,7 +61314,7 @@ static ma_result ma_default_vfs_tell__win32(ma_vfs* pVFS, ma_vfs_file file, ma_i return ma_result_from_GetLastError(GetLastError()); } - if (pCursor != NULL) { + if (pCursor != nullptr) { *pCursor = liTell.QuadPart; } @@ -61353,9 +61353,9 @@ static ma_result ma_default_vfs_open__stdio(ma_vfs* pVFS, const char* pFilePath, FILE* pFileStd; const char* pOpenModeStr; - MA_ASSERT(pFilePath != NULL); + MA_ASSERT(pFilePath != nullptr); MA_ASSERT(openMode != 0); - MA_ASSERT(pFile != NULL); + MA_ASSERT(pFile != nullptr); (void)pVFS; @@ -61385,9 +61385,9 @@ static ma_result ma_default_vfs_open_w__stdio(ma_vfs* pVFS, const wchar_t* pFile FILE* pFileStd; const wchar_t* pOpenModeStr; - MA_ASSERT(pFilePath != NULL); + MA_ASSERT(pFilePath != nullptr); MA_ASSERT(openMode != 0); - MA_ASSERT(pFile != NULL); + MA_ASSERT(pFile != nullptr); (void)pVFS; @@ -61401,7 +61401,7 @@ static ma_result ma_default_vfs_open_w__stdio(ma_vfs* pVFS, const wchar_t* pFile pOpenModeStr = L"wb"; } - result = ma_wfopen(&pFileStd, pFilePath, pOpenModeStr, (pVFS != NULL) ? &((ma_default_vfs*)pVFS)->allocationCallbacks : NULL); + result = ma_wfopen(&pFileStd, pFilePath, pOpenModeStr, (pVFS != nullptr) ? &((ma_default_vfs*)pVFS)->allocationCallbacks : nullptr); if (result != MA_SUCCESS) { return result; } @@ -61413,7 +61413,7 @@ static ma_result ma_default_vfs_open_w__stdio(ma_vfs* pVFS, const wchar_t* pFile static ma_result ma_default_vfs_close__stdio(ma_vfs* pVFS, ma_vfs_file file) { - MA_ASSERT(file != NULL); + MA_ASSERT(file != nullptr); (void)pVFS; @@ -61426,14 +61426,14 @@ static ma_result ma_default_vfs_read__stdio(ma_vfs* pVFS, ma_vfs_file file, void { size_t result; - MA_ASSERT(file != NULL); - MA_ASSERT(pDst != NULL); + MA_ASSERT(file != nullptr); + MA_ASSERT(pDst != nullptr); (void)pVFS; result = fread(pDst, 1, sizeInBytes, (FILE*)file); - if (pBytesRead != NULL) { + if (pBytesRead != nullptr) { *pBytesRead = result; } @@ -61452,14 +61452,14 @@ static ma_result ma_default_vfs_write__stdio(ma_vfs* pVFS, ma_vfs_file file, con { size_t result; - MA_ASSERT(file != NULL); - MA_ASSERT(pSrc != NULL); + MA_ASSERT(file != nullptr); + MA_ASSERT(pSrc != nullptr); (void)pVFS; result = fwrite(pSrc, 1, sizeInBytes, (FILE*)file); - if (pBytesWritten != NULL) { + if (pBytesWritten != nullptr) { *pBytesWritten = result; } @@ -61475,7 +61475,7 @@ static ma_result ma_default_vfs_seek__stdio(ma_vfs* pVFS, ma_vfs_file file, ma_i int result; int whence; - MA_ASSERT(file != NULL); + MA_ASSERT(file != nullptr); (void)pVFS; @@ -61512,8 +61512,8 @@ static ma_result ma_default_vfs_tell__stdio(ma_vfs* pVFS, ma_vfs_file file, ma_i { ma_int64 result; - MA_ASSERT(file != NULL); - MA_ASSERT(pCursor != NULL); + MA_ASSERT(file != nullptr); + MA_ASSERT(pCursor != nullptr); (void)pVFS; @@ -61541,8 +61541,8 @@ static ma_result ma_default_vfs_info__stdio(ma_vfs* pVFS, ma_vfs_file file, ma_f int fd; struct stat info; - MA_ASSERT(file != NULL); - MA_ASSERT(pInfo != NULL); + MA_ASSERT(file != nullptr); + MA_ASSERT(pInfo != nullptr); (void)pVFS; @@ -61565,13 +61565,13 @@ static ma_result ma_default_vfs_info__stdio(ma_vfs* pVFS, ma_vfs_file file, ma_f static ma_result ma_default_vfs_open(ma_vfs* pVFS, const char* pFilePath, ma_uint32 openMode, ma_vfs_file* pFile) { - if (pFile == NULL) { + if (pFile == nullptr) { return MA_INVALID_ARGS; } - *pFile = NULL; + *pFile = nullptr; - if (pFilePath == NULL || openMode == 0) { + if (pFilePath == nullptr || openMode == 0) { return MA_INVALID_ARGS; } @@ -61584,13 +61584,13 @@ static ma_result ma_default_vfs_open(ma_vfs* pVFS, const char* pFilePath, ma_uin static ma_result ma_default_vfs_open_w(ma_vfs* pVFS, const wchar_t* pFilePath, ma_uint32 openMode, ma_vfs_file* pFile) { - if (pFile == NULL) { + if (pFile == nullptr) { return MA_INVALID_ARGS; } - *pFile = NULL; + *pFile = nullptr; - if (pFilePath == NULL || openMode == 0) { + if (pFilePath == nullptr || openMode == 0) { return MA_INVALID_ARGS; } @@ -61603,7 +61603,7 @@ static ma_result ma_default_vfs_open_w(ma_vfs* pVFS, const wchar_t* pFilePath, m static ma_result ma_default_vfs_close(ma_vfs* pVFS, ma_vfs_file file) { - if (file == NULL) { + if (file == nullptr) { return MA_INVALID_ARGS; } @@ -61616,11 +61616,11 @@ static ma_result ma_default_vfs_close(ma_vfs* pVFS, ma_vfs_file file) static ma_result ma_default_vfs_read(ma_vfs* pVFS, ma_vfs_file file, void* pDst, size_t sizeInBytes, size_t* pBytesRead) { - if (pBytesRead != NULL) { + if (pBytesRead != nullptr) { *pBytesRead = 0; } - if (file == NULL || pDst == NULL) { + if (file == nullptr || pDst == nullptr) { return MA_INVALID_ARGS; } @@ -61633,11 +61633,11 @@ static ma_result ma_default_vfs_read(ma_vfs* pVFS, ma_vfs_file file, void* pDst, static ma_result ma_default_vfs_write(ma_vfs* pVFS, ma_vfs_file file, const void* pSrc, size_t sizeInBytes, size_t* pBytesWritten) { - if (pBytesWritten != NULL) { + if (pBytesWritten != nullptr) { *pBytesWritten = 0; } - if (file == NULL || pSrc == NULL) { + if (file == nullptr || pSrc == nullptr) { return MA_INVALID_ARGS; } @@ -61650,7 +61650,7 @@ static ma_result ma_default_vfs_write(ma_vfs* pVFS, ma_vfs_file file, const void static ma_result ma_default_vfs_seek(ma_vfs* pVFS, ma_vfs_file file, ma_int64 offset, ma_seek_origin origin) { - if (file == NULL) { + if (file == nullptr) { return MA_INVALID_ARGS; } @@ -61663,13 +61663,13 @@ static ma_result ma_default_vfs_seek(ma_vfs* pVFS, ma_vfs_file file, ma_int64 of static ma_result ma_default_vfs_tell(ma_vfs* pVFS, ma_vfs_file file, ma_int64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; - if (file == NULL) { + if (file == nullptr) { return MA_INVALID_ARGS; } @@ -61684,13 +61684,13 @@ static ma_result ma_default_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_inf { ma_result result; - if (pInfo == NULL) { + if (pInfo == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pInfo); - if (file == NULL) { + if (file == nullptr) { return MA_INVALID_ARGS; } @@ -61736,7 +61736,7 @@ static ma_result ma_default_vfs_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_inf MA_API ma_result ma_default_vfs_init(ma_default_vfs* pVFS, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pVFS == NULL) { + if (pVFS == nullptr) { return MA_INVALID_ARGS; } @@ -61756,7 +61756,7 @@ MA_API ma_result ma_default_vfs_init(ma_default_vfs* pVFS, const ma_allocation_c MA_API ma_result ma_vfs_or_default_open(ma_vfs* pVFS, const char* pFilePath, ma_uint32 openMode, ma_vfs_file* pFile) { - if (pVFS != NULL) { + if (pVFS != nullptr) { return ma_vfs_open(pVFS, pFilePath, openMode, pFile); } else { return ma_default_vfs_open(pVFS, pFilePath, openMode, pFile); @@ -61765,7 +61765,7 @@ MA_API ma_result ma_vfs_or_default_open(ma_vfs* pVFS, const char* pFilePath, ma_ MA_API ma_result ma_vfs_or_default_open_w(ma_vfs* pVFS, const wchar_t* pFilePath, ma_uint32 openMode, ma_vfs_file* pFile) { - if (pVFS != NULL) { + if (pVFS != nullptr) { return ma_vfs_open_w(pVFS, pFilePath, openMode, pFile); } else { return ma_default_vfs_open_w(pVFS, pFilePath, openMode, pFile); @@ -61774,7 +61774,7 @@ MA_API ma_result ma_vfs_or_default_open_w(ma_vfs* pVFS, const wchar_t* pFilePath MA_API ma_result ma_vfs_or_default_close(ma_vfs* pVFS, ma_vfs_file file) { - if (pVFS != NULL) { + if (pVFS != nullptr) { return ma_vfs_close(pVFS, file); } else { return ma_default_vfs_close(pVFS, file); @@ -61783,7 +61783,7 @@ MA_API ma_result ma_vfs_or_default_close(ma_vfs* pVFS, ma_vfs_file file) MA_API ma_result ma_vfs_or_default_read(ma_vfs* pVFS, ma_vfs_file file, void* pDst, size_t sizeInBytes, size_t* pBytesRead) { - if (pVFS != NULL) { + if (pVFS != nullptr) { return ma_vfs_read(pVFS, file, pDst, sizeInBytes, pBytesRead); } else { return ma_default_vfs_read(pVFS, file, pDst, sizeInBytes, pBytesRead); @@ -61792,7 +61792,7 @@ MA_API ma_result ma_vfs_or_default_read(ma_vfs* pVFS, ma_vfs_file file, void* pD MA_API ma_result ma_vfs_or_default_write(ma_vfs* pVFS, ma_vfs_file file, const void* pSrc, size_t sizeInBytes, size_t* pBytesWritten) { - if (pVFS != NULL) { + if (pVFS != nullptr) { return ma_vfs_write(pVFS, file, pSrc, sizeInBytes, pBytesWritten); } else { return ma_default_vfs_write(pVFS, file, pSrc, sizeInBytes, pBytesWritten); @@ -61801,7 +61801,7 @@ MA_API ma_result ma_vfs_or_default_write(ma_vfs* pVFS, ma_vfs_file file, const v MA_API ma_result ma_vfs_or_default_seek(ma_vfs* pVFS, ma_vfs_file file, ma_int64 offset, ma_seek_origin origin) { - if (pVFS != NULL) { + if (pVFS != nullptr) { return ma_vfs_seek(pVFS, file, offset, origin); } else { return ma_default_vfs_seek(pVFS, file, offset, origin); @@ -61810,7 +61810,7 @@ MA_API ma_result ma_vfs_or_default_seek(ma_vfs* pVFS, ma_vfs_file file, ma_int64 MA_API ma_result ma_vfs_or_default_tell(ma_vfs* pVFS, ma_vfs_file file, ma_int64* pCursor) { - if (pVFS != NULL) { + if (pVFS != nullptr) { return ma_vfs_tell(pVFS, file, pCursor); } else { return ma_default_vfs_tell(pVFS, file, pCursor); @@ -61819,7 +61819,7 @@ MA_API ma_result ma_vfs_or_default_tell(ma_vfs* pVFS, ma_vfs_file file, ma_int64 MA_API ma_result ma_vfs_or_default_info(ma_vfs* pVFS, ma_vfs_file file, ma_file_info* pInfo) { - if (pVFS != NULL) { + if (pVFS != nullptr) { return ma_vfs_info(pVFS, file, pInfo); } else { return ma_default_vfs_info(pVFS, file, pInfo); @@ -61836,18 +61836,18 @@ static ma_result ma_vfs_open_and_read_file_ex(ma_vfs* pVFS, const char* pFilePat void* pData; size_t bytesRead; - if (ppData != NULL) { - *ppData = NULL; + if (ppData != nullptr) { + *ppData = nullptr; } - if (pSize != NULL) { + if (pSize != nullptr) { *pSize = 0; } - if (ppData == NULL) { + if (ppData == nullptr) { return MA_INVALID_ARGS; } - if (pFilePath != NULL) { + if (pFilePath != nullptr) { result = ma_vfs_or_default_open(pVFS, pFilePath, MA_OPEN_MODE_READ, &file); } else { result = ma_vfs_or_default_open_w(pVFS, pFilePathW, MA_OPEN_MODE_READ, &file); @@ -61868,7 +61868,7 @@ static ma_result ma_vfs_open_and_read_file_ex(ma_vfs* pVFS, const char* pFilePat } pData = ma_malloc((size_t)info.sizeInBytes, pAllocationCallbacks); /* Safe cast. */ - if (pData == NULL) { + if (pData == nullptr) { ma_vfs_or_default_close(pVFS, file); return result; } @@ -61881,11 +61881,11 @@ static ma_result ma_vfs_open_and_read_file_ex(ma_vfs* pVFS, const char* pFilePat return result; } - if (pSize != NULL) { + if (pSize != nullptr) { *pSize = bytesRead; } - MA_ASSERT(ppData != NULL); + MA_ASSERT(ppData != nullptr); *ppData = pData; return MA_SUCCESS; @@ -61893,12 +61893,12 @@ static ma_result ma_vfs_open_and_read_file_ex(ma_vfs* pVFS, const char* pFilePat MA_API ma_result ma_vfs_open_and_read_file(ma_vfs* pVFS, const char* pFilePath, void** ppData, size_t* pSize, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_vfs_open_and_read_file_ex(pVFS, pFilePath, NULL, ppData, pSize, pAllocationCallbacks); + return ma_vfs_open_and_read_file_ex(pVFS, pFilePath, nullptr, ppData, pSize, pAllocationCallbacks); } MA_API ma_result ma_vfs_open_and_read_file_w(ma_vfs* pVFS, const wchar_t* pFilePath, void** ppData, size_t* pSize, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_vfs_open_and_read_file_ex(pVFS, NULL, pFilePath, ppData, pSize, pAllocationCallbacks); + return ma_vfs_open_and_read_file_ex(pVFS, nullptr, pFilePath, ppData, pSize, pAllocationCallbacks); } @@ -62821,23 +62821,23 @@ Decoding static ma_result ma_decoder_read_bytes(ma_decoder* pDecoder, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead) { - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); return pDecoder->onRead(pDecoder, pBufferOut, bytesToRead, pBytesRead); } static ma_result ma_decoder_seek_bytes(ma_decoder* pDecoder, ma_int64 byteOffset, ma_seek_origin origin) { - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); return pDecoder->onSeek(pDecoder, byteOffset, origin); } static ma_result ma_decoder_tell_bytes(ma_decoder* pDecoder, ma_int64* pCursor) { - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); - if (pDecoder->onTell == NULL) { + if (pDecoder->onTell == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -62880,7 +62880,7 @@ MA_API ma_decoder_config ma_decoder_config_init_default(void) MA_API ma_decoder_config ma_decoder_config_init_copy(const ma_decoder_config* pConfig) { ma_decoder_config config; - if (pConfig != NULL) { + if (pConfig != nullptr) { config = *pConfig; } else { MA_ZERO_OBJECT(&config); @@ -62898,8 +62898,8 @@ static ma_result ma_decoder__init_data_converter(ma_decoder* pDecoder, const ma_ ma_uint32 internalSampleRate; ma_channel internalChannelMap[MA_MAX_CHANNELS]; - MA_ASSERT(pDecoder != NULL); - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pDecoder != nullptr); + MA_ASSERT(pConfig != nullptr); result = ma_data_source_get_data_format(pDecoder->pBackend, &internalFormat, &internalChannels, &internalSampleRate, internalChannelMap, ma_countof(internalChannelMap)); if (result != MA_SUCCESS) { @@ -62980,7 +62980,7 @@ static ma_result ma_decoder__init_data_converter(ma_decoder* pDecoder, const ma_ } pDecoder->pInputCache = ma_malloc((size_t)inputCacheCapSizeInBytes, &pDecoder->allocationCallbacks); /* Safe cast to size_t. */ - if (pDecoder->pInputCache == NULL) { + if (pDecoder->pInputCache == nullptr) { ma_data_converter_uninit(&pDecoder->converter, &pDecoder->allocationCallbacks); return MA_OUT_OF_MEMORY; } @@ -62995,7 +62995,7 @@ static ma_result ma_decoder__init_data_converter(ma_decoder* pDecoder, const ma_ static ma_result ma_decoder_internal_on_read__custom(void* pUserData, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead) { ma_decoder* pDecoder = (ma_decoder*)pUserData; - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); return ma_decoder_read_bytes(pDecoder, pBufferOut, bytesToRead, pBytesRead); } @@ -63003,7 +63003,7 @@ static ma_result ma_decoder_internal_on_read__custom(void* pUserData, void* pBuf static ma_result ma_decoder_internal_on_seek__custom(void* pUserData, ma_int64 offset, ma_seek_origin origin) { ma_decoder* pDecoder = (ma_decoder*)pUserData; - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); return ma_decoder_seek_bytes(pDecoder, offset, origin); } @@ -63011,7 +63011,7 @@ static ma_result ma_decoder_internal_on_seek__custom(void* pUserData, ma_int64 o static ma_result ma_decoder_internal_on_tell__custom(void* pUserData, ma_int64* pCursor) { ma_decoder* pDecoder = (ma_decoder*)pUserData; - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); return ma_decoder_tell_bytes(pDecoder, pCursor); } @@ -63023,11 +63023,11 @@ static ma_result ma_decoder_init_from_vtable__internal(const ma_decoding_backend ma_decoding_backend_config backendConfig; ma_data_source* pBackend; - MA_ASSERT(pVTable != NULL); - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pVTable != nullptr); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); - if (pVTable->onInit == NULL) { + if (pVTable->onInit == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -63052,11 +63052,11 @@ static ma_result ma_decoder_init_from_file__internal(const ma_decoding_backend_v ma_decoding_backend_config backendConfig; ma_data_source* pBackend; - MA_ASSERT(pVTable != NULL); - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pVTable != nullptr); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); - if (pVTable->onInitFile == NULL) { + if (pVTable->onInitFile == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -63081,11 +63081,11 @@ static ma_result ma_decoder_init_from_file_w__internal(const ma_decoding_backend ma_decoding_backend_config backendConfig; ma_data_source* pBackend; - MA_ASSERT(pVTable != NULL); - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pVTable != nullptr); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); - if (pVTable->onInitFileW == NULL) { + if (pVTable->onInitFileW == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -63110,11 +63110,11 @@ static ma_result ma_decoder_init_from_memory__internal(const ma_decoding_backend ma_decoding_backend_config backendConfig; ma_data_source* pBackend; - MA_ASSERT(pVTable != NULL); - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pVTable != nullptr); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); - if (pVTable->onInitMemory == NULL) { + if (pVTable->onInitMemory == nullptr) { return MA_NOT_IMPLEMENTED; } @@ -63140,17 +63140,17 @@ static ma_result ma_decoder_init_custom__internal(const ma_decoder_config* pConf ma_result result = MA_NO_BACKEND; size_t ivtable; - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); - if (pConfig->ppCustomBackendVTables == NULL) { + if (pConfig->ppCustomBackendVTables == nullptr) { return MA_NO_BACKEND; } /* The order each backend is listed is what defines the priority. */ for (ivtable = 0; ivtable < pConfig->customBackendCount; ivtable += 1) { const ma_decoding_backend_vtable* pVTable = pConfig->ppCustomBackendVTables[ivtable]; - if (pVTable != NULL) { + if (pVTable != nullptr) { result = ma_decoder_init_from_vtable__internal(pVTable, pConfig->pCustomBackendUserData, pConfig, pDecoder); if (result == MA_SUCCESS) { return MA_SUCCESS; @@ -63175,17 +63175,17 @@ static ma_result ma_decoder_init_custom_from_file__internal(const char* pFilePat ma_result result = MA_NO_BACKEND; size_t ivtable; - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); - if (pConfig->ppCustomBackendVTables == NULL) { + if (pConfig->ppCustomBackendVTables == nullptr) { return MA_NO_BACKEND; } /* The order each backend is listed is what defines the priority. */ for (ivtable = 0; ivtable < pConfig->customBackendCount; ivtable += 1) { const ma_decoding_backend_vtable* pVTable = pConfig->ppCustomBackendVTables[ivtable]; - if (pVTable != NULL) { + if (pVTable != nullptr) { result = ma_decoder_init_from_file__internal(pVTable, pConfig->pCustomBackendUserData, pFilePath, pConfig, pDecoder); if (result == MA_SUCCESS) { return MA_SUCCESS; @@ -63204,17 +63204,17 @@ static ma_result ma_decoder_init_custom_from_file_w__internal(const wchar_t* pFi ma_result result = MA_NO_BACKEND; size_t ivtable; - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); - if (pConfig->ppCustomBackendVTables == NULL) { + if (pConfig->ppCustomBackendVTables == nullptr) { return MA_NO_BACKEND; } /* The order each backend is listed is what defines the priority. */ for (ivtable = 0; ivtable < pConfig->customBackendCount; ivtable += 1) { const ma_decoding_backend_vtable* pVTable = pConfig->ppCustomBackendVTables[ivtable]; - if (pVTable != NULL) { + if (pVTable != nullptr) { result = ma_decoder_init_from_file_w__internal(pVTable, pConfig->pCustomBackendUserData, pFilePath, pConfig, pDecoder); if (result == MA_SUCCESS) { return MA_SUCCESS; @@ -63233,17 +63233,17 @@ static ma_result ma_decoder_init_custom_from_memory__internal(const void* pData, ma_result result = MA_NO_BACKEND; size_t ivtable; - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); - if (pConfig->ppCustomBackendVTables == NULL) { + if (pConfig->ppCustomBackendVTables == nullptr) { return MA_NO_BACKEND; } /* The order each backend is listed is what defines the priority. */ for (ivtable = 0; ivtable < pConfig->customBackendCount; ivtable += 1) { const ma_decoding_backend_vtable* pVTable = pConfig->ppCustomBackendVTables[ivtable]; - if (pVTable != NULL) { + if (pVTable != nullptr) { result = ma_decoder_init_from_memory__internal(pVTable, pConfig->pCustomBackendUserData, pData, dataSize, pConfig, pDecoder); if (result == MA_SUCCESS) { return MA_SUCCESS; @@ -63318,7 +63318,7 @@ static ma_data_source_vtable g_ma_wav_ds_vtable = ma_wav_ds_get_data_format, ma_wav_ds_get_cursor, ma_wav_ds_get_length, - NULL, /* onSetLooping */ + nullptr, /* onSetLooping */ 0 }; @@ -63330,7 +63330,7 @@ static size_t ma_wav_dr_callback__read(void* pUserData, void* pBufferOut, size_t ma_result result; size_t bytesRead; - MA_ASSERT(pWav != NULL); + MA_ASSERT(pWav != nullptr); result = pWav->onRead(pWav->pReadSeekTellUserData, pBufferOut, bytesToRead, &bytesRead); (void)result; @@ -63344,7 +63344,7 @@ static ma_bool32 ma_wav_dr_callback__seek(void* pUserData, int offset, ma_dr_wav ma_result result; ma_seek_origin maSeekOrigin; - MA_ASSERT(pWav != NULL); + MA_ASSERT(pWav != nullptr); maSeekOrigin = ma_seek_origin_start; if (origin == MA_DR_WAV_SEEK_CUR) { @@ -63366,10 +63366,10 @@ static ma_bool32 ma_wav_dr_callback__tell(void* pUserData, ma_int64* pCursor) ma_wav* pWav = (ma_wav*)pUserData; ma_result result; - MA_ASSERT(pWav != NULL); - MA_ASSERT(pCursor != NULL); + MA_ASSERT(pWav != nullptr); + MA_ASSERT(pCursor != nullptr); - if (pWav->onTell == NULL) { + if (pWav->onTell == nullptr) { return MA_FALSE; /* Not implemented. */ } @@ -63387,14 +63387,14 @@ static ma_result ma_wav_init_internal(const ma_decoding_backend_config* pConfig, ma_result result; ma_data_source_config dataSourceConfig; - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pWav); pWav->format = ma_format_unknown; /* Use closest match to source file by default. */ - if (pConfig != NULL && (pConfig->preferredFormat == ma_format_f32 || pConfig->preferredFormat == ma_format_s16 || pConfig->preferredFormat == ma_format_s32)) { + if (pConfig != nullptr && (pConfig->preferredFormat == ma_format_f32 || pConfig->preferredFormat == ma_format_s16 || pConfig->preferredFormat == ma_format_s32)) { pWav->format = pConfig->preferredFormat; } else { /* Getting here means something other than f32 and s16 was specified. Just leave this unset to use the default format. */ @@ -63461,7 +63461,7 @@ MA_API ma_result ma_wav_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_p return result; } - if (onRead == NULL || onSeek == NULL) { + if (onRead == nullptr || onSeek == nullptr) { return MA_INVALID_ARGS; /* onRead and onSeek are mandatory. */ } @@ -63591,7 +63591,7 @@ MA_API ma_result ma_wav_init_memory(const void* pData, size_t dataSize, const ma MA_API void ma_wav_uninit(ma_wav* pWav, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pWav == NULL) { + if (pWav == nullptr) { return; } @@ -63613,7 +63613,7 @@ MA_API void ma_wav_uninit(ma_wav* pWav, const ma_allocation_callbacks* pAllocati MA_API ma_result ma_wav_read_pcm_frames(ma_wav* pWav, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -63621,7 +63621,7 @@ MA_API ma_result ma_wav_read_pcm_frames(ma_wav* pWav, void* pFramesOut, ma_uint6 return MA_INVALID_ARGS; } - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_ARGS; } @@ -63632,7 +63632,7 @@ MA_API ma_result ma_wav_read_pcm_frames(ma_wav* pWav, void* pFramesOut, ma_uint6 ma_uint64 totalFramesRead = 0; ma_format format; - ma_wav_get_data_format(pWav, &format, NULL, NULL, NULL, 0); + ma_wav_get_data_format(pWav, &format, nullptr, nullptr, nullptr, 0); switch (format) { @@ -63664,7 +63664,7 @@ MA_API ma_result ma_wav_read_pcm_frames(ma_wav* pWav, void* pFramesOut, ma_uint6 result = MA_AT_END; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesRead; } @@ -63690,7 +63690,7 @@ MA_API ma_result ma_wav_read_pcm_frames(ma_wav* pWav, void* pFramesOut, ma_uint6 MA_API ma_result ma_wav_seek_to_pcm_frame(ma_wav* pWav, ma_uint64 frameIndex) { - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_ARGS; } @@ -63720,38 +63720,38 @@ MA_API ma_result ma_wav_seek_to_pcm_frame(ma_wav* pWav, ma_uint64 frameIndex) MA_API ma_result ma_wav_get_data_format(ma_wav* pWav, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap) { /* Defaults for safety. */ - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = ma_format_unknown; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = 0; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = 0; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { MA_ZERO_MEMORY(pChannelMap, sizeof(*pChannelMap) * channelMapCap); } - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_OPERATION; } - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = pWav->format; } #if !defined(MA_NO_WAV) { - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = pWav->dr.channels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = pWav->dr.sampleRate; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { ma_channel_map_init_standard(ma_standard_channel_map_microsoft, pChannelMap, channelMapCap, pWav->dr.channels); } @@ -63768,13 +63768,13 @@ MA_API ma_result ma_wav_get_data_format(ma_wav* pWav, ma_format* pFormat, ma_uin MA_API ma_result ma_wav_get_cursor_in_pcm_frames(ma_wav* pWav, ma_uint64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; /* Safety. */ - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_ARGS; } @@ -63798,13 +63798,13 @@ MA_API ma_result ma_wav_get_cursor_in_pcm_frames(ma_wav* pWav, ma_uint64* pCurso MA_API ma_result ma_wav_get_length_in_pcm_frames(ma_wav* pWav, ma_uint64* pLength) { - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; /* Safety. */ - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_ARGS; } @@ -63836,7 +63836,7 @@ static ma_result ma_decoding_backend_init__wav(void* pUserData, ma_read_proc onR /* For now we're just allocating the decoder backend on the heap. */ pWav = (ma_wav*)ma_malloc(sizeof(*pWav), pAllocationCallbacks); - if (pWav == NULL) { + if (pWav == nullptr) { return MA_OUT_OF_MEMORY; } @@ -63860,7 +63860,7 @@ static ma_result ma_decoding_backend_init_file__wav(void* pUserData, const char* /* For now we're just allocating the decoder backend on the heap. */ pWav = (ma_wav*)ma_malloc(sizeof(*pWav), pAllocationCallbacks); - if (pWav == NULL) { + if (pWav == nullptr) { return MA_OUT_OF_MEMORY; } @@ -63884,7 +63884,7 @@ static ma_result ma_decoding_backend_init_file_w__wav(void* pUserData, const wch /* For now we're just allocating the decoder backend on the heap. */ pWav = (ma_wav*)ma_malloc(sizeof(*pWav), pAllocationCallbacks); - if (pWav == NULL) { + if (pWav == nullptr) { return MA_OUT_OF_MEMORY; } @@ -63908,7 +63908,7 @@ static ma_result ma_decoding_backend_init_memory__wav(void* pUserData, const voi /* For now we're just allocating the decoder backend on the heap. */ pWav = (ma_wav*)ma_malloc(sizeof(*pWav), pAllocationCallbacks); - if (pWav == NULL) { + if (pWav == nullptr) { return MA_OUT_OF_MEMORY; } @@ -63944,22 +63944,22 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_wav = static ma_result ma_decoder_init_wav__internal(const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_vtable__internal(&g_ma_decoding_backend_vtable_wav, NULL, pConfig, pDecoder); + return ma_decoder_init_from_vtable__internal(&g_ma_decoding_backend_vtable_wav, nullptr, pConfig, pDecoder); } static ma_result ma_decoder_init_wav_from_file__internal(const char* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_file__internal(&g_ma_decoding_backend_vtable_wav, NULL, pFilePath, pConfig, pDecoder); + return ma_decoder_init_from_file__internal(&g_ma_decoding_backend_vtable_wav, nullptr, pFilePath, pConfig, pDecoder); } static ma_result ma_decoder_init_wav_from_file_w__internal(const wchar_t* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_file_w__internal(&g_ma_decoding_backend_vtable_wav, NULL, pFilePath, pConfig, pDecoder); + return ma_decoder_init_from_file_w__internal(&g_ma_decoding_backend_vtable_wav, nullptr, pFilePath, pConfig, pDecoder); } static ma_result ma_decoder_init_wav_from_memory__internal(const void* pData, size_t dataSize, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_memory__internal(&g_ma_decoding_backend_vtable_wav, NULL, pData, dataSize, pConfig, pDecoder); + return ma_decoder_init_from_memory__internal(&g_ma_decoding_backend_vtable_wav, nullptr, pData, dataSize, pConfig, pDecoder); } #endif /* ma_dr_wav_h */ @@ -64023,7 +64023,7 @@ static ma_data_source_vtable g_ma_flac_ds_vtable = ma_flac_ds_get_data_format, ma_flac_ds_get_cursor, ma_flac_ds_get_length, - NULL, /* onSetLooping */ + nullptr, /* onSetLooping */ 0 }; @@ -64035,7 +64035,7 @@ static size_t ma_flac_dr_callback__read(void* pUserData, void* pBufferOut, size_ ma_result result; size_t bytesRead; - MA_ASSERT(pFlac != NULL); + MA_ASSERT(pFlac != nullptr); result = pFlac->onRead(pFlac->pReadSeekTellUserData, pBufferOut, bytesToRead, &bytesRead); (void)result; @@ -64049,7 +64049,7 @@ static ma_bool32 ma_flac_dr_callback__seek(void* pUserData, int offset, ma_dr_fl ma_result result; ma_seek_origin maSeekOrigin; - MA_ASSERT(pFlac != NULL); + MA_ASSERT(pFlac != nullptr); maSeekOrigin = ma_seek_origin_start; if (origin == MA_DR_FLAC_SEEK_CUR) { @@ -64071,10 +64071,10 @@ static ma_bool32 ma_flac_dr_callback__tell(void* pUserData, ma_int64* pCursor) ma_flac* pFlac = (ma_flac*)pUserData; ma_result result; - MA_ASSERT(pFlac != NULL); - MA_ASSERT(pCursor != NULL); + MA_ASSERT(pFlac != nullptr); + MA_ASSERT(pCursor != nullptr); - if (pFlac->onTell == NULL) { + if (pFlac->onTell == nullptr) { return MA_FALSE; /* Not implemented. */ } @@ -64092,14 +64092,14 @@ static ma_result ma_flac_init_internal(const ma_decoding_backend_config* pConfig ma_result result; ma_data_source_config dataSourceConfig; - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pFlac); pFlac->format = ma_format_f32; /* f32 by default. */ - if (pConfig != NULL && (pConfig->preferredFormat == ma_format_f32 || pConfig->preferredFormat == ma_format_s16 || pConfig->preferredFormat == ma_format_s32)) { + if (pConfig != nullptr && (pConfig->preferredFormat == ma_format_f32 || pConfig->preferredFormat == ma_format_s16 || pConfig->preferredFormat == ma_format_s32)) { pFlac->format = pConfig->preferredFormat; } else { /* Getting here means something other than f32 and s16 was specified. Just leave this unset to use the default format. */ @@ -64125,7 +64125,7 @@ MA_API ma_result ma_flac_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_ return result; } - if (onRead == NULL || onSeek == NULL) { + if (onRead == nullptr || onSeek == nullptr) { return MA_INVALID_ARGS; /* onRead and onSeek are mandatory. */ } @@ -64137,7 +64137,7 @@ MA_API ma_result ma_flac_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_ #if !defined(MA_NO_FLAC) { pFlac->dr = ma_dr_flac_open(ma_flac_dr_callback__read, ma_flac_dr_callback__seek, ma_flac_dr_callback__tell, pFlac, pAllocationCallbacks); - if (pFlac->dr == NULL) { + if (pFlac->dr == nullptr) { return MA_INVALID_FILE; } @@ -64164,7 +64164,7 @@ MA_API ma_result ma_flac_init_file(const char* pFilePath, const ma_decoding_back #if !defined(MA_NO_FLAC) { pFlac->dr = ma_dr_flac_open_file(pFilePath, pAllocationCallbacks); - if (pFlac->dr == NULL) { + if (pFlac->dr == nullptr) { return MA_INVALID_FILE; } @@ -64192,7 +64192,7 @@ MA_API ma_result ma_flac_init_file_w(const wchar_t* pFilePath, const ma_decoding #if !defined(MA_NO_FLAC) { pFlac->dr = ma_dr_flac_open_file_w(pFilePath, pAllocationCallbacks); - if (pFlac->dr == NULL) { + if (pFlac->dr == nullptr) { return MA_INVALID_FILE; } @@ -64220,7 +64220,7 @@ MA_API ma_result ma_flac_init_memory(const void* pData, size_t dataSize, const m #if !defined(MA_NO_FLAC) { pFlac->dr = ma_dr_flac_open_memory(pData, dataSize, pAllocationCallbacks); - if (pFlac->dr == NULL) { + if (pFlac->dr == nullptr) { return MA_INVALID_FILE; } @@ -64239,7 +64239,7 @@ MA_API ma_result ma_flac_init_memory(const void* pData, size_t dataSize, const m MA_API void ma_flac_uninit(ma_flac* pFlac, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFlac == NULL) { + if (pFlac == nullptr) { return; } @@ -64261,7 +64261,7 @@ MA_API void ma_flac_uninit(ma_flac* pFlac, const ma_allocation_callbacks* pAlloc MA_API ma_result ma_flac_read_pcm_frames(ma_flac* pFlac, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -64269,7 +64269,7 @@ MA_API ma_result ma_flac_read_pcm_frames(ma_flac* pFlac, void* pFramesOut, ma_ui return MA_INVALID_ARGS; } - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_INVALID_ARGS; } @@ -64280,7 +64280,7 @@ MA_API ma_result ma_flac_read_pcm_frames(ma_flac* pFlac, void* pFramesOut, ma_ui ma_uint64 totalFramesRead = 0; ma_format format; - ma_flac_get_data_format(pFlac, &format, NULL, NULL, NULL, 0); + ma_flac_get_data_format(pFlac, &format, nullptr, nullptr, nullptr, 0); switch (format) { @@ -64313,7 +64313,7 @@ MA_API ma_result ma_flac_read_pcm_frames(ma_flac* pFlac, void* pFramesOut, ma_ui result = MA_AT_END; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesRead; } @@ -64339,7 +64339,7 @@ MA_API ma_result ma_flac_read_pcm_frames(ma_flac* pFlac, void* pFramesOut, ma_ui MA_API ma_result ma_flac_seek_to_pcm_frame(ma_flac* pFlac, ma_uint64 frameIndex) { - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_INVALID_ARGS; } @@ -64369,38 +64369,38 @@ MA_API ma_result ma_flac_seek_to_pcm_frame(ma_flac* pFlac, ma_uint64 frameIndex) MA_API ma_result ma_flac_get_data_format(ma_flac* pFlac, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap) { /* Defaults for safety. */ - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = ma_format_unknown; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = 0; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = 0; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { MA_ZERO_MEMORY(pChannelMap, sizeof(*pChannelMap) * channelMapCap); } - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_INVALID_OPERATION; } - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = pFlac->format; } #if !defined(MA_NO_FLAC) { - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = pFlac->dr->channels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = pFlac->dr->sampleRate; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { ma_channel_map_init_standard(ma_standard_channel_map_microsoft, pChannelMap, channelMapCap, pFlac->dr->channels); } @@ -64417,13 +64417,13 @@ MA_API ma_result ma_flac_get_data_format(ma_flac* pFlac, ma_format* pFormat, ma_ MA_API ma_result ma_flac_get_cursor_in_pcm_frames(ma_flac* pFlac, ma_uint64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; /* Safety. */ - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_INVALID_ARGS; } @@ -64444,13 +64444,13 @@ MA_API ma_result ma_flac_get_cursor_in_pcm_frames(ma_flac* pFlac, ma_uint64* pCu MA_API ma_result ma_flac_get_length_in_pcm_frames(ma_flac* pFlac, ma_uint64* pLength) { - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; /* Safety. */ - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_INVALID_ARGS; } @@ -64479,7 +64479,7 @@ static ma_result ma_decoding_backend_init__flac(void* pUserData, ma_read_proc on /* For now we're just allocating the decoder backend on the heap. */ pFlac = (ma_flac*)ma_malloc(sizeof(*pFlac), pAllocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_OUT_OF_MEMORY; } @@ -64503,7 +64503,7 @@ static ma_result ma_decoding_backend_init_file__flac(void* pUserData, const char /* For now we're just allocating the decoder backend on the heap. */ pFlac = (ma_flac*)ma_malloc(sizeof(*pFlac), pAllocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_OUT_OF_MEMORY; } @@ -64527,7 +64527,7 @@ static ma_result ma_decoding_backend_init_file_w__flac(void* pUserData, const wc /* For now we're just allocating the decoder backend on the heap. */ pFlac = (ma_flac*)ma_malloc(sizeof(*pFlac), pAllocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_OUT_OF_MEMORY; } @@ -64551,7 +64551,7 @@ static ma_result ma_decoding_backend_init_memory__flac(void* pUserData, const vo /* For now we're just allocating the decoder backend on the heap. */ pFlac = (ma_flac*)ma_malloc(sizeof(*pFlac), pAllocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_OUT_OF_MEMORY; } @@ -64587,22 +64587,22 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_flac = static ma_result ma_decoder_init_flac__internal(const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_vtable__internal(&g_ma_decoding_backend_vtable_flac, NULL, pConfig, pDecoder); + return ma_decoder_init_from_vtable__internal(&g_ma_decoding_backend_vtable_flac, nullptr, pConfig, pDecoder); } static ma_result ma_decoder_init_flac_from_file__internal(const char* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_file__internal(&g_ma_decoding_backend_vtable_flac, NULL, pFilePath, pConfig, pDecoder); + return ma_decoder_init_from_file__internal(&g_ma_decoding_backend_vtable_flac, nullptr, pFilePath, pConfig, pDecoder); } static ma_result ma_decoder_init_flac_from_file_w__internal(const wchar_t* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_file_w__internal(&g_ma_decoding_backend_vtable_flac, NULL, pFilePath, pConfig, pDecoder); + return ma_decoder_init_from_file_w__internal(&g_ma_decoding_backend_vtable_flac, nullptr, pFilePath, pConfig, pDecoder); } static ma_result ma_decoder_init_flac_from_memory__internal(const void* pData, size_t dataSize, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_memory__internal(&g_ma_decoding_backend_vtable_flac, NULL, pData, dataSize, pConfig, pDecoder); + return ma_decoder_init_from_memory__internal(&g_ma_decoding_backend_vtable_flac, nullptr, pData, dataSize, pConfig, pDecoder); } #endif /* ma_dr_flac_h */ @@ -64668,7 +64668,7 @@ static ma_data_source_vtable g_ma_mp3_ds_vtable = ma_mp3_ds_get_data_format, ma_mp3_ds_get_cursor, ma_mp3_ds_get_length, - NULL, /* onSetLooping */ + nullptr, /* onSetLooping */ 0 }; @@ -64680,7 +64680,7 @@ static size_t ma_mp3_dr_callback__read(void* pUserData, void* pBufferOut, size_t ma_result result; size_t bytesRead; - MA_ASSERT(pMP3 != NULL); + MA_ASSERT(pMP3 != nullptr); result = pMP3->onRead(pMP3->pReadSeekTellUserData, pBufferOut, bytesToRead, &bytesRead); (void)result; @@ -64694,7 +64694,7 @@ static ma_bool32 ma_mp3_dr_callback__seek(void* pUserData, int offset, ma_dr_mp3 ma_result result; ma_seek_origin maSeekOrigin; - MA_ASSERT(pMP3 != NULL); + MA_ASSERT(pMP3 != nullptr); if (origin == MA_DR_MP3_SEEK_SET) { maSeekOrigin = ma_seek_origin_start; @@ -64717,7 +64717,7 @@ static ma_bool32 ma_mp3_dr_callback__tell(void* pUserData, ma_int64* pCursor) ma_mp3* pMP3 = (ma_mp3*)pUserData; ma_result result; - MA_ASSERT(pMP3 != NULL); + MA_ASSERT(pMP3 != nullptr); result = pMP3->onTell(pMP3->pReadSeekTellUserData, pCursor); if (result != MA_SUCCESS) { @@ -64733,14 +64733,14 @@ static ma_result ma_mp3_init_internal(const ma_decoding_backend_config* pConfig, ma_result result; ma_data_source_config dataSourceConfig; - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pMP3); pMP3->format = ma_format_f32; /* f32 by default. */ - if (pConfig != NULL && (pConfig->preferredFormat == ma_format_f32 || pConfig->preferredFormat == ma_format_s16)) { + if (pConfig != nullptr && (pConfig->preferredFormat == ma_format_f32 || pConfig->preferredFormat == ma_format_s16)) { pMP3->format = pConfig->preferredFormat; } else { /* Getting here means something other than f32 and s16 was specified. Just leave this unset to use the default format. */ @@ -64761,15 +64761,15 @@ static ma_result ma_mp3_generate_seek_table(ma_mp3* pMP3, const ma_decoding_back { ma_bool32 mp3Result; ma_uint32 seekPointCount = 0; - ma_dr_mp3_seek_point* pSeekPoints = NULL; + ma_dr_mp3_seek_point* pSeekPoints = nullptr; - MA_ASSERT(pMP3 != NULL); - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pMP3 != nullptr); + MA_ASSERT(pConfig != nullptr); seekPointCount = pConfig->seekPointCount; if (seekPointCount > 0) { pSeekPoints = (ma_dr_mp3_seek_point*)ma_malloc(sizeof(*pMP3->pSeekPoints) * seekPointCount, pAllocationCallbacks); - if (pSeekPoints == NULL) { + if (pSeekPoints == nullptr) { return MA_OUT_OF_MEMORY; } } @@ -64813,7 +64813,7 @@ MA_API ma_result ma_mp3_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_p return result; } - if (onRead == NULL || onSeek == NULL) { + if (onRead == nullptr || onSeek == nullptr) { return MA_INVALID_ARGS; /* onRead and onSeek are mandatory. */ } @@ -64826,7 +64826,7 @@ MA_API ma_result ma_mp3_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_tell_p { ma_bool32 mp3Result; - mp3Result = ma_dr_mp3_init(&pMP3->dr, ma_mp3_dr_callback__read, ma_mp3_dr_callback__seek, ma_mp3_dr_callback__tell, NULL, pMP3, pAllocationCallbacks); + mp3Result = ma_dr_mp3_init(&pMP3->dr, ma_mp3_dr_callback__read, ma_mp3_dr_callback__seek, ma_mp3_dr_callback__tell, nullptr, pMP3, pAllocationCallbacks); if (mp3Result != MA_TRUE) { return MA_INVALID_FILE; } @@ -64943,7 +64943,7 @@ MA_API ma_result ma_mp3_init_memory(const void* pData, size_t dataSize, const ma MA_API void ma_mp3_uninit(ma_mp3* pMP3, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return; } @@ -64966,7 +64966,7 @@ MA_API void ma_mp3_uninit(ma_mp3* pMP3, const ma_allocation_callbacks* pAllocati MA_API ma_result ma_mp3_read_pcm_frames(ma_mp3* pMP3, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -64974,7 +64974,7 @@ MA_API ma_result ma_mp3_read_pcm_frames(ma_mp3* pMP3, void* pFramesOut, ma_uint6 return MA_INVALID_ARGS; } - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_INVALID_ARGS; } @@ -64985,7 +64985,7 @@ MA_API ma_result ma_mp3_read_pcm_frames(ma_mp3* pMP3, void* pFramesOut, ma_uint6 ma_uint64 totalFramesRead = 0; ma_format format; - ma_mp3_get_data_format(pMP3, &format, NULL, NULL, NULL, 0); + ma_mp3_get_data_format(pMP3, &format, nullptr, nullptr, nullptr, 0); switch (format) { @@ -65014,7 +65014,7 @@ MA_API ma_result ma_mp3_read_pcm_frames(ma_mp3* pMP3, void* pFramesOut, ma_uint6 result = MA_AT_END; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesRead; } @@ -65036,7 +65036,7 @@ MA_API ma_result ma_mp3_read_pcm_frames(ma_mp3* pMP3, void* pFramesOut, ma_uint6 MA_API ma_result ma_mp3_seek_to_pcm_frame(ma_mp3* pMP3, ma_uint64 frameIndex) { - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_INVALID_ARGS; } @@ -65066,38 +65066,38 @@ MA_API ma_result ma_mp3_seek_to_pcm_frame(ma_mp3* pMP3, ma_uint64 frameIndex) MA_API ma_result ma_mp3_get_data_format(ma_mp3* pMP3, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap) { /* Defaults for safety. */ - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = ma_format_unknown; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = 0; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = 0; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { MA_ZERO_MEMORY(pChannelMap, sizeof(*pChannelMap) * channelMapCap); } - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_INVALID_OPERATION; } - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = pMP3->format; } #if !defined(MA_NO_MP3) { - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = pMP3->dr.channels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = pMP3->dr.sampleRate; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { ma_channel_map_init_standard(ma_standard_channel_map_default, pChannelMap, channelMapCap, pMP3->dr.channels); } @@ -65114,13 +65114,13 @@ MA_API ma_result ma_mp3_get_data_format(ma_mp3* pMP3, ma_format* pFormat, ma_uin MA_API ma_result ma_mp3_get_cursor_in_pcm_frames(ma_mp3* pMP3, ma_uint64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; /* Safety. */ - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_INVALID_ARGS; } @@ -65141,13 +65141,13 @@ MA_API ma_result ma_mp3_get_cursor_in_pcm_frames(ma_mp3* pMP3, ma_uint64* pCurso MA_API ma_result ma_mp3_get_length_in_pcm_frames(ma_mp3* pMP3, ma_uint64* pLength) { - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; /* Safety. */ - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_INVALID_ARGS; } @@ -65176,7 +65176,7 @@ static ma_result ma_decoding_backend_init__mp3(void* pUserData, ma_read_proc onR /* For now we're just allocating the decoder backend on the heap. */ pMP3 = (ma_mp3*)ma_malloc(sizeof(*pMP3), pAllocationCallbacks); - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_OUT_OF_MEMORY; } @@ -65200,7 +65200,7 @@ static ma_result ma_decoding_backend_init_file__mp3(void* pUserData, const char* /* For now we're just allocating the decoder backend on the heap. */ pMP3 = (ma_mp3*)ma_malloc(sizeof(*pMP3), pAllocationCallbacks); - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_OUT_OF_MEMORY; } @@ -65224,7 +65224,7 @@ static ma_result ma_decoding_backend_init_file_w__mp3(void* pUserData, const wch /* For now we're just allocating the decoder backend on the heap. */ pMP3 = (ma_mp3*)ma_malloc(sizeof(*pMP3), pAllocationCallbacks); - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_OUT_OF_MEMORY; } @@ -65248,7 +65248,7 @@ static ma_result ma_decoding_backend_init_memory__mp3(void* pUserData, const voi /* For now we're just allocating the decoder backend on the heap. */ pMP3 = (ma_mp3*)ma_malloc(sizeof(*pMP3), pAllocationCallbacks); - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_OUT_OF_MEMORY; } @@ -65284,22 +65284,22 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_mp3 = static ma_result ma_decoder_init_mp3__internal(const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_vtable__internal(&g_ma_decoding_backend_vtable_mp3, NULL, pConfig, pDecoder); + return ma_decoder_init_from_vtable__internal(&g_ma_decoding_backend_vtable_mp3, nullptr, pConfig, pDecoder); } static ma_result ma_decoder_init_mp3_from_file__internal(const char* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_file__internal(&g_ma_decoding_backend_vtable_mp3, NULL, pFilePath, pConfig, pDecoder); + return ma_decoder_init_from_file__internal(&g_ma_decoding_backend_vtable_mp3, nullptr, pFilePath, pConfig, pDecoder); } static ma_result ma_decoder_init_mp3_from_file_w__internal(const wchar_t* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_file_w__internal(&g_ma_decoding_backend_vtable_mp3, NULL, pFilePath, pConfig, pDecoder); + return ma_decoder_init_from_file_w__internal(&g_ma_decoding_backend_vtable_mp3, nullptr, pFilePath, pConfig, pDecoder); } static ma_result ma_decoder_init_mp3_from_memory__internal(const void* pData, size_t dataSize, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_memory__internal(&g_ma_decoding_backend_vtable_mp3, NULL, pData, dataSize, pConfig, pDecoder); + return ma_decoder_init_from_memory__internal(&g_ma_decoding_backend_vtable_mp3, nullptr, pData, dataSize, pConfig, pDecoder); } #endif /* ma_dr_mp3_h */ @@ -65381,7 +65381,7 @@ static ma_data_source_vtable g_ma_stbvorbis_ds_vtable = ma_stbvorbis_ds_get_data_format, ma_stbvorbis_ds_get_cursor, ma_stbvorbis_ds_get_length, - NULL, /* onSetLooping */ + nullptr, /* onSetLooping */ 0 }; @@ -65393,7 +65393,7 @@ static ma_result ma_stbvorbis_init_internal(const ma_decoding_backend_config* pC (void)pConfig; - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_INVALID_ARGS; } @@ -65416,7 +65416,7 @@ static ma_result ma_stbvorbis_post_init(ma_stbvorbis* pVorbis) { stb_vorbis_info info; - MA_ASSERT(pVorbis != NULL); + MA_ASSERT(pVorbis != nullptr); info = stb_vorbis_get_info(pVorbis->stb); @@ -65432,7 +65432,7 @@ static ma_result ma_stbvorbis_init_internal_decoder_push(ma_stbvorbis* pVorbis) stb_vorbis* stb; size_t dataSize = 0; size_t dataCapacity = 0; - ma_uint8* pData = NULL; /* <-- Must be initialized to NULL. */ + ma_uint8* pData = nullptr; /* <-- Must be initialized to nullptr. */ for (;;) { int vorbisError; @@ -65443,7 +65443,7 @@ static ma_result ma_stbvorbis_init_internal_decoder_push(ma_stbvorbis* pVorbis) /* Allocate memory for the new chunk. */ dataCapacity += MA_VORBIS_DATA_CHUNK_SIZE; pNewData = (ma_uint8*)ma_realloc(pData, dataCapacity, &pVorbis->allocationCallbacks); - if (pNewData == NULL) { + if (pNewData == nullptr) { ma_free(pData, &pVorbis->allocationCallbacks); return MA_OUT_OF_MEMORY; } @@ -65465,8 +65465,8 @@ static ma_result ma_stbvorbis_init_internal_decoder_push(ma_stbvorbis* pVorbis) return MA_TOO_BIG; } - stb = stb_vorbis_open_pushdata(pData, (int)dataSize, &consumedDataSize, &vorbisError, NULL); - if (stb != NULL) { + stb = stb_vorbis_open_pushdata(pData, (int)dataSize, &consumedDataSize, &vorbisError, nullptr); + if (stb != nullptr) { /* Successfully opened the Vorbis decoder. We might have some leftover unprocessed data so we'll need to move that down to the front. @@ -65492,7 +65492,7 @@ static ma_result ma_stbvorbis_init_internal_decoder_push(ma_stbvorbis* pVorbis) } } - MA_ASSERT(stb != NULL); + MA_ASSERT(stb != nullptr); pVorbis->stb = stb; pVorbis->push.pData = pData; pVorbis->push.dataSize = dataSize; @@ -65511,7 +65511,7 @@ MA_API ma_result ma_stbvorbis_init(ma_read_proc onRead, ma_seek_proc onSeek, ma_ return result; } - if (onRead == NULL || onSeek == NULL) { + if (onRead == nullptr || onSeek == nullptr) { return MA_INVALID_ARGS; /* onRead and onSeek are mandatory. */ } @@ -65567,8 +65567,8 @@ MA_API ma_result ma_stbvorbis_init_file(const char* pFilePath, const ma_decoding (void)pAllocationCallbacks; /* Don't know how to make use of this with stb_vorbis. */ /* We can use stb_vorbis' pull mode for file based streams. */ - pVorbis->stb = stb_vorbis_open_filename(pFilePath, NULL, NULL); - if (pVorbis->stb == NULL) { + pVorbis->stb = stb_vorbis_open_filename(pFilePath, nullptr, nullptr); + if (pVorbis->stb == nullptr) { return MA_INVALID_FILE; } @@ -65610,8 +65610,8 @@ MA_API ma_result ma_stbvorbis_init_memory(const void* pData, size_t dataSize, co return MA_TOO_BIG; } - pVorbis->stb = stb_vorbis_open_memory((const unsigned char*)pData, (int)dataSize, NULL, NULL); - if (pVorbis->stb == NULL) { + pVorbis->stb = stb_vorbis_open_memory((const unsigned char*)pData, (int)dataSize, nullptr, nullptr); + if (pVorbis->stb == nullptr) { return MA_INVALID_FILE; } @@ -65638,7 +65638,7 @@ MA_API ma_result ma_stbvorbis_init_memory(const void* pData, size_t dataSize, co MA_API void ma_stbvorbis_uninit(ma_stbvorbis* pVorbis, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return; } @@ -65663,7 +65663,7 @@ MA_API void ma_stbvorbis_uninit(ma_stbvorbis* pVorbis, const ma_allocation_callb MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -65671,7 +65671,7 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram return MA_INVALID_ARGS; } - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_INVALID_ARGS; } @@ -65683,7 +65683,7 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram ma_format format; ma_uint32 channels; - ma_stbvorbis_get_data_format(pVorbis, &format, &channels, NULL, NULL, 0); + ma_stbvorbis_get_data_format(pVorbis, &format, &channels, nullptr, nullptr, 0); if (format == ma_format_f32) { /* We read differently depending on whether or not we're using push mode. */ @@ -65696,7 +65696,7 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram ma_uint32 framesToReadFromCache = (ma_uint32)ma_min(pVorbis->push.framesRemaining, (frameCount - totalFramesRead)); /* Safe cast because pVorbis->framesRemaining is 32-bit. */ /* The output pointer can be null in which case we just treat it as a seek. */ - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { ma_uint64 iFrame; for (iFrame = 0; iFrame < framesToReadFromCache; iFrame += 1) { ma_uint32 iChannel; @@ -65730,7 +65730,7 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram break; /* Too big. */ } - consumedDataSize = stb_vorbis_decode_frame_pushdata(pVorbis->stb, pVorbis->push.pData, (int)pVorbis->push.dataSize, NULL, &pVorbis->push.ppPacketData, &samplesRead); + consumedDataSize = stb_vorbis_decode_frame_pushdata(pVorbis->stb, pVorbis->push.pData, (int)pVorbis->push.dataSize, nullptr, &pVorbis->push.ppPacketData, &samplesRead); if (consumedDataSize != 0) { /* Successfully decoded a Vorbis frame. Consume the data. */ pVorbis->push.dataSize -= (size_t)consumedDataSize; @@ -65750,7 +65750,7 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram ma_uint8* pNewData; pNewData = (ma_uint8*)ma_realloc(pVorbis->push.pData, newCap, &pVorbis->allocationCallbacks); - if (pNewData == NULL) { + if (pNewData == nullptr) { result = MA_OUT_OF_MEMORY; break; } @@ -65802,7 +65802,7 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram result = MA_AT_END; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesRead; } @@ -65828,7 +65828,7 @@ MA_API ma_result ma_stbvorbis_read_pcm_frames(ma_stbvorbis* pVorbis, void* pFram MA_API ma_result ma_stbvorbis_seek_to_pcm_frame(ma_stbvorbis* pVorbis, ma_uint64 frameIndex) { - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_INVALID_ARGS; } @@ -65918,38 +65918,38 @@ MA_API ma_result ma_stbvorbis_seek_to_pcm_frame(ma_stbvorbis* pVorbis, ma_uint64 MA_API ma_result ma_stbvorbis_get_data_format(ma_stbvorbis* pVorbis, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap) { /* Defaults for safety. */ - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = ma_format_unknown; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = 0; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = 0; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { MA_ZERO_MEMORY(pChannelMap, sizeof(*pChannelMap) * channelMapCap); } - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_INVALID_OPERATION; } - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = pVorbis->format; } #if !defined(MA_NO_VORBIS) { - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = pVorbis->channels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = pVorbis->sampleRate; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { ma_channel_map_init_standard(ma_standard_channel_map_vorbis, pChannelMap, channelMapCap, pVorbis->channels); } @@ -65966,13 +65966,13 @@ MA_API ma_result ma_stbvorbis_get_data_format(ma_stbvorbis* pVorbis, ma_format* MA_API ma_result ma_stbvorbis_get_cursor_in_pcm_frames(ma_stbvorbis* pVorbis, ma_uint64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; /* Safety. */ - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_INVALID_ARGS; } @@ -65993,13 +65993,13 @@ MA_API ma_result ma_stbvorbis_get_cursor_in_pcm_frames(ma_stbvorbis* pVorbis, ma MA_API ma_result ma_stbvorbis_get_length_in_pcm_frames(ma_stbvorbis* pVorbis, ma_uint64* pLength) { - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; /* Safety. */ - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_INVALID_ARGS; } @@ -66032,7 +66032,7 @@ static ma_result ma_decoding_backend_init__stbvorbis(void* pUserData, ma_read_pr /* For now we're just allocating the decoder backend on the heap. */ pVorbis = (ma_stbvorbis*)ma_malloc(sizeof(*pVorbis), pAllocationCallbacks); - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_OUT_OF_MEMORY; } @@ -66056,7 +66056,7 @@ static ma_result ma_decoding_backend_init_file__stbvorbis(void* pUserData, const /* For now we're just allocating the decoder backend on the heap. */ pVorbis = (ma_stbvorbis*)ma_malloc(sizeof(*pVorbis), pAllocationCallbacks); - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_OUT_OF_MEMORY; } @@ -66080,7 +66080,7 @@ static ma_result ma_decoding_backend_init_memory__stbvorbis(void* pUserData, con /* For now we're just allocating the decoder backend on the heap. */ pVorbis = (ma_stbvorbis*)ma_malloc(sizeof(*pVorbis), pAllocationCallbacks); - if (pVorbis == NULL) { + if (pVorbis == nullptr) { return MA_OUT_OF_MEMORY; } @@ -66109,29 +66109,29 @@ static ma_decoding_backend_vtable g_ma_decoding_backend_vtable_stbvorbis = { ma_decoding_backend_init__stbvorbis, ma_decoding_backend_init_file__stbvorbis, - NULL, /* onInitFileW() */ + nullptr, /* onInitFileW() */ ma_decoding_backend_init_memory__stbvorbis, ma_decoding_backend_uninit__stbvorbis }; static ma_result ma_decoder_init_vorbis__internal(const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_vtable__internal(&g_ma_decoding_backend_vtable_stbvorbis, NULL, pConfig, pDecoder); + return ma_decoder_init_from_vtable__internal(&g_ma_decoding_backend_vtable_stbvorbis, nullptr, pConfig, pDecoder); } static ma_result ma_decoder_init_vorbis_from_file__internal(const char* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_file__internal(&g_ma_decoding_backend_vtable_stbvorbis, NULL, pFilePath, pConfig, pDecoder); + return ma_decoder_init_from_file__internal(&g_ma_decoding_backend_vtable_stbvorbis, nullptr, pFilePath, pConfig, pDecoder); } static ma_result ma_decoder_init_vorbis_from_file_w__internal(const wchar_t* pFilePath, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_file_w__internal(&g_ma_decoding_backend_vtable_stbvorbis, NULL, pFilePath, pConfig, pDecoder); + return ma_decoder_init_from_file_w__internal(&g_ma_decoding_backend_vtable_stbvorbis, nullptr, pFilePath, pConfig, pDecoder); } static ma_result ma_decoder_init_vorbis_from_memory__internal(const void* pData, size_t dataSize, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - return ma_decoder_init_from_memory__internal(&g_ma_decoding_backend_vtable_stbvorbis, NULL, pData, dataSize, pConfig, pDecoder); + return ma_decoder_init_from_memory__internal(&g_ma_decoding_backend_vtable_stbvorbis, nullptr, pData, dataSize, pConfig, pDecoder); } #endif /* STB_VORBIS_INCLUDE_STB_VORBIS_H */ @@ -66139,9 +66139,9 @@ static ma_result ma_decoder_init_vorbis_from_memory__internal(const void* pData, static ma_result ma_decoder__init_allocation_callbacks(const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); - if (pConfig != NULL) { + if (pConfig != nullptr) { return ma_allocation_callbacks_init_copy(&pDecoder->allocationCallbacks, &pConfig->allocationCallbacks); } else { pDecoder->allocationCallbacks = ma_allocation_callbacks_init_default(); @@ -66181,7 +66181,7 @@ static ma_data_source_vtable g_ma_decoder_data_source_vtable = ma_decoder__data_source_on_get_data_format, ma_decoder__data_source_on_get_cursor, ma_decoder__data_source_on_get_length, - NULL, /* onSetLooping */ + nullptr, /* onSetLooping */ 0 }; @@ -66190,9 +66190,9 @@ static ma_result ma_decoder__preinit(ma_decoder_read_proc onRead, ma_decoder_see ma_result result; ma_data_source_config dataSourceConfig; - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pConfig != nullptr); - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_INVALID_ARGS; } @@ -66240,8 +66240,8 @@ static ma_result ma_decoder_init__internal(ma_decoder_read_proc onRead, ma_decod { ma_result result = MA_NO_BACKEND; - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pDecoder != nullptr); /* Silence some warnings in the case that we don't have any decoder backends enabled. */ (void)onRead; @@ -66346,7 +66346,7 @@ MA_API ma_result ma_decoder_init(ma_decoder_read_proc onRead, ma_decoder_seek_pr config = ma_decoder_config_init_copy(pConfig); - result = ma_decoder__preinit(onRead, onSeek, NULL, pUserData, &config, pDecoder); + result = ma_decoder__preinit(onRead, onSeek, nullptr, pUserData, &config, pDecoder); if (result != MA_SUCCESS) { return result; } @@ -66361,7 +66361,7 @@ static ma_result ma_decoder__on_read_memory(ma_decoder* pDecoder, void* pBufferO MA_ASSERT(pDecoder->data.memory.dataSize >= pDecoder->data.memory.currentReadPos); - if (pBytesRead != NULL) { + if (pBytesRead != nullptr) { *pBytesRead = 0; } @@ -66379,7 +66379,7 @@ static ma_result ma_decoder__on_read_memory(ma_decoder* pDecoder, void* pBufferO pDecoder->data.memory.currentReadPos += bytesToRead; } - if (pBytesRead != NULL) { + if (pBytesRead != nullptr) { *pBytesRead = bytesToRead; } @@ -66431,8 +66431,8 @@ static ma_result ma_decoder__on_seek_memory(ma_decoder* pDecoder, ma_int64 byteO static ma_result ma_decoder__on_tell_memory(ma_decoder* pDecoder, ma_int64* pCursor) { - MA_ASSERT(pDecoder != NULL); - MA_ASSERT(pCursor != NULL); + MA_ASSERT(pDecoder != nullptr); + MA_ASSERT(pCursor != nullptr); *pCursor = (ma_int64)pDecoder->data.memory.currentReadPos; @@ -66441,12 +66441,12 @@ static ma_result ma_decoder__on_tell_memory(ma_decoder* pDecoder, ma_int64* pCur static ma_result ma_decoder__preinit_memory_wrapper(const void* pData, size_t dataSize, const ma_decoder_config* pConfig, ma_decoder* pDecoder) { - ma_result result = ma_decoder__preinit(ma_decoder__on_read_memory, ma_decoder__on_seek_memory, ma_decoder__on_tell_memory, NULL, pConfig, pDecoder); + ma_result result = ma_decoder__preinit(ma_decoder__on_read_memory, ma_decoder__on_seek_memory, ma_decoder__on_tell_memory, nullptr, pConfig, pDecoder); if (result != MA_SUCCESS) { return result; } - if (pData == NULL || dataSize == 0) { + if (pData == nullptr || dataSize == 0) { return MA_INVALID_ARGS; } @@ -66465,12 +66465,12 @@ MA_API ma_result ma_decoder_init_memory(const void* pData, size_t dataSize, cons config = ma_decoder_config_init_copy(pConfig); - result = ma_decoder__preinit(NULL, NULL, NULL, NULL, &config, pDecoder); + result = ma_decoder__preinit(nullptr, nullptr, nullptr, nullptr, &config, pDecoder); if (result != MA_SUCCESS) { return result; } - if (pData == NULL || dataSize == 0) { + if (pData == nullptr || dataSize == 0) { return MA_INVALID_ARGS; } @@ -66560,7 +66560,7 @@ MA_API ma_result ma_decoder_init_memory(const void* pData, size_t dataSize, cons return result; } - result = ma_decoder_init__internal(ma_decoder__on_read_memory, ma_decoder__on_seek_memory, NULL, &config, pDecoder); + result = ma_decoder_init__internal(ma_decoder__on_read_memory, ma_decoder__on_seek_memory, nullptr, &config, pDecoder); if (result != MA_SUCCESS) { return result; } @@ -66582,8 +66582,8 @@ static const char* ma_path_file_name(const char* path) { const char* fileName; - if (path == NULL) { - return NULL; + if (path == nullptr) { + return nullptr; } fileName = path; @@ -66609,8 +66609,8 @@ static const wchar_t* ma_path_file_name_w(const wchar_t* path) { const wchar_t* fileName; - if (path == NULL) { - return NULL; + if (path == nullptr) { + return nullptr; } fileName = path; @@ -66638,12 +66638,12 @@ static const char* ma_path_extension(const char* path) const char* extension; const char* lastOccurance; - if (path == NULL) { + if (path == nullptr) { path = ""; } extension = ma_path_file_name(path); - lastOccurance = NULL; + lastOccurance = nullptr; /* Just find the last '.' and return. */ while (extension[0] != '\0') { @@ -66655,7 +66655,7 @@ static const char* ma_path_extension(const char* path) extension += 1; } - return (lastOccurance != NULL) ? lastOccurance : extension; + return (lastOccurance != nullptr) ? lastOccurance : extension; } static const wchar_t* ma_path_extension_w(const wchar_t* path) @@ -66663,12 +66663,12 @@ static const wchar_t* ma_path_extension_w(const wchar_t* path) const wchar_t* extension; const wchar_t* lastOccurance; - if (path == NULL) { + if (path == nullptr) { path = L""; } extension = ma_path_file_name_w(path); - lastOccurance = NULL; + lastOccurance = nullptr; /* Just find the last '.' and return. */ while (extension[0] != '\0') { @@ -66680,7 +66680,7 @@ static const wchar_t* ma_path_extension_w(const wchar_t* path) extension += 1; } - return (lastOccurance != NULL) ? lastOccurance : extension; + return (lastOccurance != nullptr) ? lastOccurance : extension; } @@ -66689,7 +66689,7 @@ static ma_bool32 ma_path_extension_equal(const char* path, const char* extension const char* ext1; const char* ext2; - if (path == NULL || extension == NULL) { + if (path == nullptr || extension == nullptr) { return MA_FALSE; } @@ -66708,7 +66708,7 @@ static ma_bool32 ma_path_extension_equal_w(const wchar_t* path, const wchar_t* e const wchar_t* ext1; const wchar_t* ext2; - if (path == NULL || extension == NULL) { + if (path == nullptr || extension == nullptr) { return MA_FALSE; } @@ -66758,22 +66758,22 @@ static ma_bool32 ma_path_extension_equal_w(const wchar_t* path, const wchar_t* e static ma_result ma_decoder__on_read_vfs(ma_decoder* pDecoder, void* pBufferOut, size_t bytesToRead, size_t* pBytesRead) { - MA_ASSERT(pDecoder != NULL); - MA_ASSERT(pBufferOut != NULL); + MA_ASSERT(pDecoder != nullptr); + MA_ASSERT(pBufferOut != nullptr); return ma_vfs_or_default_read(pDecoder->data.vfs.pVFS, pDecoder->data.vfs.file, pBufferOut, bytesToRead, pBytesRead); } static ma_result ma_decoder__on_seek_vfs(ma_decoder* pDecoder, ma_int64 offset, ma_seek_origin origin) { - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); return ma_vfs_or_default_seek(pDecoder->data.vfs.pVFS, pDecoder->data.vfs.file, offset, origin); } static ma_result ma_decoder__on_tell_vfs(ma_decoder* pDecoder, ma_int64* pCursor) { - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); return ma_vfs_or_default_tell(pDecoder->data.vfs.pVFS, pDecoder->data.vfs.file, pCursor); } @@ -66783,12 +66783,12 @@ static ma_result ma_decoder__preinit_vfs(ma_vfs* pVFS, const char* pFilePath, co ma_result result; ma_vfs_file file; - result = ma_decoder__preinit(ma_decoder__on_read_vfs, ma_decoder__on_seek_vfs, ma_decoder__on_tell_vfs, NULL, pConfig, pDecoder); + result = ma_decoder__preinit(ma_decoder__on_read_vfs, ma_decoder__on_seek_vfs, ma_decoder__on_tell_vfs, nullptr, pConfig, pDecoder); if (result != MA_SUCCESS) { return result; } - if (pFilePath == NULL || pFilePath[0] == '\0') { + if (pFilePath == nullptr || pFilePath[0] == '\0') { return MA_INVALID_ARGS; } @@ -66892,13 +66892,13 @@ MA_API ma_result ma_decoder_init_vfs(ma_vfs* pVFS, const char* pFilePath, const /* If we still haven't got a result just use trial and error. Otherwise we can finish up. */ if (result != MA_SUCCESS) { - result = ma_decoder_init__internal(ma_decoder__on_read_vfs, ma_decoder__on_seek_vfs, NULL, &config, pDecoder); + result = ma_decoder_init__internal(ma_decoder__on_read_vfs, ma_decoder__on_seek_vfs, nullptr, &config, pDecoder); } else { result = ma_decoder__postinit(&config, pDecoder); } if (result != MA_SUCCESS) { - if (pDecoder->data.vfs.file != NULL) { /* <-- Will be reset to NULL if ma_decoder_uninit() is called in one of the steps above which allows us to avoid a double close of the file. */ + if (pDecoder->data.vfs.file != nullptr) { /* <-- Will be reset to nullptr if ma_decoder_uninit() is called in one of the steps above which allows us to avoid a double close of the file. */ ma_vfs_or_default_close(pVFS, pDecoder->data.vfs.file); } @@ -66914,12 +66914,12 @@ static ma_result ma_decoder__preinit_vfs_w(ma_vfs* pVFS, const wchar_t* pFilePat ma_result result; ma_vfs_file file; - result = ma_decoder__preinit(ma_decoder__on_read_vfs, ma_decoder__on_seek_vfs, ma_decoder__on_tell_vfs, NULL, pConfig, pDecoder); + result = ma_decoder__preinit(ma_decoder__on_read_vfs, ma_decoder__on_seek_vfs, ma_decoder__on_tell_vfs, nullptr, pConfig, pDecoder); if (result != MA_SUCCESS) { return result; } - if (pFilePath == NULL || pFilePath[0] == '\0') { + if (pFilePath == nullptr || pFilePath[0] == '\0') { return MA_INVALID_ARGS; } @@ -67023,7 +67023,7 @@ MA_API ma_result ma_decoder_init_vfs_w(ma_vfs* pVFS, const wchar_t* pFilePath, c /* If we still haven't got a result just use trial and error. Otherwise we can finish up. */ if (result != MA_SUCCESS) { - result = ma_decoder_init__internal(ma_decoder__on_read_vfs, ma_decoder__on_seek_vfs, NULL, &config, pDecoder); + result = ma_decoder_init__internal(ma_decoder__on_read_vfs, ma_decoder__on_seek_vfs, nullptr, &config, pDecoder); } else { result = ma_decoder__postinit(&config, pDecoder); } @@ -67041,12 +67041,12 @@ static ma_result ma_decoder__preinit_file(const char* pFilePath, const ma_decode { ma_result result; - result = ma_decoder__preinit(NULL, NULL, NULL, NULL, pConfig, pDecoder); + result = ma_decoder__preinit(nullptr, nullptr, nullptr, nullptr, pConfig, pDecoder); if (result != MA_SUCCESS) { return result; } - if (pFilePath == NULL || pFilePath[0] == '\0') { + if (pFilePath == nullptr || pFilePath[0] == '\0') { return MA_INVALID_ARGS; } @@ -67170,7 +67170,7 @@ MA_API ma_result ma_decoder_init_file(const char* pFilePath, const ma_decoder_co } } else { /* Probably no implementation for loading from a file path. Use miniaudio's file IO instead. */ - result = ma_decoder_init_vfs(NULL, pFilePath, pConfig, pDecoder); + result = ma_decoder_init_vfs(nullptr, pFilePath, pConfig, pDecoder); if (result != MA_SUCCESS) { return result; } @@ -67183,12 +67183,12 @@ static ma_result ma_decoder__preinit_file_w(const wchar_t* pFilePath, const ma_d { ma_result result; - result = ma_decoder__preinit(NULL, NULL, NULL, NULL, pConfig, pDecoder); + result = ma_decoder__preinit(nullptr, nullptr, nullptr, nullptr, pConfig, pDecoder); if (result != MA_SUCCESS) { return result; } - if (pFilePath == NULL || pFilePath[0] == '\0') { + if (pFilePath == nullptr || pFilePath[0] == '\0') { return MA_INVALID_ARGS; } @@ -67312,7 +67312,7 @@ MA_API ma_result ma_decoder_init_file_w(const wchar_t* pFilePath, const ma_decod } } else { /* Probably no implementation for loading from a file path. Use miniaudio's file IO instead. */ - result = ma_decoder_init_vfs_w(NULL, pFilePath, pConfig, pDecoder); + result = ma_decoder_init_vfs_w(nullptr, pFilePath, pConfig, pDecoder); if (result != MA_SUCCESS) { return result; } @@ -67323,25 +67323,25 @@ MA_API ma_result ma_decoder_init_file_w(const wchar_t* pFilePath, const ma_decod MA_API ma_result ma_decoder_uninit(ma_decoder* pDecoder) { - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_INVALID_ARGS; } - if (pDecoder->pBackend != NULL) { - if (pDecoder->pBackendVTable != NULL && pDecoder->pBackendVTable->onUninit != NULL) { + if (pDecoder->pBackend != nullptr) { + if (pDecoder->pBackendVTable != nullptr && pDecoder->pBackendVTable->onUninit != nullptr) { pDecoder->pBackendVTable->onUninit(pDecoder->pBackendUserData, pDecoder->pBackend, &pDecoder->allocationCallbacks); } } if (pDecoder->onRead == ma_decoder__on_read_vfs) { ma_vfs_or_default_close(pDecoder->data.vfs.pVFS, pDecoder->data.vfs.file); - pDecoder->data.vfs.file = NULL; + pDecoder->data.vfs.file = nullptr; } ma_data_converter_uninit(&pDecoder->converter, &pDecoder->allocationCallbacks); ma_data_source_uninit(&pDecoder->ds); - if (pDecoder->pInputCache != NULL) { + if (pDecoder->pInputCache != nullptr) { ma_free(pDecoder->pInputCache, &pDecoder->allocationCallbacks); } @@ -67354,7 +67354,7 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO ma_uint64 totalFramesReadOut; void* pRunningFramesOut; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; /* Safety. */ } @@ -67362,11 +67362,11 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO return MA_INVALID_ARGS; } - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_INVALID_ARGS; } - if (pDecoder->pBackend == NULL) { + if (pDecoder->pBackend == nullptr) { return MA_INVALID_OPERATION; } @@ -67378,8 +67378,8 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO Getting here means we need to do data conversion. If we're seeking forward and are _not_ doing resampling we can run this in a fast path. If we're doing resampling we need to run through each sample because we need to ensure its internal cache is updated. */ - if (pFramesOut == NULL && pDecoder->converter.hasResampler == MA_FALSE) { - result = ma_data_source_read_pcm_frames(pDecoder->pBackend, NULL, frameCount, &totalFramesReadOut); + if (pFramesOut == nullptr && pDecoder->converter.hasResampler == MA_FALSE) { + result = ma_data_source_read_pcm_frames(pDecoder->pBackend, nullptr, frameCount, &totalFramesReadOut); } else { /* Slow path. Need to run everything through the data converter. */ ma_format internalFormat; @@ -67388,7 +67388,7 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO totalFramesReadOut = 0; pRunningFramesOut = pFramesOut; - result = ma_data_source_get_data_format(pDecoder->pBackend, &internalFormat, &internalChannels, NULL, NULL, 0); + result = ma_data_source_get_data_format(pDecoder->pBackend, &internalFormat, &internalChannels, nullptr, nullptr, 0); if (result != MA_SUCCESS) { return result; /* Failed to retrieve the internal format and channel count. */ } @@ -67399,7 +67399,7 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO the required number of input frames, we'll use the heap-allocated path. Otherwise we'll use the stack-allocated path. */ - if (pDecoder->pInputCache != NULL) { + if (pDecoder->pInputCache != nullptr) { /* We don't have a way of determining the required number of input frames, so need to persistently store input data in a cache. */ while (totalFramesReadOut < frameCount) { ma_uint64 framesToReadThisIterationIn; @@ -67423,7 +67423,7 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO totalFramesReadOut += framesToReadThisIterationOut; - if (pRunningFramesOut != NULL) { + if (pRunningFramesOut != nullptr) { pRunningFramesOut = ma_offset_ptr(pRunningFramesOut, framesToReadThisIterationOut * ma_get_bytes_per_frame(pDecoder->outputFormat, pDecoder->outputChannels)); } @@ -67491,7 +67491,7 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO totalFramesReadOut += framesReadThisIterationOut; - if (pRunningFramesOut != NULL) { + if (pRunningFramesOut != nullptr) { pRunningFramesOut = ma_offset_ptr(pRunningFramesOut, framesReadThisIterationOut * ma_get_bytes_per_frame(pDecoder->outputFormat, pDecoder->outputChannels)); } @@ -67505,7 +67505,7 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO pDecoder->readPointerInPCMFrames += totalFramesReadOut; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesReadOut; } @@ -67518,17 +67518,17 @@ MA_API ma_result ma_decoder_read_pcm_frames(ma_decoder* pDecoder, void* pFramesO MA_API ma_result ma_decoder_seek_to_pcm_frame(ma_decoder* pDecoder, ma_uint64 frameIndex) { - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_INVALID_ARGS; } - if (pDecoder->pBackend != NULL) { + if (pDecoder->pBackend != nullptr) { ma_result result; ma_uint64 internalFrameIndex; ma_uint32 internalSampleRate; ma_uint64 currentFrameIndex; - result = ma_data_source_get_data_format(pDecoder->pBackend, NULL, NULL, &internalSampleRate, NULL, 0); + result = ma_data_source_get_data_format(pDecoder->pBackend, nullptr, nullptr, &internalSampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; /* Failed to retrieve the internal sample rate. */ } @@ -67560,23 +67560,23 @@ MA_API ma_result ma_decoder_seek_to_pcm_frame(ma_decoder* pDecoder, ma_uint64 fr MA_API ma_result ma_decoder_get_data_format(ma_decoder* pDecoder, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap) { - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_INVALID_ARGS; } - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = pDecoder->outputFormat; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = pDecoder->outputChannels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = pDecoder->outputSampleRate; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { ma_data_converter_get_output_channel_map(&pDecoder->converter, pChannelMap, channelMapCap); } @@ -67585,13 +67585,13 @@ MA_API ma_result ma_decoder_get_data_format(ma_decoder* pDecoder, ma_format* pFo MA_API ma_result ma_decoder_get_cursor_in_pcm_frames(ma_decoder* pDecoder, ma_uint64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_INVALID_ARGS; } @@ -67602,17 +67602,17 @@ MA_API ma_result ma_decoder_get_cursor_in_pcm_frames(ma_decoder* pDecoder, ma_ui MA_API ma_result ma_decoder_get_length_in_pcm_frames(ma_decoder* pDecoder, ma_uint64* pLength) { - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_INVALID_ARGS; } - if (pDecoder->pBackend != NULL) { + if (pDecoder->pBackend != nullptr) { ma_result result; ma_uint64 internalLengthInPCMFrames; ma_uint32 internalSampleRate; @@ -67622,7 +67622,7 @@ MA_API ma_result ma_decoder_get_length_in_pcm_frames(ma_decoder* pDecoder, ma_ui return result; /* Failed to retrieve the internal length. */ } - result = ma_data_source_get_data_format(pDecoder->pBackend, NULL, NULL, &internalSampleRate, NULL, 0); + result = ma_data_source_get_data_format(pDecoder->pBackend, nullptr, nullptr, &internalSampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; /* Failed to retrieve the internal sample rate. */ } @@ -67644,13 +67644,13 @@ MA_API ma_result ma_decoder_get_available_frames(ma_decoder* pDecoder, ma_uint64 ma_result result; ma_uint64 totalFrameCount; - if (pAvailableFrames == NULL) { + if (pAvailableFrames == nullptr) { return MA_INVALID_ARGS; } *pAvailableFrames = 0; - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_INVALID_ARGS; } @@ -67677,14 +67677,14 @@ static ma_result ma_decoder__full_decode_and_uninit(ma_decoder* pDecoder, ma_dec ma_uint64 dataCapInFrames; void* pPCMFramesOut; - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pDecoder != nullptr); totalFrameCount = 0; bpf = ma_get_bytes_per_frame(pDecoder->outputFormat, pDecoder->outputChannels); /* The frame count is unknown until we try reading. Thus, we just run in a loop. */ dataCapInFrames = 0; - pPCMFramesOut = NULL; + pPCMFramesOut = nullptr; for (;;) { ma_uint64 frameCountToTryReading; ma_uint64 framesJustRead; @@ -67703,7 +67703,7 @@ static ma_result ma_decoder__full_decode_and_uninit(ma_decoder* pDecoder, ma_dec } pNewPCMFramesOut = (void*)ma_realloc(pPCMFramesOut, (size_t)(newDataCapInFrames * bpf), &pDecoder->allocationCallbacks); - if (pNewPCMFramesOut == NULL) { + if (pNewPCMFramesOut == nullptr) { ma_free(pPCMFramesOut, &pDecoder->allocationCallbacks); return MA_OUT_OF_MEMORY; } @@ -67728,19 +67728,19 @@ static ma_result ma_decoder__full_decode_and_uninit(ma_decoder* pDecoder, ma_dec } - if (pConfigOut != NULL) { + if (pConfigOut != nullptr) { pConfigOut->format = pDecoder->outputFormat; pConfigOut->channels = pDecoder->outputChannels; pConfigOut->sampleRate = pDecoder->outputSampleRate; } - if (ppPCMFramesOut != NULL) { + if (ppPCMFramesOut != nullptr) { *ppPCMFramesOut = pPCMFramesOut; } else { ma_free(pPCMFramesOut, &pDecoder->allocationCallbacks); } - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = totalFrameCount; } @@ -67754,11 +67754,11 @@ MA_API ma_result ma_decode_from_vfs(ma_vfs* pVFS, const char* pFilePath, ma_deco ma_decoder_config config; ma_decoder decoder; - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = 0; } - if (ppPCMFramesOut != NULL) { - *ppPCMFramesOut = NULL; + if (ppPCMFramesOut != nullptr) { + *ppPCMFramesOut = nullptr; } config = ma_decoder_config_init_copy(pConfig); @@ -67775,7 +67775,7 @@ MA_API ma_result ma_decode_from_vfs(ma_vfs* pVFS, const char* pFilePath, ma_deco MA_API ma_result ma_decode_file(const char* pFilePath, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut) { - return ma_decode_from_vfs(NULL, pFilePath, pConfig, pFrameCountOut, ppPCMFramesOut); + return ma_decode_from_vfs(nullptr, pFilePath, pConfig, pFrameCountOut, ppPCMFramesOut); } MA_API ma_result ma_decode_memory(const void* pData, size_t dataSize, ma_decoder_config* pConfig, ma_uint64* pFrameCountOut, void** ppPCMFramesOut) @@ -67784,14 +67784,14 @@ MA_API ma_result ma_decode_memory(const void* pData, size_t dataSize, ma_decoder ma_decoder decoder; ma_result result; - if (pFrameCountOut != NULL) { + if (pFrameCountOut != nullptr) { *pFrameCountOut = 0; } - if (ppPCMFramesOut != NULL) { - *ppPCMFramesOut = NULL; + if (ppPCMFramesOut != nullptr) { + *ppPCMFramesOut = nullptr; } - if (pData == NULL || dataSize == 0) { + if (pData == nullptr || dataSize == 0) { return MA_INVALID_ARGS; } @@ -67815,7 +67815,7 @@ static size_t ma_encoder__internal_on_write_wav(void* pUserData, const void* pDa ma_encoder* pEncoder = (ma_encoder*)pUserData; size_t bytesWritten = 0; - MA_ASSERT(pEncoder != NULL); + MA_ASSERT(pEncoder != nullptr); pEncoder->onWrite(pEncoder, pData, bytesToWrite, &bytesWritten); return bytesWritten; @@ -67827,7 +67827,7 @@ static ma_bool32 ma_encoder__internal_on_seek_wav(void* pUserData, int offset, m ma_result result; ma_seek_origin maSeekOrigin; - MA_ASSERT(pEncoder != NULL); + MA_ASSERT(pEncoder != nullptr); maSeekOrigin = ma_seek_origin_start; if (origin == MA_DR_WAV_SEEK_CUR) { @@ -67850,10 +67850,10 @@ static ma_result ma_encoder__on_init_wav(ma_encoder* pEncoder) ma_allocation_callbacks allocationCallbacks; ma_dr_wav* pWav; - MA_ASSERT(pEncoder != NULL); + MA_ASSERT(pEncoder != nullptr); pWav = (ma_dr_wav*)ma_malloc(sizeof(*pWav), &pEncoder->config.allocationCallbacks); - if (pWav == NULL) { + if (pWav == nullptr) { return MA_OUT_OF_MEMORY; } @@ -67885,10 +67885,10 @@ static void ma_encoder__on_uninit_wav(ma_encoder* pEncoder) { ma_dr_wav* pWav; - MA_ASSERT(pEncoder != NULL); + MA_ASSERT(pEncoder != nullptr); pWav = (ma_dr_wav*)pEncoder->pInternalEncoder; - MA_ASSERT(pWav != NULL); + MA_ASSERT(pWav != nullptr); ma_dr_wav_uninit(pWav); ma_free(pWav, &pEncoder->config.allocationCallbacks); @@ -67899,14 +67899,14 @@ static ma_result ma_encoder__on_write_pcm_frames_wav(ma_encoder* pEncoder, const ma_dr_wav* pWav; ma_uint64 framesWritten; - MA_ASSERT(pEncoder != NULL); + MA_ASSERT(pEncoder != nullptr); pWav = (ma_dr_wav*)pEncoder->pInternalEncoder; - MA_ASSERT(pWav != NULL); + MA_ASSERT(pWav != nullptr); framesWritten = ma_dr_wav_write_pcm_frames(pWav, frameCount, pFramesIn); - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = framesWritten; } @@ -67931,13 +67931,13 @@ MA_API ma_result ma_encoder_preinit(const ma_encoder_config* pConfig, ma_encoder { ma_result result; - if (pEncoder == NULL) { + if (pEncoder == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pEncoder); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -67960,9 +67960,9 @@ MA_API ma_result ma_encoder_init__internal(ma_encoder_write_proc onWrite, ma_enc ma_result result = MA_SUCCESS; /* This assumes ma_encoder_preinit() has been called prior. */ - MA_ASSERT(pEncoder != NULL); + MA_ASSERT(pEncoder != nullptr); - if (onWrite == NULL || onSeek == NULL) { + if (onWrite == nullptr || onSeek == nullptr) { return MA_INVALID_ARGS; } @@ -68026,7 +68026,7 @@ MA_API ma_result ma_encoder_init_vfs(ma_vfs* pVFS, const char* pFilePath, const pEncoder->data.vfs.pVFS = pVFS; pEncoder->data.vfs.file = file; - result = ma_encoder_init__internal(ma_encoder__on_write_vfs, ma_encoder__on_seek_vfs, NULL, pEncoder); + result = ma_encoder_init__internal(ma_encoder__on_write_vfs, ma_encoder__on_seek_vfs, nullptr, pEncoder); if (result != MA_SUCCESS) { ma_vfs_or_default_close(pVFS, file); return result; @@ -68054,7 +68054,7 @@ MA_API ma_result ma_encoder_init_vfs_w(ma_vfs* pVFS, const wchar_t* pFilePath, c pEncoder->data.vfs.pVFS = pVFS; pEncoder->data.vfs.file = file; - result = ma_encoder_init__internal(ma_encoder__on_write_vfs, ma_encoder__on_seek_vfs, NULL, pEncoder); + result = ma_encoder_init__internal(ma_encoder__on_write_vfs, ma_encoder__on_seek_vfs, nullptr, pEncoder); if (result != MA_SUCCESS) { ma_vfs_or_default_close(pVFS, file); return result; @@ -68065,12 +68065,12 @@ MA_API ma_result ma_encoder_init_vfs_w(ma_vfs* pVFS, const wchar_t* pFilePath, c MA_API ma_result ma_encoder_init_file(const char* pFilePath, const ma_encoder_config* pConfig, ma_encoder* pEncoder) { - return ma_encoder_init_vfs(NULL, pFilePath, pConfig, pEncoder); + return ma_encoder_init_vfs(nullptr, pFilePath, pConfig, pEncoder); } MA_API ma_result ma_encoder_init_file_w(const wchar_t* pFilePath, const ma_encoder_config* pConfig, ma_encoder* pEncoder) { - return ma_encoder_init_vfs_w(NULL, pFilePath, pConfig, pEncoder); + return ma_encoder_init_vfs_w(nullptr, pFilePath, pConfig, pEncoder); } MA_API ma_result ma_encoder_init(ma_encoder_write_proc onWrite, ma_encoder_seek_proc onSeek, void* pUserData, const ma_encoder_config* pConfig, ma_encoder* pEncoder) @@ -68088,7 +68088,7 @@ MA_API ma_result ma_encoder_init(ma_encoder_write_proc onWrite, ma_encoder_seek_ MA_API void ma_encoder_uninit(ma_encoder* pEncoder) { - if (pEncoder == NULL) { + if (pEncoder == nullptr) { return; } @@ -68099,18 +68099,18 @@ MA_API void ma_encoder_uninit(ma_encoder* pEncoder) /* If we have a file handle, close it. */ if (pEncoder->onWrite == ma_encoder__on_write_vfs) { ma_vfs_or_default_close(pEncoder->data.vfs.pVFS, pEncoder->data.vfs.file); - pEncoder->data.vfs.file = NULL; + pEncoder->data.vfs.file = nullptr; } } MA_API ma_result ma_encoder_write_pcm_frames(ma_encoder* pEncoder, const void* pFramesIn, ma_uint64 frameCount, ma_uint64* pFramesWritten) { - if (pFramesWritten != NULL) { + if (pFramesWritten != nullptr) { *pFramesWritten = 0; } - if (pEncoder == NULL || pFramesIn == NULL) { + if (pEncoder == nullptr || pFramesIn == nullptr) { return MA_INVALID_ARGS; } @@ -68188,8 +68188,8 @@ static ma_data_source_vtable g_ma_waveform_data_source_vtable = ma_waveform__data_source_on_seek, ma_waveform__data_source_on_get_data_format, ma_waveform__data_source_on_get_cursor, - NULL, /* onGetLength. There's no notion of a length in waveforms. */ - NULL, /* onSetLooping */ + nullptr, /* onGetLength. There's no notion of a length in waveforms. */ + nullptr, /* onSetLooping */ 0 }; @@ -68198,7 +68198,7 @@ MA_API ma_result ma_waveform_init(const ma_waveform_config* pConfig, ma_waveform ma_result result; ma_data_source_config dataSourceConfig; - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68221,7 +68221,7 @@ MA_API ma_result ma_waveform_init(const ma_waveform_config* pConfig, ma_waveform MA_API void ma_waveform_uninit(ma_waveform* pWaveform) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return; } @@ -68230,7 +68230,7 @@ MA_API void ma_waveform_uninit(ma_waveform* pWaveform) MA_API ma_result ma_waveform_set_amplitude(ma_waveform* pWaveform, double amplitude) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68240,7 +68240,7 @@ MA_API ma_result ma_waveform_set_amplitude(ma_waveform* pWaveform, double amplit MA_API ma_result ma_waveform_set_frequency(ma_waveform* pWaveform, double frequency) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68252,7 +68252,7 @@ MA_API ma_result ma_waveform_set_frequency(ma_waveform* pWaveform, double freque MA_API ma_result ma_waveform_set_type(ma_waveform* pWaveform, ma_waveform_type type) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68262,7 +68262,7 @@ MA_API ma_result ma_waveform_set_type(ma_waveform* pWaveform, ma_waveform_type t MA_API ma_result ma_waveform_set_sample_rate(ma_waveform* pWaveform, ma_uint32 sampleRate) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68338,8 +68338,8 @@ static void ma_waveform_read_pcm_frames__sine(ma_waveform* pWaveform, void* pFra ma_uint32 bps = ma_get_bytes_per_sample(pWaveform->config.format); ma_uint32 bpf = bps * pWaveform->config.channels; - MA_ASSERT(pWaveform != NULL); - MA_ASSERT(pFramesOut != NULL); + MA_ASSERT(pWaveform != nullptr); + MA_ASSERT(pFramesOut != nullptr); if (pWaveform->config.format == ma_format_f32) { float* pFramesOutF32 = (float*)pFramesOut; @@ -68380,8 +68380,8 @@ static void ma_waveform_read_pcm_frames__square(ma_waveform* pWaveform, double d ma_uint32 bps = ma_get_bytes_per_sample(pWaveform->config.format); ma_uint32 bpf = bps * pWaveform->config.channels; - MA_ASSERT(pWaveform != NULL); - MA_ASSERT(pFramesOut != NULL); + MA_ASSERT(pWaveform != nullptr); + MA_ASSERT(pFramesOut != nullptr); if (pWaveform->config.format == ma_format_f32) { float* pFramesOutF32 = (float*)pFramesOut; @@ -68422,8 +68422,8 @@ static void ma_waveform_read_pcm_frames__triangle(ma_waveform* pWaveform, void* ma_uint32 bps = ma_get_bytes_per_sample(pWaveform->config.format); ma_uint32 bpf = bps * pWaveform->config.channels; - MA_ASSERT(pWaveform != NULL); - MA_ASSERT(pFramesOut != NULL); + MA_ASSERT(pWaveform != nullptr); + MA_ASSERT(pFramesOut != nullptr); if (pWaveform->config.format == ma_format_f32) { float* pFramesOutF32 = (float*)pFramesOut; @@ -68464,8 +68464,8 @@ static void ma_waveform_read_pcm_frames__sawtooth(ma_waveform* pWaveform, void* ma_uint32 bps = ma_get_bytes_per_sample(pWaveform->config.format); ma_uint32 bpf = bps * pWaveform->config.channels; - MA_ASSERT(pWaveform != NULL); - MA_ASSERT(pFramesOut != NULL); + MA_ASSERT(pWaveform != nullptr); + MA_ASSERT(pFramesOut != nullptr); if (pWaveform->config.format == ma_format_f32) { float* pFramesOutF32 = (float*)pFramesOut; @@ -68501,7 +68501,7 @@ static void ma_waveform_read_pcm_frames__sawtooth(ma_waveform* pWaveform, void* MA_API ma_result ma_waveform_read_pcm_frames(ma_waveform* pWaveform, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -68509,11 +68509,11 @@ MA_API ma_result ma_waveform_read_pcm_frames(ma_waveform* pWaveform, void* pFram return MA_INVALID_ARGS; } - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { switch (pWaveform->config.type) { case ma_waveform_type_sine: @@ -68542,7 +68542,7 @@ MA_API ma_result ma_waveform_read_pcm_frames(ma_waveform* pWaveform, void* pFram pWaveform->time += pWaveform->advance * (ma_int64)frameCount; /* Cast to int64 required for VC6. Won't affect anything in practice. */ } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = frameCount; } @@ -68551,7 +68551,7 @@ MA_API ma_result ma_waveform_read_pcm_frames(ma_waveform* pWaveform, void* pFram MA_API ma_result ma_waveform_seek_to_pcm_frame(ma_waveform* pWaveform, ma_uint64 frameIndex) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68580,7 +68580,7 @@ MA_API ma_result ma_pulsewave_init(const ma_pulsewave_config* pConfig, ma_pulsew ma_result result; ma_waveform_config config; - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68603,7 +68603,7 @@ MA_API ma_result ma_pulsewave_init(const ma_pulsewave_config* pConfig, ma_pulsew MA_API void ma_pulsewave_uninit(ma_pulsewave* pWaveform) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return; } @@ -68612,7 +68612,7 @@ MA_API void ma_pulsewave_uninit(ma_pulsewave* pWaveform) MA_API ma_result ma_pulsewave_read_pcm_frames(ma_pulsewave* pWaveform, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -68620,17 +68620,17 @@ MA_API ma_result ma_pulsewave_read_pcm_frames(ma_pulsewave* pWaveform, void* pFr return MA_INVALID_ARGS; } - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { ma_waveform_read_pcm_frames__square(&pWaveform->waveform, pWaveform->config.dutyCycle, pFramesOut, frameCount); } else { pWaveform->waveform.time += pWaveform->waveform.advance * (ma_int64)frameCount; /* Cast to int64 required for VC6. Won't affect anything in practice. */ } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = frameCount; } @@ -68639,7 +68639,7 @@ MA_API ma_result ma_pulsewave_read_pcm_frames(ma_pulsewave* pWaveform, void* pFr MA_API ma_result ma_pulsewave_seek_to_pcm_frame(ma_pulsewave* pWaveform, ma_uint64 frameIndex) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68650,7 +68650,7 @@ MA_API ma_result ma_pulsewave_seek_to_pcm_frame(ma_pulsewave* pWaveform, ma_uint MA_API ma_result ma_pulsewave_set_amplitude(ma_pulsewave* pWaveform, double amplitude) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68662,7 +68662,7 @@ MA_API ma_result ma_pulsewave_set_amplitude(ma_pulsewave* pWaveform, double ampl MA_API ma_result ma_pulsewave_set_frequency(ma_pulsewave* pWaveform, double frequency) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68674,7 +68674,7 @@ MA_API ma_result ma_pulsewave_set_frequency(ma_pulsewave* pWaveform, double freq MA_API ma_result ma_pulsewave_set_sample_rate(ma_pulsewave* pWaveform, ma_uint32 sampleRate) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68686,7 +68686,7 @@ MA_API ma_result ma_pulsewave_set_sample_rate(ma_pulsewave* pWaveform, ma_uint32 MA_API ma_result ma_pulsewave_set_duty_cycle(ma_pulsewave* pWaveform, double dutyCycle) { - if (pWaveform == NULL) { + if (pWaveform == nullptr) { return MA_INVALID_ARGS; } @@ -68746,9 +68746,9 @@ static ma_data_source_vtable g_ma_noise_data_source_vtable = ma_noise__data_source_on_read, ma_noise__data_source_on_seek, /* No-op for noise. */ ma_noise__data_source_on_get_data_format, - NULL, /* onGetCursor. No notion of a cursor for noise. */ - NULL, /* onGetLength. No notion of a length for noise. */ - NULL, /* onSetLooping */ + nullptr, /* onGetCursor. No notion of a cursor for noise. */ + nullptr, /* onGetLength. No notion of a length for noise. */ + nullptr, /* onSetLooping */ 0 }; @@ -68774,11 +68774,11 @@ typedef struct static ma_result ma_noise_get_heap_layout(const ma_noise_config* pConfig, ma_noise_heap_layout* pHeapLayout) { - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -68822,7 +68822,7 @@ MA_API ma_result ma_noise_get_heap_size(const ma_noise_config* pConfig, size_t* ma_result result; ma_noise_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -68845,7 +68845,7 @@ MA_API ma_result ma_noise_init_preallocated(const ma_noise_config* pConfig, void ma_data_source_config dataSourceConfig; ma_uint32 iChannel; - if (pNoise == NULL) { + if (pNoise == nullptr) { return MA_INVALID_ARGS; } @@ -68906,11 +68906,11 @@ MA_API ma_result ma_noise_init(const ma_noise_config* pConfig, const ma_allocati if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_noise_init_preallocated(pConfig, pHeap, pNoise); @@ -68925,7 +68925,7 @@ MA_API ma_result ma_noise_init(const ma_noise_config* pConfig, const ma_allocati MA_API void ma_noise_uninit(ma_noise* pNoise, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pNoise == NULL) { + if (pNoise == nullptr) { return; } @@ -68938,7 +68938,7 @@ MA_API void ma_noise_uninit(ma_noise* pNoise, const ma_allocation_callbacks* pAl MA_API ma_result ma_noise_set_amplitude(ma_noise* pNoise, double amplitude) { - if (pNoise == NULL) { + if (pNoise == nullptr) { return MA_INVALID_ARGS; } @@ -68948,7 +68948,7 @@ MA_API ma_result ma_noise_set_amplitude(ma_noise* pNoise, double amplitude) MA_API ma_result ma_noise_set_seed(ma_noise* pNoise, ma_int32 seed) { - if (pNoise == NULL) { + if (pNoise == nullptr) { return MA_INVALID_ARGS; } @@ -68959,7 +68959,7 @@ MA_API ma_result ma_noise_set_seed(ma_noise* pNoise, ma_int32 seed) MA_API ma_result ma_noise_set_type(ma_noise* pNoise, ma_noise_type type) { - if (pNoise == NULL) { + if (pNoise == nullptr) { return MA_INVALID_ARGS; } @@ -69252,7 +69252,7 @@ MA_API ma_result ma_noise_read_pcm_frames(ma_noise* pNoise, void* pFramesOut, ma { ma_uint64 framesRead = 0; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -69260,12 +69260,12 @@ MA_API ma_result ma_noise_read_pcm_frames(ma_noise* pNoise, void* pFramesOut, ma return MA_INVALID_ARGS; } - if (pNoise == NULL) { + if (pNoise == nullptr) { return MA_INVALID_ARGS; } - /* The output buffer is allowed to be NULL. Since we aren't tracking cursors or anything we can just do nothing and pretend to be successful. */ - if (pFramesOut == NULL) { + /* The output buffer is allowed to be nullptr. Since we aren't tracking cursors or anything we can just do nothing and pretend to be successful. */ + if (pFramesOut == nullptr) { framesRead = frameCount; } else { switch (pNoise->config.type) { @@ -69276,7 +69276,7 @@ MA_API ma_result ma_noise_read_pcm_frames(ma_noise* pNoise, void* pFramesOut, ma } } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = framesRead; } @@ -69306,7 +69306,7 @@ MA_API ma_resource_manager_pipeline_notifications ma_resource_manager_pipeline_n static void ma_resource_manager_pipeline_notifications_signal_all_notifications(const ma_resource_manager_pipeline_notifications* pPipelineNotifications) { - if (pPipelineNotifications == NULL) { + if (pPipelineNotifications == nullptr) { return; } @@ -69316,22 +69316,22 @@ static void ma_resource_manager_pipeline_notifications_signal_all_notifications( static void ma_resource_manager_pipeline_notifications_acquire_all_fences(const ma_resource_manager_pipeline_notifications* pPipelineNotifications) { - if (pPipelineNotifications == NULL) { + if (pPipelineNotifications == nullptr) { return; } - if (pPipelineNotifications->init.pFence != NULL) { ma_fence_acquire(pPipelineNotifications->init.pFence); } - if (pPipelineNotifications->done.pFence != NULL) { ma_fence_acquire(pPipelineNotifications->done.pFence); } + if (pPipelineNotifications->init.pFence != nullptr) { ma_fence_acquire(pPipelineNotifications->init.pFence); } + if (pPipelineNotifications->done.pFence != nullptr) { ma_fence_acquire(pPipelineNotifications->done.pFence); } } static void ma_resource_manager_pipeline_notifications_release_all_fences(const ma_resource_manager_pipeline_notifications* pPipelineNotifications) { - if (pPipelineNotifications == NULL) { + if (pPipelineNotifications == nullptr) { return; } - if (pPipelineNotifications->init.pFence != NULL) { ma_fence_release(pPipelineNotifications->init.pFence); } - if (pPipelineNotifications->done.pFence != NULL) { ma_fence_release(pPipelineNotifications->done.pFence); } + if (pPipelineNotifications->init.pFence != nullptr) { ma_fence_release(pPipelineNotifications->init.pFence); } + if (pPipelineNotifications->done.pFence != nullptr) { ma_fence_release(pPipelineNotifications->done.pFence); } } @@ -69447,11 +69447,11 @@ static ma_result ma_resource_manager_data_buffer_node_search(ma_resource_manager { ma_resource_manager_data_buffer_node* pCurrentNode; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(ppDataBufferNode != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(ppDataBufferNode != nullptr); pCurrentNode = pResourceManager->pRootDataBufferNode; - while (pCurrentNode != NULL) { + while (pCurrentNode != nullptr) { if (hashedName32 == pCurrentNode->hashedName32) { break; /* Found. */ } else if (hashedName32 < pCurrentNode->hashedName32) { @@ -69463,7 +69463,7 @@ static ma_result ma_resource_manager_data_buffer_node_search(ma_resource_manager *ppDataBufferNode = pCurrentNode; - if (pCurrentNode == NULL) { + if (pCurrentNode == nullptr) { return MA_DOES_NOT_EXIST; } else { return MA_SUCCESS; @@ -69475,31 +69475,31 @@ static ma_result ma_resource_manager_data_buffer_node_insert_point(ma_resource_m ma_result result = MA_SUCCESS; ma_resource_manager_data_buffer_node* pCurrentNode; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(ppInsertPoint != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(ppInsertPoint != nullptr); - *ppInsertPoint = NULL; + *ppInsertPoint = nullptr; - if (pResourceManager->pRootDataBufferNode == NULL) { + if (pResourceManager->pRootDataBufferNode == nullptr) { return MA_SUCCESS; /* No items. */ } /* We need to find the node that will become the parent of the new node. If a node is found that already has the same hashed name we need to return MA_ALREADY_EXISTS. */ pCurrentNode = pResourceManager->pRootDataBufferNode; - while (pCurrentNode != NULL) { + while (pCurrentNode != nullptr) { if (hashedName32 == pCurrentNode->hashedName32) { result = MA_ALREADY_EXISTS; break; } else { if (hashedName32 < pCurrentNode->hashedName32) { - if (pCurrentNode->pChildLo == NULL) { + if (pCurrentNode->pChildLo == nullptr) { result = MA_SUCCESS; break; } else { pCurrentNode = pCurrentNode->pChildLo; } } else { - if (pCurrentNode->pChildHi == NULL) { + if (pCurrentNode->pChildHi == nullptr) { result = MA_SUCCESS; break; } else { @@ -69515,22 +69515,22 @@ static ma_result ma_resource_manager_data_buffer_node_insert_point(ma_resource_m static ma_result ma_resource_manager_data_buffer_node_insert_at(ma_resource_manager* pResourceManager, ma_resource_manager_data_buffer_node* pDataBufferNode, ma_resource_manager_data_buffer_node* pInsertPoint) { - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); /* The key must have been set before calling this function. */ MA_ASSERT(pDataBufferNode->hashedName32 != 0); - if (pInsertPoint == NULL) { + if (pInsertPoint == nullptr) { /* It's the first node. */ pResourceManager->pRootDataBufferNode = pDataBufferNode; } else { /* It's not the first node. It needs to be inserted. */ if (pDataBufferNode->hashedName32 < pInsertPoint->hashedName32) { - MA_ASSERT(pInsertPoint->pChildLo == NULL); + MA_ASSERT(pInsertPoint->pChildLo == nullptr); pInsertPoint->pChildLo = pDataBufferNode; } else { - MA_ASSERT(pInsertPoint->pChildHi == NULL); + MA_ASSERT(pInsertPoint->pChildHi == nullptr); pInsertPoint->pChildHi = pDataBufferNode; } } @@ -69546,8 +69546,8 @@ static ma_result ma_resource_manager_data_buffer_node_insert(ma_resource_manager ma_result result; ma_resource_manager_data_buffer_node* pInsertPoint; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); result = ma_resource_manager_data_buffer_node_insert_point(pResourceManager, pDataBufferNode->hashedName32, &pInsertPoint); if (result != MA_SUCCESS) { @@ -69562,10 +69562,10 @@ static MA_INLINE ma_resource_manager_data_buffer_node* ma_resource_manager_data_ { ma_resource_manager_data_buffer_node* pCurrentNode; - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pDataBufferNode != nullptr); pCurrentNode = pDataBufferNode; - while (pCurrentNode->pChildLo != NULL) { + while (pCurrentNode->pChildLo != nullptr) { pCurrentNode = pCurrentNode->pChildLo; } @@ -69576,10 +69576,10 @@ static MA_INLINE ma_resource_manager_data_buffer_node* ma_resource_manager_data_ { ma_resource_manager_data_buffer_node* pCurrentNode; - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pDataBufferNode != nullptr); pCurrentNode = pDataBufferNode; - while (pCurrentNode->pChildHi != NULL) { + while (pCurrentNode->pChildHi != nullptr) { pCurrentNode = pCurrentNode->pChildHi; } @@ -69588,8 +69588,8 @@ static MA_INLINE ma_resource_manager_data_buffer_node* ma_resource_manager_data_ static MA_INLINE ma_resource_manager_data_buffer_node* ma_resource_manager_data_buffer_node_find_inorder_successor(ma_resource_manager_data_buffer_node* pDataBufferNode) { - MA_ASSERT(pDataBufferNode != NULL); - MA_ASSERT(pDataBufferNode->pChildHi != NULL); + MA_ASSERT(pDataBufferNode != nullptr); + MA_ASSERT(pDataBufferNode->pChildHi != nullptr); return ma_resource_manager_data_buffer_node_find_min(pDataBufferNode->pChildHi); } @@ -69597,8 +69597,8 @@ static MA_INLINE ma_resource_manager_data_buffer_node* ma_resource_manager_data_ #if 0 /* Currently unused, but might make use of this later. */ static MA_INLINE ma_resource_manager_data_buffer_node* ma_resource_manager_data_buffer_node_find_inorder_predecessor(ma_resource_manager_data_buffer_node* pDataBufferNode) { - MA_ASSERT(pDataBufferNode != NULL); - MA_ASSERT(pDataBufferNode->pChildLo != NULL); + MA_ASSERT(pDataBufferNode != nullptr); + MA_ASSERT(pDataBufferNode->pChildLo != nullptr); return ma_resource_manager_data_buffer_node_find_max(pDataBufferNode->pChildLo); } @@ -69606,27 +69606,27 @@ static MA_INLINE ma_resource_manager_data_buffer_node* ma_resource_manager_data_ static ma_result ma_resource_manager_data_buffer_node_remove(ma_resource_manager* pResourceManager, ma_resource_manager_data_buffer_node* pDataBufferNode) { - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); - if (pDataBufferNode->pChildLo == NULL) { - if (pDataBufferNode->pChildHi == NULL) { + if (pDataBufferNode->pChildLo == nullptr) { + if (pDataBufferNode->pChildHi == nullptr) { /* Simple case - deleting a buffer with no children. */ - if (pDataBufferNode->pParent == NULL) { + if (pDataBufferNode->pParent == nullptr) { MA_ASSERT(pResourceManager->pRootDataBufferNode == pDataBufferNode); /* There is only a single buffer in the tree which should be equal to the root node. */ - pResourceManager->pRootDataBufferNode = NULL; + pResourceManager->pRootDataBufferNode = nullptr; } else { if (pDataBufferNode->pParent->pChildLo == pDataBufferNode) { - pDataBufferNode->pParent->pChildLo = NULL; + pDataBufferNode->pParent->pChildLo = nullptr; } else { - pDataBufferNode->pParent->pChildHi = NULL; + pDataBufferNode->pParent->pChildHi = nullptr; } } } else { - /* Node has one child - pChildHi != NULL. */ + /* Node has one child - pChildHi != nullptr. */ pDataBufferNode->pChildHi->pParent = pDataBufferNode->pParent; - if (pDataBufferNode->pParent == NULL) { + if (pDataBufferNode->pParent == nullptr) { MA_ASSERT(pResourceManager->pRootDataBufferNode == pDataBufferNode); pResourceManager->pRootDataBufferNode = pDataBufferNode->pChildHi; } else { @@ -69638,11 +69638,11 @@ static ma_result ma_resource_manager_data_buffer_node_remove(ma_resource_manager } } } else { - if (pDataBufferNode->pChildHi == NULL) { - /* Node has one child - pChildLo != NULL. */ + if (pDataBufferNode->pChildHi == nullptr) { + /* Node has one child - pChildLo != nullptr. */ pDataBufferNode->pChildLo->pParent = pDataBufferNode->pParent; - if (pDataBufferNode->pParent == NULL) { + if (pDataBufferNode->pParent == nullptr) { MA_ASSERT(pResourceManager->pRootDataBufferNode == pDataBufferNode); pResourceManager->pRootDataBufferNode = pDataBufferNode->pChildLo; } else { @@ -69658,7 +69658,7 @@ static ma_result ma_resource_manager_data_buffer_node_remove(ma_resource_manager /* For now we are just going to use the in-order successor as the replacement, but we may want to try to keep this balanced by switching between the two. */ pReplacementDataBufferNode = ma_resource_manager_data_buffer_node_find_inorder_successor(pDataBufferNode); - MA_ASSERT(pReplacementDataBufferNode != NULL); + MA_ASSERT(pReplacementDataBufferNode != nullptr); /* Now that we have our replacement node we can make the change. The simple way to do this would be to just exchange the values, and then remove the replacement @@ -69666,14 +69666,14 @@ static ma_result ma_resource_manager_data_buffer_node_remove(ma_resource_manager replacement node should have at most 1 child. Therefore, we can detach it in terms of our simpler cases above. What we're essentially doing is detaching the replacement node and reinserting it into the same position as the deleted node. */ - MA_ASSERT(pReplacementDataBufferNode->pParent != NULL); /* The replacement node should never be the root which means it should always have a parent. */ - MA_ASSERT(pReplacementDataBufferNode->pChildLo == NULL); /* Because we used in-order successor. This would be pChildHi == NULL if we used in-order predecessor. */ + MA_ASSERT(pReplacementDataBufferNode->pParent != nullptr); /* The replacement node should never be the root which means it should always have a parent. */ + MA_ASSERT(pReplacementDataBufferNode->pChildLo == nullptr); /* Because we used in-order successor. This would be pChildHi == nullptr if we used in-order predecessor. */ - if (pReplacementDataBufferNode->pChildHi == NULL) { + if (pReplacementDataBufferNode->pChildHi == nullptr) { if (pReplacementDataBufferNode->pParent->pChildLo == pReplacementDataBufferNode) { - pReplacementDataBufferNode->pParent->pChildLo = NULL; + pReplacementDataBufferNode->pParent->pChildLo = nullptr; } else { - pReplacementDataBufferNode->pParent->pChildHi = NULL; + pReplacementDataBufferNode->pParent->pChildHi = nullptr; } } else { pReplacementDataBufferNode->pChildHi->pParent = pReplacementDataBufferNode->pParent; @@ -69686,7 +69686,7 @@ static ma_result ma_resource_manager_data_buffer_node_remove(ma_resource_manager /* The replacement node has essentially been detached from the binary tree, so now we need to replace the old data buffer with it. The first thing to update is the parent */ - if (pDataBufferNode->pParent != NULL) { + if (pDataBufferNode->pParent != nullptr) { if (pDataBufferNode->pParent->pChildLo == pDataBufferNode) { pDataBufferNode->pParent->pChildLo = pReplacementDataBufferNode; } else { @@ -69700,10 +69700,10 @@ static ma_result ma_resource_manager_data_buffer_node_remove(ma_resource_manager pReplacementDataBufferNode->pChildHi = pDataBufferNode->pChildHi; /* Now the children of the replacement node need to have their parent pointers updated. */ - if (pReplacementDataBufferNode->pChildLo != NULL) { + if (pReplacementDataBufferNode->pChildLo != nullptr) { pReplacementDataBufferNode->pChildLo->pParent = pReplacementDataBufferNode; } - if (pReplacementDataBufferNode->pChildHi != NULL) { + if (pReplacementDataBufferNode->pChildHi != nullptr) { pReplacementDataBufferNode->pChildHi->pParent = pReplacementDataBufferNode; } @@ -69746,14 +69746,14 @@ static ma_result ma_resource_manager_data_buffer_node_increment_ref(ma_resource_ { ma_uint32 refCount; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); (void)pResourceManager; refCount = ma_atomic_fetch_add_32(&pDataBufferNode->refCount, 1) + 1; - if (pNewRefCount != NULL) { + if (pNewRefCount != nullptr) { *pNewRefCount = refCount; } @@ -69764,14 +69764,14 @@ static ma_result ma_resource_manager_data_buffer_node_decrement_ref(ma_resource_ { ma_uint32 refCount; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); (void)pResourceManager; refCount = ma_atomic_fetch_sub_32(&pDataBufferNode->refCount, 1) - 1; - if (pNewRefCount != NULL) { + if (pNewRefCount != nullptr) { *pNewRefCount = refCount; } @@ -69780,17 +69780,17 @@ static ma_result ma_resource_manager_data_buffer_node_decrement_ref(ma_resource_ static void ma_resource_manager_data_buffer_node_free(ma_resource_manager* pResourceManager, ma_resource_manager_data_buffer_node* pDataBufferNode) { - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); if (pDataBufferNode->isDataOwnedByResourceManager) { if (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBufferNode) == ma_resource_manager_data_supply_type_encoded) { ma_free((void*)pDataBufferNode->data.backend.encoded.pData, &pResourceManager->config.allocationCallbacks); - pDataBufferNode->data.backend.encoded.pData = NULL; + pDataBufferNode->data.backend.encoded.pData = nullptr; pDataBufferNode->data.backend.encoded.sizeInBytes = 0; } else if (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBufferNode) == ma_resource_manager_data_supply_type_decoded) { ma_free((void*)pDataBufferNode->data.backend.decoded.pData, &pResourceManager->config.allocationCallbacks); - pDataBufferNode->data.backend.decoded.pData = NULL; + pDataBufferNode->data.backend.decoded.pData = nullptr; pDataBufferNode->data.backend.decoded.totalFrameCount = 0; } else if (ma_resource_manager_data_buffer_node_get_data_supply_type(pDataBufferNode) == ma_resource_manager_data_supply_type_decoded_paged) { ma_paged_audio_buffer_data_uninit(&pDataBufferNode->data.backend.decodedPaged.data, &pResourceManager->config.allocationCallbacks); @@ -69806,7 +69806,7 @@ static void ma_resource_manager_data_buffer_node_free(ma_resource_manager* pReso static ma_result ma_resource_manager_data_buffer_node_result(const ma_resource_manager_data_buffer_node* pDataBufferNode) { - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pDataBufferNode != nullptr); return (ma_result)ma_atomic_load_i32((ma_result*)&pDataBufferNode->result); /* Need a naughty const-cast here. */ } @@ -69814,7 +69814,7 @@ static ma_result ma_resource_manager_data_buffer_node_result(const ma_resource_m static ma_bool32 ma_resource_manager_is_threading_enabled(const ma_resource_manager* pResourceManager) { - MA_ASSERT(pResourceManager != NULL); + MA_ASSERT(pResourceManager != nullptr); return (pResourceManager->config.flags & MA_RESOURCE_MANAGER_FLAG_NO_THREADING) == 0; } @@ -69832,8 +69832,8 @@ typedef struct static ma_result ma_resource_manager_inline_notification_init(ma_resource_manager* pResourceManager, ma_resource_manager_inline_notification* pNotification) { - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pNotification != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pNotification != nullptr); pNotification->pResourceManager = pResourceManager; @@ -69846,7 +69846,7 @@ static ma_result ma_resource_manager_inline_notification_init(ma_resource_manage static void ma_resource_manager_inline_notification_uninit(ma_resource_manager_inline_notification* pNotification) { - MA_ASSERT(pNotification != NULL); + MA_ASSERT(pNotification != nullptr); if (ma_resource_manager_is_threading_enabled(pNotification->pResourceManager)) { ma_async_notification_event_uninit(&pNotification->backend.e); @@ -69857,7 +69857,7 @@ static void ma_resource_manager_inline_notification_uninit(ma_resource_manager_i static void ma_resource_manager_inline_notification_wait(ma_resource_manager_inline_notification* pNotification) { - MA_ASSERT(pNotification != NULL); + MA_ASSERT(pNotification != nullptr); if (ma_resource_manager_is_threading_enabled(pNotification->pResourceManager)) { ma_async_notification_event_wait(&pNotification->backend.e); @@ -69880,7 +69880,7 @@ static void ma_resource_manager_inline_notification_wait_and_uninit(ma_resource_ static void ma_resource_manager_data_buffer_bst_lock(ma_resource_manager* pResourceManager) { - MA_ASSERT(pResourceManager != NULL); + MA_ASSERT(pResourceManager != nullptr); if (ma_resource_manager_is_threading_enabled(pResourceManager)) { #ifndef MA_NO_THREADING @@ -69899,7 +69899,7 @@ static void ma_resource_manager_data_buffer_bst_lock(ma_resource_manager* pResou static void ma_resource_manager_data_buffer_bst_unlock(ma_resource_manager* pResourceManager) { - MA_ASSERT(pResourceManager != NULL); + MA_ASSERT(pResourceManager != nullptr); if (ma_resource_manager_is_threading_enabled(pResourceManager)) { #ifndef MA_NO_THREADING @@ -69920,7 +69920,7 @@ static void ma_resource_manager_data_buffer_bst_unlock(ma_resource_manager* pRes static ma_thread_result MA_THREADCALL ma_resource_manager_job_thread(void* pUserData) { ma_resource_manager* pResourceManager = (ma_resource_manager*)pUserData; - MA_ASSERT(pResourceManager != NULL); + MA_ASSERT(pResourceManager != nullptr); for (;;) { ma_result result; @@ -69974,13 +69974,13 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon ma_result result; ma_job_queue_config jobQueueConfig; - if (pResourceManager == NULL) { + if (pResourceManager == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pResourceManager); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -69996,16 +69996,16 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon ma_allocation_callbacks_init_copy(&pResourceManager->config.allocationCallbacks, &pConfig->allocationCallbacks); /* Get the log set up early so we can start using it as soon as possible. */ - if (pResourceManager->config.pLog == NULL) { + if (pResourceManager->config.pLog == nullptr) { result = ma_log_init(&pResourceManager->config.allocationCallbacks, &pResourceManager->log); if (result == MA_SUCCESS) { pResourceManager->config.pLog = &pResourceManager->log; } else { - pResourceManager->config.pLog = NULL; /* Logging is unavailable. */ + pResourceManager->config.pLog = nullptr; /* Logging is unavailable. */ } } - if (pResourceManager->config.pVFS == NULL) { + if (pResourceManager->config.pVFS == nullptr) { result = ma_default_vfs_init(&pResourceManager->defaultVFS, &pResourceManager->config.allocationCallbacks); if (result != MA_SUCCESS) { return result; /* Failed to initialize the default file system. */ @@ -70049,12 +70049,12 @@ MA_API ma_result ma_resource_manager_init(const ma_resource_manager_config* pCon /* Custom decoding backends. */ - if (pConfig->ppCustomDecodingBackendVTables != NULL && pConfig->customDecodingBackendCount > 0) { + if (pConfig->ppCustomDecodingBackendVTables != nullptr && pConfig->customDecodingBackendCount > 0) { size_t sizeInBytes = sizeof(*pResourceManager->config.ppCustomDecodingBackendVTables) * pConfig->customDecodingBackendCount; ma_decoding_backend_vtable** ppCustomDecodingBackendVTables; ppCustomDecodingBackendVTables = (ma_decoding_backend_vtable**)ma_malloc(sizeInBytes, &pResourceManager->config.allocationCallbacks); - if (pResourceManager->config.ppCustomDecodingBackendVTables == NULL) { + if (pResourceManager->config.ppCustomDecodingBackendVTables == nullptr) { ma_job_queue_uninit(&pResourceManager->jobQueue, &pResourceManager->config.allocationCallbacks); return MA_OUT_OF_MEMORY; } @@ -70108,7 +70108,7 @@ static void ma_resource_manager_delete_all_data_buffer_nodes(ma_resource_manager MA_ASSERT(pResourceManager); /* If everything was done properly, there shouldn't be any active data buffers. */ - while (pResourceManager->pRootDataBufferNode != NULL) { + while (pResourceManager->pRootDataBufferNode != nullptr) { ma_resource_manager_data_buffer_node* pDataBufferNode = pResourceManager->pRootDataBufferNode; ma_resource_manager_data_buffer_node_remove(pResourceManager, pDataBufferNode); @@ -70119,7 +70119,7 @@ static void ma_resource_manager_delete_all_data_buffer_nodes(ma_resource_manager MA_API void ma_resource_manager_uninit(ma_resource_manager* pResourceManager) { - if (pResourceManager == NULL) { + if (pResourceManager == nullptr) { return; } @@ -70174,8 +70174,8 @@ MA_API void ma_resource_manager_uninit(ma_resource_manager* pResourceManager) MA_API ma_log* ma_resource_manager_get_log(ma_resource_manager* pResourceManager) { - if (pResourceManager == NULL) { - return NULL; + if (pResourceManager == nullptr) { + return nullptr; } return pResourceManager->config.pLog; @@ -70217,13 +70217,13 @@ static ma_result ma_resource_manager__init_decoder(ma_resource_manager* pResourc ma_result result; ma_decoder_config config; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pFilePath != NULL || pFilePathW != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pFilePath != nullptr || pFilePathW != nullptr); + MA_ASSERT(pDecoder != nullptr); config = ma_resource_manager__init_decoder_config(pResourceManager); - if (pFilePath != NULL) { + if (pFilePath != nullptr) { result = ma_decoder_init_vfs(pResourceManager->config.pVFS, pFilePath, &config, pDecoder); if (result != MA_SUCCESS) { ma_log_postf(ma_resource_manager_get_log(pResourceManager), MA_LOG_LEVEL_WARNING, "Failed to load file \"%s\". %s.\n", pFilePath, ma_result_description(result)); @@ -70250,7 +70250,7 @@ static ma_bool32 ma_resource_manager_data_buffer_has_connector(ma_resource_manag static ma_data_source* ma_resource_manager_data_buffer_get_connector(ma_resource_manager_data_buffer* pDataBuffer) { if (ma_resource_manager_data_buffer_has_connector(pDataBuffer) == MA_FALSE) { - return NULL; /* Connector not yet initialized. */ + return nullptr; /* Connector not yet initialized. */ } switch (pDataBuffer->pNode->data.type) @@ -70263,7 +70263,7 @@ static ma_data_source* ma_resource_manager_data_buffer_get_connector(ma_resource default: { ma_log_postf(ma_resource_manager_get_log(pDataBuffer->pResourceManager), MA_LOG_LEVEL_ERROR, "Failed to retrieve data buffer connector. Unknown data supply type.\n"); - return NULL; + return nullptr; }; }; } @@ -70272,8 +70272,8 @@ static ma_result ma_resource_manager_data_buffer_init_connector(ma_resource_mana { ma_result result; - MA_ASSERT(pDataBuffer != NULL); - MA_ASSERT(pConfig != NULL); + MA_ASSERT(pDataBuffer != nullptr); + MA_ASSERT(pConfig != nullptr); MA_ASSERT(ma_resource_manager_data_buffer_has_connector(pDataBuffer) == MA_FALSE); /* The underlying data buffer must be initialized before we'll be able to know how to initialize the backend. */ @@ -70299,7 +70299,7 @@ static ma_result ma_resource_manager_data_buffer_init_connector(ma_resource_mana case ma_resource_manager_data_supply_type_decoded: /* Connector is an audio buffer. */ { ma_audio_buffer_config config; - config = ma_audio_buffer_config_init(pDataBuffer->pNode->data.backend.decoded.format, pDataBuffer->pNode->data.backend.decoded.channels, pDataBuffer->pNode->data.backend.decoded.totalFrameCount, pDataBuffer->pNode->data.backend.decoded.pData, NULL); + config = ma_audio_buffer_config_init(pDataBuffer->pNode->data.backend.decoded.format, pDataBuffer->pNode->data.backend.decoded.channels, pDataBuffer->pNode->data.backend.decoded.totalFrameCount, pDataBuffer->pNode->data.backend.decoded.pData, nullptr); result = ma_audio_buffer_init(&config, &pDataBuffer->connector.buffer); } break; @@ -70349,11 +70349,11 @@ static ma_result ma_resource_manager_data_buffer_init_connector(ma_resource_mana ma_atomic_bool32_set(&pDataBuffer->isConnectorInitialized, MA_TRUE); - if (pInitNotification != NULL) { + if (pInitNotification != nullptr) { ma_async_notification_signal(pInitNotification); } - if (pInitFence != NULL) { + if (pInitFence != nullptr) { ma_fence_release(pInitFence); } } @@ -70364,8 +70364,8 @@ static ma_result ma_resource_manager_data_buffer_init_connector(ma_resource_mana static ma_result ma_resource_manager_data_buffer_uninit_connector(ma_resource_manager* pResourceManager, ma_resource_manager_data_buffer* pDataBuffer) { - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBuffer != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBuffer != nullptr); (void)pResourceManager; @@ -70399,7 +70399,7 @@ static ma_result ma_resource_manager_data_buffer_uninit_connector(ma_resource_ma static ma_uint32 ma_resource_manager_data_buffer_node_next_execution_order(ma_resource_manager_data_buffer_node* pDataBufferNode) { - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pDataBufferNode != nullptr); return ma_atomic_fetch_add_32(&pDataBufferNode->executionCounter, 1); } @@ -70409,13 +70409,13 @@ static ma_result ma_resource_manager_data_buffer_node_init_supply_encoded(ma_res size_t dataSizeInBytes; void* pData; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); - MA_ASSERT(pFilePath != NULL || pFilePathW != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); + MA_ASSERT(pFilePath != nullptr || pFilePathW != nullptr); result = ma_vfs_open_and_read_file_ex(pResourceManager->config.pVFS, pFilePath, pFilePathW, &pData, &dataSizeInBytes, &pResourceManager->config.allocationCallbacks); if (result != MA_SUCCESS) { - if (pFilePath != NULL) { + if (pFilePath != nullptr) { ma_log_postf(ma_resource_manager_get_log(pResourceManager), MA_LOG_LEVEL_WARNING, "Failed to load file \"%s\". %s.\n", pFilePath, ma_result_description(result)); } else { #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(_MSC_VER) @@ -70439,15 +70439,15 @@ static ma_result ma_resource_manager_data_buffer_node_init_supply_decoded(ma_res ma_decoder* pDecoder; ma_uint64 totalFrameCount; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); - MA_ASSERT(ppDecoder != NULL); - MA_ASSERT(pFilePath != NULL || pFilePathW != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); + MA_ASSERT(ppDecoder != nullptr); + MA_ASSERT(pFilePath != nullptr || pFilePathW != nullptr); - *ppDecoder = NULL; /* For safety. */ + *ppDecoder = nullptr; /* For safety. */ pDecoder = (ma_decoder*)ma_malloc(sizeof(*pDecoder), &pResourceManager->config.allocationCallbacks); - if (pDecoder == NULL) { + if (pDecoder == nullptr) { return MA_OUT_OF_MEMORY; } @@ -70485,7 +70485,7 @@ static ma_result ma_resource_manager_data_buffer_node_init_supply_decoded(ma_res } pData = ma_malloc((size_t)dataSizeInBytes, &pResourceManager->config.allocationCallbacks); - if (pData == NULL) { + if (pData == nullptr) { ma_decoder_uninit(pDecoder); ma_free(pDecoder, &pResourceManager->config.allocationCallbacks); return MA_OUT_OF_MEMORY; @@ -70532,9 +70532,9 @@ static ma_result ma_resource_manager_data_buffer_node_decode_next_page(ma_resour ma_uint64 framesToTryReading; ma_uint64 framesRead; - MA_ASSERT(pResourceManager != NULL); - MA_ASSERT(pDataBufferNode != NULL); - MA_ASSERT(pDecoder != NULL); + MA_ASSERT(pResourceManager != nullptr); + MA_ASSERT(pDataBufferNode != nullptr); + MA_ASSERT(pDecoder != nullptr); /* We need to know the size of a page in frames to know how many frames to decode. */ pageSizeInFrames = MA_RESOURCE_MANAGER_PAGE_SIZE_IN_MILLISECONDS * (pDecoder->outputSampleRate/1000); @@ -70562,7 +70562,7 @@ static ma_result ma_resource_manager_data_buffer_node_decode_next_page(ma_resour pDataBufferNode->data.backend.decoded.pData, pDataBufferNode->data.backend.decoded.decodedFrameCount * ma_get_bytes_per_frame(pDataBufferNode->data.backend.decoded.format, pDataBufferNode->data.backend.decoded.channels) ); - MA_ASSERT(pDst != NULL); + MA_ASSERT(pDst != nullptr); result = ma_decoder_read_pcm_frames(pDecoder, pDst, framesToTryReading, &framesRead); if (framesRead > 0) { @@ -70578,7 +70578,7 @@ static ma_result ma_resource_manager_data_buffer_node_decode_next_page(ma_resour /* The destination buffer is a freshly allocated page. */ ma_paged_audio_buffer_page* pPage; - result = ma_paged_audio_buffer_data_allocate_page(&pDataBufferNode->data.backend.decodedPaged.data, framesToTryReading, NULL, &pResourceManager->config.allocationCallbacks, &pPage); + result = ma_paged_audio_buffer_data_allocate_page(&pDataBufferNode->data.backend.decodedPaged.data, framesToTryReading, nullptr, &pResourceManager->config.allocationCallbacks, &pPage); if (result != MA_SUCCESS) { return result; } @@ -70622,11 +70622,11 @@ static ma_result ma_resource_manager_data_buffer_node_decode_next_page(ma_resour static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(ma_resource_manager* pResourceManager, const char* pFilePath, const wchar_t* pFilePathW, ma_uint32 hashedName32, ma_uint32 flags, const ma_resource_manager_data_supply* pExistingData, ma_fence* pInitFence, ma_fence* pDoneFence, ma_resource_manager_inline_notification* pInitNotification, ma_resource_manager_data_buffer_node** ppDataBufferNode) { ma_result result = MA_SUCCESS; - ma_resource_manager_data_buffer_node* pDataBufferNode = NULL; + ma_resource_manager_data_buffer_node* pDataBufferNode = nullptr; ma_resource_manager_data_buffer_node* pInsertPoint; - if (ppDataBufferNode != NULL) { - *ppDataBufferNode = NULL; + if (ppDataBufferNode != nullptr) { + *ppDataBufferNode = nullptr; } result = ma_resource_manager_data_buffer_node_insert_point(pResourceManager, hashedName32, &pInsertPoint); @@ -70634,7 +70634,7 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m /* The node already exists. We just need to increment the reference count. */ pDataBufferNode = pInsertPoint; - result = ma_resource_manager_data_buffer_node_increment_ref(pResourceManager, pDataBufferNode, NULL); + result = ma_resource_manager_data_buffer_node_increment_ref(pResourceManager, pDataBufferNode, nullptr); if (result != MA_SUCCESS) { return result; /* Should never happen. Failed to increment the reference count. */ } @@ -70648,7 +70648,7 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m does not occur before initialization on another thread. */ pDataBufferNode = (ma_resource_manager_data_buffer_node*)ma_malloc(sizeof(*pDataBufferNode), &pResourceManager->config.allocationCallbacks); - if (pDataBufferNode == NULL) { + if (pDataBufferNode == nullptr) { return MA_OUT_OF_MEMORY; } @@ -70656,7 +70656,7 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m pDataBufferNode->hashedName32 = hashedName32; pDataBufferNode->refCount = 1; /* Always set to 1 by default (this is our first reference). */ - if (pExistingData == NULL) { + if (pExistingData == nullptr) { pDataBufferNode->data.type = ma_resource_manager_data_supply_type_unknown; /* <-- We won't know this until we start decoding. */ pDataBufferNode->result = MA_BUSY; /* Must be set to MA_BUSY before we leave the critical section, so might as well do it now. */ pDataBufferNode->isDataOwnedByResourceManager = MA_TRUE; @@ -70680,17 +70680,17 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m if (pDataBufferNode->isDataOwnedByResourceManager && (flags & MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_ASYNC) != 0) { /* Loading asynchronously. Post the job. */ ma_job job; - char* pFilePathCopy = NULL; - wchar_t* pFilePathWCopy = NULL; + char* pFilePathCopy = nullptr; + wchar_t* pFilePathWCopy = nullptr; /* We need a copy of the file path. We should probably make this more efficient, but for now we'll do a transient memory allocation. */ - if (pFilePath != NULL) { + if (pFilePath != nullptr) { pFilePathCopy = ma_copy_string(pFilePath, &pResourceManager->config.allocationCallbacks); } else { pFilePathWCopy = ma_copy_string_w(pFilePathW, &pResourceManager->config.allocationCallbacks); } - if (pFilePathCopy == NULL && pFilePathWCopy == NULL) { + if (pFilePathCopy == nullptr && pFilePathWCopy == nullptr) { ma_resource_manager_data_buffer_node_remove(pResourceManager, pDataBufferNode); ma_free(pDataBufferNode, &pResourceManager->config.allocationCallbacks); return MA_OUT_OF_MEMORY; @@ -70701,8 +70701,8 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m } /* Acquire init and done fences before posting the job. These will be unacquired by the job thread. */ - if (pInitFence != NULL) { ma_fence_acquire(pInitFence); } - if (pDoneFence != NULL) { ma_fence_acquire(pDoneFence); } + if (pInitFence != nullptr) { ma_fence_acquire(pInitFence); } + if (pDoneFence != nullptr) { ma_fence_acquire(pDoneFence); } /* We now have everything we need to post the job to the job thread. */ job = ma_job_init(MA_JOB_TYPE_RESOURCE_MANAGER_LOAD_DATA_BUFFER_NODE); @@ -70712,8 +70712,8 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m job.data.resourceManager.loadDataBufferNode.pFilePath = pFilePathCopy; job.data.resourceManager.loadDataBufferNode.pFilePathW = pFilePathWCopy; job.data.resourceManager.loadDataBufferNode.flags = flags; - job.data.resourceManager.loadDataBufferNode.pInitNotification = ((flags & MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_WAIT_INIT) != 0) ? pInitNotification : NULL; - job.data.resourceManager.loadDataBufferNode.pDoneNotification = NULL; + job.data.resourceManager.loadDataBufferNode.pInitNotification = ((flags & MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_WAIT_INIT) != 0) ? pInitNotification : nullptr; + job.data.resourceManager.loadDataBufferNode.pDoneNotification = nullptr; job.data.resourceManager.loadDataBufferNode.pInitFence = pInitFence; job.data.resourceManager.loadDataBufferNode.pDoneFence = pDoneFence; @@ -70737,8 +70737,8 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m In the WAIT_INIT case, these will have already been released in ma_job_process() so we should only release fences in this branch. */ - if (pInitFence != NULL) { ma_fence_release(pInitFence); } - if (pDoneFence != NULL) { ma_fence_release(pDoneFence); } + if (pInitFence != nullptr) { ma_fence_release(pInitFence); } + if (pDoneFence != nullptr) { ma_fence_release(pDoneFence); } /* These will have been freed by the job thread, but with WAIT_INIT they will already have happened since the job has already been handled. */ ma_free(pFilePathCopy, &pResourceManager->config.allocationCallbacks); @@ -70754,7 +70754,7 @@ static ma_result ma_resource_manager_data_buffer_node_acquire_critical_section(m } done: - if (ppDataBufferNode != NULL) { + if (ppDataBufferNode != nullptr) { *ppDataBufferNode = pDataBufferNode; } @@ -70765,19 +70765,19 @@ static ma_result ma_resource_manager_data_buffer_node_acquire(ma_resource_manage { ma_result result = MA_SUCCESS; ma_bool32 nodeAlreadyExists = MA_FALSE; - ma_resource_manager_data_buffer_node* pDataBufferNode = NULL; + ma_resource_manager_data_buffer_node* pDataBufferNode = nullptr; ma_resource_manager_inline_notification initNotification; /* Used when the WAIT_INIT flag is set. */ - if (ppDataBufferNode != NULL) { - *ppDataBufferNode = NULL; /* Safety. */ + if (ppDataBufferNode != nullptr) { + *ppDataBufferNode = nullptr; /* Safety. */ } - if (pResourceManager == NULL || (pFilePath == NULL && pFilePathW == NULL && hashedName32 == 0)) { + if (pResourceManager == nullptr || (pFilePath == nullptr && pFilePathW == nullptr && hashedName32 == 0)) { return MA_INVALID_ARGS; } /* If we're specifying existing data, it must be valid. */ - if (pExistingData != NULL && pExistingData->type == ma_resource_manager_data_supply_type_unknown) { + if (pExistingData != nullptr && pExistingData->type == ma_resource_manager_data_supply_type_unknown) { return MA_INVALID_ARGS; } @@ -70787,7 +70787,7 @@ static ma_result ma_resource_manager_data_buffer_node_acquire(ma_resource_manage } if (hashedName32 == 0) { - if (pFilePath != NULL) { + if (pFilePath != nullptr) { hashedName32 = ma_hash_string_32(pFilePath); } else { hashedName32 = ma_hash_string_w_32(pFilePathW); @@ -70823,7 +70823,7 @@ static ma_result ma_resource_manager_data_buffer_node_acquire(ma_resource_manage the node is initialized by the decoding thread(s). */ if (nodeAlreadyExists == MA_FALSE) { /* Don't need to try loading anything if the node already exists. */ - if (pFilePath == NULL && pFilePathW == NULL) { + if (pFilePath == nullptr && pFilePathW == nullptr) { /* If this path is hit, it means a buffer is being copied (i.e. initialized from only the hashed name), but that node has been freed in the meantime, probably from some other @@ -70883,7 +70883,7 @@ static ma_result ma_resource_manager_data_buffer_node_acquire(ma_resource_manage } } else { /* The data is not managed by the resource manager so there's nothing else to do. */ - MA_ASSERT(pExistingData != NULL); + MA_ASSERT(pExistingData != nullptr); } } @@ -70906,7 +70906,7 @@ done: } } - if (ppDataBufferNode != NULL) { + if (ppDataBufferNode != nullptr) { *ppDataBufferNode = pDataBufferNode; } @@ -70919,16 +70919,16 @@ static ma_result ma_resource_manager_data_buffer_node_unacquire(ma_resource_mana ma_uint32 refCount = 0xFFFFFFFF; /* The new reference count of the node after decrementing. Initialize to non-0 to be safe we don't fall into the freeing path. */ ma_uint32 hashedName32 = 0; - if (pResourceManager == NULL) { + if (pResourceManager == nullptr) { return MA_INVALID_ARGS; } - if (pDataBufferNode == NULL) { - if (pName == NULL && pNameW == NULL) { + if (pDataBufferNode == nullptr) { + if (pName == nullptr && pNameW == nullptr) { return MA_INVALID_ARGS; } - if (pName != NULL) { + if (pName != nullptr) { hashedName32 = ma_hash_string_32(pName); } else { hashedName32 = ma_hash_string_w_32(pNameW); @@ -70943,7 +70943,7 @@ static ma_result ma_resource_manager_data_buffer_node_unacquire(ma_resource_mana ma_resource_manager_data_buffer_bst_lock(pResourceManager); { /* Might need to find the node. Must be done inside the critical section. */ - if (pDataBufferNode == NULL) { + if (pDataBufferNode == nullptr) { result = ma_resource_manager_data_buffer_node_search(pResourceManager, hashedName32, &pDataBufferNode); if (result != MA_SUCCESS) { goto stage2; /* Couldn't find the node. */ @@ -71017,7 +71017,7 @@ stage2: static ma_uint32 ma_resource_manager_data_buffer_next_execution_order(ma_resource_manager_data_buffer* pDataBuffer) { - MA_ASSERT(pDataBuffer != NULL); + MA_ASSERT(pDataBuffer != nullptr); return ma_atomic_fetch_add_32(&pDataBuffer->executionCounter, 1); } @@ -71049,7 +71049,7 @@ static ma_result ma_resource_manager_data_buffer_cb__get_length_in_pcm_frames(ma static ma_result ma_resource_manager_data_buffer_cb__set_looping(ma_data_source* pDataSource, ma_bool32 isLooping) { ma_resource_manager_data_buffer* pDataBuffer = (ma_resource_manager_data_buffer*)pDataSource; - MA_ASSERT(pDataBuffer != NULL); + MA_ASSERT(pDataBuffer != nullptr); ma_atomic_exchange_32(&pDataBuffer->isLooping, isLooping); @@ -71079,8 +71079,8 @@ static ma_result ma_resource_manager_data_buffer_init_ex_internal(ma_resource_ma ma_uint32 flags; ma_resource_manager_pipeline_notifications notifications; - if (pDataBuffer == NULL) { - if (pConfig != NULL && pConfig->pNotifications != NULL) { + if (pDataBuffer == nullptr) { + if (pConfig != nullptr && pConfig->pNotifications != nullptr) { ma_resource_manager_pipeline_notifications_signal_all_notifications(pConfig->pNotifications); } @@ -71089,12 +71089,12 @@ static ma_result ma_resource_manager_data_buffer_init_ex_internal(ma_resource_ma MA_ZERO_OBJECT(pDataBuffer); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - if (pConfig->pNotifications != NULL) { - notifications = *pConfig->pNotifications; /* From here on out we should be referencing `notifications` instead of `pNotifications`. Set this to NULL to catch errors at testing time. */ + if (pConfig->pNotifications != nullptr) { + notifications = *pConfig->pNotifications; /* From here on out we should be referencing `notifications` instead of `pNotifications`. Set this to nullptr to catch errors at testing time. */ } else { MA_ZERO_OBJECT(¬ifications); } @@ -71126,7 +71126,7 @@ static ma_result ma_resource_manager_data_buffer_init_ex_internal(ma_resource_ma ma_resource_manager_pipeline_notifications_acquire_all_fences(¬ifications); { /* We first need to acquire a node. If ASYNC is not set, this will not return until the entire sound has been loaded. */ - result = ma_resource_manager_data_buffer_node_acquire(pResourceManager, pConfig->pFilePath, pConfig->pFilePathW, hashedName32, flags, NULL, notifications.init.pFence, notifications.done.pFence, &pDataBufferNode); + result = ma_resource_manager_data_buffer_node_acquire(pResourceManager, pConfig->pFilePath, pConfig->pFilePathW, hashedName32, flags, nullptr, notifications.init.pFence, notifications.done.pFence, &pDataBufferNode); if (result != MA_SUCCESS) { ma_resource_manager_pipeline_notifications_signal_all_notifications(¬ifications); goto done; @@ -71137,7 +71137,7 @@ static ma_result ma_resource_manager_data_buffer_init_ex_internal(ma_resource_ma result = ma_data_source_init(&dataSourceConfig, &pDataBuffer->ds); if (result != MA_SUCCESS) { - ma_resource_manager_data_buffer_node_unacquire(pResourceManager, pDataBufferNode, NULL, NULL); + ma_resource_manager_data_buffer_node_unacquire(pResourceManager, pDataBufferNode, nullptr, nullptr); ma_resource_manager_pipeline_notifications_signal_all_notifications(¬ifications); goto done; } @@ -71150,7 +71150,7 @@ static ma_result ma_resource_manager_data_buffer_init_ex_internal(ma_resource_ma /* If we're loading asynchronously we need to post a job to the job queue to initialize the connector. */ if (async == MA_FALSE || ma_resource_manager_data_buffer_node_result(pDataBufferNode) == MA_SUCCESS) { /* Loading synchronously or the data has already been fully loaded. We can just initialize the connector from here without a job. */ - result = ma_resource_manager_data_buffer_init_connector(pDataBuffer, pConfig, NULL, NULL); + result = ma_resource_manager_data_buffer_init_connector(pDataBuffer, pConfig, nullptr, nullptr); ma_atomic_exchange_i32(&pDataBuffer->result, result); ma_resource_manager_pipeline_notifications_signal_all_notifications(¬ifications); @@ -71205,7 +71205,7 @@ static ma_result ma_resource_manager_data_buffer_init_ex_internal(ma_resource_ma if ((flags & MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_WAIT_INIT) != 0) { ma_resource_manager_inline_notification_wait(&initNotification); - if (notifications.init.pNotification != NULL) { + if (notifications.init.pNotification != nullptr) { ma_async_notification_signal(notifications.init.pNotification); } @@ -71225,7 +71225,7 @@ static ma_result ma_resource_manager_data_buffer_init_ex_internal(ma_resource_ma } if (result != MA_SUCCESS) { - ma_resource_manager_data_buffer_node_unacquire(pResourceManager, pDataBufferNode, NULL, NULL); + ma_resource_manager_data_buffer_node_unacquire(pResourceManager, pDataBufferNode, nullptr, nullptr); goto done; } } @@ -71274,11 +71274,11 @@ MA_API ma_result ma_resource_manager_data_buffer_init_copy(ma_resource_manager* { ma_resource_manager_data_source_config config; - if (pExistingDataBuffer == NULL) { + if (pExistingDataBuffer == nullptr) { return MA_INVALID_ARGS; } - MA_ASSERT(pExistingDataBuffer->pNode != NULL); /* <-- If you've triggered this, you've passed in an invalid existing data buffer. */ + MA_ASSERT(pExistingDataBuffer->pNode != nullptr); /* <-- If you've triggered this, you've passed in an invalid existing data buffer. */ config = ma_resource_manager_data_source_config_init(); config.flags = pExistingDataBuffer->flags; @@ -71288,13 +71288,13 @@ MA_API ma_result ma_resource_manager_data_buffer_init_copy(ma_resource_manager* static ma_result ma_resource_manager_data_buffer_uninit_internal(ma_resource_manager_data_buffer* pDataBuffer) { - MA_ASSERT(pDataBuffer != NULL); + MA_ASSERT(pDataBuffer != nullptr); /* The connector should be uninitialized first. */ ma_resource_manager_data_buffer_uninit_connector(pDataBuffer->pResourceManager, pDataBuffer); /* With the connector uninitialized we can unacquire the node. */ - ma_resource_manager_data_buffer_node_unacquire(pDataBuffer->pResourceManager, pDataBuffer->pNode, NULL, NULL); + ma_resource_manager_data_buffer_node_unacquire(pDataBuffer->pResourceManager, pDataBuffer->pNode, nullptr, nullptr); /* The base data source needs to be uninitialized as well. */ ma_data_source_uninit(&pDataBuffer->ds); @@ -71306,7 +71306,7 @@ MA_API ma_result ma_resource_manager_data_buffer_uninit(ma_resource_manager_data { ma_result result; - if (pDataBuffer == NULL) { + if (pDataBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -71337,7 +71337,7 @@ MA_API ma_result ma_resource_manager_data_buffer_uninit(ma_resource_manager_data job.order = ma_resource_manager_data_buffer_next_execution_order(pDataBuffer); job.data.resourceManager.freeDataBuffer.pDataBuffer = pDataBuffer; job.data.resourceManager.freeDataBuffer.pDoneNotification = ¬ification; - job.data.resourceManager.freeDataBuffer.pDoneFence = NULL; + job.data.resourceManager.freeDataBuffer.pDoneFence = nullptr; result = ma_resource_manager_post_job(pDataBuffer->pResourceManager, &job); if (result != MA_SUCCESS) { @@ -71358,7 +71358,7 @@ MA_API ma_result ma_resource_manager_data_buffer_read_pcm_frames(ma_resource_man ma_bool32 isDecodedBufferBusy = MA_FALSE; /* Safety. */ - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -71452,7 +71452,7 @@ MA_API ma_result ma_resource_manager_data_buffer_read_pcm_frames(ma_resource_man result = MA_BUSY; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = framesRead; } @@ -71533,7 +71533,7 @@ MA_API ma_result ma_resource_manager_data_buffer_get_data_format(ma_resource_man MA_API ma_result ma_resource_manager_data_buffer_get_cursor_in_pcm_frames(ma_resource_manager_data_buffer* pDataBuffer, ma_uint64* pCursor) { - if (pDataBuffer == NULL || pCursor == NULL) { + if (pDataBuffer == nullptr || pCursor == nullptr) { return MA_INVALID_ARGS; } @@ -71573,7 +71573,7 @@ MA_API ma_result ma_resource_manager_data_buffer_get_cursor_in_pcm_frames(ma_res MA_API ma_result ma_resource_manager_data_buffer_get_length_in_pcm_frames(ma_resource_manager_data_buffer* pDataBuffer, ma_uint64* pLength) { - if (pDataBuffer == NULL || pLength == NULL) { + if (pDataBuffer == nullptr || pLength == nullptr) { return MA_INVALID_ARGS; } @@ -71589,7 +71589,7 @@ MA_API ma_result ma_resource_manager_data_buffer_get_length_in_pcm_frames(ma_res MA_API ma_result ma_resource_manager_data_buffer_result(const ma_resource_manager_data_buffer* pDataBuffer) { - if (pDataBuffer == NULL) { + if (pDataBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -71608,13 +71608,13 @@ MA_API ma_bool32 ma_resource_manager_data_buffer_is_looping(const ma_resource_ma MA_API ma_result ma_resource_manager_data_buffer_get_available_frames(ma_resource_manager_data_buffer* pDataBuffer, ma_uint64* pAvailableFrames) { - if (pAvailableFrames == NULL) { + if (pAvailableFrames == nullptr) { return MA_INVALID_ARGS; } *pAvailableFrames = 0; - if (pDataBuffer == NULL) { + if (pDataBuffer == nullptr) { return MA_INVALID_ARGS; } @@ -71663,18 +71663,18 @@ MA_API ma_result ma_resource_manager_data_buffer_get_available_frames(ma_resourc MA_API ma_result ma_resource_manager_register_file(ma_resource_manager* pResourceManager, const char* pFilePath, ma_uint32 flags) { - return ma_resource_manager_data_buffer_node_acquire(pResourceManager, pFilePath, NULL, 0, flags, NULL, NULL, NULL, NULL); + return ma_resource_manager_data_buffer_node_acquire(pResourceManager, pFilePath, nullptr, 0, flags, nullptr, nullptr, nullptr, nullptr); } MA_API ma_result ma_resource_manager_register_file_w(ma_resource_manager* pResourceManager, const wchar_t* pFilePath, ma_uint32 flags) { - return ma_resource_manager_data_buffer_node_acquire(pResourceManager, NULL, pFilePath, 0, flags, NULL, NULL, NULL, NULL); + return ma_resource_manager_data_buffer_node_acquire(pResourceManager, nullptr, pFilePath, 0, flags, nullptr, nullptr, nullptr, nullptr); } static ma_result ma_resource_manager_register_data(ma_resource_manager* pResourceManager, const char* pName, const wchar_t* pNameW, ma_resource_manager_data_supply* pExistingData) { - return ma_resource_manager_data_buffer_node_acquire(pResourceManager, pName, pNameW, 0, 0, pExistingData, NULL, NULL, NULL); + return ma_resource_manager_data_buffer_node_acquire(pResourceManager, pName, pNameW, 0, 0, pExistingData, nullptr, nullptr, nullptr); } static ma_result ma_resource_manager_register_decoded_data_internal(ma_resource_manager* pResourceManager, const char* pName, const wchar_t* pNameW, const void* pData, ma_uint64 frameCount, ma_format format, ma_uint32 channels, ma_uint32 sampleRate) @@ -71692,12 +71692,12 @@ static ma_result ma_resource_manager_register_decoded_data_internal(ma_resource_ MA_API ma_result ma_resource_manager_register_decoded_data(ma_resource_manager* pResourceManager, const char* pName, const void* pData, ma_uint64 frameCount, ma_format format, ma_uint32 channels, ma_uint32 sampleRate) { - return ma_resource_manager_register_decoded_data_internal(pResourceManager, pName, NULL, pData, frameCount, format, channels, sampleRate); + return ma_resource_manager_register_decoded_data_internal(pResourceManager, pName, nullptr, pData, frameCount, format, channels, sampleRate); } MA_API ma_result ma_resource_manager_register_decoded_data_w(ma_resource_manager* pResourceManager, const wchar_t* pName, const void* pData, ma_uint64 frameCount, ma_format format, ma_uint32 channels, ma_uint32 sampleRate) { - return ma_resource_manager_register_decoded_data_internal(pResourceManager, NULL, pName, pData, frameCount, format, channels, sampleRate); + return ma_resource_manager_register_decoded_data_internal(pResourceManager, nullptr, pName, pData, frameCount, format, channels, sampleRate); } @@ -71713,12 +71713,12 @@ static ma_result ma_resource_manager_register_encoded_data_internal(ma_resource_ MA_API ma_result ma_resource_manager_register_encoded_data(ma_resource_manager* pResourceManager, const char* pName, const void* pData, size_t sizeInBytes) { - return ma_resource_manager_register_encoded_data_internal(pResourceManager, pName, NULL, pData, sizeInBytes); + return ma_resource_manager_register_encoded_data_internal(pResourceManager, pName, nullptr, pData, sizeInBytes); } MA_API ma_result ma_resource_manager_register_encoded_data_w(ma_resource_manager* pResourceManager, const wchar_t* pName, const void* pData, size_t sizeInBytes) { - return ma_resource_manager_register_encoded_data_internal(pResourceManager, NULL, pName, pData, sizeInBytes); + return ma_resource_manager_register_encoded_data_internal(pResourceManager, nullptr, pName, pData, sizeInBytes); } @@ -71734,30 +71734,30 @@ MA_API ma_result ma_resource_manager_unregister_file_w(ma_resource_manager* pRes MA_API ma_result ma_resource_manager_unregister_data(ma_resource_manager* pResourceManager, const char* pName) { - return ma_resource_manager_data_buffer_node_unacquire(pResourceManager, NULL, pName, NULL); + return ma_resource_manager_data_buffer_node_unacquire(pResourceManager, nullptr, pName, nullptr); } MA_API ma_result ma_resource_manager_unregister_data_w(ma_resource_manager* pResourceManager, const wchar_t* pName) { - return ma_resource_manager_data_buffer_node_unacquire(pResourceManager, NULL, NULL, pName); + return ma_resource_manager_data_buffer_node_unacquire(pResourceManager, nullptr, nullptr, pName); } static ma_uint32 ma_resource_manager_data_stream_next_execution_order(ma_resource_manager_data_stream* pDataStream) { - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); return ma_atomic_fetch_add_32(&pDataStream->executionCounter, 1); } static ma_bool32 ma_resource_manager_data_stream_is_decoder_at_end(const ma_resource_manager_data_stream* pDataStream) { - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); return ma_atomic_load_32((ma_bool32*)&pDataStream->isDecoderAtEnd); } static ma_uint32 ma_resource_manager_data_stream_seek_counter(const ma_resource_manager_data_stream* pDataStream) { - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); return ma_atomic_load_32((ma_uint32*)&pDataStream->seekCounter); } @@ -71790,7 +71790,7 @@ static ma_result ma_resource_manager_data_stream_cb__get_length_in_pcm_frames(ma static ma_result ma_resource_manager_data_stream_cb__set_looping(ma_data_source* pDataSource, ma_bool32 isLooping) { ma_resource_manager_data_stream* pDataStream = (ma_resource_manager_data_stream*)pDataSource; - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); ma_atomic_exchange_32(&pDataStream->isLooping, isLooping); @@ -71822,16 +71822,16 @@ MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pR { ma_result result; ma_data_source_config dataSourceConfig; - char* pFilePathCopy = NULL; - wchar_t* pFilePathWCopy = NULL; + char* pFilePathCopy = nullptr; + wchar_t* pFilePathWCopy = nullptr; ma_job job; ma_bool32 waitBeforeReturning = MA_FALSE; ma_resource_manager_inline_notification waitNotification; ma_resource_manager_pipeline_notifications notifications; ma_uint32 flags; - if (pDataStream == NULL) { - if (pConfig != NULL && pConfig->pNotifications != NULL) { + if (pDataStream == nullptr) { + if (pConfig != nullptr && pConfig->pNotifications != nullptr) { ma_resource_manager_pipeline_notifications_signal_all_notifications(pConfig->pNotifications); } @@ -71840,12 +71840,12 @@ MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pR MA_ZERO_OBJECT(pDataStream); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - if (pConfig->pNotifications != NULL) { - notifications = *pConfig->pNotifications; /* From here on out, `notifications` should be used instead of `pNotifications`. Setting this to NULL to catch any errors at testing time. */ + if (pConfig->pNotifications != nullptr) { + notifications = *pConfig->pNotifications; /* From here on out, `notifications` should be used instead of `pNotifications`. Setting this to nullptr to catch any errors at testing time. */ } else { MA_ZERO_OBJECT(¬ifications); } @@ -71872,7 +71872,7 @@ MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pR ma_data_source_set_loop_point_in_pcm_frames(pDataStream, pConfig->loopPointBegInPCMFrames, pConfig->loopPointEndInPCMFrames); ma_data_source_set_looping(pDataStream, (flags & MA_RESOURCE_MANAGER_DATA_SOURCE_FLAG_LOOPING) != 0); - if (pResourceManager == NULL || (pConfig->pFilePath == NULL && pConfig->pFilePathW == NULL)) { + if (pResourceManager == nullptr || (pConfig->pFilePath == nullptr && pConfig->pFilePathW == nullptr)) { ma_resource_manager_pipeline_notifications_signal_all_notifications(¬ifications); return MA_INVALID_ARGS; } @@ -71880,13 +71880,13 @@ MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pR /* We want all access to the VFS and the internal decoder to happen on the job thread just to keep things easier to manage for the VFS. */ /* We need a copy of the file path. We should probably make this more efficient, but for now we'll do a transient memory allocation. */ - if (pConfig->pFilePath != NULL) { + if (pConfig->pFilePath != nullptr) { pFilePathCopy = ma_copy_string(pConfig->pFilePath, &pResourceManager->config.allocationCallbacks); } else { pFilePathWCopy = ma_copy_string_w(pConfig->pFilePathW, &pResourceManager->config.allocationCallbacks); } - if (pFilePathCopy == NULL && pFilePathWCopy == NULL) { + if (pFilePathCopy == nullptr && pFilePathWCopy == nullptr) { ma_resource_manager_pipeline_notifications_signal_all_notifications(¬ifications); return MA_OUT_OF_MEMORY; } @@ -71932,7 +71932,7 @@ MA_API ma_result ma_resource_manager_data_stream_init_ex(ma_resource_manager* pR if (waitBeforeReturning) { ma_resource_manager_inline_notification_wait_and_uninit(&waitNotification); - if (notifications.init.pNotification != NULL) { + if (notifications.init.pNotification != nullptr) { ma_async_notification_signal(notifications.init.pNotification); } @@ -71979,7 +71979,7 @@ MA_API ma_result ma_resource_manager_data_stream_uninit(ma_resource_manager_data ma_resource_manager_inline_notification freeEvent; ma_job job; - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -71996,7 +71996,7 @@ MA_API ma_result ma_resource_manager_data_stream_uninit(ma_resource_manager_data job.order = ma_resource_manager_data_stream_next_execution_order(pDataStream); job.data.resourceManager.freeDataStream.pDataStream = pDataStream; job.data.resourceManager.freeDataStream.pDoneNotification = &freeEvent; - job.data.resourceManager.freeDataStream.pDoneFence = NULL; + job.data.resourceManager.freeDataStream.pDoneFence = nullptr; ma_resource_manager_post_job(pDataStream->pResourceManager, &job); /* We need to wait for the job to finish processing before we return. */ @@ -72008,7 +72008,7 @@ MA_API ma_result ma_resource_manager_data_stream_uninit(ma_resource_manager_data static ma_uint32 ma_resource_manager_data_stream_get_page_size_in_frames(ma_resource_manager_data_stream* pDataStream) { - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); MA_ASSERT(pDataStream->isDecoderInitialized == MA_TRUE); return MA_RESOURCE_MANAGER_PAGE_SIZE_IN_MILLISECONDS * (pDataStream->decoder.outputSampleRate/1000); @@ -72016,7 +72016,7 @@ static ma_uint32 ma_resource_manager_data_stream_get_page_size_in_frames(ma_reso static void* ma_resource_manager_data_stream_get_page_data_pointer(ma_resource_manager_data_stream* pDataStream, ma_uint32 pageIndex, ma_uint32 relativeCursor) { - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); MA_ASSERT(pDataStream->isDecoderInitialized == MA_TRUE); MA_ASSERT(pageIndex == 0 || pageIndex == 1); @@ -72062,7 +72062,7 @@ static void ma_resource_manager_data_stream_fill_pages(ma_resource_manager_data_ { ma_uint32 iPage; - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); for (iPage = 0; iPage < 2; iPage += 1) { ma_resource_manager_data_stream_fill_page(pDataStream, iPage); @@ -72078,15 +72078,15 @@ static ma_result ma_resource_manager_data_stream_map(ma_resource_manager_data_st /* We cannot be using the data source after it's been uninitialized. */ MA_ASSERT(ma_resource_manager_data_stream_result(pDataStream) != MA_UNAVAILABLE); - if (pFrameCount != NULL) { + if (pFrameCount != nullptr) { frameCount = *pFrameCount; *pFrameCount = 0; } - if (ppFramesOut != NULL) { - *ppFramesOut = NULL; + if (ppFramesOut != nullptr) { + *ppFramesOut = nullptr; } - if (pDataStream == NULL || ppFramesOut == NULL || pFrameCount == NULL) { + if (pDataStream == nullptr || ppFramesOut == nullptr || pFrameCount == nullptr) { return MA_INVALID_ARGS; } @@ -72143,7 +72143,7 @@ static ma_result ma_resource_manager_data_stream_unmap(ma_resource_manager_data_ /* We cannot be using the data source after it's been uninitialized. */ MA_ASSERT(ma_resource_manager_data_stream_result(pDataStream) != MA_UNAVAILABLE); - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -72197,7 +72197,7 @@ MA_API ma_result ma_resource_manager_data_stream_read_pcm_frames(ma_resource_man ma_uint32 channels; /* Safety. */ - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -72208,7 +72208,7 @@ MA_API ma_result ma_resource_manager_data_stream_read_pcm_frames(ma_resource_man /* We cannot be using the data source after it's been uninitialized. */ MA_ASSERT(ma_resource_manager_data_stream_result(pDataStream) != MA_UNAVAILABLE); - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -72221,7 +72221,7 @@ MA_API ma_result ma_resource_manager_data_stream_read_pcm_frames(ma_resource_man return MA_BUSY; } - ma_resource_manager_data_stream_get_data_format(pDataStream, &format, &channels, NULL, NULL, 0); + ma_resource_manager_data_stream_get_data_format(pDataStream, &format, &channels, nullptr, nullptr, 0); /* Reading is implemented in terms of map/unmap. We need to run this in a loop because mapping is clamped against page boundaries. */ totalFramesProcessed = 0; @@ -72235,8 +72235,8 @@ MA_API ma_result ma_resource_manager_data_stream_read_pcm_frames(ma_resource_man break; } - /* Copy the mapped data to the output buffer if we have one. It's allowed for pFramesOut to be NULL in which case a relative forward seek is performed. */ - if (pFramesOut != NULL) { + /* Copy the mapped data to the output buffer if we have one. It's allowed for pFramesOut to be nullptr in which case a relative forward seek is performed. */ + if (pFramesOut != nullptr) { ma_copy_pcm_frames(ma_offset_pcm_frames_ptr(pFramesOut, totalFramesProcessed, format, channels), pMappedFrames, mappedFrameCount, format, channels); } @@ -72248,7 +72248,7 @@ MA_API ma_result ma_resource_manager_data_stream_read_pcm_frames(ma_resource_man } } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesProcessed; } @@ -72269,7 +72269,7 @@ MA_API ma_result ma_resource_manager_data_stream_seek_to_pcm_frame(ma_resource_m /* We cannot be using the data source after it's been uninitialized. */ MA_ASSERT(streamResult != MA_UNAVAILABLE); - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -72320,23 +72320,23 @@ MA_API ma_result ma_resource_manager_data_stream_get_data_format(ma_resource_man /* We cannot be using the data source after it's been uninitialized. */ MA_ASSERT(ma_resource_manager_data_stream_result(pDataStream) != MA_UNAVAILABLE); - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = ma_format_unknown; } - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = 0; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = 0; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { MA_ZERO_MEMORY(pChannelMap, sizeof(*pChannelMap) * channelMapCap); } - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -72355,7 +72355,7 @@ MA_API ma_result ma_resource_manager_data_stream_get_cursor_in_pcm_frames(ma_res { ma_result result; - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } @@ -72364,7 +72364,7 @@ MA_API ma_result ma_resource_manager_data_stream_get_cursor_in_pcm_frames(ma_res /* We cannot be using the data source after it's been uninitialized. */ MA_ASSERT(ma_resource_manager_data_stream_result(pDataStream) != MA_UNAVAILABLE); - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -72387,7 +72387,7 @@ MA_API ma_result ma_resource_manager_data_stream_get_length_in_pcm_frames(ma_res { ma_result streamResult; - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } @@ -72398,7 +72398,7 @@ MA_API ma_result ma_resource_manager_data_stream_get_length_in_pcm_frames(ma_res /* We cannot be using the data source after it's been uninitialized. */ MA_ASSERT(streamResult != MA_UNAVAILABLE); - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -72420,7 +72420,7 @@ MA_API ma_result ma_resource_manager_data_stream_get_length_in_pcm_frames(ma_res MA_API ma_result ma_resource_manager_data_stream_result(const ma_resource_manager_data_stream* pDataStream) { - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -72434,7 +72434,7 @@ MA_API ma_result ma_resource_manager_data_stream_set_looping(ma_resource_manager MA_API ma_bool32 ma_resource_manager_data_stream_is_looping(const ma_resource_manager_data_stream* pDataStream) { - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_FALSE; } @@ -72448,13 +72448,13 @@ MA_API ma_result ma_resource_manager_data_stream_get_available_frames(ma_resourc ma_uint32 relativeCursor; ma_uint64 availableFrames; - if (pAvailableFrames == NULL) { + if (pAvailableFrames == nullptr) { return MA_INVALID_ARGS; } *pAvailableFrames = 0; - if (pDataStream == NULL) { + if (pDataStream == nullptr) { return MA_INVALID_ARGS; } @@ -72477,17 +72477,17 @@ MA_API ma_result ma_resource_manager_data_stream_get_available_frames(ma_resourc static ma_result ma_resource_manager_data_source_preinit(ma_resource_manager* pResourceManager, const ma_resource_manager_data_source_config* pConfig, ma_resource_manager_data_source* pDataSource) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pDataSource); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - if (pResourceManager == NULL) { + if (pResourceManager == nullptr) { return MA_INVALID_ARGS; } @@ -72545,7 +72545,7 @@ MA_API ma_result ma_resource_manager_data_source_init_copy(ma_resource_manager* ma_result result; ma_resource_manager_data_source_config config; - if (pExistingDataSource == NULL) { + if (pExistingDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72567,7 +72567,7 @@ MA_API ma_result ma_resource_manager_data_source_init_copy(ma_resource_manager* MA_API ma_result ma_resource_manager_data_source_uninit(ma_resource_manager_data_source* pDataSource) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72582,11 +72582,11 @@ MA_API ma_result ma_resource_manager_data_source_uninit(ma_resource_manager_data MA_API ma_result ma_resource_manager_data_source_read_pcm_frames(ma_resource_manager_data_source* pDataSource, void* pFramesOut, ma_uint64 frameCount, ma_uint64* pFramesRead) { /* Safety. */ - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72599,7 +72599,7 @@ MA_API ma_result ma_resource_manager_data_source_read_pcm_frames(ma_resource_man MA_API ma_result ma_resource_manager_data_source_seek_to_pcm_frame(ma_resource_manager_data_source* pDataSource, ma_uint64 frameIndex) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72612,7 +72612,7 @@ MA_API ma_result ma_resource_manager_data_source_seek_to_pcm_frame(ma_resource_m MA_API ma_result ma_resource_manager_data_source_map(ma_resource_manager_data_source* pDataSource, void** ppFramesOut, ma_uint64* pFrameCount) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72625,7 +72625,7 @@ MA_API ma_result ma_resource_manager_data_source_map(ma_resource_manager_data_so MA_API ma_result ma_resource_manager_data_source_unmap(ma_resource_manager_data_source* pDataSource, ma_uint64 frameCount) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72638,7 +72638,7 @@ MA_API ma_result ma_resource_manager_data_source_unmap(ma_resource_manager_data_ MA_API ma_result ma_resource_manager_data_source_get_data_format(ma_resource_manager_data_source* pDataSource, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72651,7 +72651,7 @@ MA_API ma_result ma_resource_manager_data_source_get_data_format(ma_resource_man MA_API ma_result ma_resource_manager_data_source_get_cursor_in_pcm_frames(ma_resource_manager_data_source* pDataSource, ma_uint64* pCursor) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72664,7 +72664,7 @@ MA_API ma_result ma_resource_manager_data_source_get_cursor_in_pcm_frames(ma_res MA_API ma_result ma_resource_manager_data_source_get_length_in_pcm_frames(ma_resource_manager_data_source* pDataSource, ma_uint64* pLength) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72677,7 +72677,7 @@ MA_API ma_result ma_resource_manager_data_source_get_length_in_pcm_frames(ma_res MA_API ma_result ma_resource_manager_data_source_result(const ma_resource_manager_data_source* pDataSource) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72690,7 +72690,7 @@ MA_API ma_result ma_resource_manager_data_source_result(const ma_resource_manage MA_API ma_result ma_resource_manager_data_source_set_looping(ma_resource_manager_data_source* pDataSource, ma_bool32 isLooping) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72703,7 +72703,7 @@ MA_API ma_result ma_resource_manager_data_source_set_looping(ma_resource_manager MA_API ma_bool32 ma_resource_manager_data_source_is_looping(const ma_resource_manager_data_source* pDataSource) { - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_FALSE; } @@ -72716,13 +72716,13 @@ MA_API ma_bool32 ma_resource_manager_data_source_is_looping(const ma_resource_ma MA_API ma_result ma_resource_manager_data_source_get_available_frames(ma_resource_manager_data_source* pDataSource, ma_uint64* pAvailableFrames) { - if (pAvailableFrames == NULL) { + if (pAvailableFrames == nullptr) { return MA_INVALID_ARGS; } *pAvailableFrames = 0; - if (pDataSource == NULL) { + if (pDataSource == nullptr) { return MA_INVALID_ARGS; } @@ -72736,7 +72736,7 @@ MA_API ma_result ma_resource_manager_data_source_get_available_frames(ma_resourc MA_API ma_result ma_resource_manager_post_job(ma_resource_manager* pResourceManager, const ma_job* pJob) { - if (pResourceManager == NULL) { + if (pResourceManager == nullptr) { return MA_INVALID_ARGS; } @@ -72751,7 +72751,7 @@ MA_API ma_result ma_resource_manager_post_job_quit(ma_resource_manager* pResourc MA_API ma_result ma_resource_manager_next_job(ma_resource_manager* pResourceManager, ma_job* pJob) { - if (pResourceManager == NULL) { + if (pResourceManager == nullptr) { return MA_INVALID_ARGS; } @@ -72765,13 +72765,13 @@ static ma_result ma_job_process__resource_manager__load_data_buffer_node(ma_job* ma_resource_manager* pResourceManager; ma_resource_manager_data_buffer_node* pDataBufferNode; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pResourceManager = (ma_resource_manager*)pJob->data.resourceManager.loadDataBufferNode.pResourceManager; - MA_ASSERT(pResourceManager != NULL); + MA_ASSERT(pResourceManager != nullptr); pDataBufferNode = (ma_resource_manager_data_buffer_node*)pJob->data.resourceManager.loadDataBufferNode.pDataBufferNode; - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pDataBufferNode != nullptr); MA_ASSERT(pDataBufferNode->isDataOwnedByResourceManager == MA_TRUE); /* The data should always be owned by the resource manager. */ /* The data buffer is not getting deleted, but we may be getting executed out of order. If so, we need to push the job back onto the queue and return. */ @@ -72825,7 +72825,7 @@ static ma_result ma_job_process__resource_manager__load_data_buffer_node(ma_job* } if (result != MA_SUCCESS) { - if (pJob->data.resourceManager.loadDataBufferNode.pFilePath != NULL) { + if (pJob->data.resourceManager.loadDataBufferNode.pFilePath != nullptr) { ma_log_postf(ma_resource_manager_get_log(pResourceManager), MA_LOG_LEVEL_WARNING, "Failed to initialize data supply for \"%s\". %s.\n", pJob->data.resourceManager.loadDataBufferNode.pFilePath, ma_result_description(result)); } else { #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(_MSC_VER) @@ -72889,19 +72889,19 @@ done: ma_atomic_compare_and_swap_i32(&pDataBufferNode->result, MA_BUSY, result); /* At this point initialization is complete and we can signal the notification if any. */ - if (pJob->data.resourceManager.loadDataBufferNode.pInitNotification != NULL) { + if (pJob->data.resourceManager.loadDataBufferNode.pInitNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.loadDataBufferNode.pInitNotification); } - if (pJob->data.resourceManager.loadDataBufferNode.pInitFence != NULL) { + if (pJob->data.resourceManager.loadDataBufferNode.pInitFence != nullptr) { ma_fence_release(pJob->data.resourceManager.loadDataBufferNode.pInitFence); } /* If we have a success result it means we've fully loaded the buffer. This will happen in the non-decoding case. */ if (result != MA_BUSY) { - if (pJob->data.resourceManager.loadDataBufferNode.pDoneNotification != NULL) { + if (pJob->data.resourceManager.loadDataBufferNode.pDoneNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.loadDataBufferNode.pDoneNotification); } - if (pJob->data.resourceManager.loadDataBufferNode.pDoneFence != NULL) { + if (pJob->data.resourceManager.loadDataBufferNode.pDoneFence != nullptr) { ma_fence_release(pJob->data.resourceManager.loadDataBufferNode.pDoneFence); } } @@ -72922,24 +72922,24 @@ static ma_result ma_job_process__resource_manager__free_data_buffer_node(ma_job* ma_resource_manager* pResourceManager; ma_resource_manager_data_buffer_node* pDataBufferNode; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pResourceManager = (ma_resource_manager*)pJob->data.resourceManager.freeDataBufferNode.pResourceManager; - MA_ASSERT(pResourceManager != NULL); + MA_ASSERT(pResourceManager != nullptr); pDataBufferNode = (ma_resource_manager_data_buffer_node*)pJob->data.resourceManager.freeDataBufferNode.pDataBufferNode; - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pDataBufferNode != nullptr); if (pJob->order != ma_atomic_load_32(&pDataBufferNode->executionPointer)) { return ma_resource_manager_post_job(pResourceManager, pJob); /* Out of order. */ } /* The event needs to be signalled last. */ - if (pJob->data.resourceManager.freeDataBufferNode.pDoneNotification != NULL) { + if (pJob->data.resourceManager.freeDataBufferNode.pDoneNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.freeDataBufferNode.pDoneNotification); } - if (pJob->data.resourceManager.freeDataBufferNode.pDoneFence != NULL) { + if (pJob->data.resourceManager.freeDataBufferNode.pDoneFence != nullptr) { ma_fence_release(pJob->data.resourceManager.freeDataBufferNode.pDoneFence); } @@ -72956,13 +72956,13 @@ static ma_result ma_job_process__resource_manager__page_data_buffer_node(ma_job* ma_resource_manager* pResourceManager; ma_resource_manager_data_buffer_node* pDataBufferNode; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pResourceManager = (ma_resource_manager*)pJob->data.resourceManager.pageDataBufferNode.pResourceManager; - MA_ASSERT(pResourceManager != NULL); + MA_ASSERT(pResourceManager != nullptr); pDataBufferNode = (ma_resource_manager_data_buffer_node*)pJob->data.resourceManager.pageDataBufferNode.pDataBufferNode; - MA_ASSERT(pDataBufferNode != NULL); + MA_ASSERT(pDataBufferNode != nullptr); if (pJob->order != ma_atomic_load_32(&pDataBufferNode->executionPointer)) { return ma_resource_manager_post_job(pResourceManager, pJob); /* Out of order. */ @@ -73011,11 +73011,11 @@ done: /* Signal the notification after setting the result in case the notification callback wants to inspect the result code. */ if (result != MA_BUSY) { - if (pJob->data.resourceManager.pageDataBufferNode.pDoneNotification != NULL) { + if (pJob->data.resourceManager.pageDataBufferNode.pDoneNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.pageDataBufferNode.pDoneNotification); } - if (pJob->data.resourceManager.pageDataBufferNode.pDoneFence != NULL) { + if (pJob->data.resourceManager.pageDataBufferNode.pDoneFence != nullptr) { ma_fence_release(pJob->data.resourceManager.pageDataBufferNode.pDoneFence); } } @@ -73037,10 +73037,10 @@ static ma_result ma_job_process__resource_manager__load_data_buffer(ma_job* pJob All we're doing here is checking if the node has finished loading. If not, we just re-post the job and keep waiting. Otherwise we increment the execution counter and set the buffer's result code. */ - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pDataBuffer = (ma_resource_manager_data_buffer*)pJob->data.resourceManager.loadDataBuffer.pDataBuffer; - MA_ASSERT(pDataBuffer != NULL); + MA_ASSERT(pDataBuffer != nullptr); pResourceManager = pDataBuffer->pResourceManager; @@ -73106,10 +73106,10 @@ done: ma_atomic_compare_and_swap_i32(&pDataBuffer->result, MA_BUSY, result); /* Only signal the other threads after the result has been set just for cleanliness sake. */ - if (pJob->data.resourceManager.loadDataBuffer.pDoneNotification != NULL) { + if (pJob->data.resourceManager.loadDataBuffer.pDoneNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.loadDataBuffer.pDoneNotification); } - if (pJob->data.resourceManager.loadDataBuffer.pDoneFence != NULL) { + if (pJob->data.resourceManager.loadDataBuffer.pDoneFence != nullptr) { ma_fence_release(pJob->data.resourceManager.loadDataBuffer.pDoneFence); } @@ -73118,10 +73118,10 @@ done: notification event was never signalled which means we need to signal it here. */ if (ma_resource_manager_data_buffer_has_connector(pDataBuffer) == MA_FALSE && result != MA_SUCCESS) { - if (pJob->data.resourceManager.loadDataBuffer.pInitNotification != NULL) { + if (pJob->data.resourceManager.loadDataBuffer.pInitNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.loadDataBuffer.pInitNotification); } - if (pJob->data.resourceManager.loadDataBuffer.pInitFence != NULL) { + if (pJob->data.resourceManager.loadDataBuffer.pInitFence != nullptr) { ma_fence_release(pJob->data.resourceManager.loadDataBuffer.pInitFence); } } @@ -73135,10 +73135,10 @@ static ma_result ma_job_process__resource_manager__free_data_buffer(ma_job* pJob ma_resource_manager* pResourceManager; ma_resource_manager_data_buffer* pDataBuffer; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pDataBuffer = (ma_resource_manager_data_buffer*)pJob->data.resourceManager.freeDataBuffer.pDataBuffer; - MA_ASSERT(pDataBuffer != NULL); + MA_ASSERT(pDataBuffer != nullptr); pResourceManager = pDataBuffer->pResourceManager; @@ -73149,11 +73149,11 @@ static ma_result ma_job_process__resource_manager__free_data_buffer(ma_job* pJob ma_resource_manager_data_buffer_uninit_internal(pDataBuffer); /* The event needs to be signalled last. */ - if (pJob->data.resourceManager.freeDataBuffer.pDoneNotification != NULL) { + if (pJob->data.resourceManager.freeDataBuffer.pDoneNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.freeDataBuffer.pDoneNotification); } - if (pJob->data.resourceManager.freeDataBuffer.pDoneFence != NULL) { + if (pJob->data.resourceManager.freeDataBuffer.pDoneFence != nullptr) { ma_fence_release(pJob->data.resourceManager.freeDataBuffer.pDoneFence); } @@ -73169,10 +73169,10 @@ static ma_result ma_job_process__resource_manager__load_data_stream(ma_job* pJob ma_resource_manager* pResourceManager; ma_resource_manager_data_stream* pDataStream; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pDataStream = (ma_resource_manager_data_stream*)pJob->data.resourceManager.loadDataStream.pDataStream; - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); pResourceManager = pDataStream->pResourceManager; @@ -73188,7 +73188,7 @@ static ma_result ma_job_process__resource_manager__load_data_stream(ma_job* pJob /* We need to initialize the decoder first so we can determine the size of the pages. */ decoderConfig = ma_resource_manager__init_decoder_config(pResourceManager); - if (pJob->data.resourceManager.loadDataStream.pFilePath != NULL) { + if (pJob->data.resourceManager.loadDataStream.pFilePath != nullptr) { result = ma_decoder_init_vfs(pResourceManager->config.pVFS, pJob->data.resourceManager.loadDataStream.pFilePath, &decoderConfig, &pDataStream->decoder); } else { result = ma_decoder_init_vfs_w(pResourceManager->config.pVFS, pJob->data.resourceManager.loadDataStream.pFilePathW, &decoderConfig, &pDataStream->decoder); @@ -73217,7 +73217,7 @@ static ma_result ma_job_process__resource_manager__load_data_stream(ma_job* pJob pageBufferSizeInBytes = ma_resource_manager_data_stream_get_page_size_in_frames(pDataStream) * 2 * ma_get_bytes_per_frame(pDataStream->decoder.outputFormat, pDataStream->decoder.outputChannels); pDataStream->pPageData = ma_malloc(pageBufferSizeInBytes, &pResourceManager->config.allocationCallbacks); - if (pDataStream->pPageData == NULL) { + if (pDataStream->pPageData == nullptr) { ma_decoder_uninit(&pDataStream->decoder); result = MA_OUT_OF_MEMORY; goto done; @@ -73240,10 +73240,10 @@ done: ma_atomic_compare_and_swap_i32(&pDataStream->result, MA_BUSY, result); /* Only signal the other threads after the result has been set just for cleanliness sake. */ - if (pJob->data.resourceManager.loadDataStream.pInitNotification != NULL) { + if (pJob->data.resourceManager.loadDataStream.pInitNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.loadDataStream.pInitNotification); } - if (pJob->data.resourceManager.loadDataStream.pInitFence != NULL) { + if (pJob->data.resourceManager.loadDataStream.pInitFence != nullptr) { ma_fence_release(pJob->data.resourceManager.loadDataStream.pInitFence); } @@ -73256,10 +73256,10 @@ static ma_result ma_job_process__resource_manager__free_data_stream(ma_job* pJob ma_resource_manager* pResourceManager; ma_resource_manager_data_stream* pDataStream; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pDataStream = (ma_resource_manager_data_stream*)pJob->data.resourceManager.freeDataStream.pDataStream; - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); pResourceManager = pDataStream->pResourceManager; @@ -73274,18 +73274,18 @@ static ma_result ma_job_process__resource_manager__free_data_stream(ma_job* pJob ma_decoder_uninit(&pDataStream->decoder); } - if (pDataStream->pPageData != NULL) { + if (pDataStream->pPageData != nullptr) { ma_free(pDataStream->pPageData, &pResourceManager->config.allocationCallbacks); - pDataStream->pPageData = NULL; /* Just in case... */ + pDataStream->pPageData = nullptr; /* Just in case... */ } ma_data_source_uninit(&pDataStream->ds); /* The event needs to be signalled last. */ - if (pJob->data.resourceManager.freeDataStream.pDoneNotification != NULL) { + if (pJob->data.resourceManager.freeDataStream.pDoneNotification != nullptr) { ma_async_notification_signal(pJob->data.resourceManager.freeDataStream.pDoneNotification); } - if (pJob->data.resourceManager.freeDataStream.pDoneFence != NULL) { + if (pJob->data.resourceManager.freeDataStream.pDoneFence != nullptr) { ma_fence_release(pJob->data.resourceManager.freeDataStream.pDoneFence); } @@ -73299,10 +73299,10 @@ static ma_result ma_job_process__resource_manager__page_data_stream(ma_job* pJob ma_resource_manager* pResourceManager; ma_resource_manager_data_stream* pDataStream; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pDataStream = (ma_resource_manager_data_stream*)pJob->data.resourceManager.pageDataStream.pDataStream; - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); pResourceManager = pDataStream->pResourceManager; @@ -73329,10 +73329,10 @@ static ma_result ma_job_process__resource_manager__seek_data_stream(ma_job* pJob ma_resource_manager* pResourceManager; ma_resource_manager_data_stream* pDataStream; - MA_ASSERT(pJob != NULL); + MA_ASSERT(pJob != nullptr); pDataStream = (ma_resource_manager_data_stream*)pJob->data.resourceManager.seekDataStream.pDataStream; - MA_ASSERT(pDataStream != NULL); + MA_ASSERT(pDataStream != nullptr); pResourceManager = pDataStream->pResourceManager; @@ -73365,7 +73365,7 @@ done: MA_API ma_result ma_resource_manager_process_job(ma_resource_manager* pResourceManager, ma_job* pJob) { - if (pResourceManager == NULL || pJob == NULL) { + if (pResourceManager == nullptr || pJob == nullptr) { return MA_INVALID_ARGS; } @@ -73377,7 +73377,7 @@ MA_API ma_result ma_resource_manager_process_next_job(ma_resource_manager* pReso ma_result result; ma_job job; - if (pResourceManager == NULL) { + if (pResourceManager == nullptr) { return MA_INVALID_ARGS; } @@ -73410,12 +73410,12 @@ static ma_stack* ma_stack_init(size_t sizeInBytes, const ma_allocation_callbacks ma_stack* pStack; if (sizeInBytes == 0) { - return NULL; + return nullptr; } pStack = (ma_stack*)ma_malloc(sizeof(*pStack) - sizeof(pStack->_data) + sizeInBytes, pAllocationCallbacks); - if (pStack == NULL) { - return NULL; + if (pStack == nullptr) { + return nullptr; } pStack->offset = 0; @@ -73426,7 +73426,7 @@ static ma_stack* ma_stack_init(size_t sizeInBytes, const ma_allocation_callbacks static void ma_stack_uninit(ma_stack* pStack, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pStack == NULL) { + if (pStack == nullptr) { return; } @@ -73441,7 +73441,7 @@ static void* ma_stack_alloc(ma_stack* pStack, size_t sz) sz = (sz + (sizeof(ma_uintptr) - 1)) & ~(sizeof(ma_uintptr) - 1); /* Padding. */ if (pStack->offset + sz + sizeof(size_t) > pStack->sizeInBytes) { - return NULL; /* Out of memory. */ + return nullptr; /* Out of memory. */ } pStack->offset += sz + sizeof(size_t); @@ -73454,7 +73454,7 @@ static void ma_stack_free(ma_stack* pStack, void* p) { size_t* pSize; - if (p == NULL) { + if (p == nullptr) { return; } @@ -73484,7 +73484,7 @@ MA_API void ma_debug_fill_pcm_frames_with_sine_wave(float* pFramesOut, ma_uint32 waveformConfig = ma_waveform_config_init(format, channels, sampleRate, ma_waveform_type_sine, 1.0, 400); ma_waveform_init(&waveformConfig, &waveform); - ma_waveform_read_pcm_frames(&waveform, pFramesOut, frameCount, NULL); + ma_waveform_read_pcm_frames(&waveform, pFramesOut, frameCount, nullptr); } #else { @@ -73520,14 +73520,14 @@ MA_API ma_node_graph_config ma_node_graph_config_init(ma_uint32 channels) static void ma_node_graph_set_is_reading(ma_node_graph* pNodeGraph, ma_bool32 isReading) { - MA_ASSERT(pNodeGraph != NULL); + MA_ASSERT(pNodeGraph != nullptr); ma_atomic_exchange_32(&pNodeGraph->isReading, isReading); } #if 0 static ma_bool32 ma_node_graph_is_reading(ma_node_graph* pNodeGraph) { - MA_ASSERT(pNodeGraph != NULL); + MA_ASSERT(pNodeGraph != nullptr); return ma_atomic_load_32(&pNodeGraph->isReading); } #endif @@ -73549,7 +73549,7 @@ static void ma_node_graph_node_process_pcm_frames(ma_node* pNode, const float** static ma_node_vtable g_node_graph_node_vtable = { ma_node_graph_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 0, /* 0 input buses. */ 1, /* 1 output bus. */ 0 /* Flags. */ @@ -73557,7 +73557,7 @@ static ma_node_vtable g_node_graph_node_vtable = static void ma_node_graph_endpoint_process_pcm_frames(ma_node* pNode, const float** ppFramesIn, ma_uint32* pFrameCountIn, float** ppFramesOut, ma_uint32* pFrameCountOut) { - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); MA_ASSERT(ma_node_get_input_bus_count(pNode) == 1); MA_ASSERT(ma_node_get_output_bus_count(pNode) == 1); @@ -73573,7 +73573,7 @@ static void ma_node_graph_endpoint_process_pcm_frames(ma_node* pNode, const floa #if 0 /* The data has already been mixed. We just need to move it to the output buffer. */ - if (ppFramesIn != NULL) { + if (ppFramesIn != nullptr) { ma_copy_pcm_frames(ppFramesOut[0], ppFramesIn[0], *pFrameCountOut, ma_format_f32, ma_node_get_output_channels(pNode, 0)); } #endif @@ -73582,7 +73582,7 @@ static void ma_node_graph_endpoint_process_pcm_frames(ma_node* pNode, const floa static ma_node_vtable g_node_graph_endpoint_vtable = { ma_node_graph_endpoint_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* 1 input bus. */ 1, /* 1 output bus. */ MA_NODE_FLAG_PASSTHROUGH /* Flags. The endpoint is a passthrough. */ @@ -73594,7 +73594,7 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m ma_node_config baseConfig; ma_node_config endpointConfig; - if (pNodeGraph == NULL) { + if (pNodeGraph == nullptr) { return MA_INVALID_ARGS; } @@ -73628,7 +73628,7 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m /* Processing cache. */ if (pConfig->processingSizeInFrames > 0) { pNodeGraph->pProcessingCache = (float*)ma_malloc(pConfig->processingSizeInFrames * pConfig->channels * sizeof(float), pAllocationCallbacks); - if (pNodeGraph->pProcessingCache == NULL) { + if (pNodeGraph->pProcessingCache == nullptr) { ma_node_uninit(&pNodeGraph->endpoint, pAllocationCallbacks); ma_node_uninit(&pNodeGraph->base, pAllocationCallbacks); return MA_OUT_OF_MEMORY; @@ -73646,10 +73646,10 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m } pNodeGraph->pPreMixStack = ma_stack_init(preMixStackSizeInBytes, pAllocationCallbacks); - if (pNodeGraph->pPreMixStack == NULL) { + if (pNodeGraph->pPreMixStack == nullptr) { ma_node_uninit(&pNodeGraph->endpoint, pAllocationCallbacks); ma_node_uninit(&pNodeGraph->base, pAllocationCallbacks); - if (pNodeGraph->pProcessingCache != NULL) { + if (pNodeGraph->pProcessingCache != nullptr) { ma_free(pNodeGraph->pProcessingCache, pAllocationCallbacks); } @@ -73663,28 +73663,28 @@ MA_API ma_result ma_node_graph_init(const ma_node_graph_config* pConfig, const m MA_API void ma_node_graph_uninit(ma_node_graph* pNodeGraph, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pNodeGraph == NULL) { + if (pNodeGraph == nullptr) { return; } ma_node_uninit(&pNodeGraph->endpoint, pAllocationCallbacks); ma_node_uninit(&pNodeGraph->base, pAllocationCallbacks); - if (pNodeGraph->pProcessingCache != NULL) { + if (pNodeGraph->pProcessingCache != nullptr) { ma_free(pNodeGraph->pProcessingCache, pAllocationCallbacks); - pNodeGraph->pProcessingCache = NULL; + pNodeGraph->pProcessingCache = nullptr; } - if (pNodeGraph->pPreMixStack != NULL) { + if (pNodeGraph->pPreMixStack != nullptr) { ma_stack_uninit(pNodeGraph->pPreMixStack, pAllocationCallbacks); - pNodeGraph->pPreMixStack = NULL; + pNodeGraph->pPreMixStack = nullptr; } } MA_API ma_node* ma_node_graph_get_endpoint(ma_node_graph* pNodeGraph) { - if (pNodeGraph == NULL) { - return NULL; + if (pNodeGraph == nullptr) { + return nullptr; } return &pNodeGraph->endpoint; @@ -73696,11 +73696,11 @@ MA_API ma_result ma_node_graph_read_pcm_frames(ma_node_graph* pNodeGraph, void* ma_uint64 totalFramesRead; ma_uint32 channels; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; /* Safety. */ } - if (pNodeGraph == NULL) { + if (pNodeGraph == nullptr) { return MA_INVALID_ARGS; } @@ -73785,7 +73785,7 @@ MA_API ma_result ma_node_graph_read_pcm_frames(ma_node_graph* pNodeGraph, void* ma_silence_pcm_frames(ma_offset_pcm_frames_ptr(pFramesOut, totalFramesRead, ma_format_f32, channels), (frameCount - totalFramesRead), ma_format_f32, channels); } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = totalFramesRead; } @@ -73794,7 +73794,7 @@ MA_API ma_result ma_node_graph_read_pcm_frames(ma_node_graph* pNodeGraph, void* MA_API ma_uint32 ma_node_graph_get_channels(const ma_node_graph* pNodeGraph) { - if (pNodeGraph == NULL) { + if (pNodeGraph == nullptr) { return 0; } @@ -73803,7 +73803,7 @@ MA_API ma_uint32 ma_node_graph_get_channels(const ma_node_graph* pNodeGraph) MA_API ma_uint64 ma_node_graph_get_time(const ma_node_graph* pNodeGraph) { - if (pNodeGraph == NULL) { + if (pNodeGraph == nullptr) { return 0; } @@ -73812,7 +73812,7 @@ MA_API ma_uint64 ma_node_graph_get_time(const ma_node_graph* pNodeGraph) MA_API ma_result ma_node_graph_set_time(ma_node_graph* pNodeGraph, ma_uint64 globalTime) { - if (pNodeGraph == NULL) { + if (pNodeGraph == nullptr) { return MA_INVALID_ARGS; } @@ -73821,7 +73821,7 @@ MA_API ma_result ma_node_graph_set_time(ma_node_graph* pNodeGraph, ma_uint64 glo MA_API ma_uint32 ma_node_graph_get_processing_size_in_frames(const ma_node_graph* pNodeGraph) { - if (pNodeGraph == NULL) { + if (pNodeGraph == nullptr) { return 0; } @@ -73833,7 +73833,7 @@ MA_API ma_uint32 ma_node_graph_get_processing_size_in_frames(const ma_node_graph static ma_result ma_node_output_bus_init(ma_node* pNode, ma_uint32 outputBusIndex, ma_uint32 channels, ma_node_output_bus* pOutputBus) { - MA_ASSERT(pOutputBus != NULL); + MA_ASSERT(pOutputBus != nullptr); MA_ASSERT(outputBusIndex < MA_MAX_NODE_BUS_COUNT); MA_ASSERT(outputBusIndex < ma_node_get_output_bus_count(pNode)); MA_ASSERT(channels < 256); @@ -73898,7 +73898,7 @@ static ma_bool32 ma_node_output_bus_is_attached(ma_node_output_bus* pOutputBus) static ma_result ma_node_output_bus_set_volume(ma_node_output_bus* pOutputBus, float volume) { - MA_ASSERT(pOutputBus != NULL); + MA_ASSERT(pOutputBus != nullptr); if (volume < 0.0f) { volume = 0.0f; @@ -73917,7 +73917,7 @@ static float ma_node_output_bus_get_volume(const ma_node_output_bus* pOutputBus) static ma_result ma_node_input_bus_init(ma_uint32 channels, ma_node_input_bus* pInputBus) { - MA_ASSERT(pInputBus != NULL); + MA_ASSERT(pInputBus != nullptr); MA_ASSERT(channels < 256); MA_ZERO_OBJECT(pInputBus); @@ -73933,14 +73933,14 @@ static ma_result ma_node_input_bus_init(ma_uint32 channels, ma_node_input_bus* p static void ma_node_input_bus_lock(ma_node_input_bus* pInputBus) { - MA_ASSERT(pInputBus != NULL); + MA_ASSERT(pInputBus != nullptr); ma_spinlock_lock(&pInputBus->lock); } static void ma_node_input_bus_unlock(ma_node_input_bus* pInputBus) { - MA_ASSERT(pInputBus != NULL); + MA_ASSERT(pInputBus != nullptr); ma_spinlock_unlock(&pInputBus->lock); } @@ -73970,8 +73970,8 @@ static ma_uint32 ma_node_input_bus_get_channels(const ma_node_input_bus* pInputB static void ma_node_input_bus_detach__no_output_bus_lock(ma_node_input_bus* pInputBus, ma_node_output_bus* pOutputBus) { - MA_ASSERT(pInputBus != NULL); - MA_ASSERT(pOutputBus != NULL); + MA_ASSERT(pInputBus != nullptr); + MA_ASSERT(pOutputBus != nullptr); /* Mark the output bus as detached first. This will prevent future iterations on the audio thread @@ -73996,19 +73996,19 @@ static void ma_node_input_bus_detach__no_output_bus_lock(ma_node_input_bus* pInp ma_node_output_bus* pOldPrev = (ma_node_output_bus*)ma_atomic_load_ptr(&pOutputBus->pPrev); ma_node_output_bus* pOldNext = (ma_node_output_bus*)ma_atomic_load_ptr(&pOutputBus->pNext); - if (pOldPrev != NULL) { + if (pOldPrev != nullptr) { ma_atomic_exchange_ptr(&pOldPrev->pNext, pOldNext); /* <-- This is where the output bus is detached from the list. */ } - if (pOldNext != NULL) { + if (pOldNext != nullptr) { ma_atomic_exchange_ptr(&pOldNext->pPrev, pOldPrev); /* <-- This is required for detachment. */ } } ma_node_input_bus_unlock(pInputBus); /* At this point the output bus is detached and the linked list is completely unaware of it. Reset some data for safety. */ - ma_atomic_exchange_ptr(&pOutputBus->pNext, NULL); /* Using atomic exchanges here, mainly for the benefit of analysis tools which don't always recognize spinlocks. */ - ma_atomic_exchange_ptr(&pOutputBus->pPrev, NULL); /* As above. */ - pOutputBus->pInputNode = NULL; + ma_atomic_exchange_ptr(&pOutputBus->pNext, nullptr); /* Using atomic exchanges here, mainly for the benefit of analysis tools which don't always recognize spinlocks. */ + ma_atomic_exchange_ptr(&pOutputBus->pPrev, nullptr); /* As above. */ + pOutputBus->pInputNode = nullptr; pOutputBus->inputNodeInputBusIndex = 0; @@ -74044,8 +74044,8 @@ static void ma_node_input_bus_detach__no_output_bus_lock(ma_node_input_bus* pInp #if 0 /* Not used at the moment, but leaving here in case I need it later. */ static void ma_node_input_bus_detach(ma_node_input_bus* pInputBus, ma_node_output_bus* pOutputBus) { - MA_ASSERT(pInputBus != NULL); - MA_ASSERT(pOutputBus != NULL); + MA_ASSERT(pInputBus != nullptr); + MA_ASSERT(pOutputBus != nullptr); ma_node_output_bus_lock(pOutputBus); { @@ -74057,15 +74057,15 @@ static void ma_node_input_bus_detach(ma_node_input_bus* pInputBus, ma_node_outpu static void ma_node_input_bus_attach(ma_node_input_bus* pInputBus, ma_node_output_bus* pOutputBus, ma_node* pNewInputNode, ma_uint32 inputNodeInputBusIndex) { - MA_ASSERT(pInputBus != NULL); - MA_ASSERT(pOutputBus != NULL); + MA_ASSERT(pInputBus != nullptr); + MA_ASSERT(pOutputBus != nullptr); ma_node_output_bus_lock(pOutputBus); { ma_node_output_bus* pOldInputNode = (ma_node_output_bus*)ma_atomic_load_ptr(&pOutputBus->pInputNode); /* Detach from any existing attachment first if necessary. */ - if (pOldInputNode != NULL) { + if (pOldInputNode != nullptr) { ma_node_input_bus_detach__no_output_bus_lock(pInputBus, pOutputBus); } @@ -74102,7 +74102,7 @@ static void ma_node_input_bus_attach(ma_node_input_bus* pInputBus, ma_node_outpu ma_atomic_exchange_ptr(&pInputBus->head.pNext, pOutputBus); /* <-- This is where the output bus is actually attached to the input bus. */ /* Do the previous pointer last. This is only used for detachment. */ - if (pNewNext != NULL) { + if (pNewNext != nullptr) { ma_atomic_exchange_ptr(&pNewNext->pPrev, pOutputBus); } } @@ -74121,10 +74121,10 @@ static ma_node_output_bus* ma_node_input_bus_next(ma_node_input_bus* pInputBus, { ma_node_output_bus* pNext; - MA_ASSERT(pInputBus != NULL); + MA_ASSERT(pInputBus != nullptr); - if (pOutputBus == NULL) { - return NULL; + if (pOutputBus == nullptr) { + return nullptr; } ma_node_input_bus_next_begin(pInputBus); @@ -74132,7 +74132,7 @@ static ma_node_output_bus* ma_node_input_bus_next(ma_node_input_bus* pInputBus, pNext = pOutputBus; for (;;) { pNext = (ma_node_output_bus*)ma_atomic_load_ptr(&pNext->pNext); - if (pNext == NULL) { + if (pNext == nullptr) { break; /* Reached the end. */ } @@ -74145,7 +74145,7 @@ static ma_node_output_bus* ma_node_input_bus_next(ma_node_input_bus* pInputBus, } /* We need to increment the reference count of the selected node. */ - if (pNext != NULL) { + if (pNext != nullptr) { ma_atomic_fetch_add_32(&pNext->refCount, 1); } @@ -74189,8 +74189,8 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_ do this, we need to read from each attachment in a loop and read as many frames as we can, up to `frameCount`. */ - MA_ASSERT(pInputNode != NULL); - MA_ASSERT(pFramesRead != NULL); /* pFramesRead is critical and must always be specified. On input it's undefined and on output it'll be set to the number of frames actually read. */ + MA_ASSERT(pInputNode != nullptr); + MA_ASSERT(pFramesRead != nullptr); /* pFramesRead is critical and must always be specified. On input it's undefined and on output it'll be set to the number of frames actually read. */ *pFramesRead = 0; /* Safety. */ @@ -74205,20 +74205,20 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_ after calling ma_node_input_bus_next(), which we won't be. */ pFirst = ma_node_input_bus_first(pInputBus); - if (pFirst == NULL) { + if (pFirst == nullptr) { return MA_SUCCESS; /* No attachments. Read nothing. */ } - for (pOutputBus = pFirst; pOutputBus != NULL; pOutputBus = ma_node_input_bus_next(pInputBus, pOutputBus)) { + for (pOutputBus = pFirst; pOutputBus != nullptr; pOutputBus = ma_node_input_bus_next(pInputBus, pOutputBus)) { ma_uint32 framesProcessed = 0; ma_bool32 isSilentOutput = MA_FALSE; - MA_ASSERT(pOutputBus->pNode != NULL); - MA_ASSERT(((ma_node_base*)pOutputBus->pNode)->vtable != NULL); + MA_ASSERT(pOutputBus->pNode != nullptr); + MA_ASSERT(((ma_node_base*)pOutputBus->pNode)->vtable != nullptr); isSilentOutput = (((ma_node_base*)pOutputBus->pNode)->vtable->flags & MA_NODE_FLAG_SILENT_OUTPUT) != 0; - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { /* Read. */ while (framesProcessed < frameCount) { float* pRunningFramesOut; @@ -74236,7 +74236,7 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_ ma_uint32 preMixBufferCapInFrames = ((ma_node_base*)pInputNode)->cachedDataCapInFramesPerBus; float* pPreMixBuffer = (float*)ma_stack_alloc(((ma_node_base*)pInputNode)->pNodeGraph->pPreMixStack, preMixBufferCapInFrames * inputChannels * sizeof(float)); - if (pPreMixBuffer == NULL) { + if (pPreMixBuffer == nullptr) { /* If you're hitting this assert it means you've got an unusually deep chain of nodes, you've got an excessively large processing size, or you have a combination of both, and as a result have run out of stack space. You can increase this using the @@ -74258,7 +74258,7 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_ /* The pre-mix buffer is no longer required. */ ma_stack_free(((ma_node_base*)pInputNode)->pNodeGraph->pPreMixStack, pPreMixBuffer); - pPreMixBuffer = NULL; + pPreMixBuffer = nullptr; } } @@ -74285,12 +74285,12 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_ } } else { /* Seek. */ - ma_node_read_pcm_frames(pOutputBus->pNode, pOutputBus->outputBusIndex, NULL, frameCount, &framesProcessed, globalTime); + ma_node_read_pcm_frames(pOutputBus->pNode, pOutputBus->outputBusIndex, nullptr, frameCount, &framesProcessed, globalTime); } } /* If we didn't output anything, output silence. */ - if (doesOutputBufferHaveContent == MA_FALSE && pFramesOut != NULL) { + if (doesOutputBufferHaveContent == MA_FALSE && pFramesOut != nullptr) { ma_silence_pcm_frames(pFramesOut, frameCount, ma_format_f32, inputChannels); } @@ -74342,7 +74342,7 @@ static float* ma_node_get_cached_input_ptr(ma_node* pNode, ma_uint32 inputBusInd ma_uint32 iInputBus; float* pBasePtr; - MA_ASSERT(pNodeBase != NULL); + MA_ASSERT(pNodeBase != nullptr); /* Input data is stored at the front of the buffer. */ pBasePtr = pNodeBase->pCachedData; @@ -74360,7 +74360,7 @@ static float* ma_node_get_cached_output_ptr(ma_node* pNode, ma_uint32 outputBusI ma_uint32 iOutputBus; float* pBasePtr; - MA_ASSERT(pNodeBase != NULL); + MA_ASSERT(pNodeBase != nullptr); /* Cached output data starts after the input data. */ pBasePtr = pNodeBase->pCachedData; @@ -74391,9 +74391,9 @@ static ma_result ma_node_translate_bus_counts(const ma_node_config* pConfig, ma_ ma_uint32 inputBusCount; ma_uint32 outputBusCount; - MA_ASSERT(pConfig != NULL); - MA_ASSERT(pInputBusCount != NULL); - MA_ASSERT(pOutputBusCount != NULL); + MA_ASSERT(pConfig != nullptr); + MA_ASSERT(pInputBusCount != nullptr); + MA_ASSERT(pOutputBusCount != nullptr); /* Bus counts are determined by the vtable, unless they're set to `MA_NODE_BUS_COUNT_UNKNWON`, in which case they're taken from the config. */ if (pConfig->vtable->inputBusCount == MA_NODE_BUS_COUNT_UNKNOWN) { @@ -74423,7 +74423,7 @@ static ma_result ma_node_translate_bus_counts(const ma_node_config* pConfig, ma_ /* We must have channel counts for each bus. */ - if ((inputBusCount > 0 && pConfig->pInputChannels == NULL) || (outputBusCount > 0 && pConfig->pOutputChannels == NULL)) { + if ((inputBusCount > 0 && pConfig->pInputChannels == nullptr) || (outputBusCount > 0 && pConfig->pOutputChannels == nullptr)) { return MA_INVALID_ARGS; /* You must specify channel counts for each input and output bus. */ } @@ -74452,11 +74452,11 @@ static ma_result ma_node_get_heap_layout(ma_node_graph* pNodeGraph, const ma_nod ma_uint32 inputBusCount; ma_uint32 outputBusCount; - MA_ASSERT(pHeapLayout != NULL); + MA_ASSERT(pHeapLayout != nullptr); MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL || pConfig->vtable == NULL || pConfig->vtable->onProcess == NULL) { + if (pConfig == nullptr || pConfig->vtable == nullptr || pConfig->vtable->onProcess == nullptr) { return MA_INVALID_ARGS; } @@ -74542,7 +74542,7 @@ MA_API ma_result ma_node_get_heap_size(ma_node_graph* pNodeGraph, const ma_node_ ma_result result; ma_node_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -74566,7 +74566,7 @@ MA_API ma_result ma_node_init_preallocated(ma_node_graph* pNodeGraph, const ma_n ma_uint32 iInputBus; ma_uint32 iOutputBus; - if (pNodeBase == NULL) { + if (pNodeBase == nullptr) { return MA_INVALID_ARGS; } @@ -74604,7 +74604,7 @@ MA_API ma_result ma_node_init_preallocated(ma_node_graph* pNodeGraph, const ma_n pNodeBase->pCachedData = (float*)ma_offset_ptr(pHeap, heapLayout.cachedDataOffset); pNodeBase->cachedDataCapInFramesPerBus = ma_node_config_get_cache_size_in_frames(pConfig, pNodeGraph); } else { - pNodeBase->pCachedData = NULL; + pNodeBase->pCachedData = nullptr; } @@ -74625,7 +74625,7 @@ MA_API ma_result ma_node_init_preallocated(ma_node_graph* pNodeGraph, const ma_n /* The cached data needs to be initialized to silence (or a sine wave tone if we're debugging). */ - if (pNodeBase->pCachedData != NULL) { + if (pNodeBase->pCachedData != nullptr) { ma_uint32 iBus; #if 1 /* Toggle this between 0 and 1 to turn debugging on or off. 1 = fill with a sine wave for debugging; 0 = fill with silence. */ @@ -74663,11 +74663,11 @@ MA_API ma_result ma_node_init(ma_node_graph* pNodeGraph, const ma_node_config* p if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_node_init_preallocated(pNodeGraph, pConfig, pHeap, pNode); @@ -74684,7 +74684,7 @@ MA_API void ma_node_uninit(ma_node* pNode, const ma_allocation_callbacks* pAlloc { ma_node_base* pNodeBase = (ma_node_base*)pNode; - if (pNodeBase == NULL) { + if (pNodeBase == nullptr) { return; } @@ -74707,8 +74707,8 @@ MA_API void ma_node_uninit(ma_node* pNode, const ma_allocation_callbacks* pAlloc MA_API ma_node_graph* ma_node_get_node_graph(const ma_node* pNode) { - if (pNode == NULL) { - return NULL; + if (pNode == nullptr) { + return nullptr; } return ((const ma_node_base*)pNode)->pNodeGraph; @@ -74716,7 +74716,7 @@ MA_API ma_node_graph* ma_node_get_node_graph(const ma_node* pNode) MA_API ma_uint32 ma_node_get_input_bus_count(const ma_node* pNode) { - if (pNode == NULL) { + if (pNode == nullptr) { return 0; } @@ -74725,7 +74725,7 @@ MA_API ma_uint32 ma_node_get_input_bus_count(const ma_node* pNode) MA_API ma_uint32 ma_node_get_output_bus_count(const ma_node* pNode) { - if (pNode == NULL) { + if (pNode == nullptr) { return 0; } @@ -74737,7 +74737,7 @@ MA_API ma_uint32 ma_node_get_input_channels(const ma_node* pNode, ma_uint32 inpu { const ma_node_base* pNodeBase = (const ma_node_base*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return 0; } @@ -74752,7 +74752,7 @@ MA_API ma_uint32 ma_node_get_output_channels(const ma_node* pNode, ma_uint32 out { const ma_node_base* pNodeBase = (const ma_node_base*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return 0; } @@ -74769,7 +74769,7 @@ static ma_result ma_node_detach_full(ma_node* pNode) ma_node_base* pNodeBase = (ma_node_base*)pNode; ma_uint32 iInputBus; - if (pNodeBase == NULL) { + if (pNodeBase == nullptr) { return MA_INVALID_ARGS; } @@ -74796,7 +74796,7 @@ static ma_result ma_node_detach_full(ma_node* pNode) linked list logic. We don't need to worry about the audio thread referencing these because the step above severed the connection to the graph. */ - for (pOutputBus = (ma_node_output_bus*)ma_atomic_load_ptr(&pInputBus->head.pNext); pOutputBus != NULL; pOutputBus = (ma_node_output_bus*)ma_atomic_load_ptr(&pInputBus->head.pNext)) { + for (pOutputBus = (ma_node_output_bus*)ma_atomic_load_ptr(&pInputBus->head.pNext); pOutputBus != nullptr; pOutputBus = (ma_node_output_bus*)ma_atomic_load_ptr(&pInputBus->head.pNext)) { ma_node_detach_output_bus(pOutputBus->pNode, pOutputBus->outputBusIndex); /* This won't do any waiting in practice and should be efficient. */ } } @@ -74810,7 +74810,7 @@ MA_API ma_result ma_node_detach_output_bus(ma_node* pNode, ma_uint32 outputBusIn ma_node_base* pNodeBase = (ma_node_base*)pNode; ma_node_base* pInputNodeBase; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -74822,7 +74822,7 @@ MA_API ma_result ma_node_detach_output_bus(ma_node* pNode, ma_uint32 outputBusIn ma_node_output_bus_lock(&pNodeBase->pOutputBuses[outputBusIndex]); { pInputNodeBase = (ma_node_base*)pNodeBase->pOutputBuses[outputBusIndex].pInputNode; - if (pInputNodeBase != NULL) { + if (pInputNodeBase != nullptr) { ma_node_input_bus_detach__no_output_bus_lock(&pInputNodeBase->pInputBuses[pNodeBase->pOutputBuses[outputBusIndex].inputNodeInputBusIndex], &pNodeBase->pOutputBuses[outputBusIndex]); } } @@ -74835,7 +74835,7 @@ MA_API ma_result ma_node_detach_all_output_buses(ma_node* pNode) { ma_uint32 iOutputBus; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -74851,7 +74851,7 @@ MA_API ma_result ma_node_attach_output_bus(ma_node* pNode, ma_uint32 outputBusIn ma_node_base* pNodeBase = (ma_node_base*)pNode; ma_node_base* pOtherNodeBase = (ma_node_base*)pOtherNode; - if (pNodeBase == NULL || pOtherNodeBase == NULL) { + if (pNodeBase == nullptr || pOtherNodeBase == nullptr) { return MA_INVALID_ARGS; } @@ -74878,7 +74878,7 @@ MA_API ma_result ma_node_set_output_bus_volume(ma_node* pNode, ma_uint32 outputB { ma_node_base* pNodeBase = (ma_node_base*)pNode; - if (pNodeBase == NULL) { + if (pNodeBase == nullptr) { return MA_INVALID_ARGS; } @@ -74893,7 +74893,7 @@ MA_API float ma_node_get_output_bus_volume(const ma_node* pNode, ma_uint32 outpu { const ma_node_base* pNodeBase = (const ma_node_base*)pNode; - if (pNodeBase == NULL) { + if (pNodeBase == nullptr) { return 0; } @@ -74908,7 +74908,7 @@ MA_API ma_result ma_node_set_state(ma_node* pNode, ma_node_state state) { ma_node_base* pNodeBase = (ma_node_base*)pNode; - if (pNodeBase == NULL) { + if (pNodeBase == nullptr) { return MA_INVALID_ARGS; } @@ -74921,7 +74921,7 @@ MA_API ma_node_state ma_node_get_state(const ma_node* pNode) { const ma_node_base* pNodeBase = (const ma_node_base*)pNode; - if (pNodeBase == NULL) { + if (pNodeBase == nullptr) { return ma_node_state_stopped; } @@ -74930,7 +74930,7 @@ MA_API ma_node_state ma_node_get_state(const ma_node* pNode) MA_API ma_result ma_node_set_state_time(ma_node* pNode, ma_node_state state, ma_uint64 globalTime) { - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -74946,7 +74946,7 @@ MA_API ma_result ma_node_set_state_time(ma_node* pNode, ma_node_state state, ma_ MA_API ma_uint64 ma_node_get_state_time(const ma_node* pNode, ma_node_state state) { - if (pNode == NULL) { + if (pNode == nullptr) { return 0; } @@ -74960,7 +74960,7 @@ MA_API ma_uint64 ma_node_get_state_time(const ma_node* pNode, ma_node_state stat MA_API ma_node_state ma_node_get_state_by_time(const ma_node* pNode, ma_uint64 globalTime) { - if (pNode == NULL) { + if (pNode == nullptr) { return ma_node_state_stopped; } @@ -74971,7 +74971,7 @@ MA_API ma_node_state ma_node_get_state_by_time_range(const ma_node* pNode, ma_ui { ma_node_state state; - if (pNode == NULL) { + if (pNode == nullptr) { return ma_node_state_stopped; } @@ -75001,7 +75001,7 @@ MA_API ma_node_state ma_node_get_state_by_time_range(const ma_node* pNode, ma_ui MA_API ma_uint64 ma_node_get_time(const ma_node* pNode) { - if (pNode == NULL) { + if (pNode == nullptr) { return 0; } @@ -75010,7 +75010,7 @@ MA_API ma_uint64 ma_node_get_time(const ma_node* pNode) MA_API ma_result ma_node_set_time(ma_node* pNode, ma_uint64 localTime) { - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -75025,7 +75025,7 @@ static void ma_node_process_pcm_frames_internal(ma_node* pNode, const float** pp { ma_node_base* pNodeBase = (ma_node_base*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); if (pNodeBase->vtable->onProcess) { pNodeBase->vtable->onProcess(pNode, ppFramesIn, pFrameCountIn, ppFramesOut, pFrameCountOut); @@ -75057,14 +75057,14 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde expected that the number of frames read may be different to that requested. Therefore, the caller must look at this value to correctly determine how many frames were read. */ - MA_ASSERT(pFramesRead != NULL); /* <-- If you've triggered this assert, you're using this function wrong. You *must* use this variable and inspect it after the call returns. */ - if (pFramesRead == NULL) { + MA_ASSERT(pFramesRead != nullptr); /* <-- If you've triggered this assert, you're using this function wrong. You *must* use this variable and inspect it after the call returns. */ + if (pFramesRead == nullptr) { return MA_INVALID_ARGS; } *pFramesRead = 0; /* Safety. */ - if (pNodeBase == NULL) { + if (pNodeBase == nullptr) { return MA_INVALID_ARGS; } @@ -75142,7 +75142,7 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde ma_silence_pcm_frames(pFramesOut, frameCount, ma_format_f32, ma_node_get_output_channels(pNode, outputBusIndex)); } - ma_node_process_pcm_frames_internal(pNode, NULL, &frameCountIn, ppFramesOut, &frameCountOut); + ma_node_process_pcm_frames_internal(pNode, nullptr, &frameCountIn, ppFramesOut, &frameCountOut); totalFramesRead = frameCountOut; } else { /* Slow path. Need to read input data. */ @@ -75271,7 +75271,7 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde input frames to the maximum number we read from each attachment (the lesser will be padded with silence). If we didn't read anything, this will be set to 0 and the entire buffer will have been assigned to silence. This being equal to 0 is an important property for us because - it allows us to detect when NULL can be passed into the processing callback for the input + it allows us to detect when nullptr can be passed into the processing callback for the input buffer for the purpose of continuous processing. */ pNodeBase->cachedFrameCountIn = (ma_uint16)maxFramesReadIn; @@ -75287,7 +75287,7 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde optimization here - we can set the pointer to the output buffer for this output bus so that the final copy into the output buffer is done directly by onProcess(). */ - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { ppFramesOut[outputBusIndex] = ma_offset_pcm_frames_ptr_f32(pFramesOut, pNodeBase->cachedFrameCountOut, ma_node_get_output_channels(pNode, outputBusIndex)); } @@ -75299,7 +75299,7 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde We need to treat nodes with continuous processing a little differently. For these ones, we always want to fire the callback with the requested number of frames, regardless of pNodeBase->cachedFrameCountIn, which could be 0. Also, we want to check if we can pass - in NULL for the input buffer to the callback. + in nullptr for the input buffer to the callback. */ if ((pNodeBase->vtable->flags & MA_NODE_FLAG_CONTINUOUS_PROCESSING) != 0) { /* We're using continuous processing. Make sure we specify the whole frame count at all times. */ @@ -75332,11 +75332,11 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde } /* - Process data slightly differently depending on whether or not we're consuming NULL + Process data slightly differently depending on whether or not we're consuming nullptr input (checked just above). */ if (consumeNullInput) { - ma_node_process_pcm_frames_internal(pNode, NULL, &frameCountIn, ppFramesOut, &frameCountOut); + ma_node_process_pcm_frames_internal(pNode, nullptr, &frameCountIn, ppFramesOut, &frameCountOut); } else { /* We want to skip processing if there's no input data, but we can only do that safely if @@ -75360,7 +75360,7 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde Thanks to our sneaky optimization above we don't need to do any data copying directly into the output buffer - the onProcess() callback just did that for us. We do, however, need to apply the number of input and output frames that were processed. Note that due to continuous - processing above, we need to do explicit checks here. If we just consumed a NULL input + processing above, we need to do explicit checks here. If we just consumed a nullptr input buffer it means that no actual input data was processed from the internal buffers and we don't want to be modifying any counters. */ @@ -75382,7 +75382,7 @@ static ma_result ma_node_read_pcm_frames(ma_node* pNode, ma_uint32 outputBusInde We're not needing to read anything from the input buffer so just read directly from our already-processed data. */ - if (pFramesOut != NULL) { + if (pFramesOut != nullptr) { ma_copy_pcm_frames(pFramesOut, ma_node_get_cached_output_ptr(pNodeBase, outputBusIndex), pNodeBase->cachedFrameCountOut, ma_format_f32, ma_node_get_output_channels(pNodeBase, outputBusIndex)); } } @@ -75429,8 +75429,8 @@ static void ma_data_source_node_process_pcm_frames(ma_node* pNode, const float** ma_uint32 frameCount; ma_uint64 framesRead = 0; - MA_ASSERT(pDataSourceNode != NULL); - MA_ASSERT(pDataSourceNode->pDataSource != NULL); + MA_ASSERT(pDataSourceNode != nullptr); + MA_ASSERT(pDataSourceNode->pDataSource != nullptr); MA_ASSERT(ma_node_get_input_bus_count(pDataSourceNode) == 0); MA_ASSERT(ma_node_get_output_bus_count(pDataSourceNode) == 1); @@ -75443,7 +75443,7 @@ static void ma_data_source_node_process_pcm_frames(ma_node* pNode, const float** /* miniaudio should never be calling this with a frame count of zero. */ MA_ASSERT(frameCount > 0); - if (ma_data_source_get_data_format(pDataSourceNode->pDataSource, &format, &channels, NULL, NULL, 0) == MA_SUCCESS) { /* <-- Don't care about sample rate here. */ + if (ma_data_source_get_data_format(pDataSourceNode->pDataSource, &format, &channels, nullptr, nullptr, 0) == MA_SUCCESS) { /* <-- Don't care about sample rate here. */ /* The node graph system requires samples be in floating point format. This is checked in ma_data_source_node_init(). */ MA_ASSERT(format == ma_format_f32); (void)format; /* Just to silence some static analysis tools. */ @@ -75457,7 +75457,7 @@ static void ma_data_source_node_process_pcm_frames(ma_node* pNode, const float** static ma_node_vtable g_ma_data_source_node_vtable = { ma_data_source_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 0, /* 0 input buses. */ 1, /* 1 output bus. */ 0 @@ -75470,17 +75470,17 @@ MA_API ma_result ma_data_source_node_init(ma_node_graph* pNodeGraph, const ma_da ma_uint32 channels; /* For specifying the channel count of the output bus. */ ma_node_config baseConfig; - if (pDataSourceNode == NULL) { + if (pDataSourceNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pDataSourceNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - result = ma_data_source_get_data_format(pConfig->pDataSource, &format, &channels, NULL, NULL, 0); /* Don't care about sample rate. This will check pDataSource for NULL. */ + result = ma_data_source_get_data_format(pConfig->pDataSource, &format, &channels, nullptr, nullptr, 0); /* Don't care about sample rate. This will check pDataSource for nullptr. */ if (result != MA_SUCCESS) { return result; } @@ -75497,11 +75497,11 @@ MA_API ma_result ma_data_source_node_init(ma_node_graph* pNodeGraph, const ma_da /* The channel count is defined by the data source. It is invalid for the caller to manually set the channel counts in the config. `ma_data_source_node_config_init()` will have defaulted the - channel count pointer to NULL which is how it must remain. If you trigger any of these asserts + channel count pointer to nullptr which is how it must remain. If you trigger any of these asserts it means you're explicitly setting the channel count. Instead, configure the output channel count of your data source to be the necessary channel count. */ - if (baseConfig.pOutputChannels != NULL) { + if (baseConfig.pOutputChannels != nullptr) { return MA_INVALID_ARGS; } @@ -75524,7 +75524,7 @@ MA_API void ma_data_source_node_uninit(ma_data_source_node* pDataSourceNode, con MA_API ma_result ma_data_source_node_set_looping(ma_data_source_node* pDataSourceNode, ma_bool32 isLooping) { - if (pDataSourceNode == NULL) { + if (pDataSourceNode == nullptr) { return MA_INVALID_ARGS; } @@ -75533,7 +75533,7 @@ MA_API ma_result ma_data_source_node_set_looping(ma_data_source_node* pDataSourc MA_API ma_bool32 ma_data_source_node_is_looping(ma_data_source_node* pDataSourceNode) { - if (pDataSourceNode == NULL) { + if (pDataSourceNode == nullptr) { return MA_FALSE; } @@ -75562,7 +75562,7 @@ static void ma_splitter_node_process_pcm_frames(ma_node* pNode, const float** pp ma_uint32 iOutputBus; ma_uint32 channels; - MA_ASSERT(pNodeBase != NULL); + MA_ASSERT(pNodeBase != nullptr); MA_ASSERT(ma_node_get_input_bus_count(pNodeBase) == 1); /* We don't need to consider the input frame count - it'll be the same as the output frame count and we process everything. */ @@ -75580,7 +75580,7 @@ static void ma_splitter_node_process_pcm_frames(ma_node* pNode, const float** pp static ma_node_vtable g_ma_splitter_node_vtable = { ma_splitter_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* 1 input bus. */ MA_NODE_BUS_COUNT_UNKNOWN, /* The output bus count is specified on a per-node basis. */ 0 @@ -75594,13 +75594,13 @@ MA_API ma_result ma_splitter_node_init(ma_node_graph* pNodeGraph, const ma_split ma_uint32 pOutputChannels[MA_MAX_NODE_BUS_COUNT]; ma_uint32 iOutputBus; - if (pSplitterNode == NULL) { + if (pSplitterNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pSplitterNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -75651,7 +75651,7 @@ static void ma_biquad_node_process_pcm_frames(ma_node* pNode, const float** ppFr { ma_biquad_node* pLPFNode = (ma_biquad_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); (void)pFrameCountIn; ma_biquad_process_pcm_frames(&pLPFNode->biquad, ppFramesOut[0], ppFramesIn[0], *pFrameCountOut); @@ -75660,7 +75660,7 @@ static void ma_biquad_node_process_pcm_frames(ma_node* pNode, const float** ppFr static ma_node_vtable g_ma_biquad_node_vtable = { ma_biquad_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* One input. */ 1, /* One output. */ 0 /* Default flags. */ @@ -75671,13 +75671,13 @@ MA_API ma_result ma_biquad_node_init(ma_node_graph* pNodeGraph, const ma_biquad_ ma_result result; ma_node_config baseNodeConfig; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -75707,7 +75707,7 @@ MA_API ma_result ma_biquad_node_reinit(const ma_biquad_config* pConfig, ma_biqua { ma_biquad_node* pLPFNode = (ma_biquad_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); return ma_biquad_reinit(pConfig, &pLPFNode->biquad); } @@ -75716,7 +75716,7 @@ MA_API void ma_biquad_node_uninit(ma_biquad_node* pNode, const ma_allocation_cal { ma_biquad_node* pLPFNode = (ma_biquad_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return; } @@ -75743,7 +75743,7 @@ static void ma_lpf_node_process_pcm_frames(ma_node* pNode, const float** ppFrame { ma_lpf_node* pLPFNode = (ma_lpf_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); (void)pFrameCountIn; ma_lpf_process_pcm_frames(&pLPFNode->lpf, ppFramesOut[0], ppFramesIn[0], *pFrameCountOut); @@ -75752,7 +75752,7 @@ static void ma_lpf_node_process_pcm_frames(ma_node* pNode, const float** ppFrame static ma_node_vtable g_ma_lpf_node_vtable = { ma_lpf_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* One input. */ 1, /* One output. */ 0 /* Default flags. */ @@ -75763,13 +75763,13 @@ MA_API ma_result ma_lpf_node_init(ma_node_graph* pNodeGraph, const ma_lpf_node_c ma_result result; ma_node_config baseNodeConfig; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -75799,7 +75799,7 @@ MA_API ma_result ma_lpf_node_reinit(const ma_lpf_config* pConfig, ma_lpf_node* p { ma_lpf_node* pLPFNode = (ma_lpf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -75810,7 +75810,7 @@ MA_API void ma_lpf_node_uninit(ma_lpf_node* pNode, const ma_allocation_callbacks { ma_lpf_node* pLPFNode = (ma_lpf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return; } @@ -75837,7 +75837,7 @@ static void ma_hpf_node_process_pcm_frames(ma_node* pNode, const float** ppFrame { ma_hpf_node* pHPFNode = (ma_hpf_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); (void)pFrameCountIn; ma_hpf_process_pcm_frames(&pHPFNode->hpf, ppFramesOut[0], ppFramesIn[0], *pFrameCountOut); @@ -75846,7 +75846,7 @@ static void ma_hpf_node_process_pcm_frames(ma_node* pNode, const float** ppFrame static ma_node_vtable g_ma_hpf_node_vtable = { ma_hpf_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* One input. */ 1, /* One output. */ 0 /* Default flags. */ @@ -75857,13 +75857,13 @@ MA_API ma_result ma_hpf_node_init(ma_node_graph* pNodeGraph, const ma_hpf_node_c ma_result result; ma_node_config baseNodeConfig; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -75893,7 +75893,7 @@ MA_API ma_result ma_hpf_node_reinit(const ma_hpf_config* pConfig, ma_hpf_node* p { ma_hpf_node* pHPFNode = (ma_hpf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -75904,7 +75904,7 @@ MA_API void ma_hpf_node_uninit(ma_hpf_node* pNode, const ma_allocation_callbacks { ma_hpf_node* pHPFNode = (ma_hpf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return; } @@ -75932,7 +75932,7 @@ static void ma_bpf_node_process_pcm_frames(ma_node* pNode, const float** ppFrame { ma_bpf_node* pBPFNode = (ma_bpf_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); (void)pFrameCountIn; ma_bpf_process_pcm_frames(&pBPFNode->bpf, ppFramesOut[0], ppFramesIn[0], *pFrameCountOut); @@ -75941,7 +75941,7 @@ static void ma_bpf_node_process_pcm_frames(ma_node* pNode, const float** ppFrame static ma_node_vtable g_ma_bpf_node_vtable = { ma_bpf_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* One input. */ 1, /* One output. */ 0 /* Default flags. */ @@ -75952,13 +75952,13 @@ MA_API ma_result ma_bpf_node_init(ma_node_graph* pNodeGraph, const ma_bpf_node_c ma_result result; ma_node_config baseNodeConfig; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -75988,7 +75988,7 @@ MA_API ma_result ma_bpf_node_reinit(const ma_bpf_config* pConfig, ma_bpf_node* p { ma_bpf_node* pBPFNode = (ma_bpf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -75999,7 +75999,7 @@ MA_API void ma_bpf_node_uninit(ma_bpf_node* pNode, const ma_allocation_callbacks { ma_bpf_node* pBPFNode = (ma_bpf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return; } @@ -76026,7 +76026,7 @@ static void ma_notch_node_process_pcm_frames(ma_node* pNode, const float** ppFra { ma_notch_node* pBPFNode = (ma_notch_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); (void)pFrameCountIn; ma_notch2_process_pcm_frames(&pBPFNode->notch, ppFramesOut[0], ppFramesIn[0], *pFrameCountOut); @@ -76035,7 +76035,7 @@ static void ma_notch_node_process_pcm_frames(ma_node* pNode, const float** ppFra static ma_node_vtable g_ma_notch_node_vtable = { ma_notch_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* One input. */ 1, /* One output. */ 0 /* Default flags. */ @@ -76046,13 +76046,13 @@ MA_API ma_result ma_notch_node_init(ma_node_graph* pNodeGraph, const ma_notch_no ma_result result; ma_node_config baseNodeConfig; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -76082,7 +76082,7 @@ MA_API ma_result ma_notch_node_reinit(const ma_notch_config* pConfig, ma_notch_n { ma_notch_node* pNotchNode = (ma_notch_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -76093,7 +76093,7 @@ MA_API void ma_notch_node_uninit(ma_notch_node* pNode, const ma_allocation_callb { ma_notch_node* pNotchNode = (ma_notch_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return; } @@ -76120,7 +76120,7 @@ static void ma_peak_node_process_pcm_frames(ma_node* pNode, const float** ppFram { ma_peak_node* pBPFNode = (ma_peak_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); (void)pFrameCountIn; ma_peak2_process_pcm_frames(&pBPFNode->peak, ppFramesOut[0], ppFramesIn[0], *pFrameCountOut); @@ -76129,7 +76129,7 @@ static void ma_peak_node_process_pcm_frames(ma_node* pNode, const float** ppFram static ma_node_vtable g_ma_peak_node_vtable = { ma_peak_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* One input. */ 1, /* One output. */ 0 /* Default flags. */ @@ -76140,13 +76140,13 @@ MA_API ma_result ma_peak_node_init(ma_node_graph* pNodeGraph, const ma_peak_node ma_result result; ma_node_config baseNodeConfig; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -76177,7 +76177,7 @@ MA_API ma_result ma_peak_node_reinit(const ma_peak_config* pConfig, ma_peak_node { ma_peak_node* pPeakNode = (ma_peak_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -76188,7 +76188,7 @@ MA_API void ma_peak_node_uninit(ma_peak_node* pNode, const ma_allocation_callbac { ma_peak_node* pPeakNode = (ma_peak_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return; } @@ -76215,7 +76215,7 @@ static void ma_loshelf_node_process_pcm_frames(ma_node* pNode, const float** ppF { ma_loshelf_node* pBPFNode = (ma_loshelf_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); (void)pFrameCountIn; ma_loshelf2_process_pcm_frames(&pBPFNode->loshelf, ppFramesOut[0], ppFramesIn[0], *pFrameCountOut); @@ -76224,7 +76224,7 @@ static void ma_loshelf_node_process_pcm_frames(ma_node* pNode, const float** ppF static ma_node_vtable g_ma_loshelf_node_vtable = { ma_loshelf_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* One input. */ 1, /* One output. */ 0 /* Default flags. */ @@ -76235,13 +76235,13 @@ MA_API ma_result ma_loshelf_node_init(ma_node_graph* pNodeGraph, const ma_loshel ma_result result; ma_node_config baseNodeConfig; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -76271,7 +76271,7 @@ MA_API ma_result ma_loshelf_node_reinit(const ma_loshelf_config* pConfig, ma_los { ma_loshelf_node* pLoshelfNode = (ma_loshelf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -76282,7 +76282,7 @@ MA_API void ma_loshelf_node_uninit(ma_loshelf_node* pNode, const ma_allocation_c { ma_loshelf_node* pLoshelfNode = (ma_loshelf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return; } @@ -76309,7 +76309,7 @@ static void ma_hishelf_node_process_pcm_frames(ma_node* pNode, const float** ppF { ma_hishelf_node* pBPFNode = (ma_hishelf_node*)pNode; - MA_ASSERT(pNode != NULL); + MA_ASSERT(pNode != nullptr); (void)pFrameCountIn; ma_hishelf2_process_pcm_frames(&pBPFNode->hishelf, ppFramesOut[0], ppFramesIn[0], *pFrameCountOut); @@ -76318,7 +76318,7 @@ static void ma_hishelf_node_process_pcm_frames(ma_node* pNode, const float** ppF static ma_node_vtable g_ma_hishelf_node_vtable = { ma_hishelf_node_process_pcm_frames, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* One input. */ 1, /* One output. */ 0 /* Default flags. */ @@ -76329,13 +76329,13 @@ MA_API ma_result ma_hishelf_node_init(ma_node_graph* pNodeGraph, const ma_hishel ma_result result; ma_node_config baseNodeConfig; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pNode); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -76365,7 +76365,7 @@ MA_API ma_result ma_hishelf_node_reinit(const ma_hishelf_config* pConfig, ma_his { ma_hishelf_node* pHishelfNode = (ma_hishelf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return MA_INVALID_ARGS; } @@ -76376,7 +76376,7 @@ MA_API void ma_hishelf_node_uninit(ma_hishelf_node* pNode, const ma_allocation_c { ma_hishelf_node* pHishelfNode = (ma_hishelf_node*)pNode; - if (pNode == NULL) { + if (pNode == nullptr) { return; } @@ -76410,7 +76410,7 @@ static void ma_delay_node_process_pcm_frames(ma_node* pNode, const float** ppFra static ma_node_vtable g_ma_delay_node_vtable = { ma_delay_node_process_pcm_frames, - NULL, + nullptr, 1, /* 1 input channels. */ 1, /* 1 output channel. */ MA_NODE_FLAG_CONTINUOUS_PROCESSING /* Delay requires continuous processing to ensure the tail get's processed. */ @@ -76421,7 +76421,7 @@ MA_API ma_result ma_delay_node_init(ma_node_graph* pNodeGraph, const ma_delay_no ma_result result; ma_node_config baseConfig; - if (pDelayNode == NULL) { + if (pDelayNode == nullptr) { return MA_INVALID_ARGS; } @@ -76448,7 +76448,7 @@ MA_API ma_result ma_delay_node_init(ma_node_graph* pNodeGraph, const ma_delay_no MA_API void ma_delay_node_uninit(ma_delay_node* pDelayNode, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pDelayNode == NULL) { + if (pDelayNode == nullptr) { return; } @@ -76459,7 +76459,7 @@ MA_API void ma_delay_node_uninit(ma_delay_node* pDelayNode, const ma_allocation_ MA_API void ma_delay_node_set_wet(ma_delay_node* pDelayNode, float value) { - if (pDelayNode == NULL) { + if (pDelayNode == nullptr) { return; } @@ -76468,7 +76468,7 @@ MA_API void ma_delay_node_set_wet(ma_delay_node* pDelayNode, float value) MA_API float ma_delay_node_get_wet(const ma_delay_node* pDelayNode) { - if (pDelayNode == NULL) { + if (pDelayNode == nullptr) { return 0; } @@ -76477,7 +76477,7 @@ MA_API float ma_delay_node_get_wet(const ma_delay_node* pDelayNode) MA_API void ma_delay_node_set_dry(ma_delay_node* pDelayNode, float value) { - if (pDelayNode == NULL) { + if (pDelayNode == nullptr) { return; } @@ -76486,7 +76486,7 @@ MA_API void ma_delay_node_set_dry(ma_delay_node* pDelayNode, float value) MA_API float ma_delay_node_get_dry(const ma_delay_node* pDelayNode) { - if (pDelayNode == NULL) { + if (pDelayNode == nullptr) { return 0; } @@ -76495,7 +76495,7 @@ MA_API float ma_delay_node_get_dry(const ma_delay_node* pDelayNode) MA_API void ma_delay_node_set_decay(ma_delay_node* pDelayNode, float value) { - if (pDelayNode == NULL) { + if (pDelayNode == nullptr) { return; } @@ -76504,7 +76504,7 @@ MA_API void ma_delay_node_set_decay(ma_delay_node* pDelayNode, float value) MA_API float ma_delay_node_get_decay(const ma_delay_node* pDelayNode) { - if (pDelayNode == NULL) { + if (pDelayNode == nullptr) { return 0; } @@ -76525,7 +76525,7 @@ Engine static void ma_sound_set_at_end(ma_sound* pSound, ma_bool32 atEnd) { - MA_ASSERT(pSound != NULL); + MA_ASSERT(pSound != nullptr); ma_atomic_exchange_32(&pSound->atEnd, atEnd); /* @@ -76537,7 +76537,7 @@ static void ma_sound_set_at_end(ma_sound* pSound, ma_bool32 atEnd) #if 0 /* Fire any callbacks or events. */ if (atEnd) { - if (pSound->endCallback != NULL) { + if (pSound->endCallback != nullptr) { pSound->endCallback(pSound->pEndCallbackUserData, pSound); } } @@ -76546,7 +76546,7 @@ static void ma_sound_set_at_end(ma_sound* pSound, ma_bool32 atEnd) static ma_bool32 ma_sound_get_at_end(const ma_sound* pSound) { - MA_ASSERT(pSound != NULL); + MA_ASSERT(pSound != nullptr); return ma_atomic_load_32(&pSound->atEnd); } @@ -76572,7 +76572,7 @@ static void ma_engine_node_update_pitch_if_required(ma_engine_node* pEngineNode) ma_bool32 isUpdateRequired = MA_FALSE; float newPitch; - MA_ASSERT(pEngineNode != NULL); + MA_ASSERT(pEngineNode != nullptr); newPitch = ma_atomic_load_explicit_f32(&pEngineNode->pitch, ma_atomic_memory_order_acquire); @@ -76594,7 +76594,7 @@ static void ma_engine_node_update_pitch_if_required(ma_engine_node* pEngineNode) static ma_bool32 ma_engine_node_is_pitching_enabled(const ma_engine_node* pEngineNode) { - MA_ASSERT(pEngineNode != NULL); + MA_ASSERT(pEngineNode != nullptr); /* Don't try to be clever by skipping resampling in the pitch=1 case or else you'll glitch when moving away from 1. */ return !ma_atomic_load_explicit_32(&pEngineNode->isPitchDisabled, ma_atomic_memory_order_acquire); @@ -76602,14 +76602,14 @@ static ma_bool32 ma_engine_node_is_pitching_enabled(const ma_engine_node* pEngin static ma_bool32 ma_engine_node_is_spatialization_enabled(const ma_engine_node* pEngineNode) { - MA_ASSERT(pEngineNode != NULL); + MA_ASSERT(pEngineNode != nullptr); return !ma_atomic_load_explicit_32(&pEngineNode->isSpatializationDisabled, ma_atomic_memory_order_acquire); } static ma_result ma_engine_node_set_volume(ma_engine_node* pEngineNode, float volume) { - if (pEngineNode == NULL) { + if (pEngineNode == nullptr) { return MA_INVALID_ARGS; } @@ -76629,13 +76629,13 @@ static ma_result ma_engine_node_set_volume(ma_engine_node* pEngineNode, float vo static ma_result ma_engine_node_get_volume(const ma_engine_node* pEngineNode, float* pVolume) { - if (pVolume == NULL) { + if (pVolume == nullptr) { return MA_INVALID_ARGS; } *pVolume = 0.0f; - if (pEngineNode == NULL) { + if (pEngineNode == nullptr) { return MA_INVALID_ARGS; } @@ -76821,7 +76821,7 @@ static void ma_engine_node_process_pcm_frames__general(ma_engine_node* pEngineNo } } else { /* Channel conversion required. TODO: Add support for channel maps here. */ - ma_channel_map_apply_f32(pRunningFramesOut, NULL, channelsOut, pWorkingBuffer, NULL, channelsIn, framesJustProcessedOut, ma_channel_mix_mode_simple, pEngineNode->monoExpansionMode); + ma_channel_map_apply_f32(pRunningFramesOut, nullptr, channelsOut, pWorkingBuffer, nullptr, channelsIn, framesJustProcessedOut, ma_channel_mix_mode_simple, pEngineNode->monoExpansionMode); /* If we're using smoothing, the volume will have already been applied. */ if (!isVolumeSmoothingEnabled) { @@ -76873,7 +76873,7 @@ static void ma_engine_node_process_pcm_frames__sound(ma_node* pNode, const float if (ma_sound_at_end(pSound)) { ma_sound_stop(pSound); - if (pSound->endCallback != NULL) { + if (pSound->endCallback != nullptr) { pSound->endCallback(pSound->pEndCallbackUserData, pSound); } @@ -76907,7 +76907,7 @@ static void ma_engine_node_process_pcm_frames__sound(ma_node* pNode, const float For the convenience of the caller, we're doing to allow data sources to use non-floating-point formats and channel counts that differ from the main engine. */ - result = ma_data_source_get_data_format(pSound->pDataSource, &dataSourceFormat, &dataSourceChannels, NULL, NULL, 0); + result = ma_data_source_get_data_format(pSound->pDataSource, &dataSourceFormat, &dataSourceChannels, nullptr, nullptr, 0); if (result == MA_SUCCESS) { tempCapInFrames = sizeof(temp) / ma_get_bytes_per_frame(dataSourceFormat, dataSourceChannels); @@ -77008,7 +77008,7 @@ static void ma_engine_node_process_pcm_frames__group(ma_node* pNode, const float static ma_node_vtable g_ma_engine_node_vtable__sound = { ma_engine_node_process_pcm_frames__sound, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 0, /* Sounds are data source nodes which means they have zero inputs (their input is drawn from the data source itself). */ 1, /* Sounds have one output bus. */ 0 /* Default flags. */ @@ -77017,7 +77017,7 @@ static ma_node_vtable g_ma_engine_node_vtable__sound = static ma_node_vtable g_ma_engine_node_vtable__group = { ma_engine_node_process_pcm_frames__group, - NULL, /* onGetRequiredInputFrameCount */ + nullptr, /* onGetRequiredInputFrameCount */ 1, /* Groups have one input bus. */ 1, /* Groups have one output bus. */ MA_NODE_FLAG_DIFFERENT_PROCESSING_RATES /* The engine node does resampling so should let miniaudio know about it. */ @@ -77075,11 +77075,11 @@ static ma_result ma_engine_node_get_heap_layout(const ma_engine_node_config* pCo MA_ZERO_OBJECT(pHeapLayout); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } - if (pConfig->pEngine == NULL) { + if (pConfig->pEngine == nullptr) { return MA_INVALID_ARGS; /* An engine must be specified. */ } @@ -77158,7 +77158,7 @@ MA_API ma_result ma_engine_node_get_heap_size(const ma_engine_node_config* pConf ma_result result; ma_engine_node_heap_layout heapLayout; - if (pHeapSizeInBytes == NULL) { + if (pHeapSizeInBytes == nullptr) { return MA_INVALID_ARGS; } @@ -77188,7 +77188,7 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p ma_uint32 channelsOut; ma_channel defaultStereoChannelMap[2] = {MA_CHANNEL_SIDE_LEFT, MA_CHANNEL_SIDE_RIGHT}; /* <-- Consistent with the default channel map of a stereo listener. Means channel conversion can run on a fast path. */ - if (pEngineNode == NULL) { + if (pEngineNode == nullptr) { return MA_INVALID_ARGS; } @@ -77318,9 +77318,9 @@ MA_API ma_result ma_engine_node_init_preallocated(const ma_engine_node_config* p return MA_SUCCESS; /* No need for allocation callbacks here because we use a preallocated heap. */ -error3: ma_spatializer_uninit(&pEngineNode->spatializer, NULL); -error2: ma_resampler_uninit(&pEngineNode->resampler, NULL); -error1: ma_node_uninit(&pEngineNode->baseNode, NULL); +error3: ma_spatializer_uninit(&pEngineNode->spatializer, nullptr); +error2: ma_resampler_uninit(&pEngineNode->resampler, nullptr); +error1: ma_node_uninit(&pEngineNode->baseNode, nullptr); error0: return result; } @@ -77337,11 +77337,11 @@ MA_API ma_result ma_engine_node_init(const ma_engine_node_config* pConfig, const if (heapSizeInBytes > 0) { pHeap = ma_malloc(heapSizeInBytes, pAllocationCallbacks); - if (pHeap == NULL) { + if (pHeap == nullptr) { return MA_OUT_OF_MEMORY; } } else { - pHeap = NULL; + pHeap = nullptr; } result = ma_engine_node_init_preallocated(pConfig, pHeap, pEngineNode); @@ -77379,7 +77379,7 @@ MA_API void ma_engine_node_uninit(ma_engine_node* pEngineNode, const ma_allocati MA_API ma_sound_config ma_sound_config_init(void) { - return ma_sound_config_init_2(NULL); + return ma_sound_config_init_2(nullptr); } MA_API ma_sound_config ma_sound_config_init_2(ma_engine* pEngine) @@ -77388,7 +77388,7 @@ MA_API ma_sound_config ma_sound_config_init_2(ma_engine* pEngine) MA_ZERO_OBJECT(&config); - if (pEngine != NULL) { + if (pEngine != nullptr) { config.monoExpansionMode = pEngine->monoExpansionMode; config.pitchResampling = pEngine->pitchResamplingConfig; } else { @@ -77406,7 +77406,7 @@ MA_API ma_sound_config ma_sound_config_init_2(ma_engine* pEngine) MA_API ma_sound_group_config ma_sound_group_config_init(void) { - return ma_sound_group_config_init_2(NULL); + return ma_sound_group_config_init_2(nullptr); } MA_API ma_sound_group_config ma_sound_group_config_init_2(ma_engine* pEngine) @@ -77415,7 +77415,7 @@ MA_API ma_sound_group_config ma_sound_group_config_init_2(ma_engine* pEngine) MA_ZERO_OBJECT(&config); - if (pEngine != NULL) { + if (pEngine != nullptr) { config.monoExpansionMode = pEngine->monoExpansionMode; config.pitchResampling = pEngine->pitchResamplingConfig; } else { @@ -77468,7 +77468,7 @@ static void ma_engine_data_callback_internal(ma_device* pDevice, void* pFramesOu */ #if !defined(MA_NO_RESOURCE_MANAGER) && defined(MA_EMSCRIPTEN) { - if (pEngine->pResourceManager != NULL) { + if (pEngine->pResourceManager != nullptr) { if ((pEngine->pResourceManager->config.flags & MA_RESOURCE_MANAGER_FLAG_NO_THREADING) != 0) { ma_resource_manager_process_next_job(pEngine->pResourceManager); } @@ -77476,7 +77476,7 @@ static void ma_engine_data_callback_internal(ma_device* pDevice, void* pFramesOu } #endif - ma_engine_read_pcm_frames(pEngine, pFramesOut, frameCount, NULL); + ma_engine_read_pcm_frames(pEngine, pFramesOut, frameCount, nullptr); } static ma_uint32 ma_device__get_processing_size_in_frames(ma_device* pDevice) @@ -77503,14 +77503,14 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng ma_spatializer_listener_config listenerConfig; ma_uint32 iListener; - if (pEngine == NULL) { + if (pEngine == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pEngine); - /* The config is allowed to be NULL in which case we use defaults for everything. */ - if (pConfig != NULL) { + /* The config is allowed to be nullptr in which case we use defaults for everything. */ + if (pConfig != nullptr) { engineConfig = *pConfig; } else { engineConfig = ma_engine_config_init(); @@ -77534,11 +77534,11 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng pEngine->pDevice = engineConfig.pDevice; /* If we don't have a device, we need one. */ - if (pEngine->pDevice == NULL && engineConfig.noDevice == MA_FALSE) { + if (pEngine->pDevice == nullptr && engineConfig.noDevice == MA_FALSE) { ma_device_config deviceConfig; pEngine->pDevice = (ma_device*)ma_malloc(sizeof(*pEngine->pDevice), &pEngine->allocationCallbacks); - if (pEngine->pDevice == NULL) { + if (pEngine->pDevice == nullptr) { return MA_OUT_OF_MEMORY; } @@ -77547,7 +77547,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng deviceConfig.playback.format = ma_format_f32; deviceConfig.playback.channels = engineConfig.channels; deviceConfig.sampleRate = engineConfig.sampleRate; - deviceConfig.dataCallback = (engineConfig.dataCallback != NULL) ? engineConfig.dataCallback : ma_engine_data_callback_internal; + deviceConfig.dataCallback = (engineConfig.dataCallback != nullptr) ? engineConfig.dataCallback : ma_engine_data_callback_internal; deviceConfig.pUserData = pEngine; deviceConfig.notificationCallback = engineConfig.notificationCallback; deviceConfig.periodSizeInFrames = engineConfig.periodSizeInFrames; @@ -77555,7 +77555,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng deviceConfig.noPreSilencedOutputBuffer = MA_TRUE; /* We'll always be outputting to every frame in the callback so there's no need for a pre-silenced buffer. */ deviceConfig.noClip = MA_TRUE; /* The engine will do clipping itself. */ - if (engineConfig.pContext == NULL) { + if (engineConfig.pContext == nullptr) { ma_context_config contextConfig = ma_context_config_init(); contextConfig.allocationCallbacks = pEngine->allocationCallbacks; contextConfig.pLog = engineConfig.pLog; @@ -77563,20 +77563,20 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng /* If the engine config does not specify a log, use the resource manager's if we have one. */ #ifndef MA_NO_RESOURCE_MANAGER { - if (contextConfig.pLog == NULL && engineConfig.pResourceManager != NULL) { + if (contextConfig.pLog == nullptr && engineConfig.pResourceManager != nullptr) { contextConfig.pLog = ma_resource_manager_get_log(engineConfig.pResourceManager); } } #endif - result = ma_device_init_ex(NULL, 0, &contextConfig, &deviceConfig, pEngine->pDevice); + result = ma_device_init_ex(nullptr, 0, &contextConfig, &deviceConfig, pEngine->pDevice); } else { result = ma_device_init(engineConfig.pContext, &deviceConfig, pEngine->pDevice); } if (result != MA_SUCCESS) { ma_free(pEngine->pDevice, &pEngine->allocationCallbacks); - pEngine->pDevice = NULL; + pEngine->pDevice = nullptr; return result; } @@ -77584,7 +77584,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng } /* Update the channel count and sample rate of the engine config so we can reference it below. */ - if (pEngine->pDevice != NULL) { + if (pEngine->pDevice != nullptr) { engineConfig.channels = pEngine->pDevice->playback.channels; engineConfig.sampleRate = pEngine->pDevice->sampleRate; @@ -77606,7 +77606,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng pEngine->sampleRate = engineConfig.sampleRate; /* The engine always uses either the log that was passed into the config, or the context's log is available. */ - if (engineConfig.pLog != NULL) { + if (engineConfig.pLog != nullptr) { pEngine->pLog = engineConfig.pLog; } else { #if !defined(MA_NO_DEVICE_IO) @@ -77615,7 +77615,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng } #else { - pEngine->pLog = NULL; + pEngine->pLog = nullptr; } #endif } @@ -77651,7 +77651,7 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng */ #if !defined(MA_NO_DEVICE_IO) { - if (pEngine->pDevice != NULL) { + if (pEngine->pDevice != nullptr) { /* Temporarily disabled. There is a subtle bug here where front-left and front-right will be used by the device's channel map, but this is not what we want to use for @@ -77687,11 +77687,11 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng /* We need a resource manager. */ #ifndef MA_NO_RESOURCE_MANAGER { - if (pEngine->pResourceManager == NULL) { + if (pEngine->pResourceManager == nullptr) { ma_resource_manager_config resourceManagerConfig; pEngine->pResourceManager = (ma_resource_manager*)ma_malloc(sizeof(*pEngine->pResourceManager), &pEngine->allocationCallbacks); - if (pEngine->pResourceManager == NULL) { + if (pEngine->pResourceManager == nullptr) { result = MA_OUT_OF_MEMORY; goto on_error_2; } @@ -77725,12 +77725,12 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng /* Setup some stuff for inlined sounds. That is sounds played with ma_engine_play_sound(). */ pEngine->inlinedSoundLock = 0; - pEngine->pInlinedSoundHead = NULL; + pEngine->pInlinedSoundHead = nullptr; /* Start the engine if required. This should always be the last step. */ #if !defined(MA_NO_DEVICE_IO) { - if (engineConfig.noAutoStart == MA_FALSE && pEngine->pDevice != NULL) { + if (engineConfig.noAutoStart == MA_FALSE && pEngine->pDevice != nullptr) { result = ma_engine_start(pEngine); if (result != MA_SUCCESS) { goto on_error_4; /* Failed to start the engine. */ @@ -77773,7 +77773,7 @@ MA_API void ma_engine_uninit(ma_engine* pEngine) { ma_uint32 iListener; - if (pEngine == NULL) { + if (pEngine == nullptr) { return; } @@ -77784,7 +77784,7 @@ MA_API void ma_engine_uninit(ma_engine* pEngine) ma_device_uninit(pEngine->pDevice); ma_free(pEngine->pDevice, &pEngine->allocationCallbacks); } else { - if (pEngine->pDevice != NULL) { + if (pEngine->pDevice != nullptr) { ma_device_stop(pEngine->pDevice); } } @@ -77799,7 +77799,7 @@ MA_API void ma_engine_uninit(ma_engine* pEngine) { for (;;) { ma_sound_inlined* pSoundToDelete = pEngine->pInlinedSoundHead; - if (pSoundToDelete == NULL) { + if (pSoundToDelete == nullptr) { break; /* Done. */ } @@ -77832,7 +77832,7 @@ MA_API ma_result ma_engine_read_pcm_frames(ma_engine* pEngine, void* pFramesOut, ma_result result; ma_uint64 framesRead = 0; - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = 0; } @@ -77841,7 +77841,7 @@ MA_API ma_result ma_engine_read_pcm_frames(ma_engine* pEngine, void* pFramesOut, return result; } - if (pFramesRead != NULL) { + if (pFramesRead != nullptr) { *pFramesRead = framesRead; } @@ -77854,8 +77854,8 @@ MA_API ma_result ma_engine_read_pcm_frames(ma_engine* pEngine, void* pFramesOut, MA_API ma_node_graph* ma_engine_get_node_graph(ma_engine* pEngine) { - if (pEngine == NULL) { - return NULL; + if (pEngine == nullptr) { + return nullptr; } return &pEngine->nodeGraph; @@ -77864,8 +77864,8 @@ MA_API ma_node_graph* ma_engine_get_node_graph(ma_engine* pEngine) #if !defined(MA_NO_RESOURCE_MANAGER) MA_API ma_resource_manager* ma_engine_get_resource_manager(ma_engine* pEngine) { - if (pEngine == NULL) { - return NULL; + if (pEngine == nullptr) { + return nullptr; } #if !defined(MA_NO_RESOURCE_MANAGER) @@ -77874,7 +77874,7 @@ MA_API ma_resource_manager* ma_engine_get_resource_manager(ma_engine* pEngine) } #else { - return NULL; + return nullptr; } #endif } @@ -77882,8 +77882,8 @@ MA_API ma_resource_manager* ma_engine_get_resource_manager(ma_engine* pEngine) MA_API ma_device* ma_engine_get_device(ma_engine* pEngine) { - if (pEngine == NULL) { - return NULL; + if (pEngine == nullptr) { + return nullptr; } #if !defined(MA_NO_DEVICE_IO) @@ -77892,18 +77892,18 @@ MA_API ma_device* ma_engine_get_device(ma_engine* pEngine) } #else { - return NULL; + return nullptr; } #endif } MA_API ma_log* ma_engine_get_log(ma_engine* pEngine) { - if (pEngine == NULL) { - return NULL; + if (pEngine == nullptr) { + return nullptr; } - if (pEngine->pLog != NULL) { + if (pEngine->pLog != nullptr) { return pEngine->pLog; } else { #if !defined(MA_NO_DEVICE_IO) @@ -77912,7 +77912,7 @@ MA_API ma_log* ma_engine_get_log(ma_engine* pEngine) } #else { - return NULL; + return nullptr; } #endif } @@ -77960,7 +77960,7 @@ MA_API ma_uint32 ma_engine_get_channels(const ma_engine* pEngine) MA_API ma_uint32 ma_engine_get_sample_rate(const ma_engine* pEngine) { - if (pEngine == NULL) { + if (pEngine == nullptr) { return 0; } @@ -77972,13 +77972,13 @@ MA_API ma_result ma_engine_start(ma_engine* pEngine) { ma_result result; - if (pEngine == NULL) { + if (pEngine == nullptr) { return MA_INVALID_ARGS; } #if !defined(MA_NO_DEVICE_IO) { - if (pEngine->pDevice != NULL) { + if (pEngine->pDevice != nullptr) { result = ma_device_start(pEngine->pDevice); } else { result = MA_INVALID_OPERATION; /* The engine is running without a device which means there's no real notion of "starting" the engine. */ @@ -78001,13 +78001,13 @@ MA_API ma_result ma_engine_stop(ma_engine* pEngine) { ma_result result; - if (pEngine == NULL) { + if (pEngine == nullptr) { return MA_INVALID_ARGS; } #if !defined(MA_NO_DEVICE_IO) { - if (pEngine->pDevice != NULL) { + if (pEngine->pDevice != nullptr) { result = ma_device_stop(pEngine->pDevice); } else { result = MA_INVALID_OPERATION; /* The engine is running without a device which means there's no real notion of "stopping" the engine. */ @@ -78028,7 +78028,7 @@ MA_API ma_result ma_engine_stop(ma_engine* pEngine) MA_API ma_result ma_engine_set_volume(ma_engine* pEngine, float volume) { - if (pEngine == NULL) { + if (pEngine == nullptr) { return MA_INVALID_ARGS; } @@ -78037,7 +78037,7 @@ MA_API ma_result ma_engine_set_volume(ma_engine* pEngine, float volume) MA_API float ma_engine_get_volume(ma_engine* pEngine) { - if (pEngine == NULL) { + if (pEngine == nullptr) { return 0; } @@ -78057,7 +78057,7 @@ MA_API float ma_engine_get_gain_db(ma_engine* pEngine) MA_API ma_uint32 ma_engine_get_listener_count(const ma_engine* pEngine) { - if (pEngine == NULL) { + if (pEngine == nullptr) { return 0; } @@ -78070,7 +78070,7 @@ MA_API ma_uint32 ma_engine_find_closest_listener(const ma_engine* pEngine, float ma_uint32 iListenerClosest; float closestLen2 = MA_FLT_MAX; - if (pEngine == NULL || pEngine->listenerCount == 1) { + if (pEngine == nullptr || pEngine->listenerCount == 1) { return 0; } @@ -78091,7 +78091,7 @@ MA_API ma_uint32 ma_engine_find_closest_listener(const ma_engine* pEngine, float MA_API void ma_engine_listener_set_position(ma_engine* pEngine, ma_uint32 listenerIndex, float x, float y, float z) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return; } @@ -78100,7 +78100,7 @@ MA_API void ma_engine_listener_set_position(ma_engine* pEngine, ma_uint32 listen MA_API ma_vec3f ma_engine_listener_get_position(const ma_engine* pEngine, ma_uint32 listenerIndex) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return ma_vec3f_init_3f(0, 0, 0); } @@ -78109,7 +78109,7 @@ MA_API ma_vec3f ma_engine_listener_get_position(const ma_engine* pEngine, ma_uin MA_API void ma_engine_listener_set_direction(ma_engine* pEngine, ma_uint32 listenerIndex, float x, float y, float z) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return; } @@ -78118,7 +78118,7 @@ MA_API void ma_engine_listener_set_direction(ma_engine* pEngine, ma_uint32 liste MA_API ma_vec3f ma_engine_listener_get_direction(const ma_engine* pEngine, ma_uint32 listenerIndex) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return ma_vec3f_init_3f(0, 0, -1); } @@ -78127,7 +78127,7 @@ MA_API ma_vec3f ma_engine_listener_get_direction(const ma_engine* pEngine, ma_ui MA_API void ma_engine_listener_set_velocity(ma_engine* pEngine, ma_uint32 listenerIndex, float x, float y, float z) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return; } @@ -78136,7 +78136,7 @@ MA_API void ma_engine_listener_set_velocity(ma_engine* pEngine, ma_uint32 listen MA_API ma_vec3f ma_engine_listener_get_velocity(const ma_engine* pEngine, ma_uint32 listenerIndex) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return ma_vec3f_init_3f(0, 0, 0); } @@ -78145,7 +78145,7 @@ MA_API ma_vec3f ma_engine_listener_get_velocity(const ma_engine* pEngine, ma_uin MA_API void ma_engine_listener_set_cone(ma_engine* pEngine, ma_uint32 listenerIndex, float innerAngleInRadians, float outerAngleInRadians, float outerGain) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return; } @@ -78154,19 +78154,19 @@ MA_API void ma_engine_listener_set_cone(ma_engine* pEngine, ma_uint32 listenerIn MA_API void ma_engine_listener_get_cone(const ma_engine* pEngine, ma_uint32 listenerIndex, float* pInnerAngleInRadians, float* pOuterAngleInRadians, float* pOuterGain) { - if (pInnerAngleInRadians != NULL) { + if (pInnerAngleInRadians != nullptr) { *pInnerAngleInRadians = 0; } - if (pOuterAngleInRadians != NULL) { + if (pOuterAngleInRadians != nullptr) { *pOuterAngleInRadians = 0; } - if (pOuterGain != NULL) { + if (pOuterGain != nullptr) { *pOuterGain = 0; } - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return; } @@ -78175,7 +78175,7 @@ MA_API void ma_engine_listener_get_cone(const ma_engine* pEngine, ma_uint32 list MA_API void ma_engine_listener_set_world_up(ma_engine* pEngine, ma_uint32 listenerIndex, float x, float y, float z) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return; } @@ -78184,7 +78184,7 @@ MA_API void ma_engine_listener_set_world_up(ma_engine* pEngine, ma_uint32 listen MA_API ma_vec3f ma_engine_listener_get_world_up(const ma_engine* pEngine, ma_uint32 listenerIndex) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return ma_vec3f_init_3f(0, 1, 0); } @@ -78193,7 +78193,7 @@ MA_API ma_vec3f ma_engine_listener_get_world_up(const ma_engine* pEngine, ma_uin MA_API void ma_engine_listener_set_enabled(ma_engine* pEngine, ma_uint32 listenerIndex, ma_bool32 isEnabled) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return; } @@ -78202,7 +78202,7 @@ MA_API void ma_engine_listener_set_enabled(ma_engine* pEngine, ma_uint32 listene MA_API ma_bool32 ma_engine_listener_is_enabled(const ma_engine* pEngine, ma_uint32 listenerIndex) { - if (pEngine == NULL || listenerIndex >= pEngine->listenerCount) { + if (pEngine == nullptr || listenerIndex >= pEngine->listenerCount) { return MA_FALSE; } @@ -78214,15 +78214,15 @@ MA_API ma_bool32 ma_engine_listener_is_enabled(const ma_engine* pEngine, ma_uint MA_API ma_result ma_engine_play_sound_ex(ma_engine* pEngine, const char* pFilePath, ma_node* pNode, ma_uint32 nodeInputBusIndex) { ma_result result = MA_SUCCESS; - ma_sound_inlined* pSound = NULL; - ma_sound_inlined* pNextSound = NULL; + ma_sound_inlined* pSound = nullptr; + ma_sound_inlined* pNextSound = nullptr; - if (pEngine == NULL || pFilePath == NULL) { + if (pEngine == nullptr || pFilePath == nullptr) { return MA_INVALID_ARGS; } /* Attach to the endpoint node if nothing is specified. */ - if (pNode == NULL) { + if (pNode == nullptr) { pNode = ma_node_graph_get_endpoint(&pEngine->nodeGraph); nodeInputBusIndex = 0; } @@ -78243,7 +78243,7 @@ MA_API ma_result ma_engine_play_sound_ex(ma_engine* pEngine, const char* pFilePa { ma_uint32 soundFlags = 0; - for (pNextSound = pEngine->pInlinedSoundHead; pNextSound != NULL; pNextSound = pNextSound->pNext) { + for (pNextSound = pEngine->pInlinedSoundHead; pNextSound != nullptr; pNextSound = pNextSound->pNext) { if (ma_sound_at_end(&pNextSound->sound)) { /* The sound is at the end which means it's available for recycling. All we need to do @@ -78255,7 +78255,7 @@ MA_API ma_result ma_engine_play_sound_ex(ma_engine* pEngine, const char* pFilePa } } - if (pSound != NULL) { + if (pSound != nullptr) { /* We actually want to detach the sound from the list here. The reason is because we want the sound to be in a consistent state at the non-recycled case to simplify the logic below. @@ -78264,10 +78264,10 @@ MA_API ma_result ma_engine_play_sound_ex(ma_engine* pEngine, const char* pFilePa pEngine->pInlinedSoundHead = pSound->pNext; } - if (pSound->pPrev != NULL) { + if (pSound->pPrev != nullptr) { pSound->pPrev->pNext = pSound->pNext; } - if (pSound->pNext != NULL) { + if (pSound->pNext != nullptr) { pSound->pNext->pPrev = pSound->pPrev; } @@ -78278,7 +78278,7 @@ MA_API ma_result ma_engine_play_sound_ex(ma_engine* pEngine, const char* pFilePa pSound = (ma_sound_inlined*)ma_malloc(sizeof(*pSound), &pEngine->allocationCallbacks); } - if (pSound != NULL) { /* Safety check for the allocation above. */ + if (pSound != nullptr) { /* Safety check for the allocation above. */ /* At this point we should have memory allocated for the inlined sound. We just need to initialize it like a normal sound now. @@ -78288,17 +78288,17 @@ MA_API ma_result ma_engine_play_sound_ex(ma_engine* pEngine, const char* pFilePa soundFlags |= MA_SOUND_FLAG_NO_PITCH; /* Pitching isn't usable with inlined sounds, so disable it to save on speed. */ soundFlags |= MA_SOUND_FLAG_NO_SPATIALIZATION; /* Not currently doing spatialization with inlined sounds, but this might actually change later. For now disable spatialization. Will be removed if we ever add support for spatialization here. */ - result = ma_sound_init_from_file(pEngine, pFilePath, soundFlags, NULL, NULL, &pSound->sound); + result = ma_sound_init_from_file(pEngine, pFilePath, soundFlags, nullptr, nullptr, &pSound->sound); if (result == MA_SUCCESS) { /* Now attach the sound to the graph. */ result = ma_node_attach_output_bus(pSound, 0, pNode, nodeInputBusIndex); if (result == MA_SUCCESS) { /* At this point the sound should be loaded and we can go ahead and add it to the list. The new item becomes the new head. */ pSound->pNext = pEngine->pInlinedSoundHead; - pSound->pPrev = NULL; + pSound->pPrev = nullptr; pEngine->pInlinedSoundHead = pSound; /* <-- This is what attaches the sound to the list. */ - if (pSound->pNext != NULL) { + if (pSound->pNext != nullptr) { pSound->pNext->pPrev = pSound; } } else { @@ -78338,14 +78338,14 @@ MA_API ma_result ma_engine_play_sound(ma_engine* pEngine, const char* pFilePath, static ma_result ma_sound_preinit(ma_engine* pEngine, ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pSound); pSound->seekTarget = MA_SEEK_TARGET_NONE; - if (pEngine == NULL) { + if (pEngine == nullptr) { return MA_INVALID_ARGS; } @@ -78359,16 +78359,16 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con ma_engine_node_type type; /* Will be set to ma_engine_node_type_group if no data source is specified. */ /* Do not clear pSound to zero here - that's done at a higher level with ma_sound_preinit(). */ - MA_ASSERT(pEngine != NULL); - MA_ASSERT(pSound != NULL); + MA_ASSERT(pEngine != nullptr); + MA_ASSERT(pSound != nullptr); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } pSound->pDataSource = pConfig->pDataSource; - if (pConfig->pDataSource != NULL) { + if (pConfig->pDataSource != nullptr) { type = ma_engine_node_type_sound; } else { type = ma_engine_node_type_group; @@ -78390,8 +78390,8 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con } /* If we're loading from a data source the input channel count needs to be the data source's native channel count. */ - if (pConfig->pDataSource != NULL) { - result = ma_data_source_get_data_format(pConfig->pDataSource, NULL, &engineNodeConfig.channelsIn, &engineNodeConfig.sampleRate, NULL, 0); + if (pConfig->pDataSource != nullptr) { + result = ma_data_source_get_data_format(pConfig->pDataSource, nullptr, &engineNodeConfig.channelsIn, &engineNodeConfig.sampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; /* Failed to retrieve the channel count. */ } @@ -78413,7 +78413,7 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con } /* If no attachment is specified, attach the sound straight to the endpoint. */ - if (pConfig->pInitialAttachment == NULL) { + if (pConfig->pInitialAttachment == nullptr) { /* No group. Attach straight to the endpoint by default, unless the caller has requested that it not. */ if ((pConfig->flags & MA_SOUND_FLAG_NO_DEFAULT_ATTACHMENT) == 0) { result = ma_node_attach_output_bus(pSound, 0, ma_node_graph_get_endpoint(&pEngine->nodeGraph), 0); @@ -78433,7 +78433,7 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con When pulling data from a data source we need a processing cache to hold onto unprocessed input data from the data source after doing resampling. */ - if (pSound->pDataSource != NULL) { + if (pSound->pDataSource != nullptr) { pSound->processingCacheFramesRemaining = 0; pSound->processingCacheCap = ma_node_graph_get_processing_size_in_frames(&pEngine->nodeGraph); if (pSound->processingCacheCap == 0) { @@ -78441,7 +78441,7 @@ static ma_result ma_sound_init_from_data_source_internal(ma_engine* pEngine, con } pSound->pProcessingCache = (float*)ma_calloc(pSound->processingCacheCap * ma_get_bytes_per_frame(ma_format_f32, engineNodeConfig.channelsIn), &pEngine->allocationCallbacks); - if (pSound->pProcessingCache == NULL) { + if (pSound->pProcessingCache == nullptr) { ma_engine_node_uninit(&pSound->engineNode, &pEngine->allocationCallbacks); return MA_OUT_OF_MEMORY; } @@ -78486,13 +78486,13 @@ MA_API ma_result ma_sound_init_from_file_internal(ma_engine* pEngine, const ma_s } pSound->pResourceManagerDataSource = (ma_resource_manager_data_source*)ma_malloc(sizeof(*pSound->pResourceManagerDataSource), &pEngine->allocationCallbacks); - if (pSound->pResourceManagerDataSource == NULL) { + if (pSound->pResourceManagerDataSource == nullptr) { return MA_OUT_OF_MEMORY; } /* Removed in 0.12. Set pDoneFence on the notifications. */ notifications = pConfig->initNotifications; - if (pConfig->pDoneFence != NULL && notifications.done.pFence == NULL) { + if (pConfig->pDoneFence != nullptr && notifications.done.pFence == nullptr) { notifications.done.pFence = pConfig->pDoneFence; } @@ -78524,8 +78524,8 @@ MA_API ma_result ma_sound_init_from_file_internal(ma_engine* pEngine, const ma_s /* We need to use a slightly customized version of the config so we'll need to make a copy. */ config = *pConfig; - config.pFilePath = NULL; - config.pFilePathW = NULL; + config.pFilePath = nullptr; + config.pFilePathW = nullptr; config.pDataSource = pSound->pResourceManagerDataSource; result = ma_sound_init_from_data_source_internal(pEngine, &config, pSound); @@ -78545,7 +78545,7 @@ MA_API ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePa { ma_sound_config config; - if (pFilePath == NULL) { + if (pFilePath == nullptr) { return MA_INVALID_ARGS; } @@ -78562,7 +78562,7 @@ MA_API ma_result ma_sound_init_from_file_w(ma_engine* pEngine, const wchar_t* pF { ma_sound_config config; - if (pFilePath == NULL) { + if (pFilePath == nullptr) { return MA_INVALID_ARGS; } @@ -78585,12 +78585,12 @@ MA_API ma_result ma_sound_init_copy(ma_engine* pEngine, const ma_sound* pExistin return result; } - if (pExistingSound == NULL) { + if (pExistingSound == nullptr) { return MA_INVALID_ARGS; } /* Cloning only works for data buffers (not streams) that are loaded from the resource manager. */ - if (pExistingSound->pResourceManagerDataSource == NULL) { + if (pExistingSound->pResourceManagerDataSource == nullptr) { return MA_INVALID_OPERATION; } @@ -78599,7 +78599,7 @@ MA_API ma_result ma_sound_init_copy(ma_engine* pEngine, const ma_sound* pExistin this will fail. */ pSound->pResourceManagerDataSource = (ma_resource_manager_data_source*)ma_malloc(sizeof(*pSound->pResourceManagerDataSource), &pEngine->allocationCallbacks); - if (pSound->pResourceManagerDataSource == NULL) { + if (pSound->pResourceManagerDataSource == nullptr) { return MA_OUT_OF_MEMORY; } @@ -78649,7 +78649,7 @@ MA_API ma_result ma_sound_init_ex(ma_engine* pEngine, const ma_sound_config* pCo return result; } - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } @@ -78658,7 +78658,7 @@ MA_API ma_result ma_sound_init_ex(ma_engine* pEngine, const ma_sound_config* pCo /* We need to load the sound differently depending on whether or not we're loading from a file. */ #ifndef MA_NO_RESOURCE_MANAGER - if (pConfig->pFilePath != NULL || pConfig->pFilePathW != NULL) { + if (pConfig->pFilePath != nullptr || pConfig->pFilePathW != nullptr) { return ma_sound_init_from_file_internal(pEngine, pConfig, pSound); } else #endif @@ -78675,7 +78675,7 @@ MA_API ma_result ma_sound_init_ex(ma_engine* pEngine, const ma_sound_config* pCo MA_API void ma_sound_uninit(ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -78685,9 +78685,9 @@ MA_API void ma_sound_uninit(ma_sound* pSound) */ ma_engine_node_uninit(&pSound->engineNode, &pSound->engineNode.pEngine->allocationCallbacks); - if (pSound->pProcessingCache != NULL) { + if (pSound->pProcessingCache != nullptr) { ma_free(pSound->pProcessingCache, &pSound->engineNode.pEngine->allocationCallbacks); - pSound->pProcessingCache = NULL; + pSound->pProcessingCache = nullptr; } /* Once the sound is detached from the group we can guarantee that it won't be referenced by the mixer thread which means it's safe for us to destroy the data source. */ @@ -78695,7 +78695,7 @@ MA_API void ma_sound_uninit(ma_sound* pSound) if (pSound->ownsDataSource) { ma_resource_manager_data_source_uninit(pSound->pResourceManagerDataSource); ma_free(pSound->pResourceManagerDataSource, &pSound->engineNode.pEngine->allocationCallbacks); - pSound->pDataSource = NULL; + pSound->pDataSource = nullptr; } #else MA_ASSERT(pSound->ownsDataSource == MA_FALSE); @@ -78704,8 +78704,8 @@ MA_API void ma_sound_uninit(ma_sound* pSound) MA_API ma_engine* ma_sound_get_engine(const ma_sound* pSound) { - if (pSound == NULL) { - return NULL; + if (pSound == nullptr) { + return nullptr; } return pSound->engineNode.pEngine; @@ -78713,8 +78713,8 @@ MA_API ma_engine* ma_sound_get_engine(const ma_sound* pSound) MA_API ma_data_source* ma_sound_get_data_source(const ma_sound* pSound) { - if (pSound == NULL) { - return NULL; + if (pSound == nullptr) { + return nullptr; } return pSound->pDataSource; @@ -78722,7 +78722,7 @@ MA_API ma_data_source* ma_sound_get_data_source(const ma_sound* pSound) MA_API ma_result ma_sound_start(ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } @@ -78750,7 +78750,7 @@ MA_API ma_result ma_sound_start(ma_sound* pSound) MA_API ma_result ma_sound_stop(ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } @@ -78762,7 +78762,7 @@ MA_API ma_result ma_sound_stop(ma_sound* pSound) MA_API ma_result ma_sound_stop_with_fade_in_pcm_frames(ma_sound* pSound, ma_uint64 fadeLengthInFrames) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } @@ -78776,7 +78776,7 @@ MA_API ma_result ma_sound_stop_with_fade_in_milliseconds(ma_sound* pSound, ma_ui { ma_uint64 sampleRate; - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } @@ -78808,7 +78808,7 @@ MA_API void ma_sound_reset_stop_time_and_fade(ma_sound* pSound) MA_API void ma_sound_set_volume(ma_sound* pSound, float volume) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -78819,7 +78819,7 @@ MA_API float ma_sound_get_volume(const ma_sound* pSound) { float volume = 0; - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -78830,7 +78830,7 @@ MA_API float ma_sound_get_volume(const ma_sound* pSound) MA_API void ma_sound_set_pan(ma_sound* pSound, float pan) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -78839,7 +78839,7 @@ MA_API void ma_sound_set_pan(ma_sound* pSound, float pan) MA_API float ma_sound_get_pan(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -78848,7 +78848,7 @@ MA_API float ma_sound_get_pan(const ma_sound* pSound) MA_API void ma_sound_set_pan_mode(ma_sound* pSound, ma_pan_mode panMode) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -78857,7 +78857,7 @@ MA_API void ma_sound_set_pan_mode(ma_sound* pSound, ma_pan_mode panMode) MA_API ma_pan_mode ma_sound_get_pan_mode(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return ma_pan_mode_balance; } @@ -78866,7 +78866,7 @@ MA_API ma_pan_mode ma_sound_get_pan_mode(const ma_sound* pSound) MA_API void ma_sound_set_pitch(ma_sound* pSound, float pitch) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -78879,7 +78879,7 @@ MA_API void ma_sound_set_pitch(ma_sound* pSound, float pitch) MA_API float ma_sound_get_pitch(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -78888,7 +78888,7 @@ MA_API float ma_sound_get_pitch(const ma_sound* pSound) MA_API void ma_sound_set_spatialization_enabled(ma_sound* pSound, ma_bool32 enabled) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -78897,7 +78897,7 @@ MA_API void ma_sound_set_spatialization_enabled(ma_sound* pSound, ma_bool32 enab MA_API ma_bool32 ma_sound_is_spatialization_enabled(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_FALSE; } @@ -78906,7 +78906,7 @@ MA_API ma_bool32 ma_sound_is_spatialization_enabled(const ma_sound* pSound) MA_API void ma_sound_set_pinned_listener_index(ma_sound* pSound, ma_uint32 listenerIndex) { - if (pSound == NULL || listenerIndex >= ma_engine_get_listener_count(ma_sound_get_engine(pSound))) { + if (pSound == nullptr || listenerIndex >= ma_engine_get_listener_count(ma_sound_get_engine(pSound))) { return; } @@ -78915,7 +78915,7 @@ MA_API void ma_sound_set_pinned_listener_index(ma_sound* pSound, ma_uint32 liste MA_API ma_uint32 ma_sound_get_pinned_listener_index(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_LISTENER_INDEX_CLOSEST; } @@ -78926,7 +78926,7 @@ MA_API ma_uint32 ma_sound_get_listener_index(const ma_sound* pSound) { ma_uint32 listenerIndex; - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -78944,23 +78944,23 @@ MA_API ma_vec3f ma_sound_get_direction_to_listener(const ma_sound* pSound) ma_vec3f relativePos; ma_engine* pEngine; - if (pSound == NULL) { + if (pSound == nullptr) { return ma_vec3f_init_3f(0, 0, -1); } pEngine = ma_sound_get_engine(pSound); - if (pEngine == NULL) { + if (pEngine == nullptr) { return ma_vec3f_init_3f(0, 0, -1); } - ma_spatializer_get_relative_position_and_direction(&pSound->engineNode.spatializer, &pEngine->listeners[ma_sound_get_listener_index(pSound)], &relativePos, NULL); + ma_spatializer_get_relative_position_and_direction(&pSound->engineNode.spatializer, &pEngine->listeners[ma_sound_get_listener_index(pSound)], &relativePos, nullptr); return ma_vec3f_normalize(ma_vec3f_neg(relativePos)); } MA_API void ma_sound_set_position(ma_sound* pSound, float x, float y, float z) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -78969,7 +78969,7 @@ MA_API void ma_sound_set_position(ma_sound* pSound, float x, float y, float z) MA_API ma_vec3f ma_sound_get_position(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return ma_vec3f_init_3f(0, 0, 0); } @@ -78978,7 +78978,7 @@ MA_API ma_vec3f ma_sound_get_position(const ma_sound* pSound) MA_API void ma_sound_set_direction(ma_sound* pSound, float x, float y, float z) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -78987,7 +78987,7 @@ MA_API void ma_sound_set_direction(ma_sound* pSound, float x, float y, float z) MA_API ma_vec3f ma_sound_get_direction(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return ma_vec3f_init_3f(0, 0, 0); } @@ -78996,7 +78996,7 @@ MA_API ma_vec3f ma_sound_get_direction(const ma_sound* pSound) MA_API void ma_sound_set_velocity(ma_sound* pSound, float x, float y, float z) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79005,7 +79005,7 @@ MA_API void ma_sound_set_velocity(ma_sound* pSound, float x, float y, float z) MA_API ma_vec3f ma_sound_get_velocity(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return ma_vec3f_init_3f(0, 0, 0); } @@ -79014,7 +79014,7 @@ MA_API ma_vec3f ma_sound_get_velocity(const ma_sound* pSound) MA_API void ma_sound_set_attenuation_model(ma_sound* pSound, ma_attenuation_model attenuationModel) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79023,7 +79023,7 @@ MA_API void ma_sound_set_attenuation_model(ma_sound* pSound, ma_attenuation_mode MA_API ma_attenuation_model ma_sound_get_attenuation_model(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return ma_attenuation_model_none; } @@ -79032,7 +79032,7 @@ MA_API ma_attenuation_model ma_sound_get_attenuation_model(const ma_sound* pSoun MA_API void ma_sound_set_positioning(ma_sound* pSound, ma_positioning positioning) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79041,7 +79041,7 @@ MA_API void ma_sound_set_positioning(ma_sound* pSound, ma_positioning positionin MA_API ma_positioning ma_sound_get_positioning(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return ma_positioning_absolute; } @@ -79050,7 +79050,7 @@ MA_API ma_positioning ma_sound_get_positioning(const ma_sound* pSound) MA_API void ma_sound_set_rolloff(ma_sound* pSound, float rolloff) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79059,7 +79059,7 @@ MA_API void ma_sound_set_rolloff(ma_sound* pSound, float rolloff) MA_API float ma_sound_get_rolloff(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -79068,7 +79068,7 @@ MA_API float ma_sound_get_rolloff(const ma_sound* pSound) MA_API void ma_sound_set_min_gain(ma_sound* pSound, float minGain) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79077,7 +79077,7 @@ MA_API void ma_sound_set_min_gain(ma_sound* pSound, float minGain) MA_API float ma_sound_get_min_gain(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -79086,7 +79086,7 @@ MA_API float ma_sound_get_min_gain(const ma_sound* pSound) MA_API void ma_sound_set_max_gain(ma_sound* pSound, float maxGain) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79095,7 +79095,7 @@ MA_API void ma_sound_set_max_gain(ma_sound* pSound, float maxGain) MA_API float ma_sound_get_max_gain(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -79104,7 +79104,7 @@ MA_API float ma_sound_get_max_gain(const ma_sound* pSound) MA_API void ma_sound_set_min_distance(ma_sound* pSound, float minDistance) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79113,7 +79113,7 @@ MA_API void ma_sound_set_min_distance(ma_sound* pSound, float minDistance) MA_API float ma_sound_get_min_distance(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -79122,7 +79122,7 @@ MA_API float ma_sound_get_min_distance(const ma_sound* pSound) MA_API void ma_sound_set_max_distance(ma_sound* pSound, float maxDistance) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79131,7 +79131,7 @@ MA_API void ma_sound_set_max_distance(ma_sound* pSound, float maxDistance) MA_API float ma_sound_get_max_distance(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -79140,7 +79140,7 @@ MA_API float ma_sound_get_max_distance(const ma_sound* pSound) MA_API void ma_sound_set_cone(ma_sound* pSound, float innerAngleInRadians, float outerAngleInRadians, float outerGain) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79149,19 +79149,19 @@ MA_API void ma_sound_set_cone(ma_sound* pSound, float innerAngleInRadians, float MA_API void ma_sound_get_cone(const ma_sound* pSound, float* pInnerAngleInRadians, float* pOuterAngleInRadians, float* pOuterGain) { - if (pInnerAngleInRadians != NULL) { + if (pInnerAngleInRadians != nullptr) { *pInnerAngleInRadians = 0; } - if (pOuterAngleInRadians != NULL) { + if (pOuterAngleInRadians != nullptr) { *pOuterAngleInRadians = 0; } - if (pOuterGain != NULL) { + if (pOuterGain != nullptr) { *pOuterGain = 0; } - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79170,7 +79170,7 @@ MA_API void ma_sound_get_cone(const ma_sound* pSound, float* pInnerAngleInRadian MA_API void ma_sound_set_doppler_factor(ma_sound* pSound, float dopplerFactor) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79179,7 +79179,7 @@ MA_API void ma_sound_set_doppler_factor(ma_sound* pSound, float dopplerFactor) MA_API float ma_sound_get_doppler_factor(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -79188,7 +79188,7 @@ MA_API float ma_sound_get_doppler_factor(const ma_sound* pSound) MA_API void ma_sound_set_directional_attenuation_factor(ma_sound* pSound, float directionalAttenuationFactor) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79197,7 +79197,7 @@ MA_API void ma_sound_set_directional_attenuation_factor(ma_sound* pSound, float MA_API float ma_sound_get_directional_attenuation_factor(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 1; } @@ -79207,7 +79207,7 @@ MA_API float ma_sound_get_directional_attenuation_factor(const ma_sound* pSound) MA_API void ma_sound_set_fade_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79216,7 +79216,7 @@ MA_API void ma_sound_set_fade_in_pcm_frames(ma_sound* pSound, float volumeBeg, f MA_API void ma_sound_set_fade_in_milliseconds(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79225,7 +79225,7 @@ MA_API void ma_sound_set_fade_in_milliseconds(ma_sound* pSound, float volumeBeg, MA_API void ma_sound_set_fade_start_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames, ma_uint64 absoluteGlobalTimeInFrames) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79244,7 +79244,7 @@ MA_API void ma_sound_set_fade_start_in_milliseconds(ma_sound* pSound, float volu { ma_uint32 sampleRate; - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79255,7 +79255,7 @@ MA_API void ma_sound_set_fade_start_in_milliseconds(ma_sound* pSound, float volu MA_API float ma_sound_get_current_fade_volume(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } @@ -79264,7 +79264,7 @@ MA_API float ma_sound_get_current_fade_volume(const ma_sound* pSound) MA_API void ma_sound_set_start_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79273,7 +79273,7 @@ MA_API void ma_sound_set_start_time_in_pcm_frames(ma_sound* pSound, ma_uint64 ab MA_API void ma_sound_set_start_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79282,7 +79282,7 @@ MA_API void ma_sound_set_start_time_in_milliseconds(ma_sound* pSound, ma_uint64 MA_API void ma_sound_set_stop_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79291,7 +79291,7 @@ MA_API void ma_sound_set_stop_time_in_pcm_frames(ma_sound* pSound, ma_uint64 abs MA_API void ma_sound_set_stop_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79300,7 +79300,7 @@ MA_API void ma_sound_set_stop_time_in_milliseconds(ma_sound* pSound, ma_uint64 a MA_API void ma_sound_set_stop_time_with_fade_in_pcm_frames(ma_sound* pSound, ma_uint64 stopAbsoluteGlobalTimeInFrames, ma_uint64 fadeLengthInFrames) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79319,7 +79319,7 @@ MA_API void ma_sound_set_stop_time_with_fade_in_milliseconds(ma_sound* pSound, m { ma_uint32 sampleRate; - if (pSound == NULL) { + if (pSound == nullptr) { return; } @@ -79330,7 +79330,7 @@ MA_API void ma_sound_set_stop_time_with_fade_in_milliseconds(ma_sound* pSound, m MA_API ma_bool32 ma_sound_is_playing(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_FALSE; } @@ -79339,7 +79339,7 @@ MA_API ma_bool32 ma_sound_is_playing(const ma_sound* pSound) MA_API ma_uint64 ma_sound_get_time_in_pcm_frames(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return 0; } @@ -79358,12 +79358,12 @@ MA_API ma_uint64 ma_sound_get_time_in_milliseconds(const ma_sound* pSound) MA_API void ma_sound_set_looping(ma_sound* pSound, ma_bool32 isLooping) { - if (pSound == NULL) { + if (pSound == nullptr) { return; } /* Looping is only a valid concept if the sound is backed by a data source. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { return; } @@ -79373,12 +79373,12 @@ MA_API void ma_sound_set_looping(ma_sound* pSound, ma_bool32 isLooping) MA_API ma_bool32 ma_sound_is_looping(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_FALSE; } /* There is no notion of looping for sounds that are not backed by a data source. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { return MA_FALSE; } @@ -79387,12 +79387,12 @@ MA_API ma_bool32 ma_sound_is_looping(const ma_sound* pSound) MA_API ma_bool32 ma_sound_at_end(const ma_sound* pSound) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_FALSE; } /* There is no notion of an end of a sound if it's not backed by a data source. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { return MA_FALSE; } @@ -79401,12 +79401,12 @@ MA_API ma_bool32 ma_sound_at_end(const ma_sound* pSound) MA_API ma_result ma_sound_seek_to_pcm_frame(ma_sound* pSound, ma_uint64 frameIndex) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } /* Seeking is only valid for sounds that are backed by a data source. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { return MA_INVALID_OPERATION; } @@ -79422,11 +79422,11 @@ MA_API ma_result ma_sound_seek_to_second(ma_sound* pSound, float seekPointInSeco ma_uint32 sampleRate; ma_result result; - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } - result = ma_sound_get_data_format(pSound, NULL, NULL, &sampleRate, NULL, 0); + result = ma_sound_get_data_format(pSound, nullptr, nullptr, &sampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; } @@ -79439,28 +79439,28 @@ MA_API ma_result ma_sound_seek_to_second(ma_sound* pSound, float seekPointInSeco MA_API ma_result ma_sound_get_data_format(const ma_sound* pSound, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } /* The data format is retrieved directly from the data source if the sound is backed by one. Otherwise we pull it from the node. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { ma_uint32 channels; - if (pFormat != NULL) { + if (pFormat != nullptr) { *pFormat = ma_format_f32; } channels = ma_node_get_input_channels(&pSound->engineNode, 0); - if (pChannels != NULL) { + if (pChannels != nullptr) { *pChannels = channels; } - if (pSampleRate != NULL) { + if (pSampleRate != nullptr) { *pSampleRate = pSound->engineNode.resampler.sampleRateIn; } - if (pChannelMap != NULL) { + if (pChannelMap != nullptr) { ma_channel_map_init_standard(ma_standard_channel_map_default, pChannelMap, channelMapCap, channels); } @@ -79474,12 +79474,12 @@ MA_API ma_result ma_sound_get_cursor_in_pcm_frames(const ma_sound* pSound, ma_ui { ma_uint64 seekTarget; - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } /* The notion of a cursor is only valid for sounds that are backed by a data source. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { return MA_INVALID_OPERATION; } @@ -79494,12 +79494,12 @@ MA_API ma_result ma_sound_get_cursor_in_pcm_frames(const ma_sound* pSound, ma_ui MA_API ma_result ma_sound_get_length_in_pcm_frames(const ma_sound* pSound, ma_uint64* pLength) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } /* The notion of a sound length is only valid for sounds that are backed by a data source. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { return MA_INVALID_OPERATION; } @@ -79512,7 +79512,7 @@ MA_API ma_result ma_sound_get_cursor_in_seconds(const ma_sound* pSound, float* p ma_uint64 cursorInPCMFrames; ma_uint32 sampleRate; - if (pCursor != NULL) { + if (pCursor != nullptr) { *pCursor = 0; } @@ -79521,7 +79521,7 @@ MA_API ma_result ma_sound_get_cursor_in_seconds(const ma_sound* pSound, float* p return result; } - result = ma_sound_get_data_format(pSound, NULL, NULL, &sampleRate, NULL, 0); + result = ma_sound_get_data_format(pSound, nullptr, nullptr, &sampleRate, nullptr, 0); if (result != MA_SUCCESS) { return result; } @@ -79534,12 +79534,12 @@ MA_API ma_result ma_sound_get_cursor_in_seconds(const ma_sound* pSound, float* p MA_API ma_result ma_sound_get_length_in_seconds(const ma_sound* pSound, float* pLength) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } /* The notion of a sound length is only valid for sounds that are backed by a data source. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { return MA_INVALID_OPERATION; } @@ -79548,12 +79548,12 @@ MA_API ma_result ma_sound_get_length_in_seconds(const ma_sound* pSound, float* p MA_API ma_result ma_sound_set_end_callback(ma_sound* pSound, ma_sound_end_proc callback, void* pUserData) { - if (pSound == NULL) { + if (pSound == nullptr) { return MA_INVALID_ARGS; } /* The notion of an end is only valid for sounds that are backed by a data source. */ - if (pSound->pDataSource == NULL) { + if (pSound->pDataSource == nullptr) { return MA_INVALID_OPERATION; } @@ -79576,21 +79576,21 @@ MA_API ma_result ma_sound_group_init_ex(ma_engine* pEngine, const ma_sound_group { ma_sound_config soundConfig; - if (pGroup == NULL) { + if (pGroup == nullptr) { return MA_INVALID_ARGS; } MA_ZERO_OBJECT(pGroup); - if (pConfig == NULL) { + if (pConfig == nullptr) { return MA_INVALID_ARGS; } /* A sound group is just a sound without a data source. */ soundConfig = *pConfig; - soundConfig.pFilePath = NULL; - soundConfig.pFilePathW = NULL; - soundConfig.pDataSource = NULL; + soundConfig.pFilePath = nullptr; + soundConfig.pFilePathW = nullptr; + soundConfig.pDataSource = nullptr; /* Groups need to have spatialization disabled by default because I think it'll be pretty rare @@ -80245,55 +80245,55 @@ MA_PRIVATE void ma_dr_wav__free_default(void* p, void* pUserData) } MA_PRIVATE void* ma_dr_wav__malloc_from_callbacks(size_t sz, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks == NULL) { - return NULL; + if (pAllocationCallbacks == nullptr) { + return nullptr; } - if (pAllocationCallbacks->onMalloc != NULL) { + if (pAllocationCallbacks->onMalloc != nullptr) { return pAllocationCallbacks->onMalloc(sz, pAllocationCallbacks->pUserData); } - if (pAllocationCallbacks->onRealloc != NULL) { - return pAllocationCallbacks->onRealloc(NULL, sz, pAllocationCallbacks->pUserData); + if (pAllocationCallbacks->onRealloc != nullptr) { + return pAllocationCallbacks->onRealloc(nullptr, sz, pAllocationCallbacks->pUserData); } - return NULL; + return nullptr; } MA_PRIVATE void* ma_dr_wav__realloc_from_callbacks(void* p, size_t szNew, size_t szOld, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks == NULL) { - return NULL; + if (pAllocationCallbacks == nullptr) { + return nullptr; } - if (pAllocationCallbacks->onRealloc != NULL) { + if (pAllocationCallbacks->onRealloc != nullptr) { return pAllocationCallbacks->onRealloc(p, szNew, pAllocationCallbacks->pUserData); } - if (pAllocationCallbacks->onMalloc != NULL && pAllocationCallbacks->onFree != NULL) { + if (pAllocationCallbacks->onMalloc != nullptr && pAllocationCallbacks->onFree != nullptr) { void* p2; p2 = pAllocationCallbacks->onMalloc(szNew, pAllocationCallbacks->pUserData); - if (p2 == NULL) { - return NULL; + if (p2 == nullptr) { + return nullptr; } - if (p != NULL) { + if (p != nullptr) { MA_DR_WAV_COPY_MEMORY(p2, p, szOld); pAllocationCallbacks->onFree(p, pAllocationCallbacks->pUserData); } return p2; } - return NULL; + return nullptr; } MA_PRIVATE void ma_dr_wav__free_from_callbacks(void* p, const ma_allocation_callbacks* pAllocationCallbacks) { - if (p == NULL || pAllocationCallbacks == NULL) { + if (p == nullptr || pAllocationCallbacks == nullptr) { return; } - if (pAllocationCallbacks->onFree != NULL) { + if (pAllocationCallbacks->onFree != nullptr) { pAllocationCallbacks->onFree(p, pAllocationCallbacks->pUserData); } } MA_PRIVATE ma_allocation_callbacks ma_dr_wav_copy_allocation_callbacks_or_defaults(const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks != NULL) { + if (pAllocationCallbacks != nullptr) { return *pAllocationCallbacks; } else { ma_allocation_callbacks allocationCallbacks; - allocationCallbacks.pUserData = NULL; + allocationCallbacks.pUserData = nullptr; allocationCallbacks.onMalloc = ma_dr_wav__malloc_default; allocationCallbacks.onRealloc = ma_dr_wav__realloc_default; allocationCallbacks.onFree = ma_dr_wav__free_default; @@ -80386,8 +80386,8 @@ MA_PRIVATE ma_bool32 ma_dr_wav__seek_from_start(ma_dr_wav_seek_proc onSeek, ma_u MA_PRIVATE size_t ma_dr_wav__on_read(ma_dr_wav_read_proc onRead, void* pUserData, void* pBufferOut, size_t bytesToRead, ma_uint64* pCursor) { size_t bytesRead; - MA_DR_WAV_ASSERT(onRead != NULL); - MA_DR_WAV_ASSERT(pCursor != NULL); + MA_DR_WAV_ASSERT(onRead != nullptr); + MA_DR_WAV_ASSERT(pCursor != nullptr); bytesRead = onRead(pUserData, pBufferOut, bytesToRead); *pCursor += bytesRead; return bytesRead; @@ -80395,8 +80395,8 @@ MA_PRIVATE size_t ma_dr_wav__on_read(ma_dr_wav_read_proc onRead, void* pUserData #if 0 MA_PRIVATE ma_bool32 ma_dr_wav__on_seek(ma_dr_wav_seek_proc onSeek, void* pUserData, int offset, ma_dr_wav_seek_origin origin, ma_uint64* pCursor) { - MA_DR_WAV_ASSERT(onSeek != NULL); - MA_DR_WAV_ASSERT(pCursor != NULL); + MA_DR_WAV_ASSERT(onSeek != nullptr); + MA_DR_WAV_ASSERT(pCursor != nullptr); if (!onSeek(pUserData, offset, origin)) { return MA_FALSE; } @@ -80474,7 +80474,7 @@ MA_PRIVATE ma_result ma_dr_wav__metadata_alloc(ma_dr_wav__metadata_parser* pPars pAllocationCallbacks->onFree(pParser->pData, pAllocationCallbacks->pUserData); pParser->pData = (ma_uint8*)pAllocationCallbacks->onMalloc(ma_dr_wav__metadata_memory_capacity(pParser), pAllocationCallbacks->pUserData); pParser->pDataCursor = pParser->pData; - if (pParser->pData == NULL) { + if (pParser->pData == nullptr) { return MA_OUT_OF_MEMORY; } pParser->pMetadata = (ma_dr_wav_metadata*)ma_dr_wav__metadata_get_memory(pParser, sizeof(ma_dr_wav_metadata) * pParser->metadataCount, 1); @@ -80484,7 +80484,7 @@ MA_PRIVATE ma_result ma_dr_wav__metadata_alloc(ma_dr_wav__metadata_parser* pPars } MA_PRIVATE size_t ma_dr_wav__metadata_parser_read(ma_dr_wav__metadata_parser* pParser, void* pBufferOut, size_t bytesToRead, ma_uint64* pCursor) { - if (pCursor != NULL) { + if (pCursor != nullptr) { return ma_dr_wav__on_read(pParser->onRead, pParser->pReadSeekUserData, pBufferOut, bytesToRead, pCursor); } else { return pParser->onRead(pParser->pReadSeekUserData, pBufferOut, bytesToRead); @@ -80495,13 +80495,13 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_smpl_to_metadata_obj(ma_dr_wav__metadata_pa ma_uint8 smplHeaderData[MA_DR_WAV_SMPL_BYTES]; ma_uint64 totalBytesRead = 0; size_t bytesJustRead; - if (pMetadata == NULL) { + if (pMetadata == nullptr) { return 0; } bytesJustRead = ma_dr_wav__metadata_parser_read(pParser, smplHeaderData, sizeof(smplHeaderData), &totalBytesRead); MA_DR_WAV_ASSERT(pParser->stage == ma_dr_wav__metadata_parser_stage_read); - MA_DR_WAV_ASSERT(pChunkHeader != NULL); - if (pMetadata != NULL && bytesJustRead == sizeof(smplHeaderData)) { + MA_DR_WAV_ASSERT(pChunkHeader != nullptr); + if (pMetadata != nullptr && bytesJustRead == sizeof(smplHeaderData)) { ma_uint32 iSampleLoop; pMetadata->type = ma_dr_wav_metadata_type_smpl; pMetadata->data.smpl.manufacturerId = ma_dr_wav_bytes_to_u32(smplHeaderData + 0); @@ -80531,7 +80531,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_smpl_to_metadata_obj(ma_dr_wav__metadata_pa } if (pMetadata->data.smpl.samplerSpecificDataSizeInBytes > 0) { pMetadata->data.smpl.pSamplerSpecificData = ma_dr_wav__metadata_get_memory(pParser, pMetadata->data.smpl.samplerSpecificDataSizeInBytes, 1); - MA_DR_WAV_ASSERT(pMetadata->data.smpl.pSamplerSpecificData != NULL); + MA_DR_WAV_ASSERT(pMetadata->data.smpl.pSamplerSpecificData != nullptr); ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.smpl.pSamplerSpecificData, pMetadata->data.smpl.samplerSpecificDataSizeInBytes, &totalBytesRead); } } @@ -80543,7 +80543,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_cue_to_metadata_obj(ma_dr_wav__metadata_par ma_uint8 cueHeaderSectionData[MA_DR_WAV_CUE_BYTES]; ma_uint64 totalBytesRead = 0; size_t bytesJustRead; - if (pMetadata == NULL) { + if (pMetadata == nullptr) { return 0; } bytesJustRead = ma_dr_wav__metadata_parser_read(pParser, cueHeaderSectionData, sizeof(cueHeaderSectionData), &totalBytesRead); @@ -80553,7 +80553,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_cue_to_metadata_obj(ma_dr_wav__metadata_par pMetadata->data.cue.cuePointCount = ma_dr_wav_bytes_to_u32(cueHeaderSectionData); if (pMetadata->data.cue.cuePointCount == (pChunkHeader->sizeInBytes - MA_DR_WAV_CUE_BYTES) / MA_DR_WAV_CUE_POINT_BYTES) { pMetadata->data.cue.pCuePoints = (ma_dr_wav_cue_point*)ma_dr_wav__metadata_get_memory(pParser, sizeof(ma_dr_wav_cue_point) * pMetadata->data.cue.cuePointCount, MA_DR_WAV_METADATA_ALIGNMENT); - MA_DR_WAV_ASSERT(pMetadata->data.cue.pCuePoints != NULL); + MA_DR_WAV_ASSERT(pMetadata->data.cue.pCuePoints != nullptr); if (pMetadata->data.cue.cuePointCount > 0) { ma_uint32 iCuePoint; for (iCuePoint = 0; iCuePoint < pMetadata->data.cue.cuePointCount; ++iCuePoint) { @@ -80582,10 +80582,10 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_inst_to_metadata_obj(ma_dr_wav__metadata_pa { ma_uint8 instData[MA_DR_WAV_INST_BYTES]; ma_uint64 bytesRead; - if (pMetadata == NULL) { + if (pMetadata == nullptr) { return 0; } - bytesRead = ma_dr_wav__metadata_parser_read(pParser, instData, sizeof(instData), NULL); + bytesRead = ma_dr_wav__metadata_parser_read(pParser, instData, sizeof(instData), nullptr); MA_DR_WAV_ASSERT(pParser->stage == ma_dr_wav__metadata_parser_stage_read); if (bytesRead == sizeof(instData)) { pMetadata->type = ma_dr_wav_metadata_type_inst; @@ -80603,10 +80603,10 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_acid_to_metadata_obj(ma_dr_wav__metadata_pa { ma_uint8 acidData[MA_DR_WAV_ACID_BYTES]; ma_uint64 bytesRead; - if (pMetadata == NULL) { + if (pMetadata == nullptr) { return 0; } - bytesRead = ma_dr_wav__metadata_parser_read(pParser, acidData, sizeof(acidData), NULL); + bytesRead = ma_dr_wav__metadata_parser_read(pParser, acidData, sizeof(acidData), nullptr); MA_DR_WAV_ASSERT(pParser->stage == ma_dr_wav__metadata_parser_stage_read); if (bytesRead == sizeof(acidData)) { pMetadata->type = ma_dr_wav_metadata_type_acid; @@ -80642,12 +80642,12 @@ MA_PRIVATE char* ma_dr_wav__metadata_copy_string(ma_dr_wav__metadata_parser* pPa size_t len = ma_dr_wav__strlen_clamped(str, maxToRead); if (len) { char* result = (char*)ma_dr_wav__metadata_get_memory(pParser, len + 1, 1); - MA_DR_WAV_ASSERT(result != NULL); + MA_DR_WAV_ASSERT(result != nullptr); MA_DR_WAV_COPY_MEMORY(result, str, len); result[len] = '\0'; return result; } else { - return NULL; + return nullptr; } } typedef struct @@ -80658,8 +80658,8 @@ typedef struct } ma_dr_wav_buffer_reader; MA_PRIVATE ma_result ma_dr_wav_buffer_reader_init(const void* pBuffer, size_t sizeInBytes, ma_dr_wav_buffer_reader* pReader) { - MA_DR_WAV_ASSERT(pBuffer != NULL); - MA_DR_WAV_ASSERT(pReader != NULL); + MA_DR_WAV_ASSERT(pBuffer != nullptr); + MA_DR_WAV_ASSERT(pReader != nullptr); MA_DR_WAV_ZERO_OBJECT(pReader); pReader->pBuffer = pBuffer; pReader->sizeInBytes = sizeInBytes; @@ -80668,12 +80668,12 @@ MA_PRIVATE ma_result ma_dr_wav_buffer_reader_init(const void* pBuffer, size_t si } MA_PRIVATE const void* ma_dr_wav_buffer_reader_ptr(const ma_dr_wav_buffer_reader* pReader) { - MA_DR_WAV_ASSERT(pReader != NULL); + MA_DR_WAV_ASSERT(pReader != nullptr); return ma_dr_wav_offset_ptr(pReader->pBuffer, pReader->cursor); } MA_PRIVATE ma_result ma_dr_wav_buffer_reader_seek(ma_dr_wav_buffer_reader* pReader, size_t bytesToSeek) { - MA_DR_WAV_ASSERT(pReader != NULL); + MA_DR_WAV_ASSERT(pReader != nullptr); if (pReader->cursor + bytesToSeek > pReader->sizeInBytes) { return MA_BAD_SEEK; } @@ -80684,15 +80684,15 @@ MA_PRIVATE ma_result ma_dr_wav_buffer_reader_read(ma_dr_wav_buffer_reader* pRead { ma_result result = MA_SUCCESS; size_t bytesRemaining; - MA_DR_WAV_ASSERT(pReader != NULL); - if (pBytesRead != NULL) { + MA_DR_WAV_ASSERT(pReader != nullptr); + if (pBytesRead != nullptr) { *pBytesRead = 0; } bytesRemaining = (pReader->sizeInBytes - pReader->cursor); if (bytesToRead > bytesRemaining) { bytesToRead = bytesRemaining; } - if (pDst == NULL) { + if (pDst == nullptr) { result = ma_dr_wav_buffer_reader_seek(pReader, bytesToRead); } else { MA_DR_WAV_COPY_MEMORY(pDst, ma_dr_wav_buffer_reader_ptr(pReader), bytesToRead); @@ -80700,7 +80700,7 @@ MA_PRIVATE ma_result ma_dr_wav_buffer_reader_read(ma_dr_wav_buffer_reader* pRead } MA_DR_WAV_ASSERT(pReader->cursor <= pReader->sizeInBytes); if (result == MA_SUCCESS) { - if (pBytesRead != NULL) { + if (pBytesRead != nullptr) { *pBytesRead = bytesToRead; } } @@ -80711,8 +80711,8 @@ MA_PRIVATE ma_result ma_dr_wav_buffer_reader_read_u16(ma_dr_wav_buffer_reader* p ma_result result; size_t bytesRead; ma_uint8 data[2]; - MA_DR_WAV_ASSERT(pReader != NULL); - MA_DR_WAV_ASSERT(pDst != NULL); + MA_DR_WAV_ASSERT(pReader != nullptr); + MA_DR_WAV_ASSERT(pDst != nullptr); *pDst = 0; result = ma_dr_wav_buffer_reader_read(pReader, data, sizeof(*pDst), &bytesRead); if (result != MA_SUCCESS || bytesRead != sizeof(*pDst)) { @@ -80726,8 +80726,8 @@ MA_PRIVATE ma_result ma_dr_wav_buffer_reader_read_u32(ma_dr_wav_buffer_reader* p ma_result result; size_t bytesRead; ma_uint8 data[4]; - MA_DR_WAV_ASSERT(pReader != NULL); - MA_DR_WAV_ASSERT(pDst != NULL); + MA_DR_WAV_ASSERT(pReader != nullptr); + MA_DR_WAV_ASSERT(pDst != nullptr); *pDst = 0; result = ma_dr_wav_buffer_reader_read(pReader, data, sizeof(*pDst), &bytesRead); if (result != MA_SUCCESS || bytesRead != sizeof(*pDst)) { @@ -80739,7 +80739,7 @@ MA_PRIVATE ma_result ma_dr_wav_buffer_reader_read_u32(ma_dr_wav_buffer_reader* p MA_PRIVATE ma_uint64 ma_dr_wav__read_bext_to_metadata_obj(ma_dr_wav__metadata_parser* pParser, ma_dr_wav_metadata* pMetadata, ma_uint64 chunkSize) { ma_uint8 bextData[MA_DR_WAV_BEXT_BYTES]; - size_t bytesRead = ma_dr_wav__metadata_parser_read(pParser, bextData, sizeof(bextData), NULL); + size_t bytesRead = ma_dr_wav__metadata_parser_read(pParser, bextData, sizeof(bextData), nullptr); MA_DR_WAV_ASSERT(pParser->stage == ma_dr_wav__metadata_parser_stage_read); if (bytesRead == sizeof(bextData)) { ma_dr_wav_buffer_reader reader; @@ -80754,14 +80754,14 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_bext_to_metadata_obj(ma_dr_wav__metadata_pa ma_dr_wav_buffer_reader_seek(&reader, MA_DR_WAV_BEXT_ORIGINATOR_NAME_BYTES); pMetadata->data.bext.pOriginatorReference = ma_dr_wav__metadata_copy_string(pParser, (const char*)ma_dr_wav_buffer_reader_ptr(&reader), MA_DR_WAV_BEXT_ORIGINATOR_REF_BYTES); ma_dr_wav_buffer_reader_seek(&reader, MA_DR_WAV_BEXT_ORIGINATOR_REF_BYTES); - ma_dr_wav_buffer_reader_read(&reader, pMetadata->data.bext.pOriginationDate, sizeof(pMetadata->data.bext.pOriginationDate), NULL); - ma_dr_wav_buffer_reader_read(&reader, pMetadata->data.bext.pOriginationTime, sizeof(pMetadata->data.bext.pOriginationTime), NULL); + ma_dr_wav_buffer_reader_read(&reader, pMetadata->data.bext.pOriginationDate, sizeof(pMetadata->data.bext.pOriginationDate), nullptr); + ma_dr_wav_buffer_reader_read(&reader, pMetadata->data.bext.pOriginationTime, sizeof(pMetadata->data.bext.pOriginationTime), nullptr); ma_dr_wav_buffer_reader_read_u32(&reader, &timeReferenceLow); ma_dr_wav_buffer_reader_read_u32(&reader, &timeReferenceHigh); pMetadata->data.bext.timeReference = ((ma_uint64)timeReferenceHigh << 32) + timeReferenceLow; ma_dr_wav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.version); pMetadata->data.bext.pUMID = ma_dr_wav__metadata_get_memory(pParser, MA_DR_WAV_BEXT_UMID_BYTES, 1); - ma_dr_wav_buffer_reader_read(&reader, pMetadata->data.bext.pUMID, MA_DR_WAV_BEXT_UMID_BYTES, NULL); + ma_dr_wav_buffer_reader_read(&reader, pMetadata->data.bext.pUMID, MA_DR_WAV_BEXT_UMID_BYTES, nullptr); ma_dr_wav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.loudnessValue); ma_dr_wav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.loudnessRange); ma_dr_wav_buffer_reader_read_u16(&reader, &pMetadata->data.bext.maxTruePeakLevel); @@ -80771,11 +80771,11 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_bext_to_metadata_obj(ma_dr_wav__metadata_pa extraBytes = (size_t)(chunkSize - MA_DR_WAV_BEXT_BYTES); if (extraBytes > 0) { pMetadata->data.bext.pCodingHistory = (char*)ma_dr_wav__metadata_get_memory(pParser, extraBytes + 1, 1); - MA_DR_WAV_ASSERT(pMetadata->data.bext.pCodingHistory != NULL); - bytesRead += ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.bext.pCodingHistory, extraBytes, NULL); + MA_DR_WAV_ASSERT(pMetadata->data.bext.pCodingHistory != nullptr); + bytesRead += ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.bext.pCodingHistory, extraBytes, nullptr); pMetadata->data.bext.codingHistorySize = (ma_uint32)ma_dr_wav__strlen(pMetadata->data.bext.pCodingHistory); } else { - pMetadata->data.bext.pCodingHistory = NULL; + pMetadata->data.bext.pCodingHistory = nullptr; pMetadata->data.bext.codingHistorySize = 0; } } @@ -80796,11 +80796,11 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_list_label_or_note_to_metadata_obj(ma_dr_wa if (sizeIncludingNullTerminator > 0) { pMetadata->data.labelOrNote.stringLength = sizeIncludingNullTerminator - 1; pMetadata->data.labelOrNote.pString = (char*)ma_dr_wav__metadata_get_memory(pParser, sizeIncludingNullTerminator, 1); - MA_DR_WAV_ASSERT(pMetadata->data.labelOrNote.pString != NULL); + MA_DR_WAV_ASSERT(pMetadata->data.labelOrNote.pString != nullptr); ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.labelOrNote.pString, sizeIncludingNullTerminator, &totalBytesRead); } else { pMetadata->data.labelOrNote.stringLength = 0; - pMetadata->data.labelOrNote.pString = NULL; + pMetadata->data.labelOrNote.pString = nullptr; } } return totalBytesRead; @@ -80828,11 +80828,11 @@ MA_PRIVATE ma_uint64 ma_dr_wav__read_list_labelled_cue_region_to_metadata_obj(ma if (sizeIncludingNullTerminator > 0) { pMetadata->data.labelledCueRegion.stringLength = sizeIncludingNullTerminator - 1; pMetadata->data.labelledCueRegion.pString = (char*)ma_dr_wav__metadata_get_memory(pParser, sizeIncludingNullTerminator, 1); - MA_DR_WAV_ASSERT(pMetadata->data.labelledCueRegion.pString != NULL); + MA_DR_WAV_ASSERT(pMetadata->data.labelledCueRegion.pString != nullptr); ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.labelledCueRegion.pString, sizeIncludingNullTerminator, &totalBytesRead); } else { pMetadata->data.labelledCueRegion.stringLength = 0; - pMetadata->data.labelledCueRegion.pString = NULL; + pMetadata->data.labelledCueRegion.pString = nullptr; } } return totalBytesRead; @@ -80850,15 +80850,15 @@ MA_PRIVATE ma_uint64 ma_dr_wav__metadata_process_info_text_chunk(ma_dr_wav__meta if (stringSizeWithNullTerminator > 0) { pMetadata->data.infoText.stringLength = stringSizeWithNullTerminator - 1; pMetadata->data.infoText.pString = (char*)ma_dr_wav__metadata_get_memory(pParser, stringSizeWithNullTerminator, 1); - MA_DR_WAV_ASSERT(pMetadata->data.infoText.pString != NULL); - bytesRead = ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.infoText.pString, (size_t)stringSizeWithNullTerminator, NULL); + MA_DR_WAV_ASSERT(pMetadata->data.infoText.pString != nullptr); + bytesRead = ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.infoText.pString, (size_t)stringSizeWithNullTerminator, nullptr); if (bytesRead == chunkSize) { pParser->metadataCursor += 1; } else { } } else { pMetadata->data.infoText.stringLength = 0; - pMetadata->data.infoText.pString = NULL; + pMetadata->data.infoText.pString = nullptr; pParser->metadataCursor += 1; } } @@ -80886,8 +80886,8 @@ MA_PRIVATE ma_uint64 ma_dr_wav__metadata_process_unknown_chunk(ma_dr_wav__metada pMetadata->data.unknown.id[3] = pChunkId[3]; pMetadata->data.unknown.dataSizeInBytes = (ma_uint32)chunkSize; pMetadata->data.unknown.pData = (ma_uint8 *)ma_dr_wav__metadata_get_memory(pParser, (size_t)chunkSize, 1); - MA_DR_WAV_ASSERT(pMetadata->data.unknown.pData != NULL); - bytesRead = ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.unknown.pData, pMetadata->data.unknown.dataSizeInBytes, NULL); + MA_DR_WAV_ASSERT(pMetadata->data.unknown.pData != nullptr); + bytesRead = ma_dr_wav__metadata_parser_read(pParser, pMetadata->data.unknown.pData, pMetadata->data.unknown.dataSizeInBytes, nullptr); if (bytesRead == pMetadata->data.unknown.dataSizeInBytes) { pParser->metadataCursor += 1; } else { @@ -81137,7 +81137,7 @@ MA_PRIVATE ma_uint32 ma_dr_wav_get_bytes_per_pcm_frame(ma_dr_wav* pWav) } MA_API ma_uint16 ma_dr_wav_fmt_get_format(const ma_dr_wav_fmt* pFMT) { - if (pFMT == NULL) { + if (pFMT == nullptr) { return 0; } if (pFMT->formatTag != MA_DR_WAVE_FORMAT_EXTENSIBLE) { @@ -81148,7 +81148,7 @@ MA_API ma_uint16 ma_dr_wav_fmt_get_format(const ma_dr_wav_fmt* pFMT) } MA_PRIVATE ma_bool32 ma_dr_wav_preinit(ma_dr_wav* pWav, ma_dr_wav_read_proc onRead, ma_dr_wav_seek_proc onSeek, ma_dr_wav_tell_proc onTell, void* pReadSeekTellUserData, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pWav == NULL || onRead == NULL || onSeek == NULL) { + if (pWav == nullptr || onRead == nullptr || onSeek == nullptr) { return MA_FALSE; } MA_DR_WAV_ZERO_MEMORY(pWav, sizeof(*pWav)); @@ -81157,7 +81157,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav_preinit(ma_dr_wav* pWav, ma_dr_wav_read_proc onRe pWav->onTell = onTell; pWav->pUserData = pReadSeekTellUserData; pWav->allocationCallbacks = ma_dr_wav_copy_allocation_callbacks_or_defaults(pAllocationCallbacks); - if (pWav->allocationCallbacks.onFree == NULL || (pWav->allocationCallbacks.onMalloc == NULL && pWav->allocationCallbacks.onRealloc == NULL)) { + if (pWav->allocationCallbacks.onFree == nullptr || (pWav->allocationCallbacks.onMalloc == nullptr && pWav->allocationCallbacks.onRealloc == nullptr)) { return MA_FALSE; } return MA_TRUE; @@ -81319,7 +81319,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav_init__internal(ma_dr_wav* pWav, ma_dr_wav_chunk_p break; } chunkSize = header.sizeInBytes; - if (!sequential && onChunk != NULL) { + if (!sequential && onChunk != nullptr) { ma_uint64 callbackBytesRead = onChunk(pChunkUserData, pWav->onRead, pWav->onSeek, pWav->pUserData, &header, pWav->container, &fmt); if (callbackBytesRead > 0) { if (ma_dr_wav__seek_from_start(pWav->onSeek, cursor, pWav->pUserData) == MA_FALSE) { @@ -81610,7 +81610,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav_init__internal(ma_dr_wav* pWav, ma_dr_wav_chunk_p pWav->pMetadata = metadataParser.pMetadata; pWav->metadataCount = metadataParser.metadataCount; } - if (pWav->onTell != NULL && pWav->onSeek != NULL) { + if (pWav->onTell != nullptr && pWav->onSeek != nullptr) { if (pWav->onSeek(pWav->pUserData, 0, MA_DR_WAV_SEEK_END) == MA_TRUE) { ma_int64 fileSize; if (pWav->onTell(pWav->pUserData, &fileSize)) { @@ -81704,7 +81704,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav_init__internal(ma_dr_wav* pWav, ma_dr_wav_chunk_p } MA_API ma_bool32 ma_dr_wav_init(ma_dr_wav* pWav, ma_dr_wav_read_proc onRead, ma_dr_wav_seek_proc onSeek, ma_dr_wav_tell_proc onTell, void* pUserData, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_wav_init_ex(pWav, onRead, onSeek, onTell, NULL, pUserData, NULL, 0, pAllocationCallbacks); + return ma_dr_wav_init_ex(pWav, onRead, onSeek, onTell, nullptr, pUserData, nullptr, 0, pAllocationCallbacks); } MA_API ma_bool32 ma_dr_wav_init_ex(ma_dr_wav* pWav, ma_dr_wav_read_proc onRead, ma_dr_wav_seek_proc onSeek, ma_dr_wav_tell_proc onTell, ma_dr_wav_chunk_proc onChunk, void* pReadSeekTellUserData, void* pChunkUserData, ma_uint32 flags, const ma_allocation_callbacks* pAllocationCallbacks) { @@ -81718,31 +81718,31 @@ MA_API ma_bool32 ma_dr_wav_init_with_metadata(ma_dr_wav* pWav, ma_dr_wav_read_pr if (!ma_dr_wav_preinit(pWav, onRead, onSeek, onTell, pUserData, pAllocationCallbacks)) { return MA_FALSE; } - return ma_dr_wav_init__internal(pWav, NULL, NULL, flags | MA_DR_WAV_WITH_METADATA); + return ma_dr_wav_init__internal(pWav, nullptr, nullptr, flags | MA_DR_WAV_WITH_METADATA); } MA_API ma_dr_wav_metadata* ma_dr_wav_take_ownership_of_metadata(ma_dr_wav* pWav) { ma_dr_wav_metadata *result = pWav->pMetadata; - pWav->pMetadata = NULL; + pWav->pMetadata = nullptr; pWav->metadataCount = 0; return result; } MA_PRIVATE size_t ma_dr_wav__write(ma_dr_wav* pWav, const void* pData, size_t dataSize) { - MA_DR_WAV_ASSERT(pWav != NULL); - MA_DR_WAV_ASSERT(pWav->onWrite != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); + MA_DR_WAV_ASSERT(pWav->onWrite != nullptr); return pWav->onWrite(pWav->pUserData, pData, dataSize); } MA_PRIVATE size_t ma_dr_wav__write_byte(ma_dr_wav* pWav, ma_uint8 byte) { - MA_DR_WAV_ASSERT(pWav != NULL); - MA_DR_WAV_ASSERT(pWav->onWrite != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); + MA_DR_WAV_ASSERT(pWav->onWrite != nullptr); return pWav->onWrite(pWav->pUserData, &byte, 1); } MA_PRIVATE size_t ma_dr_wav__write_u16ne_to_le(ma_dr_wav* pWav, ma_uint16 value) { - MA_DR_WAV_ASSERT(pWav != NULL); - MA_DR_WAV_ASSERT(pWav->onWrite != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); + MA_DR_WAV_ASSERT(pWav->onWrite != nullptr); if (!ma_dr_wav__is_little_endian()) { value = ma_dr_wav__bswap16(value); } @@ -81750,8 +81750,8 @@ MA_PRIVATE size_t ma_dr_wav__write_u16ne_to_le(ma_dr_wav* pWav, ma_uint16 value) } MA_PRIVATE size_t ma_dr_wav__write_u32ne_to_le(ma_dr_wav* pWav, ma_uint32 value) { - MA_DR_WAV_ASSERT(pWav != NULL); - MA_DR_WAV_ASSERT(pWav->onWrite != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); + MA_DR_WAV_ASSERT(pWav->onWrite != nullptr); if (!ma_dr_wav__is_little_endian()) { value = ma_dr_wav__bswap32(value); } @@ -81759,8 +81759,8 @@ MA_PRIVATE size_t ma_dr_wav__write_u32ne_to_le(ma_dr_wav* pWav, ma_uint32 value) } MA_PRIVATE size_t ma_dr_wav__write_u64ne_to_le(ma_dr_wav* pWav, ma_uint64 value) { - MA_DR_WAV_ASSERT(pWav != NULL); - MA_DR_WAV_ASSERT(pWav->onWrite != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); + MA_DR_WAV_ASSERT(pWav->onWrite != nullptr); if (!ma_dr_wav__is_little_endian()) { value = ma_dr_wav__bswap64(value); } @@ -81772,8 +81772,8 @@ MA_PRIVATE size_t ma_dr_wav__write_f32ne_to_le(ma_dr_wav* pWav, float value) ma_uint32 u32; float f32; } u; - MA_DR_WAV_ASSERT(pWav != NULL); - MA_DR_WAV_ASSERT(pWav->onWrite != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); + MA_DR_WAV_ASSERT(pWav->onWrite != nullptr); u.f32 = value; if (!ma_dr_wav__is_little_endian()) { u.u32 = ma_dr_wav__bswap32(u.u32); @@ -81782,28 +81782,28 @@ MA_PRIVATE size_t ma_dr_wav__write_f32ne_to_le(ma_dr_wav* pWav, float value) } MA_PRIVATE size_t ma_dr_wav__write_or_count(ma_dr_wav* pWav, const void* pData, size_t dataSize) { - if (pWav == NULL) { + if (pWav == nullptr) { return dataSize; } return ma_dr_wav__write(pWav, pData, dataSize); } MA_PRIVATE size_t ma_dr_wav__write_or_count_byte(ma_dr_wav* pWav, ma_uint8 byte) { - if (pWav == NULL) { + if (pWav == nullptr) { return 1; } return ma_dr_wav__write_byte(pWav, byte); } MA_PRIVATE size_t ma_dr_wav__write_or_count_u16ne_to_le(ma_dr_wav* pWav, ma_uint16 value) { - if (pWav == NULL) { + if (pWav == nullptr) { return 2; } return ma_dr_wav__write_u16ne_to_le(pWav, value); } MA_PRIVATE size_t ma_dr_wav__write_or_count_u32ne_to_le(ma_dr_wav* pWav, ma_uint32 value) { - if (pWav == NULL) { + if (pWav == nullptr) { return 4; } return ma_dr_wav__write_u32ne_to_le(pWav, value); @@ -81811,7 +81811,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_u32ne_to_le(ma_dr_wav* pWav, ma_uint #if 0 MA_PRIVATE size_t ma_dr_wav__write_or_count_u64ne_to_le(ma_dr_wav* pWav, ma_uint64 value) { - if (pWav == NULL) { + if (pWav == nullptr) { return 8; } return ma_dr_wav__write_u64ne_to_le(pWav, value); @@ -81819,7 +81819,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_u64ne_to_le(ma_dr_wav* pWav, ma_uint #endif MA_PRIVATE size_t ma_dr_wav__write_or_count_f32ne_to_le(ma_dr_wav* pWav, float value) { - if (pWav == NULL) { + if (pWav == nullptr) { return 4; } return ma_dr_wav__write_f32ne_to_le(pWav, value); @@ -81827,7 +81827,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_f32ne_to_le(ma_dr_wav* pWav, float v MA_PRIVATE size_t ma_dr_wav__write_or_count_string_to_fixed_size_buf(ma_dr_wav* pWav, char* str, size_t bufFixedSize) { size_t len; - if (pWav == NULL) { + if (pWav == nullptr) { return bufFixedSize; } len = ma_dr_wav__strlen_clamped(str, bufFixedSize); @@ -81846,7 +81846,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_metadata(ma_dr_wav* pWav, ma_dr_wav_ ma_bool32 hasListAdtl = MA_FALSE; ma_bool32 hasListInfo = MA_FALSE; ma_uint32 iMetadata; - if (pMetadatas == NULL || metadataCount == 0) { + if (pMetadatas == nullptr || metadataCount == 0) { return 0; } for (iMetadata = 0; iMetadata < metadataCount; ++iMetadata) { @@ -81996,7 +81996,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_metadata(ma_dr_wav* pWav, ma_dr_wav_ ma_dr_wav_metadata* pMetadata = &pMetadatas[iMetadata]; ma_uint32 subchunkSize = 0; if (pMetadata->type & ma_dr_wav_metadata_type_list_all_info_strings) { - const char* pID = NULL; + const char* pID = nullptr; switch (pMetadata->type) { case ma_dr_wav_metadata_type_list_info_software: pID = "ISFT"; break; case ma_dr_wav_metadata_type_list_info_copyright: pID = "ICOP"; break; @@ -82014,7 +82014,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_metadata(ma_dr_wav* pWav, ma_dr_wav_ case ma_dr_wav_metadata_type_list_info_description: pID = "ISBJ"; break; default: break; } - MA_DR_WAV_ASSERT(pID != NULL); + MA_DR_WAV_ASSERT(pID != nullptr); if (pMetadata->data.infoText.stringLength) { subchunkSize = pMetadata->data.infoText.stringLength + 1; bytesWritten += ma_dr_wav__write_or_count(pWav, pID, 4); @@ -82083,15 +82083,15 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_metadata(ma_dr_wav* pWav, ma_dr_wav_ case ma_dr_wav_metadata_type_list_note: { if (pMetadata->data.labelOrNote.stringLength > 0) { - const char *pID = NULL; + const char *pID = nullptr; if (pMetadata->type == ma_dr_wav_metadata_type_list_label) { pID = "labl"; } else if (pMetadata->type == ma_dr_wav_metadata_type_list_note) { pID = "note"; } - MA_DR_WAV_ASSERT(pID != NULL); - MA_DR_WAV_ASSERT(pMetadata->data.labelOrNote.pString != NULL); + MA_DR_WAV_ASSERT(pID != nullptr); + MA_DR_WAV_ASSERT(pMetadata->data.labelOrNote.pString != nullptr); subchunkSize = MA_DR_WAV_LIST_LABEL_OR_NOTE_BYTES; bytesWritten += ma_dr_wav__write_or_count(pWav, pID, 4); subchunkSize += pMetadata->data.labelOrNote.stringLength + 1; @@ -82117,7 +82117,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_metadata(ma_dr_wav* pWav, ma_dr_wav_ bytesWritten += ma_dr_wav__write_or_count_u16ne_to_le(pWav, pMetadata->data.labelledCueRegion.dialect); bytesWritten += ma_dr_wav__write_or_count_u16ne_to_le(pWav, pMetadata->data.labelledCueRegion.codePage); if (pMetadata->data.labelledCueRegion.stringLength > 0) { - MA_DR_WAV_ASSERT(pMetadata->data.labelledCueRegion.pString != NULL); + MA_DR_WAV_ASSERT(pMetadata->data.labelledCueRegion.pString != nullptr); bytesWritten += ma_dr_wav__write_or_count(pWav, pMetadata->data.labelledCueRegion.pString, pMetadata->data.labelledCueRegion.stringLength); bytesWritten += ma_dr_wav__write_or_count_byte(pWav, '\0'); } @@ -82126,7 +82126,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_metadata(ma_dr_wav* pWav, ma_dr_wav_ { if (pMetadata->data.unknown.chunkLocation == ma_dr_wav_metadata_location_inside_adtl_list) { subchunkSize = pMetadata->data.unknown.dataSizeInBytes; - MA_DR_WAV_ASSERT(pMetadata->data.unknown.pData != NULL); + MA_DR_WAV_ASSERT(pMetadata->data.unknown.pData != nullptr); bytesWritten += ma_dr_wav__write_or_count(pWav, pMetadata->data.unknown.id, 4); bytesWritten += ma_dr_wav__write_or_count_u32ne_to_le(pWav, subchunkSize); bytesWritten += ma_dr_wav__write_or_count(pWav, pMetadata->data.unknown.pData, subchunkSize); @@ -82144,7 +82144,7 @@ MA_PRIVATE size_t ma_dr_wav__write_or_count_metadata(ma_dr_wav* pWav, ma_dr_wav_ } MA_PRIVATE ma_uint32 ma_dr_wav__riff_chunk_size_riff(ma_uint64 dataChunkSize, ma_dr_wav_metadata* pMetadata, ma_uint32 metadataCount) { - ma_uint64 chunkSize = 4 + 24 + (ma_uint64)ma_dr_wav__write_or_count_metadata(NULL, pMetadata, metadataCount) + 8 + dataChunkSize + ma_dr_wav__chunk_padding_size_riff(dataChunkSize); + ma_uint64 chunkSize = 4 + 24 + (ma_uint64)ma_dr_wav__write_or_count_metadata(nullptr, pMetadata, metadataCount) + 8 + dataChunkSize + ma_dr_wav__chunk_padding_size_riff(dataChunkSize); if (chunkSize > 0xFFFFFFFFUL) { chunkSize = 0xFFFFFFFFUL; } @@ -82169,7 +82169,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav__data_chunk_size_w64(ma_uint64 dataChunkSize) } MA_PRIVATE ma_uint64 ma_dr_wav__riff_chunk_size_rf64(ma_uint64 dataChunkSize, ma_dr_wav_metadata *metadata, ma_uint32 numMetadata) { - ma_uint64 chunkSize = 4 + 36 + 24 + (ma_uint64)ma_dr_wav__write_or_count_metadata(NULL, metadata, numMetadata) + 8 + dataChunkSize + ma_dr_wav__chunk_padding_size_riff(dataChunkSize); + ma_uint64 chunkSize = 4 + 36 + 24 + (ma_uint64)ma_dr_wav__write_or_count_metadata(nullptr, metadata, numMetadata) + 8 + dataChunkSize + ma_dr_wav__chunk_padding_size_riff(dataChunkSize); if (chunkSize > 0xFFFFFFFFUL) { chunkSize = 0xFFFFFFFFUL; } @@ -82181,10 +82181,10 @@ MA_PRIVATE ma_uint64 ma_dr_wav__data_chunk_size_rf64(ma_uint64 dataChunkSize) } MA_PRIVATE ma_bool32 ma_dr_wav_preinit_write(ma_dr_wav* pWav, const ma_dr_wav_data_format* pFormat, ma_bool32 isSequential, ma_dr_wav_write_proc onWrite, ma_dr_wav_seek_proc onSeek, void* pUserData, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pWav == NULL || onWrite == NULL) { + if (pWav == nullptr || onWrite == nullptr) { return MA_FALSE; } - if (!isSequential && onSeek == NULL) { + if (!isSequential && onSeek == nullptr) { return MA_FALSE; } if (pFormat->format == MA_DR_WAVE_FORMAT_EXTENSIBLE) { @@ -82198,7 +82198,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav_preinit_write(ma_dr_wav* pWav, const ma_dr_wav_da pWav->onSeek = onSeek; pWav->pUserData = pUserData; pWav->allocationCallbacks = ma_dr_wav_copy_allocation_callbacks_or_defaults(pAllocationCallbacks); - if (pWav->allocationCallbacks.onFree == NULL || (pWav->allocationCallbacks.onMalloc == NULL && pWav->allocationCallbacks.onRealloc == NULL)) { + if (pWav->allocationCallbacks.onFree == nullptr || (pWav->allocationCallbacks.onMalloc == nullptr && pWav->allocationCallbacks.onRealloc == nullptr)) { return MA_FALSE; } pWav->fmt.formatTag = (ma_uint16)pFormat->format; @@ -82267,7 +82267,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav_init_write__internal(ma_dr_wav* pWav, const ma_dr runningPos += ma_dr_wav__write_u32ne_to_le(pWav, pWav->fmt.avgBytesPerSec); runningPos += ma_dr_wav__write_u16ne_to_le(pWav, pWav->fmt.blockAlign); runningPos += ma_dr_wav__write_u16ne_to_le(pWav, pWav->fmt.bitsPerSample); - if (!pWav->isSequentialWrite && pWav->pMetadata != NULL && pWav->metadataCount > 0 && (pFormat->container == ma_dr_wav_container_riff || pFormat->container == ma_dr_wav_container_rf64)) { + if (!pWav->isSequentialWrite && pWav->pMetadata != nullptr && pWav->metadataCount > 0 && (pFormat->container == ma_dr_wav_container_riff || pFormat->container == ma_dr_wav_container_rf64)) { runningPos += ma_dr_wav__write_or_count_metadata(pWav, pWav->pMetadata, pWav->metadataCount); } pWav->dataChunkDataPos = runningPos; @@ -82300,14 +82300,14 @@ MA_API ma_bool32 ma_dr_wav_init_write(ma_dr_wav* pWav, const ma_dr_wav_data_form } MA_API ma_bool32 ma_dr_wav_init_write_sequential(ma_dr_wav* pWav, const ma_dr_wav_data_format* pFormat, ma_uint64 totalSampleCount, ma_dr_wav_write_proc onWrite, void* pUserData, const ma_allocation_callbacks* pAllocationCallbacks) { - if (!ma_dr_wav_preinit_write(pWav, pFormat, MA_TRUE, onWrite, NULL, pUserData, pAllocationCallbacks)) { + if (!ma_dr_wav_preinit_write(pWav, pFormat, MA_TRUE, onWrite, nullptr, pUserData, pAllocationCallbacks)) { return MA_FALSE; } return ma_dr_wav_init_write__internal(pWav, pFormat, totalSampleCount); } MA_API ma_bool32 ma_dr_wav_init_write_sequential_pcm_frames(ma_dr_wav* pWav, const ma_dr_wav_data_format* pFormat, ma_uint64 totalPCMFrameCount, ma_dr_wav_write_proc onWrite, void* pUserData, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFormat == NULL) { + if (pFormat == nullptr) { return MA_FALSE; } return ma_dr_wav_init_write_sequential(pWav, pFormat, totalPCMFrameCount*pFormat->channels, onWrite, pUserData, pAllocationCallbacks); @@ -82361,8 +82361,8 @@ MA_PRIVATE ma_bool32 ma_dr_wav__on_tell_stdio(void* pUserData, ma_int64* pCursor { FILE* pFileStdio = (FILE*)pUserData; ma_int64 result; - MA_DR_WAV_ASSERT(pFileStdio != NULL); - MA_DR_WAV_ASSERT(pCursor != NULL); + MA_DR_WAV_ASSERT(pFileStdio != nullptr); + MA_DR_WAV_ASSERT(pCursor != nullptr); #if defined(_WIN32) && !defined(NXDK) #if defined(_MSC_VER) && _MSC_VER > 1200 result = _ftelli64(pFileStdio); @@ -82377,7 +82377,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav__on_tell_stdio(void* pUserData, ma_int64* pCursor } MA_API ma_bool32 ma_dr_wav_init_file(ma_dr_wav* pWav, const char* filename, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_wav_init_file_ex(pWav, filename, NULL, NULL, 0, pAllocationCallbacks); + return ma_dr_wav_init_file_ex(pWav, filename, nullptr, nullptr, 0, pAllocationCallbacks); } MA_PRIVATE ma_bool32 ma_dr_wav_init_file__internal_FILE(ma_dr_wav* pWav, FILE* pFile, ma_dr_wav_chunk_proc onChunk, void* pChunkUserData, ma_uint32 flags, const ma_allocation_callbacks* pAllocationCallbacks) { @@ -82405,7 +82405,7 @@ MA_API ma_bool32 ma_dr_wav_init_file_ex(ma_dr_wav* pWav, const char* filename, m #ifndef MA_DR_WAV_NO_WCHAR MA_API ma_bool32 ma_dr_wav_init_file_w(ma_dr_wav* pWav, const wchar_t* filename, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_wav_init_file_ex_w(pWav, filename, NULL, NULL, 0, pAllocationCallbacks); + return ma_dr_wav_init_file_ex_w(pWav, filename, nullptr, nullptr, 0, pAllocationCallbacks); } MA_API ma_bool32 ma_dr_wav_init_file_ex_w(ma_dr_wav* pWav, const wchar_t* filename, ma_dr_wav_chunk_proc onChunk, void* pChunkUserData, ma_uint32 flags, const ma_allocation_callbacks* pAllocationCallbacks) { @@ -82422,7 +82422,7 @@ MA_API ma_bool32 ma_dr_wav_init_file_with_metadata(ma_dr_wav* pWav, const char* if (ma_fopen(&pFile, filename, "rb") != MA_SUCCESS) { return MA_FALSE; } - return ma_dr_wav_init_file__internal_FILE(pWav, pFile, NULL, NULL, flags | MA_DR_WAV_WITH_METADATA, pAllocationCallbacks); + return ma_dr_wav_init_file__internal_FILE(pWav, pFile, nullptr, nullptr, flags | MA_DR_WAV_WITH_METADATA, pAllocationCallbacks); } #ifndef MA_DR_WAV_NO_WCHAR MA_API ma_bool32 ma_dr_wav_init_file_with_metadata_w(ma_dr_wav* pWav, const wchar_t* filename, ma_uint32 flags, const ma_allocation_callbacks* pAllocationCallbacks) @@ -82431,7 +82431,7 @@ MA_API ma_bool32 ma_dr_wav_init_file_with_metadata_w(ma_dr_wav* pWav, const wcha if (ma_wfopen(&pFile, filename, L"rb", pAllocationCallbacks) != MA_SUCCESS) { return MA_FALSE; } - return ma_dr_wav_init_file__internal_FILE(pWav, pFile, NULL, NULL, flags | MA_DR_WAV_WITH_METADATA, pAllocationCallbacks); + return ma_dr_wav_init_file__internal_FILE(pWav, pFile, nullptr, nullptr, flags | MA_DR_WAV_WITH_METADATA, pAllocationCallbacks); } #endif MA_PRIVATE ma_bool32 ma_dr_wav_init_file_write__internal_FILE(ma_dr_wav* pWav, FILE* pFile, const ma_dr_wav_data_format* pFormat, ma_uint64 totalSampleCount, ma_bool32 isSequential, const ma_allocation_callbacks* pAllocationCallbacks) @@ -82477,7 +82477,7 @@ MA_API ma_bool32 ma_dr_wav_init_file_write_sequential(ma_dr_wav* pWav, const cha } MA_API ma_bool32 ma_dr_wav_init_file_write_sequential_pcm_frames(ma_dr_wav* pWav, const char* filename, const ma_dr_wav_data_format* pFormat, ma_uint64 totalPCMFrameCount, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFormat == NULL) { + if (pFormat == nullptr) { return MA_FALSE; } return ma_dr_wav_init_file_write_sequential(pWav, filename, pFormat, totalPCMFrameCount*pFormat->channels, pAllocationCallbacks); @@ -82493,7 +82493,7 @@ MA_API ma_bool32 ma_dr_wav_init_file_write_sequential_w(ma_dr_wav* pWav, const w } MA_API ma_bool32 ma_dr_wav_init_file_write_sequential_pcm_frames_w(ma_dr_wav* pWav, const wchar_t* filename, const ma_dr_wav_data_format* pFormat, ma_uint64 totalPCMFrameCount, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFormat == NULL) { + if (pFormat == nullptr) { return MA_FALSE; } return ma_dr_wav_init_file_write_sequential_w(pWav, filename, pFormat, totalPCMFrameCount*pFormat->channels, pAllocationCallbacks); @@ -82504,7 +82504,7 @@ MA_PRIVATE size_t ma_dr_wav__on_read_memory(void* pUserData, void* pBufferOut, s { ma_dr_wav* pWav = (ma_dr_wav*)pUserData; size_t bytesRemaining; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); MA_DR_WAV_ASSERT(pWav->memoryStream.dataSize >= pWav->memoryStream.currentReadPos); bytesRemaining = pWav->memoryStream.dataSize - pWav->memoryStream.currentReadPos; if (bytesToRead > bytesRemaining) { @@ -82520,7 +82520,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav__on_seek_memory(void* pUserData, int offset, ma_d { ma_dr_wav* pWav = (ma_dr_wav*)pUserData; ma_int64 newCursor; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); if (origin == MA_DR_WAV_SEEK_SET) { newCursor = 0; } else if (origin == MA_DR_WAV_SEEK_CUR) { @@ -82545,7 +82545,7 @@ MA_PRIVATE size_t ma_dr_wav__on_write_memory(void* pUserData, const void* pDataI { ma_dr_wav* pWav = (ma_dr_wav*)pUserData; size_t bytesRemaining; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); MA_DR_WAV_ASSERT(pWav->memoryStreamWrite.dataCapacity >= pWav->memoryStreamWrite.currentWritePos); bytesRemaining = pWav->memoryStreamWrite.dataCapacity - pWav->memoryStreamWrite.currentWritePos; if (bytesRemaining < bytesToWrite) { @@ -82555,7 +82555,7 @@ MA_PRIVATE size_t ma_dr_wav__on_write_memory(void* pUserData, const void* pDataI newDataCapacity = pWav->memoryStreamWrite.currentWritePos + bytesToWrite; } pNewData = ma_dr_wav__realloc_from_callbacks(*pWav->memoryStreamWrite.ppData, newDataCapacity, pWav->memoryStreamWrite.dataCapacity, &pWav->allocationCallbacks); - if (pNewData == NULL) { + if (pNewData == nullptr) { return 0; } *pWav->memoryStreamWrite.ppData = pNewData; @@ -82573,7 +82573,7 @@ MA_PRIVATE ma_bool32 ma_dr_wav__on_seek_memory_write(void* pUserData, int offset { ma_dr_wav* pWav = (ma_dr_wav*)pUserData; ma_int64 newCursor; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); if (origin == MA_DR_WAV_SEEK_SET) { newCursor = 0; } else if (origin == MA_DR_WAV_SEEK_CUR) { @@ -82597,18 +82597,18 @@ MA_PRIVATE ma_bool32 ma_dr_wav__on_seek_memory_write(void* pUserData, int offset MA_PRIVATE ma_bool32 ma_dr_wav__on_tell_memory(void* pUserData, ma_int64* pCursor) { ma_dr_wav* pWav = (ma_dr_wav*)pUserData; - MA_DR_WAV_ASSERT(pWav != NULL); - MA_DR_WAV_ASSERT(pCursor != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); + MA_DR_WAV_ASSERT(pCursor != nullptr); *pCursor = (ma_int64)pWav->memoryStream.currentReadPos; return MA_TRUE; } MA_API ma_bool32 ma_dr_wav_init_memory(ma_dr_wav* pWav, const void* data, size_t dataSize, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_wav_init_memory_ex(pWav, data, dataSize, NULL, NULL, 0, pAllocationCallbacks); + return ma_dr_wav_init_memory_ex(pWav, data, dataSize, nullptr, nullptr, 0, pAllocationCallbacks); } MA_API ma_bool32 ma_dr_wav_init_memory_ex(ma_dr_wav* pWav, const void* data, size_t dataSize, ma_dr_wav_chunk_proc onChunk, void* pChunkUserData, ma_uint32 flags, const ma_allocation_callbacks* pAllocationCallbacks) { - if (data == NULL || dataSize == 0) { + if (data == nullptr || dataSize == 0) { return MA_FALSE; } if (!ma_dr_wav_preinit(pWav, ma_dr_wav__on_read_memory, ma_dr_wav__on_seek_memory, ma_dr_wav__on_tell_memory, pWav, pAllocationCallbacks)) { @@ -82621,7 +82621,7 @@ MA_API ma_bool32 ma_dr_wav_init_memory_ex(ma_dr_wav* pWav, const void* data, siz } MA_API ma_bool32 ma_dr_wav_init_memory_with_metadata(ma_dr_wav* pWav, const void* data, size_t dataSize, ma_uint32 flags, const ma_allocation_callbacks* pAllocationCallbacks) { - if (data == NULL || dataSize == 0) { + if (data == nullptr || dataSize == 0) { return MA_FALSE; } if (!ma_dr_wav_preinit(pWav, ma_dr_wav__on_read_memory, ma_dr_wav__on_seek_memory, ma_dr_wav__on_tell_memory, pWav, pAllocationCallbacks)) { @@ -82630,14 +82630,14 @@ MA_API ma_bool32 ma_dr_wav_init_memory_with_metadata(ma_dr_wav* pWav, const void pWav->memoryStream.data = (const ma_uint8*)data; pWav->memoryStream.dataSize = dataSize; pWav->memoryStream.currentReadPos = 0; - return ma_dr_wav_init__internal(pWav, NULL, NULL, flags | MA_DR_WAV_WITH_METADATA); + return ma_dr_wav_init__internal(pWav, nullptr, nullptr, flags | MA_DR_WAV_WITH_METADATA); } MA_PRIVATE ma_bool32 ma_dr_wav_init_memory_write__internal(ma_dr_wav* pWav, void** ppData, size_t* pDataSize, const ma_dr_wav_data_format* pFormat, ma_uint64 totalSampleCount, ma_bool32 isSequential, const ma_allocation_callbacks* pAllocationCallbacks) { - if (ppData == NULL || pDataSize == NULL) { + if (ppData == nullptr || pDataSize == nullptr) { return MA_FALSE; } - *ppData = NULL; + *ppData = nullptr; *pDataSize = 0; if (!ma_dr_wav_preinit_write(pWav, pFormat, isSequential, ma_dr_wav__on_write_memory, ma_dr_wav__on_seek_memory_write, pWav, pAllocationCallbacks)) { return MA_FALSE; @@ -82659,7 +82659,7 @@ MA_API ma_bool32 ma_dr_wav_init_memory_write_sequential(ma_dr_wav* pWav, void** } MA_API ma_bool32 ma_dr_wav_init_memory_write_sequential_pcm_frames(ma_dr_wav* pWav, void** ppData, size_t* pDataSize, const ma_dr_wav_data_format* pFormat, ma_uint64 totalPCMFrameCount, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pFormat == NULL) { + if (pFormat == nullptr) { return MA_FALSE; } return ma_dr_wav_init_memory_write_sequential(pWav, ppData, pDataSize, pFormat, totalPCMFrameCount*pFormat->channels, pAllocationCallbacks); @@ -82667,10 +82667,10 @@ MA_API ma_bool32 ma_dr_wav_init_memory_write_sequential_pcm_frames(ma_dr_wav* pW MA_API ma_result ma_dr_wav_uninit(ma_dr_wav* pWav) { ma_result result = MA_SUCCESS; - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_ARGS; } - if (pWav->onWrite != NULL) { + if (pWav->onWrite != nullptr) { ma_uint32 paddingSize = 0; if (pWav->container == ma_dr_wav_container_riff || pWav->container == ma_dr_wav_container_rf64) { paddingSize = ma_dr_wav__chunk_padding_size_riff(pWav->dataChunkDataSize); @@ -82731,7 +82731,7 @@ MA_API size_t ma_dr_wav_read_raw(ma_dr_wav* pWav, size_t bytesToRead, void* pBuf { size_t bytesRead; ma_uint32 bytesPerFrame; - if (pWav == NULL || bytesToRead == 0) { + if (pWav == nullptr || bytesToRead == 0) { return 0; } if (bytesToRead > pWav->bytesRemaining) { @@ -82744,7 +82744,7 @@ MA_API size_t ma_dr_wav_read_raw(ma_dr_wav* pWav, size_t bytesToRead, void* pBuf if (bytesPerFrame == 0) { return 0; } - if (pBufferOut != NULL) { + if (pBufferOut != nullptr) { bytesRead = pWav->onRead(pWav->pUserData, pBufferOut, bytesToRead); } else { bytesRead = 0; @@ -82781,7 +82781,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_le(ma_dr_wav* pWav, ma_uint64 framesT ma_uint32 bytesPerFrame; ma_uint64 bytesToRead; ma_uint64 framesRemainingInFile; - if (pWav == NULL || framesToRead == 0) { + if (pWav == nullptr || framesToRead == 0) { return 0; } if (ma_dr_wav__is_compressed_format_tag(pWav->translatedFormatTag)) { @@ -82807,7 +82807,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_le(ma_dr_wav* pWav, ma_uint64 framesT MA_API ma_uint64 ma_dr_wav_read_pcm_frames_be(ma_dr_wav* pWav, ma_uint64 framesToRead, void* pBufferOut) { ma_uint64 framesRead = ma_dr_wav_read_pcm_frames_le(pWav, framesToRead, pBufferOut); - if (pBufferOut != NULL) { + if (pBufferOut != nullptr) { ma_uint32 bytesPerFrame = ma_dr_wav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { return 0; @@ -82837,7 +82837,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames(ma_dr_wav* pWav, ma_uint64 framesToRe post_process: { if (pWav->container == ma_dr_wav_container_aiff && pWav->bitsPerSample == 8 && pWav->aiff.isUnsigned == MA_FALSE) { - if (pBufferOut != NULL) { + if (pBufferOut != nullptr) { ma_uint64 iSample; for (iSample = 0; iSample < framesRead * pWav->channels; iSample += 1) { ((ma_uint8*)pBufferOut)[iSample] += 128; @@ -82849,7 +82849,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames(ma_dr_wav* pWav, ma_uint64 framesToRe } MA_PRIVATE ma_bool32 ma_dr_wav_seek_to_first_pcm_frame(ma_dr_wav* pWav) { - if (pWav->onWrite != NULL) { + if (pWav->onWrite != nullptr) { return MA_FALSE; } if (!pWav->onSeek(pWav->pUserData, (int)pWav->dataChunkDataPos, MA_DR_WAV_SEEK_SET)) { @@ -82870,10 +82870,10 @@ MA_PRIVATE ma_bool32 ma_dr_wav_seek_to_first_pcm_frame(ma_dr_wav* pWav) } MA_API ma_bool32 ma_dr_wav_seek_to_pcm_frame(ma_dr_wav* pWav, ma_uint64 targetFrameIndex) { - if (pWav == NULL || pWav->onSeek == NULL) { + if (pWav == nullptr || pWav->onSeek == nullptr) { return MA_FALSE; } - if (pWav->onWrite != NULL) { + if (pWav->onWrite != nullptr) { return MA_FALSE; } if (pWav->totalPCMFrameCount == 0) { @@ -82945,11 +82945,11 @@ MA_API ma_bool32 ma_dr_wav_seek_to_pcm_frame(ma_dr_wav* pWav, ma_uint64 targetFr } MA_API ma_result ma_dr_wav_get_cursor_in_pcm_frames(ma_dr_wav* pWav, ma_uint64* pCursor) { - if (pCursor == NULL) { + if (pCursor == nullptr) { return MA_INVALID_ARGS; } *pCursor = 0; - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_ARGS; } *pCursor = pWav->readCursorInPCMFrames; @@ -82957,11 +82957,11 @@ MA_API ma_result ma_dr_wav_get_cursor_in_pcm_frames(ma_dr_wav* pWav, ma_uint64* } MA_API ma_result ma_dr_wav_get_length_in_pcm_frames(ma_dr_wav* pWav, ma_uint64* pLength) { - if (pLength == NULL) { + if (pLength == nullptr) { return MA_INVALID_ARGS; } *pLength = 0; - if (pWav == NULL) { + if (pWav == nullptr) { return MA_INVALID_ARGS; } *pLength = pWav->totalPCMFrameCount; @@ -82970,7 +82970,7 @@ MA_API ma_result ma_dr_wav_get_length_in_pcm_frames(ma_dr_wav* pWav, ma_uint64* MA_API size_t ma_dr_wav_write_raw(ma_dr_wav* pWav, size_t bytesToWrite, const void* pData) { size_t bytesWritten; - if (pWav == NULL || bytesToWrite == 0 || pData == NULL) { + if (pWav == nullptr || bytesToWrite == 0 || pData == nullptr) { return 0; } bytesWritten = pWav->onWrite(pWav->pUserData, pData, bytesToWrite); @@ -82982,7 +82982,7 @@ MA_API ma_uint64 ma_dr_wav_write_pcm_frames_le(ma_dr_wav* pWav, ma_uint64 frames ma_uint64 bytesToWrite; ma_uint64 bytesWritten; const ma_uint8* pRunningData; - if (pWav == NULL || framesToWrite == 0 || pData == NULL) { + if (pWav == nullptr || framesToWrite == 0 || pData == nullptr) { return 0; } bytesToWrite = ((framesToWrite * pWav->channels * pWav->bitsPerSample) / 8); @@ -83012,7 +83012,7 @@ MA_API ma_uint64 ma_dr_wav_write_pcm_frames_be(ma_dr_wav* pWav, ma_uint64 frames ma_uint64 bytesWritten; ma_uint32 bytesPerSample; const ma_uint8* pRunningData; - if (pWav == NULL || framesToWrite == 0 || pData == NULL) { + if (pWav == nullptr || framesToWrite == 0 || pData == nullptr) { return 0; } bytesToWrite = ((framesToWrite * pWav->channels * pWav->bitsPerSample) / 8); @@ -83065,7 +83065,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__msadpcm(ma_dr_wav* pWav, ma_ }; static const ma_int32 coeff1Table[] = { 256, 512, 0, 192, 240, 460, 392 }; static const ma_int32 coeff2Table[] = { 0, -256, 0, 64, 0, -208, -232 }; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); MA_DR_WAV_ASSERT(framesToRead > 0); while (pWav->readCursorInPCMFrames < pWav->totalPCMFrameCount) { MA_DR_WAV_ASSERT(framesToRead > 0); @@ -83112,7 +83112,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__msadpcm(ma_dr_wav* pWav, ma_ } } while (framesToRead > 0 && pWav->msadpcm.cachedFrameCount > 0 && pWav->readCursorInPCMFrames < pWav->totalPCMFrameCount) { - if (pBufferOut != NULL) { + if (pBufferOut != nullptr) { ma_uint32 iSample = 0; for (iSample = 0; iSample < pWav->channels; iSample += 1) { pBufferOut[iSample] = (ma_int16)pWav->msadpcm.cachedFrames[(ma_dr_wav_countof(pWav->msadpcm.cachedFrames) - (pWav->msadpcm.cachedFrameCount*pWav->channels)) + iSample]; @@ -83222,7 +83222,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__ima(ma_dr_wav* pWav, ma_uint 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); MA_DR_WAV_ASSERT(framesToRead > 0); while (pWav->readCursorInPCMFrames < pWav->totalPCMFrameCount) { MA_DR_WAV_ASSERT(framesToRead > 0); @@ -83263,7 +83263,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__ima(ma_dr_wav* pWav, ma_uint } } while (framesToRead > 0 && pWav->ima.cachedFrameCount > 0 && pWav->readCursorInPCMFrames < pWav->totalPCMFrameCount) { - if (pBufferOut != NULL) { + if (pBufferOut != nullptr) { ma_uint32 iSample; for (iSample = 0; iSample < pWav->channels; iSample += 1) { pBufferOut[iSample] = (ma_int16)pWav->ima.cachedFrames[(ma_dr_wav_countof(pWav->ima.cachedFrames) - (pWav->ima.cachedFrameCount*pWav->channels)) + iSample]; @@ -83426,7 +83426,7 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__pcm(ma_dr_wav* pWav, ma_uint ma_uint32 bytesPerFrame; ma_uint32 bytesPerSample; ma_uint64 samplesRead; - if ((pWav->translatedFormatTag == MA_DR_WAVE_FORMAT_PCM && pWav->bitsPerSample == 16) || pBufferOut == NULL) { + if ((pWav->translatedFormatTag == MA_DR_WAVE_FORMAT_PCM && pWav->bitsPerSample == 16) || pBufferOut == nullptr) { return ma_dr_wav_read_pcm_frames(pWav, framesToRead, pBufferOut); } bytesPerFrame = ma_dr_wav_get_bytes_per_pcm_frame(pWav); @@ -83464,8 +83464,8 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__ieee(ma_dr_wav* pWav, ma_uin ma_uint32 bytesPerFrame; ma_uint32 bytesPerSample; ma_uint64 samplesRead; - if (pBufferOut == NULL) { - return ma_dr_wav_read_pcm_frames(pWav, framesToRead, NULL); + if (pBufferOut == nullptr) { + return ma_dr_wav_read_pcm_frames(pWav, framesToRead, nullptr); } bytesPerFrame = ma_dr_wav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { @@ -83502,8 +83502,8 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__alaw(ma_dr_wav* pWav, ma_uin ma_uint32 bytesPerFrame; ma_uint32 bytesPerSample; ma_uint64 samplesRead; - if (pBufferOut == NULL) { - return ma_dr_wav_read_pcm_frames(pWav, framesToRead, NULL); + if (pBufferOut == nullptr) { + return ma_dr_wav_read_pcm_frames(pWav, framesToRead, nullptr); } bytesPerFrame = ma_dr_wav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { @@ -83550,8 +83550,8 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__mulaw(ma_dr_wav* pWav, ma_ui ma_uint32 bytesPerFrame; ma_uint32 bytesPerSample; ma_uint64 samplesRead; - if (pBufferOut == NULL) { - return ma_dr_wav_read_pcm_frames(pWav, framesToRead, NULL); + if (pBufferOut == nullptr) { + return ma_dr_wav_read_pcm_frames(pWav, framesToRead, nullptr); } bytesPerFrame = ma_dr_wav_get_bytes_per_pcm_frame(pWav); if (bytesPerFrame == 0) { @@ -83593,11 +83593,11 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s16__mulaw(ma_dr_wav* pWav, ma_ui } MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s16(ma_dr_wav* pWav, ma_uint64 framesToRead, ma_int16* pBufferOut) { - if (pWav == NULL || framesToRead == 0) { + if (pWav == nullptr || framesToRead == 0) { return 0; } - if (pBufferOut == NULL) { - return ma_dr_wav_read_pcm_frames(pWav, framesToRead, NULL); + if (pBufferOut == nullptr) { + return ma_dr_wav_read_pcm_frames(pWav, framesToRead, nullptr); } if (framesToRead * pWav->channels * sizeof(ma_int16) > MA_SIZE_MAX) { framesToRead = MA_SIZE_MAX / sizeof(ma_int16) / pWav->channels; @@ -83625,7 +83625,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s16(ma_dr_wav* pWav, ma_uint64 frames MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s16le(ma_dr_wav* pWav, ma_uint64 framesToRead, ma_int16* pBufferOut) { ma_uint64 framesRead = ma_dr_wav_read_pcm_frames_s16(pWav, framesToRead, pBufferOut); - if (pBufferOut != NULL && ma_dr_wav__is_little_endian() == MA_FALSE) { + if (pBufferOut != nullptr && ma_dr_wav__is_little_endian() == MA_FALSE) { ma_dr_wav__bswap_samples_s16(pBufferOut, framesRead*pWav->channels); } return framesRead; @@ -83633,7 +83633,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s16le(ma_dr_wav* pWav, ma_uint64 fram MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s16be(ma_dr_wav* pWav, ma_uint64 framesToRead, ma_int16* pBufferOut) { ma_uint64 framesRead = ma_dr_wav_read_pcm_frames_s16(pWav, framesToRead, pBufferOut); - if (pBufferOut != NULL && ma_dr_wav__is_little_endian() == MA_TRUE) { + if (pBufferOut != nullptr && ma_dr_wav__is_little_endian() == MA_TRUE) { ma_dr_wav__bswap_samples_s16(pBufferOut, framesRead*pWav->channels); } return framesRead; @@ -83947,11 +83947,11 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_f32__mulaw(ma_dr_wav* pWav, ma_ui } MA_API ma_uint64 ma_dr_wav_read_pcm_frames_f32(ma_dr_wav* pWav, ma_uint64 framesToRead, float* pBufferOut) { - if (pWav == NULL || framesToRead == 0) { + if (pWav == nullptr || framesToRead == 0) { return 0; } - if (pBufferOut == NULL) { - return ma_dr_wav_read_pcm_frames(pWav, framesToRead, NULL); + if (pBufferOut == nullptr) { + return ma_dr_wav_read_pcm_frames(pWav, framesToRead, nullptr); } if (framesToRead * pWav->channels * sizeof(float) > MA_SIZE_MAX) { framesToRead = MA_SIZE_MAX / sizeof(float) / pWav->channels; @@ -83976,7 +83976,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_f32(ma_dr_wav* pWav, ma_uint64 frames MA_API ma_uint64 ma_dr_wav_read_pcm_frames_f32le(ma_dr_wav* pWav, ma_uint64 framesToRead, float* pBufferOut) { ma_uint64 framesRead = ma_dr_wav_read_pcm_frames_f32(pWav, framesToRead, pBufferOut); - if (pBufferOut != NULL && ma_dr_wav__is_little_endian() == MA_FALSE) { + if (pBufferOut != nullptr && ma_dr_wav__is_little_endian() == MA_FALSE) { ma_dr_wav__bswap_samples_f32(pBufferOut, framesRead*pWav->channels); } return framesRead; @@ -83984,7 +83984,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_f32le(ma_dr_wav* pWav, ma_uint64 fram MA_API ma_uint64 ma_dr_wav_read_pcm_frames_f32be(ma_dr_wav* pWav, ma_uint64 framesToRead, float* pBufferOut) { ma_uint64 framesRead = ma_dr_wav_read_pcm_frames_f32(pWav, framesToRead, pBufferOut); - if (pBufferOut != NULL && ma_dr_wav__is_little_endian() == MA_TRUE) { + if (pBufferOut != nullptr && ma_dr_wav__is_little_endian() == MA_TRUE) { ma_dr_wav__bswap_samples_f32(pBufferOut, framesRead*pWav->channels); } return framesRead; @@ -83992,7 +83992,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_f32be(ma_dr_wav* pWav, ma_uint64 fram MA_API void ma_dr_wav_u8_to_f32(float* pOut, const ma_uint8* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } #ifdef MA_DR_WAV_LIBSNDFILE_COMPAT @@ -84011,7 +84011,7 @@ MA_API void ma_dr_wav_u8_to_f32(float* pOut, const ma_uint8* pIn, size_t sampleC MA_API void ma_dr_wav_s16_to_f32(float* pOut, const ma_int16* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84021,7 +84021,7 @@ MA_API void ma_dr_wav_s16_to_f32(float* pOut, const ma_int16* pIn, size_t sample MA_API void ma_dr_wav_s24_to_f32(float* pOut, const ma_uint8* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84036,7 +84036,7 @@ MA_API void ma_dr_wav_s24_to_f32(float* pOut, const ma_uint8* pIn, size_t sample MA_API void ma_dr_wav_s32_to_f32(float* pOut, const ma_int32* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84046,7 +84046,7 @@ MA_API void ma_dr_wav_s32_to_f32(float* pOut, const ma_int32* pIn, size_t sample MA_API void ma_dr_wav_f64_to_f32(float* pOut, const double* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84056,7 +84056,7 @@ MA_API void ma_dr_wav_f64_to_f32(float* pOut, const double* pIn, size_t sampleCo MA_API void ma_dr_wav_alaw_to_f32(float* pOut, const ma_uint8* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84066,7 +84066,7 @@ MA_API void ma_dr_wav_alaw_to_f32(float* pOut, const ma_uint8* pIn, size_t sampl MA_API void ma_dr_wav_mulaw_to_f32(float* pOut, const ma_uint8* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84307,11 +84307,11 @@ MA_PRIVATE ma_uint64 ma_dr_wav_read_pcm_frames_s32__mulaw(ma_dr_wav* pWav, ma_ui } MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s32(ma_dr_wav* pWav, ma_uint64 framesToRead, ma_int32* pBufferOut) { - if (pWav == NULL || framesToRead == 0) { + if (pWav == nullptr || framesToRead == 0) { return 0; } - if (pBufferOut == NULL) { - return ma_dr_wav_read_pcm_frames(pWav, framesToRead, NULL); + if (pBufferOut == nullptr) { + return ma_dr_wav_read_pcm_frames(pWav, framesToRead, nullptr); } if (framesToRead * pWav->channels * sizeof(ma_int32) > MA_SIZE_MAX) { framesToRead = MA_SIZE_MAX / sizeof(ma_int32) / pWav->channels; @@ -84336,7 +84336,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s32(ma_dr_wav* pWav, ma_uint64 frames MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s32le(ma_dr_wav* pWav, ma_uint64 framesToRead, ma_int32* pBufferOut) { ma_uint64 framesRead = ma_dr_wav_read_pcm_frames_s32(pWav, framesToRead, pBufferOut); - if (pBufferOut != NULL && ma_dr_wav__is_little_endian() == MA_FALSE) { + if (pBufferOut != nullptr && ma_dr_wav__is_little_endian() == MA_FALSE) { ma_dr_wav__bswap_samples_s32(pBufferOut, framesRead*pWav->channels); } return framesRead; @@ -84344,7 +84344,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s32le(ma_dr_wav* pWav, ma_uint64 fram MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s32be(ma_dr_wav* pWav, ma_uint64 framesToRead, ma_int32* pBufferOut) { ma_uint64 framesRead = ma_dr_wav_read_pcm_frames_s32(pWav, framesToRead, pBufferOut); - if (pBufferOut != NULL && ma_dr_wav__is_little_endian() == MA_TRUE) { + if (pBufferOut != nullptr && ma_dr_wav__is_little_endian() == MA_TRUE) { ma_dr_wav__bswap_samples_s32(pBufferOut, framesRead*pWav->channels); } return framesRead; @@ -84352,7 +84352,7 @@ MA_API ma_uint64 ma_dr_wav_read_pcm_frames_s32be(ma_dr_wav* pWav, ma_uint64 fram MA_API void ma_dr_wav_u8_to_s32(ma_int32* pOut, const ma_uint8* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84362,7 +84362,7 @@ MA_API void ma_dr_wav_u8_to_s32(ma_int32* pOut, const ma_uint8* pIn, size_t samp MA_API void ma_dr_wav_s16_to_s32(ma_int32* pOut, const ma_int16* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84372,7 +84372,7 @@ MA_API void ma_dr_wav_s16_to_s32(ma_int32* pOut, const ma_int16* pIn, size_t sam MA_API void ma_dr_wav_s24_to_s32(ma_int32* pOut, const ma_uint8* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84386,7 +84386,7 @@ MA_API void ma_dr_wav_s24_to_s32(ma_int32* pOut, const ma_uint8* pIn, size_t sam MA_API void ma_dr_wav_f32_to_s32(ma_int32* pOut, const float* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84396,7 +84396,7 @@ MA_API void ma_dr_wav_f32_to_s32(ma_int32* pOut, const float* pIn, size_t sample MA_API void ma_dr_wav_f64_to_s32(ma_int32* pOut, const double* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84406,7 +84406,7 @@ MA_API void ma_dr_wav_f64_to_s32(ma_int32* pOut, const double* pIn, size_t sampl MA_API void ma_dr_wav_alaw_to_s32(ma_int32* pOut, const ma_uint8* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i = 0; i < sampleCount; ++i) { @@ -84416,7 +84416,7 @@ MA_API void ma_dr_wav_alaw_to_s32(ma_int32* pOut, const ma_uint8* pIn, size_t sa MA_API void ma_dr_wav_mulaw_to_s32(ma_int32* pOut, const ma_uint8* pIn, size_t sampleCount) { size_t i; - if (pOut == NULL || pIn == NULL) { + if (pOut == nullptr || pIn == nullptr) { return; } for (i= 0; i < sampleCount; ++i) { @@ -84428,26 +84428,26 @@ MA_PRIVATE ma_int16* ma_dr_wav__read_pcm_frames_and_close_s16(ma_dr_wav* pWav, u ma_uint64 sampleDataSize; ma_int16* pSampleData; ma_uint64 framesRead; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); if (pWav->channels == 0 || pWav->totalPCMFrameCount > MA_SIZE_MAX / pWav->channels / sizeof(ma_int16)) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } sampleDataSize = pWav->totalPCMFrameCount * pWav->channels * sizeof(ma_int16); if (sampleDataSize > MA_SIZE_MAX) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } pSampleData = (ma_int16*)ma_dr_wav__malloc_from_callbacks((size_t)sampleDataSize, &pWav->allocationCallbacks); - if (pSampleData == NULL) { + if (pSampleData == nullptr) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } framesRead = ma_dr_wav_read_pcm_frames_s16(pWav, (size_t)pWav->totalPCMFrameCount, pSampleData); if (framesRead != pWav->totalPCMFrameCount) { ma_dr_wav__free_from_callbacks(pSampleData, &pWav->allocationCallbacks); ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } ma_dr_wav_uninit(pWav); if (sampleRate) { @@ -84466,26 +84466,26 @@ MA_PRIVATE float* ma_dr_wav__read_pcm_frames_and_close_f32(ma_dr_wav* pWav, unsi ma_uint64 sampleDataSize; float* pSampleData; ma_uint64 framesRead; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); if (pWav->channels == 0 || pWav->totalPCMFrameCount > MA_SIZE_MAX / pWav->channels / sizeof(float)) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } sampleDataSize = pWav->totalPCMFrameCount * pWav->channels * sizeof(float); if (sampleDataSize > MA_SIZE_MAX) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } pSampleData = (float*)ma_dr_wav__malloc_from_callbacks((size_t)sampleDataSize, &pWav->allocationCallbacks); - if (pSampleData == NULL) { + if (pSampleData == nullptr) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } framesRead = ma_dr_wav_read_pcm_frames_f32(pWav, (size_t)pWav->totalPCMFrameCount, pSampleData); if (framesRead != pWav->totalPCMFrameCount) { ma_dr_wav__free_from_callbacks(pSampleData, &pWav->allocationCallbacks); ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } ma_dr_wav_uninit(pWav); if (sampleRate) { @@ -84504,26 +84504,26 @@ MA_PRIVATE ma_int32* ma_dr_wav__read_pcm_frames_and_close_s32(ma_dr_wav* pWav, u ma_uint64 sampleDataSize; ma_int32* pSampleData; ma_uint64 framesRead; - MA_DR_WAV_ASSERT(pWav != NULL); + MA_DR_WAV_ASSERT(pWav != nullptr); if (pWav->channels == 0 || pWav->totalPCMFrameCount > MA_SIZE_MAX / pWav->channels / sizeof(ma_int32)) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } sampleDataSize = pWav->totalPCMFrameCount * pWav->channels * sizeof(ma_int32); if (sampleDataSize > MA_SIZE_MAX) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } pSampleData = (ma_int32*)ma_dr_wav__malloc_from_callbacks((size_t)sampleDataSize, &pWav->allocationCallbacks); - if (pSampleData == NULL) { + if (pSampleData == nullptr) { ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } framesRead = ma_dr_wav_read_pcm_frames_s32(pWav, (size_t)pWav->totalPCMFrameCount, pSampleData); if (framesRead != pWav->totalPCMFrameCount) { ma_dr_wav__free_from_callbacks(pSampleData, &pWav->allocationCallbacks); ma_dr_wav_uninit(pWav); - return NULL; + return nullptr; } ma_dr_wav_uninit(pWav); if (sampleRate) { @@ -84550,7 +84550,7 @@ MA_API ma_int16* ma_dr_wav_open_and_read_pcm_frames_s16(ma_dr_wav_read_proc onRe *totalFrameCountOut = 0; } if (!ma_dr_wav_init(&wav, onRead, onSeek, onTell, pUserData, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_s16(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84567,7 +84567,7 @@ MA_API float* ma_dr_wav_open_and_read_pcm_frames_f32(ma_dr_wav_read_proc onRead, *totalFrameCountOut = 0; } if (!ma_dr_wav_init(&wav, onRead, onSeek, onTell, pUserData, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_f32(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84584,7 +84584,7 @@ MA_API ma_int32* ma_dr_wav_open_and_read_pcm_frames_s32(ma_dr_wav_read_proc onRe *totalFrameCountOut = 0; } if (!ma_dr_wav_init(&wav, onRead, onSeek, onTell, pUserData, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_s32(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84602,7 +84602,7 @@ MA_API ma_int16* ma_dr_wav_open_file_and_read_pcm_frames_s16(const char* filenam *totalFrameCountOut = 0; } if (!ma_dr_wav_init_file(&wav, filename, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_s16(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84619,7 +84619,7 @@ MA_API float* ma_dr_wav_open_file_and_read_pcm_frames_f32(const char* filename, *totalFrameCountOut = 0; } if (!ma_dr_wav_init_file(&wav, filename, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_f32(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84636,7 +84636,7 @@ MA_API ma_int32* ma_dr_wav_open_file_and_read_pcm_frames_s32(const char* filenam *totalFrameCountOut = 0; } if (!ma_dr_wav_init_file(&wav, filename, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_s32(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84654,7 +84654,7 @@ MA_API ma_int16* ma_dr_wav_open_file_and_read_pcm_frames_s16_w(const wchar_t* fi *totalFrameCountOut = 0; } if (!ma_dr_wav_init_file_w(&wav, filename, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_s16(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84671,7 +84671,7 @@ MA_API float* ma_dr_wav_open_file_and_read_pcm_frames_f32_w(const wchar_t* filen *totalFrameCountOut = 0; } if (!ma_dr_wav_init_file_w(&wav, filename, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_f32(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84688,7 +84688,7 @@ MA_API ma_int32* ma_dr_wav_open_file_and_read_pcm_frames_s32_w(const wchar_t* fi *totalFrameCountOut = 0; } if (!ma_dr_wav_init_file_w(&wav, filename, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_s32(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84707,7 +84707,7 @@ MA_API ma_int16* ma_dr_wav_open_memory_and_read_pcm_frames_s16(const void* data, *totalFrameCountOut = 0; } if (!ma_dr_wav_init_memory(&wav, data, dataSize, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_s16(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84724,7 +84724,7 @@ MA_API float* ma_dr_wav_open_memory_and_read_pcm_frames_f32(const void* data, si *totalFrameCountOut = 0; } if (!ma_dr_wav_init_memory(&wav, data, dataSize, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_f32(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } @@ -84741,17 +84741,17 @@ MA_API ma_int32* ma_dr_wav_open_memory_and_read_pcm_frames_s32(const void* data, *totalFrameCountOut = 0; } if (!ma_dr_wav_init_memory(&wav, data, dataSize, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_wav__read_pcm_frames_and_close_s32(&wav, channelsOut, sampleRateOut, totalFrameCountOut); } #endif MA_API void ma_dr_wav_free(void* p, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks != NULL) { + if (pAllocationCallbacks != nullptr) { ma_dr_wav__free_from_callbacks(p, pAllocationCallbacks); } else { - ma_dr_wav__free_default(p, NULL); + ma_dr_wav__free_default(p, nullptr); } } MA_API ma_uint16 ma_dr_wav_bytes_to_u16(const ma_uint8* data) @@ -85597,8 +85597,8 @@ static void ma_dr_flac__reset_cache(ma_dr_flac_bs* bs) } static MA_INLINE ma_bool32 ma_dr_flac__read_uint32(ma_dr_flac_bs* bs, unsigned int bitCount, ma_uint32* pResultOut) { - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pResultOut != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pResultOut != nullptr); MA_DR_FLAC_ASSERT(bitCount > 0); MA_DR_FLAC_ASSERT(bitCount <= 32); if (bs->consumedBits == MA_DR_FLAC_CACHE_L1_SIZE_BITS(bs)) { @@ -85645,8 +85645,8 @@ static MA_INLINE ma_bool32 ma_dr_flac__read_uint32(ma_dr_flac_bs* bs, unsigned i static ma_bool32 ma_dr_flac__read_int32(ma_dr_flac_bs* bs, unsigned int bitCount, ma_int32* pResult) { ma_uint32 result; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pResult != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pResult != nullptr); MA_DR_FLAC_ASSERT(bitCount > 0); MA_DR_FLAC_ASSERT(bitCount <= 32); if (!ma_dr_flac__read_uint32(bs, bitCount, &result)) { @@ -85695,8 +85695,8 @@ static ma_bool32 ma_dr_flac__read_int64(ma_dr_flac_bs* bs, unsigned int bitCount static ma_bool32 ma_dr_flac__read_uint16(ma_dr_flac_bs* bs, unsigned int bitCount, ma_uint16* pResult) { ma_uint32 result; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pResult != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pResult != nullptr); MA_DR_FLAC_ASSERT(bitCount > 0); MA_DR_FLAC_ASSERT(bitCount <= 16); if (!ma_dr_flac__read_uint32(bs, bitCount, &result)) { @@ -85709,8 +85709,8 @@ static ma_bool32 ma_dr_flac__read_uint16(ma_dr_flac_bs* bs, unsigned int bitCoun static ma_bool32 ma_dr_flac__read_int16(ma_dr_flac_bs* bs, unsigned int bitCount, ma_int16* pResult) { ma_int32 result; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pResult != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pResult != nullptr); MA_DR_FLAC_ASSERT(bitCount > 0); MA_DR_FLAC_ASSERT(bitCount <= 16); if (!ma_dr_flac__read_int32(bs, bitCount, &result)) { @@ -85723,8 +85723,8 @@ static ma_bool32 ma_dr_flac__read_int16(ma_dr_flac_bs* bs, unsigned int bitCount static ma_bool32 ma_dr_flac__read_uint8(ma_dr_flac_bs* bs, unsigned int bitCount, ma_uint8* pResult) { ma_uint32 result; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pResult != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pResult != nullptr); MA_DR_FLAC_ASSERT(bitCount > 0); MA_DR_FLAC_ASSERT(bitCount <= 8); if (!ma_dr_flac__read_uint32(bs, bitCount, &result)) { @@ -85736,8 +85736,8 @@ static ma_bool32 ma_dr_flac__read_uint8(ma_dr_flac_bs* bs, unsigned int bitCount static ma_bool32 ma_dr_flac__read_int8(ma_dr_flac_bs* bs, unsigned int bitCount, ma_int8* pResult) { ma_int32 result; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pResult != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pResult != nullptr); MA_DR_FLAC_ASSERT(bitCount > 0); MA_DR_FLAC_ASSERT(bitCount <= 8); if (!ma_dr_flac__read_int32(bs, bitCount, &result)) { @@ -85793,7 +85793,7 @@ static ma_bool32 ma_dr_flac__seek_bits(ma_dr_flac_bs* bs, size_t bitsToSeek) } static ma_bool32 ma_dr_flac__find_and_seek_to_next_sync_code(ma_dr_flac_bs* bs) { - MA_DR_FLAC_ASSERT(bs != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); if (!ma_dr_flac__seek_bits(bs, MA_DR_FLAC_CACHE_L1_BITS_REMAINING(bs) & 7)) { return MA_FALSE; } @@ -86014,7 +86014,7 @@ static MA_INLINE ma_bool32 ma_dr_flac__seek_past_next_set_bit(ma_dr_flac_bs* bs, } static ma_bool32 ma_dr_flac__seek_to_byte(ma_dr_flac_bs* bs, ma_uint64 offsetFromStart) { - MA_DR_FLAC_ASSERT(bs != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); MA_DR_FLAC_ASSERT(offsetFromStart > 0); if (offsetFromStart > 0x7FFFFFFF) { ma_uint64 bytesRemaining = offsetFromStart; @@ -86048,9 +86048,9 @@ static ma_result ma_dr_flac__read_utf8_coded_number(ma_dr_flac_bs* bs, ma_uint64 ma_uint8 utf8[7] = {0}; int byteCount; int i; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pNumberOut != NULL); - MA_DR_FLAC_ASSERT(pCRCOut != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pNumberOut != nullptr); + MA_DR_FLAC_ASSERT(pCRCOut != nullptr); crc = *pCRCOut; if (!ma_dr_flac__read_uint8(bs, 8, utf8)) { *pNumberOut = 0; @@ -86323,8 +86323,8 @@ static MA_INLINE ma_int32 ma_dr_flac__calculate_prediction_64(ma_uint32 order, m static ma_bool32 ma_dr_flac__decode_samples_with_residual__rice__reference(ma_dr_flac_bs* bs, ma_uint32 bitsPerSample, ma_uint32 count, ma_uint8 riceParam, ma_uint32 lpcOrder, ma_int32 lpcShift, ma_uint32 lpcPrecision, const ma_int32* coefficients, ma_int32* pSamplesOut) { ma_uint32 i; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pSamplesOut != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pSamplesOut != nullptr); for (i = 0; i < count; ++i) { ma_uint32 zeroCounter = 0; for (;;) { @@ -86600,8 +86600,8 @@ static ma_bool32 ma_dr_flac__decode_samples_with_residual__rice__scalar_zeroorde ma_uint32 riceParamPart0; ma_uint32 riceParamMask; ma_uint32 i; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pSamplesOut != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pSamplesOut != nullptr); (void)bitsPerSample; (void)order; (void)shift; @@ -86634,8 +86634,8 @@ static ma_bool32 ma_dr_flac__decode_samples_with_residual__rice__scalar(ma_dr_fl ma_uint32 riceParamMask; const ma_int32* pSamplesOutEnd; ma_uint32 i; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pSamplesOut != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pSamplesOut != nullptr); if (lpcOrder == 0) { return ma_dr_flac__decode_samples_with_residual__rice__scalar_zeroorder(bs, bitsPerSample, count, riceParam, lpcOrder, lpcShift, coefficients, pSamplesOut); } @@ -87052,8 +87052,8 @@ static ma_bool32 ma_dr_flac__decode_samples_with_residual__rice__sse41_64(ma_dr_ } static ma_bool32 ma_dr_flac__decode_samples_with_residual__rice__sse41(ma_dr_flac_bs* bs, ma_uint32 bitsPerSample, ma_uint32 count, ma_uint8 riceParam, ma_uint32 lpcOrder, ma_int32 lpcShift, ma_uint32 lpcPrecision, const ma_int32* coefficients, ma_int32* pSamplesOut) { - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pSamplesOut != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pSamplesOut != nullptr); if (lpcOrder > 0 && lpcOrder <= 12) { if (ma_dr_flac__use_64_bit_prediction(bitsPerSample, lpcOrder, lpcPrecision)) { return ma_dr_flac__decode_samples_with_residual__rice__sse41_64(bs, count, riceParam, lpcOrder, lpcShift, coefficients, pSamplesOut); @@ -87402,8 +87402,8 @@ static ma_bool32 ma_dr_flac__decode_samples_with_residual__rice__neon_64(ma_dr_f } static ma_bool32 ma_dr_flac__decode_samples_with_residual__rice__neon(ma_dr_flac_bs* bs, ma_uint32 bitsPerSample, ma_uint32 count, ma_uint8 riceParam, ma_uint32 lpcOrder, ma_int32 lpcShift, ma_uint32 lpcPrecision, const ma_int32* coefficients, ma_int32* pSamplesOut) { - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(pSamplesOut != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(pSamplesOut != nullptr); if (lpcOrder > 0 && lpcOrder <= 12) { if (ma_dr_flac__use_64_bit_prediction(bitsPerSample, lpcOrder, lpcPrecision)) { return ma_dr_flac__decode_samples_with_residual__rice__neon_64(bs, count, riceParam, lpcOrder, lpcShift, coefficients, pSamplesOut); @@ -87437,7 +87437,7 @@ static ma_bool32 ma_dr_flac__decode_samples_with_residual__rice(ma_dr_flac_bs* b static ma_bool32 ma_dr_flac__read_and_seek_residual__rice(ma_dr_flac_bs* bs, ma_uint32 count, ma_uint8 riceParam) { ma_uint32 i; - MA_DR_FLAC_ASSERT(bs != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); for (i = 0; i < count; ++i) { if (!ma_dr_flac__seek_rice_parts(bs, riceParam)) { return MA_FALSE; @@ -87451,9 +87451,9 @@ __attribute__((no_sanitize("signed-integer-overflow"))) static ma_bool32 ma_dr_flac__decode_samples_with_residual__unencoded(ma_dr_flac_bs* bs, ma_uint32 bitsPerSample, ma_uint32 count, ma_uint8 unencodedBitsPerSample, ma_uint32 lpcOrder, ma_int32 lpcShift, ma_uint32 lpcPrecision, const ma_int32* coefficients, ma_int32* pSamplesOut) { ma_uint32 i; - MA_DR_FLAC_ASSERT(bs != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); MA_DR_FLAC_ASSERT(unencodedBitsPerSample <= 31); - MA_DR_FLAC_ASSERT(pSamplesOut != NULL); + MA_DR_FLAC_ASSERT(pSamplesOut != nullptr); for (i = 0; i < count; ++i) { if (unencodedBitsPerSample > 0) { if (!ma_dr_flac__read_int32(bs, unencodedBitsPerSample, pSamplesOut + i)) { @@ -87476,9 +87476,9 @@ static ma_bool32 ma_dr_flac__decode_samples_with_residual(ma_dr_flac_bs* bs, ma_ ma_uint8 partitionOrder; ma_uint32 samplesInPartition; ma_uint32 partitionsRemaining; - MA_DR_FLAC_ASSERT(bs != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); MA_DR_FLAC_ASSERT(blockSize != 0); - MA_DR_FLAC_ASSERT(pDecodedSamples != NULL); + MA_DR_FLAC_ASSERT(pDecodedSamples != nullptr); if (!ma_dr_flac__read_uint8(bs, 2, &residualMethod)) { return MA_FALSE; } @@ -87544,7 +87544,7 @@ static ma_bool32 ma_dr_flac__read_and_seek_residual(ma_dr_flac_bs* bs, ma_uint32 ma_uint8 partitionOrder; ma_uint32 samplesInPartition; ma_uint32 partitionsRemaining; - MA_DR_FLAC_ASSERT(bs != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); MA_DR_FLAC_ASSERT(blockSize != 0); if (!ma_dr_flac__read_uint8(bs, 2, &residualMethod)) { return MA_FALSE; @@ -87689,8 +87689,8 @@ static ma_bool32 ma_dr_flac__read_next_flac_frame_header(ma_dr_flac_bs* bs, ma_u { const ma_uint32 sampleRateTable[12] = {0, 88200, 176400, 192000, 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000}; const ma_uint8 bitsPerSampleTable[8] = {0, 8, 12, (ma_uint8)-1, 16, 20, 24, (ma_uint8)-1}; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(header != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(header != nullptr); for (;;) { ma_uint8 crc8 = 0xCE; ma_uint8 reserved = 0; @@ -87886,8 +87886,8 @@ static ma_bool32 ma_dr_flac__decode_subframe(ma_dr_flac_bs* bs, ma_dr_flac_frame { ma_dr_flac_subframe* pSubframe; ma_uint32 subframeBitsPerSample; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(frame != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(frame != nullptr); pSubframe = frame->subframes + subframeIndex; if (!ma_dr_flac__read_subframe_header(bs, pSubframe)) { return MA_FALSE; @@ -87935,8 +87935,8 @@ static ma_bool32 ma_dr_flac__seek_subframe(ma_dr_flac_bs* bs, ma_dr_flac_frame* { ma_dr_flac_subframe* pSubframe; ma_uint32 subframeBitsPerSample; - MA_DR_FLAC_ASSERT(bs != NULL); - MA_DR_FLAC_ASSERT(frame != NULL); + MA_DR_FLAC_ASSERT(bs != nullptr); + MA_DR_FLAC_ASSERT(frame != nullptr); pSubframe = frame->subframes + subframeIndex; if (!ma_dr_flac__read_subframe_header(bs, pSubframe)) { return MA_FALSE; @@ -87951,7 +87951,7 @@ static ma_bool32 ma_dr_flac__seek_subframe(ma_dr_flac_bs* bs, ma_dr_flac_frame* return MA_FALSE; } subframeBitsPerSample -= pSubframe->wastedBitsPerSample; - pSubframe->pSamplesS32 = NULL; + pSubframe->pSamplesS32 = nullptr; switch (pSubframe->subframeType) { case MA_DR_FLAC_SUBFRAME_CONSTANT: @@ -88084,7 +88084,7 @@ static ma_result ma_dr_flac__seek_flac_frame(ma_dr_flac* pFlac) } static ma_bool32 ma_dr_flac__read_and_decode_next_flac_frame(ma_dr_flac* pFlac) { - MA_DR_FLAC_ASSERT(pFlac != NULL); + MA_DR_FLAC_ASSERT(pFlac != nullptr); for (;;) { ma_result result; if (!ma_dr_flac__read_next_flac_frame_header(&pFlac->bs, pFlac->bitsPerSample, &pFlac->currentFLACFrame.header)) { @@ -88105,7 +88105,7 @@ static void ma_dr_flac__get_pcm_frame_range_of_current_flac_frame(ma_dr_flac* pF { ma_uint64 firstPCMFrame; ma_uint64 lastPCMFrame; - MA_DR_FLAC_ASSERT(pFlac != NULL); + MA_DR_FLAC_ASSERT(pFlac != nullptr); firstPCMFrame = pFlac->currentFLACFrame.header.pcmFrameNumber; if (firstPCMFrame == 0) { firstPCMFrame = ((ma_uint64)pFlac->currentFLACFrame.header.flacFrameNumber) * pFlac->maxBlockSizeInPCMFrames; @@ -88124,7 +88124,7 @@ static void ma_dr_flac__get_pcm_frame_range_of_current_flac_frame(ma_dr_flac* pF static ma_bool32 ma_dr_flac__seek_to_first_frame(ma_dr_flac* pFlac) { ma_bool32 result; - MA_DR_FLAC_ASSERT(pFlac != NULL); + MA_DR_FLAC_ASSERT(pFlac != nullptr); result = ma_dr_flac__seek_to_byte(&pFlac->bs, pFlac->firstFLACFramePosInBytes); MA_DR_FLAC_ZERO_MEMORY(&pFlac->currentFLACFrame, sizeof(pFlac->currentFLACFrame)); pFlac->currentPCMFrame = 0; @@ -88132,7 +88132,7 @@ static ma_bool32 ma_dr_flac__seek_to_first_frame(ma_dr_flac* pFlac) } static MA_INLINE ma_result ma_dr_flac__seek_to_next_flac_frame(ma_dr_flac* pFlac) { - MA_DR_FLAC_ASSERT(pFlac != NULL); + MA_DR_FLAC_ASSERT(pFlac != nullptr); return ma_dr_flac__seek_flac_frame(pFlac); } static ma_uint64 ma_dr_flac__seek_forward_by_pcm_frames(ma_dr_flac* pFlac, ma_uint64 pcmFramesToSeek) @@ -88162,7 +88162,7 @@ static ma_bool32 ma_dr_flac__seek_to_pcm_frame__brute_force(ma_dr_flac* pFlac, m { ma_bool32 isMidFrame = MA_FALSE; ma_uint64 runningPCMFrameCount; - MA_DR_FLAC_ASSERT(pFlac != NULL); + MA_DR_FLAC_ASSERT(pFlac != nullptr); if (pcmFrameIndex >= pFlac->currentPCMFrame) { runningPCMFrameCount = pFlac->currentPCMFrame; if (pFlac->currentPCMFrame == 0 && pFlac->currentFLACFrame.pcmFramesRemaining == 0) { @@ -88234,8 +88234,8 @@ static ma_bool32 ma_dr_flac__seek_to_pcm_frame__brute_force(ma_dr_flac* pFlac, m #define MA_DR_FLAC_BINARY_SEARCH_APPROX_COMPRESSION_RATIO 0.6f static ma_bool32 ma_dr_flac__seek_to_approximate_flac_frame_to_byte(ma_dr_flac* pFlac, ma_uint64 targetByte, ma_uint64 rangeLo, ma_uint64 rangeHi, ma_uint64* pLastSuccessfulSeekOffset) { - MA_DR_FLAC_ASSERT(pFlac != NULL); - MA_DR_FLAC_ASSERT(pLastSuccessfulSeekOffset != NULL); + MA_DR_FLAC_ASSERT(pFlac != nullptr); + MA_DR_FLAC_ASSERT(pLastSuccessfulSeekOffset != nullptr); MA_DR_FLAC_ASSERT(targetByte >= rangeLo); MA_DR_FLAC_ASSERT(targetByte <= rangeHi); *pLastSuccessfulSeekOffset = pFlac->firstFLACFramePosInBytes; @@ -88270,7 +88270,7 @@ static ma_bool32 ma_dr_flac__seek_to_approximate_flac_frame_to_byte(ma_dr_flac* return MA_FALSE; } } - ma_dr_flac__get_pcm_frame_range_of_current_flac_frame(pFlac, &pFlac->currentPCMFrame, NULL); + ma_dr_flac__get_pcm_frame_range_of_current_flac_frame(pFlac, &pFlac->currentPCMFrame, nullptr); MA_DR_FLAC_ASSERT(targetByte <= rangeHi); *pLastSuccessfulSeekOffset = targetByte; return MA_TRUE; @@ -88383,8 +88383,8 @@ static ma_bool32 ma_dr_flac__seek_to_pcm_frame__seek_table(ma_dr_flac* pFlac, ma ma_bool32 isMidFrame = MA_FALSE; ma_uint64 runningPCMFrameCount; ma_uint32 iSeekpoint; - MA_DR_FLAC_ASSERT(pFlac != NULL); - if (pFlac->pSeekpoints == NULL || pFlac->seekpointCount == 0) { + MA_DR_FLAC_ASSERT(pFlac != nullptr); + if (pFlac->pSeekpoints == nullptr || pFlac->seekpointCount == 0) { return MA_FALSE; } if (pFlac->pSeekpoints[0].firstPCMFrame > pcmFrameIndex) { @@ -88419,7 +88419,7 @@ static ma_bool32 ma_dr_flac__seek_to_pcm_frame__seek_table(ma_dr_flac* pFlac, ma } if (ma_dr_flac__seek_to_byte(&pFlac->bs, pFlac->firstFLACFramePosInBytes + pFlac->pSeekpoints[iClosestSeekpoint].flacFrameOffset)) { if (ma_dr_flac__read_next_flac_frame_header(&pFlac->bs, pFlac->bitsPerSample, &pFlac->currentFLACFrame.header)) { - ma_dr_flac__get_pcm_frame_range_of_current_flac_frame(pFlac, &pFlac->currentPCMFrame, NULL); + ma_dr_flac__get_pcm_frame_range_of_current_flac_frame(pFlac, &pFlac->currentPCMFrame, nullptr); if (ma_dr_flac__seek_to_pcm_frame__binary_search_internal(pFlac, pcmFrameIndex, byteRangeLo, byteRangeHi)) { return MA_TRUE; } @@ -88599,45 +88599,45 @@ static void ma_dr_flac__free_default(void* p, void* pUserData) } static void* ma_dr_flac__malloc_from_callbacks(size_t sz, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks == NULL) { - return NULL; + if (pAllocationCallbacks == nullptr) { + return nullptr; } - if (pAllocationCallbacks->onMalloc != NULL) { + if (pAllocationCallbacks->onMalloc != nullptr) { return pAllocationCallbacks->onMalloc(sz, pAllocationCallbacks->pUserData); } - if (pAllocationCallbacks->onRealloc != NULL) { - return pAllocationCallbacks->onRealloc(NULL, sz, pAllocationCallbacks->pUserData); + if (pAllocationCallbacks->onRealloc != nullptr) { + return pAllocationCallbacks->onRealloc(nullptr, sz, pAllocationCallbacks->pUserData); } - return NULL; + return nullptr; } static void* ma_dr_flac__realloc_from_callbacks(void* p, size_t szNew, size_t szOld, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks == NULL) { - return NULL; + if (pAllocationCallbacks == nullptr) { + return nullptr; } - if (pAllocationCallbacks->onRealloc != NULL) { + if (pAllocationCallbacks->onRealloc != nullptr) { return pAllocationCallbacks->onRealloc(p, szNew, pAllocationCallbacks->pUserData); } - if (pAllocationCallbacks->onMalloc != NULL && pAllocationCallbacks->onFree != NULL) { + if (pAllocationCallbacks->onMalloc != nullptr && pAllocationCallbacks->onFree != nullptr) { void* p2; p2 = pAllocationCallbacks->onMalloc(szNew, pAllocationCallbacks->pUserData); - if (p2 == NULL) { - return NULL; + if (p2 == nullptr) { + return nullptr; } - if (p != NULL) { + if (p != nullptr) { MA_DR_FLAC_COPY_MEMORY(p2, p, szOld); pAllocationCallbacks->onFree(p, pAllocationCallbacks->pUserData); } return p2; } - return NULL; + return nullptr; } static void ma_dr_flac__free_from_callbacks(void* p, const ma_allocation_callbacks* pAllocationCallbacks) { - if (p == NULL || pAllocationCallbacks == NULL) { + if (p == nullptr || pAllocationCallbacks == nullptr) { return; } - if (pAllocationCallbacks->onFree != NULL) { + if (pAllocationCallbacks->onFree != nullptr) { pAllocationCallbacks->onFree(p, pAllocationCallbacks->pUserData); } } @@ -88659,7 +88659,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea metadata.type = blockType; metadata.rawDataSize = 0; metadata.rawDataOffset = runningFilePos; - metadata.pRawData = NULL; + metadata.pRawData = nullptr; switch (blockType) { case MA_DR_FLAC_METADATA_BLOCK_TYPE_APPLICATION: @@ -88669,7 +88669,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea } if (onMeta) { void* pRawData = ma_dr_flac__malloc_from_callbacks(blockSize, pAllocationCallbacks); - if (pRawData == NULL) { + if (pRawData == nullptr) { return MA_FALSE; } if (onRead(pUserData, pRawData, blockSize) != blockSize) { @@ -88695,7 +88695,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea void* pRawData; seekpointCount = blockSize/MA_DR_FLAC_SEEKPOINT_SIZE_IN_BYTES; pRawData = ma_dr_flac__malloc_from_callbacks(seekpointCount * sizeof(ma_dr_flac_seekpoint), pAllocationCallbacks); - if (pRawData == NULL) { + if (pRawData == nullptr) { return MA_FALSE; } for (iSeekpoint = 0; iSeekpoint < seekpointCount; ++iSeekpoint) { @@ -88727,7 +88727,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea const char* pRunningDataEnd; ma_uint32 i; pRawData = ma_dr_flac__malloc_from_callbacks(blockSize, pAllocationCallbacks); - if (pRawData == NULL) { + if (pRawData == nullptr) { return MA_FALSE; } if (onRead(pUserData, pRawData, blockSize) != blockSize) { @@ -88781,7 +88781,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea ma_uint8 iIndex; void* pTrackData; pRawData = ma_dr_flac__malloc_from_callbacks(blockSize, pAllocationCallbacks); - if (pRawData == NULL) { + if (pRawData == nullptr) { return MA_FALSE; } if (onRead(pUserData, pRawData, blockSize) != blockSize) { @@ -88796,7 +88796,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea metadata.data.cuesheet.leadInSampleCount = ma_dr_flac__be2host_64(*(const ma_uint64*)pRunningData); pRunningData += 8; metadata.data.cuesheet.isCD = (pRunningData[0] & 0x80) != 0; pRunningData += 259; metadata.data.cuesheet.trackCount = pRunningData[0]; pRunningData += 1; - metadata.data.cuesheet.pTrackData = NULL; + metadata.data.cuesheet.pTrackData = nullptr; { const char* pRunningDataSaved = pRunningData; bufferSize = metadata.data.cuesheet.trackCount * MA_DR_FLAC_CUESHEET_TRACK_SIZE_IN_BYTES; @@ -88823,7 +88823,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea { char* pRunningTrackData; pTrackData = ma_dr_flac__malloc_from_callbacks(bufferSize, pAllocationCallbacks); - if (pTrackData == NULL) { + if (pTrackData == nullptr) { ma_dr_flac__free_from_callbacks(pRawData, pAllocationCallbacks); return MA_FALSE; } @@ -88847,10 +88847,10 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea metadata.data.cuesheet.pTrackData = pTrackData; } ma_dr_flac__free_from_callbacks(pRawData, pAllocationCallbacks); - pRawData = NULL; + pRawData = nullptr; onMeta(pUserDataMD, &metadata); ma_dr_flac__free_from_callbacks(pTrackData, pAllocationCallbacks); - pTrackData = NULL; + pTrackData = nullptr; } } break; case MA_DR_FLAC_METADATA_BLOCK_TYPE_PICTURE: @@ -88861,9 +88861,9 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea if (onMeta) { ma_bool32 result = MA_TRUE; ma_uint32 blockSizeRemaining = blockSize; - char* pMime = NULL; - char* pDescription = NULL; - void* pPictureData = NULL; + char* pMime = nullptr; + char* pDescription = nullptr; + void* pPictureData = nullptr; if (blockSizeRemaining < 4 || onRead(pUserData, &metadata.data.picture.type, 4) != 4) { result = MA_FALSE; goto done_flac; @@ -88877,7 +88877,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea blockSizeRemaining -= 4; metadata.data.picture.mimeLength = ma_dr_flac__be2host_32(metadata.data.picture.mimeLength); pMime = (char*)ma_dr_flac__malloc_from_callbacks(metadata.data.picture.mimeLength + 1, pAllocationCallbacks); - if (pMime == NULL) { + if (pMime == nullptr) { result = MA_FALSE; goto done_flac; } @@ -88895,7 +88895,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea blockSizeRemaining -= 4; metadata.data.picture.descriptionLength = ma_dr_flac__be2host_32(metadata.data.picture.descriptionLength); pDescription = (char*)ma_dr_flac__malloc_from_callbacks(metadata.data.picture.descriptionLength + 1, pAllocationCallbacks); - if (pDescription == NULL) { + if (pDescription == nullptr) { result = MA_FALSE; goto done_flac; } @@ -88943,7 +88943,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea metadata.data.picture.pictureDataOffset = runningFilePos + (blockSize - blockSizeRemaining); #ifndef MA_DR_FLAC_NO_PICTURE_METADATA_MALLOC pPictureData = ma_dr_flac__malloc_from_callbacks(metadata.data.picture.pictureDataSize, pAllocationCallbacks); - if (pPictureData != NULL) { + if (pPictureData != nullptr) { if (onRead(pUserData, pPictureData, metadata.data.picture.pictureDataSize) != metadata.data.picture.pictureDataSize) { result = MA_FALSE; goto done_flac; @@ -88959,7 +88959,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea blockSizeRemaining -= metadata.data.picture.pictureDataSize; (void)blockSizeRemaining; metadata.data.picture.pPictureData = (const ma_uint8*)pPictureData; - if (metadata.data.picture.pictureDataOffset != 0 || metadata.data.picture.pPictureData != NULL) { + if (metadata.data.picture.pictureDataOffset != 0 || metadata.data.picture.pPictureData != nullptr) { onMeta(pUserDataMD, &metadata); } else { } @@ -88995,7 +88995,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea { if (onMeta) { void* pRawData = ma_dr_flac__malloc_from_callbacks(blockSize, pAllocationCallbacks); - if (pRawData != NULL) { + if (pRawData != nullptr) { if (onRead(pUserData, pRawData, blockSize) != blockSize) { ma_dr_flac__free_from_callbacks(pRawData, pAllocationCallbacks); return MA_FALSE; @@ -89012,7 +89012,7 @@ static ma_bool32 ma_dr_flac__read_and_decode_metadata(ma_dr_flac_read_proc onRea } } break; } - if (onMeta == NULL && blockSize > 0) { + if (onMeta == nullptr && blockSize > 0) { if (!onSeek(pUserData, blockSize, MA_DR_FLAC_SEEK_CUR)) { isLastBlock = MA_TRUE; } @@ -89070,7 +89070,7 @@ static ma_bool32 ma_dr_flac__init_private__native(ma_dr_flac_init_info* pInit, m if (onMeta) { ma_dr_flac_metadata metadata; metadata.type = MA_DR_FLAC_METADATA_BLOCK_TYPE_STREAMINFO; - metadata.pRawData = NULL; + metadata.pRawData = nullptr; metadata.rawDataSize = 0; metadata.data.streaminfo = streaminfo; onMeta(pUserDataMD, &metadata); @@ -89430,8 +89430,8 @@ static size_t ma_dr_flac__on_read_ogg(void* pUserData, void* bufferOut, size_t b ma_dr_flac_oggbs* oggbs = (ma_dr_flac_oggbs*)pUserData; ma_uint8* pRunningBufferOut = (ma_uint8*)bufferOut; size_t bytesRead = 0; - MA_DR_FLAC_ASSERT(oggbs != NULL); - MA_DR_FLAC_ASSERT(pRunningBufferOut != NULL); + MA_DR_FLAC_ASSERT(oggbs != nullptr); + MA_DR_FLAC_ASSERT(pRunningBufferOut != nullptr); while (bytesRead < bytesToRead) { size_t bytesRemainingToRead = bytesToRead - bytesRead; if (oggbs->bytesRemainingInPage >= bytesRemainingToRead) { @@ -89457,7 +89457,7 @@ static ma_bool32 ma_dr_flac__on_seek_ogg(void* pUserData, int offset, ma_dr_flac { ma_dr_flac_oggbs* oggbs = (ma_dr_flac_oggbs*)pUserData; int bytesSeeked = 0; - MA_DR_FLAC_ASSERT(oggbs != NULL); + MA_DR_FLAC_ASSERT(oggbs != nullptr); MA_DR_FLAC_ASSERT(offset >= 0); if (origin == MA_DR_FLAC_SEEK_SET) { if (!ma_dr_flac_oggbs__seek_physical(oggbs, (int)oggbs->firstBytePos, MA_DR_FLAC_SEEK_SET)) { @@ -89504,7 +89504,7 @@ static ma_bool32 ma_dr_flac_ogg__seek_to_pcm_frame(ma_dr_flac* pFlac, ma_uint64 ma_uint64 runningGranulePosition; ma_uint64 runningFrameBytePos; ma_uint64 runningPCMFrameCount; - MA_DR_FLAC_ASSERT(oggbs != NULL); + MA_DR_FLAC_ASSERT(oggbs != nullptr); originalBytePos = oggbs->currentBytePos; if (!ma_dr_flac__seek_to_byte(&pFlac->bs, pFlac->firstFLACFramePosInBytes)) { return MA_FALSE; @@ -89655,7 +89655,7 @@ static ma_bool32 ma_dr_flac__init_private__ogg(ma_dr_flac_init_info* pInit, ma_d if (onMeta) { ma_dr_flac_metadata metadata; metadata.type = MA_DR_FLAC_METADATA_BLOCK_TYPE_STREAMINFO; - metadata.pRawData = NULL; + metadata.pRawData = nullptr; metadata.rawDataSize = 0; metadata.data.streaminfo = streaminfo; onMeta(pUserDataMD, &metadata); @@ -89700,7 +89700,7 @@ static ma_bool32 ma_dr_flac__init_private(ma_dr_flac_init_info* pInit, ma_dr_fla { ma_bool32 relaxed; ma_uint8 id[4]; - if (pInit == NULL || onRead == NULL || onSeek == NULL) { + if (pInit == nullptr || onRead == nullptr || onSeek == nullptr) { return MA_FALSE; } MA_DR_FLAC_ZERO_MEMORY(pInit, sizeof(*pInit)); @@ -89766,8 +89766,8 @@ static ma_bool32 ma_dr_flac__init_private(ma_dr_flac_init_info* pInit, ma_dr_fla } static void ma_dr_flac__init_from_info(ma_dr_flac* pFlac, const ma_dr_flac_init_info* pInit) { - MA_DR_FLAC_ASSERT(pFlac != NULL); - MA_DR_FLAC_ASSERT(pInit != NULL); + MA_DR_FLAC_ASSERT(pFlac != nullptr); + MA_DR_FLAC_ASSERT(pInit != nullptr); MA_DR_FLAC_ZERO_MEMORY(pFlac, sizeof(*pFlac)); pFlac->bs = pInit->bs; pFlac->onMeta = pInit->onMeta; @@ -89786,7 +89786,7 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on ma_uint32 wholeSIMDVectorCountPerChannel; ma_uint32 decodedSamplesAllocationSize; #ifndef MA_DR_FLAC_NO_OGG - ma_dr_flac_oggbs* pOggbs = NULL; + ma_dr_flac_oggbs* pOggbs = nullptr; #endif ma_uint64 firstFramePos; ma_uint64 seektablePos; @@ -89795,15 +89795,15 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on ma_dr_flac* pFlac; ma_dr_flac__init_cpu_caps(); if (!ma_dr_flac__init_private(&init, onRead, onSeek, onTell, onMeta, container, pUserData, pUserDataMD)) { - return NULL; + return nullptr; } - if (pAllocationCallbacks != NULL) { + if (pAllocationCallbacks != nullptr) { allocationCallbacks = *pAllocationCallbacks; - if (allocationCallbacks.onFree == NULL || (allocationCallbacks.onMalloc == NULL && allocationCallbacks.onRealloc == NULL)) { - return NULL; + if (allocationCallbacks.onFree == nullptr || (allocationCallbacks.onMalloc == nullptr && allocationCallbacks.onRealloc == nullptr)) { + return nullptr; } } else { - allocationCallbacks.pUserData = NULL; + allocationCallbacks.pUserData = nullptr; allocationCallbacks.onMalloc = ma_dr_flac__malloc_default; allocationCallbacks.onRealloc = ma_dr_flac__realloc_default; allocationCallbacks.onFree = ma_dr_flac__free_default; @@ -89821,8 +89821,8 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on if (init.container == ma_dr_flac_container_ogg) { allocationSize += sizeof(ma_dr_flac_oggbs); pOggbs = (ma_dr_flac_oggbs*)ma_dr_flac__malloc_from_callbacks(sizeof(*pOggbs), &allocationCallbacks); - if (pOggbs == NULL) { - return NULL; + if (pOggbs == nullptr) { + return nullptr; } MA_DR_FLAC_ZERO_MEMORY(pOggbs, sizeof(*pOggbs)); pOggbs->onRead = onRead; @@ -89856,16 +89856,16 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on #ifndef MA_DR_FLAC_NO_OGG ma_dr_flac__free_from_callbacks(pOggbs, &allocationCallbacks); #endif - return NULL; + return nullptr; } allocationSize += seekpointCount * sizeof(ma_dr_flac_seekpoint); } pFlac = (ma_dr_flac*)ma_dr_flac__malloc_from_callbacks(allocationSize, &allocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { #ifndef MA_DR_FLAC_NO_OGG ma_dr_flac__free_from_callbacks(pOggbs, &allocationCallbacks); #endif - return NULL; + return nullptr; } ma_dr_flac__init_from_info(pFlac, &init); pFlac->allocationCallbacks = allocationCallbacks; @@ -89875,7 +89875,7 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on ma_dr_flac_oggbs* pInternalOggbs = (ma_dr_flac_oggbs*)((ma_uint8*)pFlac->pDecodedSamples + decodedSamplesAllocationSize + (seekpointCount * sizeof(ma_dr_flac_seekpoint))); MA_DR_FLAC_COPY_MEMORY(pInternalOggbs, pOggbs, sizeof(*pOggbs)); ma_dr_flac__free_from_callbacks(pOggbs, &allocationCallbacks); - pOggbs = NULL; + pOggbs = nullptr; pFlac->bs.onRead = ma_dr_flac__on_read_ogg; pFlac->bs.onSeek = ma_dr_flac__on_seek_ogg; pFlac->bs.onTell = ma_dr_flac__on_tell_ogg; @@ -89887,7 +89887,7 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on #ifndef MA_DR_FLAC_NO_OGG if (init.container == ma_dr_flac_container_ogg) { - pFlac->pSeekpoints = NULL; + pFlac->pSeekpoints = nullptr; pFlac->seekpointCount = 0; } else @@ -89896,8 +89896,8 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on if (seektablePos != 0) { pFlac->seekpointCount = seekpointCount; pFlac->pSeekpoints = (ma_dr_flac_seekpoint*)((ma_uint8*)pFlac->pDecodedSamples + decodedSamplesAllocationSize); - MA_DR_FLAC_ASSERT(pFlac->bs.onSeek != NULL); - MA_DR_FLAC_ASSERT(pFlac->bs.onRead != NULL); + MA_DR_FLAC_ASSERT(pFlac->bs.onSeek != nullptr); + MA_DR_FLAC_ASSERT(pFlac->bs.onRead != nullptr); if (pFlac->bs.onSeek(pFlac->bs.pUserData, (int)seektablePos, MA_DR_FLAC_SEEK_SET)) { ma_uint32 iSeekpoint; for (iSeekpoint = 0; iSeekpoint < seekpointCount; iSeekpoint += 1) { @@ -89906,17 +89906,17 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on pFlac->pSeekpoints[iSeekpoint].flacFrameOffset = ma_dr_flac__be2host_64(pFlac->pSeekpoints[iSeekpoint].flacFrameOffset); pFlac->pSeekpoints[iSeekpoint].pcmFrameCount = ma_dr_flac__be2host_16(pFlac->pSeekpoints[iSeekpoint].pcmFrameCount); } else { - pFlac->pSeekpoints = NULL; + pFlac->pSeekpoints = nullptr; pFlac->seekpointCount = 0; break; } } if (!pFlac->bs.onSeek(pFlac->bs.pUserData, (int)pFlac->firstFLACFramePosInBytes, MA_DR_FLAC_SEEK_SET)) { ma_dr_flac__free_from_callbacks(pFlac, &allocationCallbacks); - return NULL; + return nullptr; } } else { - pFlac->pSeekpoints = NULL; + pFlac->pSeekpoints = nullptr; pFlac->seekpointCount = 0; } } @@ -89931,12 +89931,12 @@ static ma_dr_flac* ma_dr_flac_open_with_metadata_private(ma_dr_flac_read_proc on if (result == MA_CRC_MISMATCH) { if (!ma_dr_flac__read_next_flac_frame_header(&pFlac->bs, pFlac->bitsPerSample, &pFlac->currentFLACFrame.header)) { ma_dr_flac__free_from_callbacks(pFlac, &allocationCallbacks); - return NULL; + return nullptr; } continue; } else { ma_dr_flac__free_from_callbacks(pFlac, &allocationCallbacks); - return NULL; + return nullptr; } } } @@ -89966,8 +89966,8 @@ static ma_bool32 ma_dr_flac__on_tell_stdio(void* pUserData, ma_int64* pCursor) { FILE* pFileStdio = (FILE*)pUserData; ma_int64 result; - MA_DR_FLAC_ASSERT(pFileStdio != NULL); - MA_DR_FLAC_ASSERT(pCursor != NULL); + MA_DR_FLAC_ASSERT(pFileStdio != nullptr); + MA_DR_FLAC_ASSERT(pCursor != nullptr); #if defined(_WIN32) && !defined(NXDK) #if defined(_MSC_VER) && _MSC_VER > 1200 result = _ftelli64(pFileStdio); @@ -89985,12 +89985,12 @@ MA_API ma_dr_flac* ma_dr_flac_open_file(const char* pFileName, const ma_allocati ma_dr_flac* pFlac; FILE* pFile; if (ma_fopen(&pFile, pFileName, "rb") != MA_SUCCESS) { - return NULL; + return nullptr; } pFlac = ma_dr_flac_open(ma_dr_flac__on_read_stdio, ma_dr_flac__on_seek_stdio, ma_dr_flac__on_tell_stdio, (void*)pFile, pAllocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { fclose(pFile); - return NULL; + return nullptr; } return pFlac; } @@ -90000,12 +90000,12 @@ MA_API ma_dr_flac* ma_dr_flac_open_file_w(const wchar_t* pFileName, const ma_all ma_dr_flac* pFlac; FILE* pFile; if (ma_wfopen(&pFile, pFileName, L"rb", pAllocationCallbacks) != MA_SUCCESS) { - return NULL; + return nullptr; } pFlac = ma_dr_flac_open(ma_dr_flac__on_read_stdio, ma_dr_flac__on_seek_stdio, ma_dr_flac__on_tell_stdio, (void*)pFile, pAllocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { fclose(pFile); - return NULL; + return nullptr; } return pFlac; } @@ -90015,10 +90015,10 @@ MA_API ma_dr_flac* ma_dr_flac_open_file_with_metadata(const char* pFileName, ma_ ma_dr_flac* pFlac; FILE* pFile; if (ma_fopen(&pFile, pFileName, "rb") != MA_SUCCESS) { - return NULL; + return nullptr; } pFlac = ma_dr_flac_open_with_metadata_private(ma_dr_flac__on_read_stdio, ma_dr_flac__on_seek_stdio, ma_dr_flac__on_tell_stdio, onMeta, ma_dr_flac_container_unknown, (void*)pFile, pUserData, pAllocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { fclose(pFile); return pFlac; } @@ -90030,10 +90030,10 @@ MA_API ma_dr_flac* ma_dr_flac_open_file_with_metadata_w(const wchar_t* pFileName ma_dr_flac* pFlac; FILE* pFile; if (ma_wfopen(&pFile, pFileName, L"rb", pAllocationCallbacks) != MA_SUCCESS) { - return NULL; + return nullptr; } pFlac = ma_dr_flac_open_with_metadata_private(ma_dr_flac__on_read_stdio, ma_dr_flac__on_seek_stdio, ma_dr_flac__on_tell_stdio, onMeta, ma_dr_flac_container_unknown, (void*)pFile, pUserData, pAllocationCallbacks); - if (pFlac == NULL) { + if (pFlac == nullptr) { fclose(pFile); return pFlac; } @@ -90045,7 +90045,7 @@ static size_t ma_dr_flac__on_read_memory(void* pUserData, void* bufferOut, size_ { ma_dr_flac__memory_stream* memoryStream = (ma_dr_flac__memory_stream*)pUserData; size_t bytesRemaining; - MA_DR_FLAC_ASSERT(memoryStream != NULL); + MA_DR_FLAC_ASSERT(memoryStream != nullptr); MA_DR_FLAC_ASSERT(memoryStream->dataSize >= memoryStream->currentReadPos); bytesRemaining = memoryStream->dataSize - memoryStream->currentReadPos; if (bytesToRead > bytesRemaining) { @@ -90061,7 +90061,7 @@ static ma_bool32 ma_dr_flac__on_seek_memory(void* pUserData, int offset, ma_dr_f { ma_dr_flac__memory_stream* memoryStream = (ma_dr_flac__memory_stream*)pUserData; ma_int64 newCursor; - MA_DR_FLAC_ASSERT(memoryStream != NULL); + MA_DR_FLAC_ASSERT(memoryStream != nullptr); if (origin == MA_DR_FLAC_SEEK_SET) { newCursor = 0; } else if (origin == MA_DR_FLAC_SEEK_CUR) { @@ -90085,8 +90085,8 @@ static ma_bool32 ma_dr_flac__on_seek_memory(void* pUserData, int offset, ma_dr_f static ma_bool32 ma_dr_flac__on_tell_memory(void* pUserData, ma_int64* pCursor) { ma_dr_flac__memory_stream* memoryStream = (ma_dr_flac__memory_stream*)pUserData; - MA_DR_FLAC_ASSERT(memoryStream != NULL); - MA_DR_FLAC_ASSERT(pCursor != NULL); + MA_DR_FLAC_ASSERT(memoryStream != nullptr); + MA_DR_FLAC_ASSERT(pCursor != nullptr); *pCursor = (ma_int64)memoryStream->currentReadPos; return MA_TRUE; } @@ -90098,8 +90098,8 @@ MA_API ma_dr_flac* ma_dr_flac_open_memory(const void* pData, size_t dataSize, co memoryStream.dataSize = dataSize; memoryStream.currentReadPos = 0; pFlac = ma_dr_flac_open(ma_dr_flac__on_read_memory, ma_dr_flac__on_seek_memory, ma_dr_flac__on_tell_memory, &memoryStream, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } pFlac->memoryStream = memoryStream; #ifndef MA_DR_FLAC_NO_OGG @@ -90123,8 +90123,8 @@ MA_API ma_dr_flac* ma_dr_flac_open_memory_with_metadata(const void* pData, size_ memoryStream.dataSize = dataSize; memoryStream.currentReadPos = 0; pFlac = ma_dr_flac_open_with_metadata_private(ma_dr_flac__on_read_memory, ma_dr_flac__on_seek_memory, ma_dr_flac__on_tell_memory, onMeta, ma_dr_flac_container_unknown, &memoryStream, pUserData, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } pFlac->memoryStream = memoryStream; #ifndef MA_DR_FLAC_NO_OGG @@ -90142,11 +90142,11 @@ MA_API ma_dr_flac* ma_dr_flac_open_memory_with_metadata(const void* pData, size_ } MA_API ma_dr_flac* ma_dr_flac_open(ma_dr_flac_read_proc onRead, ma_dr_flac_seek_proc onSeek, ma_dr_flac_tell_proc onTell, void* pUserData, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_flac_open_with_metadata_private(onRead, onSeek, onTell, NULL, ma_dr_flac_container_unknown, pUserData, pUserData, pAllocationCallbacks); + return ma_dr_flac_open_with_metadata_private(onRead, onSeek, onTell, nullptr, ma_dr_flac_container_unknown, pUserData, pUserData, pAllocationCallbacks); } MA_API ma_dr_flac* ma_dr_flac_open_relaxed(ma_dr_flac_read_proc onRead, ma_dr_flac_seek_proc onSeek, ma_dr_flac_tell_proc onTell, ma_dr_flac_container container, void* pUserData, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_flac_open_with_metadata_private(onRead, onSeek, onTell, NULL, container, pUserData, pUserData, pAllocationCallbacks); + return ma_dr_flac_open_with_metadata_private(onRead, onSeek, onTell, nullptr, container, pUserData, pUserData, pAllocationCallbacks); } MA_API ma_dr_flac* ma_dr_flac_open_with_metadata(ma_dr_flac_read_proc onRead, ma_dr_flac_seek_proc onSeek, ma_dr_flac_tell_proc onTell, ma_dr_flac_meta_proc onMeta, void* pUserData, const ma_allocation_callbacks* pAllocationCallbacks) { @@ -90158,7 +90158,7 @@ MA_API ma_dr_flac* ma_dr_flac_open_with_metadata_relaxed(ma_dr_flac_read_proc on } MA_API void ma_dr_flac_close(ma_dr_flac* pFlac) { - if (pFlac == NULL) { + if (pFlac == nullptr) { return; } #ifndef MA_DR_FLAC_NO_STDIO @@ -90783,10 +90783,10 @@ MA_API ma_uint64 ma_dr_flac_read_pcm_frames_s32(ma_dr_flac* pFlac, ma_uint64 fra { ma_uint64 framesRead; ma_uint32 unusedBitsPerSample; - if (pFlac == NULL || framesToRead == 0) { + if (pFlac == nullptr || framesToRead == 0) { return 0; } - if (pBufferOut == NULL) { + if (pBufferOut == nullptr) { return ma_dr_flac__seek_forward_by_pcm_frames(pFlac, framesToRead); } MA_DR_FLAC_ASSERT(pFlac->bitsPerSample <= 32); @@ -91520,10 +91520,10 @@ MA_API ma_uint64 ma_dr_flac_read_pcm_frames_s16(ma_dr_flac* pFlac, ma_uint64 fra { ma_uint64 framesRead; ma_uint32 unusedBitsPerSample; - if (pFlac == NULL || framesToRead == 0) { + if (pFlac == nullptr || framesToRead == 0) { return 0; } - if (pBufferOut == NULL) { + if (pBufferOut == nullptr) { return ma_dr_flac__seek_forward_by_pcm_frames(pFlac, framesToRead); } MA_DR_FLAC_ASSERT(pFlac->bitsPerSample <= 32); @@ -92247,10 +92247,10 @@ MA_API ma_uint64 ma_dr_flac_read_pcm_frames_f32(ma_dr_flac* pFlac, ma_uint64 fra { ma_uint64 framesRead; ma_uint32 unusedBitsPerSample; - if (pFlac == NULL || framesToRead == 0) { + if (pFlac == nullptr || framesToRead == 0) { return 0; } - if (pBufferOut == NULL) { + if (pBufferOut == nullptr) { return ma_dr_flac__seek_forward_by_pcm_frames(pFlac, framesToRead); } MA_DR_FLAC_ASSERT(pFlac->bitsPerSample <= 32); @@ -92312,7 +92312,7 @@ MA_API ma_uint64 ma_dr_flac_read_pcm_frames_f32(ma_dr_flac* pFlac, ma_uint64 fra } MA_API ma_bool32 ma_dr_flac_seek_to_pcm_frame(ma_dr_flac* pFlac, ma_uint64 pcmFrameIndex) { - if (pFlac == NULL) { + if (pFlac == nullptr) { return MA_FALSE; } if (pFlac->currentPCMFrame == pcmFrameIndex) { @@ -92380,18 +92380,18 @@ MA_API ma_bool32 ma_dr_flac_seek_to_pcm_frame(ma_dr_flac* pFlac, ma_uint64 pcmFr #define MA_DR_FLAC_DEFINE_FULL_READ_AND_CLOSE(extension, type) \ static type* ma_dr_flac__full_read_and_close_ ## extension (ma_dr_flac* pFlac, unsigned int* channelsOut, unsigned int* sampleRateOut, ma_uint64* totalPCMFrameCountOut)\ { \ - type* pSampleData = NULL; \ + type* pSampleData = nullptr; \ ma_uint64 totalPCMFrameCount; \ type buffer[4096]; \ ma_uint64 pcmFramesRead; \ size_t sampleDataBufferSize = sizeof(buffer); \ \ - MA_DR_FLAC_ASSERT(pFlac != NULL); \ + MA_DR_FLAC_ASSERT(pFlac != nullptr); \ \ totalPCMFrameCount = 0; \ \ pSampleData = (type*)ma_dr_flac__malloc_from_callbacks(sampleDataBufferSize, &pFlac->allocationCallbacks); \ - if (pSampleData == NULL) { \ + if (pSampleData == nullptr) { \ goto on_error; \ } \ \ @@ -92402,7 +92402,7 @@ static type* ma_dr_flac__full_read_and_close_ ## extension (ma_dr_flac* pFlac, u \ newSampleDataBufferSize = sampleDataBufferSize * 2; \ pNewSampleData = (type*)ma_dr_flac__realloc_from_callbacks(pSampleData, newSampleDataBufferSize, sampleDataBufferSize, &pFlac->allocationCallbacks); \ - if (pNewSampleData == NULL) { \ + if (pNewSampleData == nullptr) { \ ma_dr_flac__free_from_callbacks(pSampleData, &pFlac->allocationCallbacks); \ goto on_error; \ } \ @@ -92427,7 +92427,7 @@ static type* ma_dr_flac__full_read_and_close_ ## extension (ma_dr_flac* pFlac, u \ on_error: \ ma_dr_flac_close(pFlac); \ - return NULL; \ + return nullptr; \ } MA_DR_FLAC_DEFINE_FULL_READ_AND_CLOSE(s32, ma_int32) MA_DR_FLAC_DEFINE_FULL_READ_AND_CLOSE(s16, ma_int16) @@ -92445,8 +92445,8 @@ MA_API ma_int32* ma_dr_flac_open_and_read_pcm_frames_s32(ma_dr_flac_read_proc on *totalPCMFrameCountOut = 0; } pFlac = ma_dr_flac_open(onRead, onSeek, onTell, pUserData, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_s32(pFlac, channelsOut, sampleRateOut, totalPCMFrameCountOut); } @@ -92463,8 +92463,8 @@ MA_API ma_int16* ma_dr_flac_open_and_read_pcm_frames_s16(ma_dr_flac_read_proc on *totalPCMFrameCountOut = 0; } pFlac = ma_dr_flac_open(onRead, onSeek, onTell, pUserData, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_s16(pFlac, channelsOut, sampleRateOut, totalPCMFrameCountOut); } @@ -92481,8 +92481,8 @@ MA_API float* ma_dr_flac_open_and_read_pcm_frames_f32(ma_dr_flac_read_proc onRea *totalPCMFrameCountOut = 0; } pFlac = ma_dr_flac_open(onRead, onSeek, onTell, pUserData, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_f32(pFlac, channelsOut, sampleRateOut, totalPCMFrameCountOut); } @@ -92500,8 +92500,8 @@ MA_API ma_int32* ma_dr_flac_open_file_and_read_pcm_frames_s32(const char* filena *totalPCMFrameCount = 0; } pFlac = ma_dr_flac_open_file(filename, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_s32(pFlac, channels, sampleRate, totalPCMFrameCount); } @@ -92518,8 +92518,8 @@ MA_API ma_int16* ma_dr_flac_open_file_and_read_pcm_frames_s16(const char* filena *totalPCMFrameCount = 0; } pFlac = ma_dr_flac_open_file(filename, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_s16(pFlac, channels, sampleRate, totalPCMFrameCount); } @@ -92536,8 +92536,8 @@ MA_API float* ma_dr_flac_open_file_and_read_pcm_frames_f32(const char* filename, *totalPCMFrameCount = 0; } pFlac = ma_dr_flac_open_file(filename, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_f32(pFlac, channels, sampleRate, totalPCMFrameCount); } @@ -92555,8 +92555,8 @@ MA_API ma_int32* ma_dr_flac_open_memory_and_read_pcm_frames_s32(const void* data *totalPCMFrameCount = 0; } pFlac = ma_dr_flac_open_memory(data, dataSize, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_s32(pFlac, channels, sampleRate, totalPCMFrameCount); } @@ -92573,8 +92573,8 @@ MA_API ma_int16* ma_dr_flac_open_memory_and_read_pcm_frames_s16(const void* data *totalPCMFrameCount = 0; } pFlac = ma_dr_flac_open_memory(data, dataSize, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_s16(pFlac, channels, sampleRate, totalPCMFrameCount); } @@ -92591,22 +92591,22 @@ MA_API float* ma_dr_flac_open_memory_and_read_pcm_frames_f32(const void* data, s *totalPCMFrameCount = 0; } pFlac = ma_dr_flac_open_memory(data, dataSize, pAllocationCallbacks); - if (pFlac == NULL) { - return NULL; + if (pFlac == nullptr) { + return nullptr; } return ma_dr_flac__full_read_and_close_f32(pFlac, channels, sampleRate, totalPCMFrameCount); } MA_API void ma_dr_flac_free(void* p, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks != NULL) { + if (pAllocationCallbacks != nullptr) { ma_dr_flac__free_from_callbacks(p, pAllocationCallbacks); } else { - ma_dr_flac__free_default(p, NULL); + ma_dr_flac__free_default(p, nullptr); } } MA_API void ma_dr_flac_init_vorbis_comment_iterator(ma_dr_flac_vorbis_comment_iterator* pIter, ma_uint32 commentCount, const void* pComments) { - if (pIter == NULL) { + if (pIter == nullptr) { return; } pIter->countRemaining = commentCount; @@ -92619,8 +92619,8 @@ MA_API const char* ma_dr_flac_next_vorbis_comment(ma_dr_flac_vorbis_comment_iter if (pCommentLengthOut) { *pCommentLengthOut = 0; } - if (pIter == NULL || pIter->countRemaining == 0 || pIter->pRunningData == NULL) { - return NULL; + if (pIter == nullptr || pIter->countRemaining == 0 || pIter->pRunningData == nullptr) { + return nullptr; } length = ma_dr_flac__le2host_32_ptr_unaligned(pIter->pRunningData); pIter->pRunningData += 4; @@ -92634,7 +92634,7 @@ MA_API const char* ma_dr_flac_next_vorbis_comment(ma_dr_flac_vorbis_comment_iter } MA_API void ma_dr_flac_init_cuesheet_track_iterator(ma_dr_flac_cuesheet_track_iterator* pIter, ma_uint32 trackCount, const void* pTrackData) { - if (pIter == NULL) { + if (pIter == nullptr) { return; } pIter->countRemaining = trackCount; @@ -92646,7 +92646,7 @@ MA_API ma_bool32 ma_dr_flac_next_cuesheet_track(ma_dr_flac_cuesheet_track_iterat const char* pRunningData; ma_uint64 offsetHi; ma_uint64 offsetLo; - if (pIter == NULL || pIter->countRemaining == 0 || pIter->pRunningData == NULL) { + if (pIter == nullptr || pIter->countRemaining == 0 || pIter->pRunningData == nullptr) { return MA_FALSE; } pRunningData = pIter->pRunningData; @@ -94289,7 +94289,7 @@ MA_API int ma_dr_mp3dec_decode_frame(ma_dr_mp3dec *dec, const ma_uint8 *mp3, int return 0; } success = ma_dr_mp3_L3_restore_reservoir(dec, bs_frame, &dec->scratch, main_data_begin); - if (success && pcm != NULL) + if (success && pcm != nullptr) { for (igr = 0; igr < (MA_DR_MP3_HDR_TEST_MPEG1(hdr) ? 2 : 1); igr++, pcm = MA_DR_MP3_OFFSET_PTR(pcm, sizeof(ma_dr_mp3d_sample_t)*576*info->channels)) { @@ -94305,7 +94305,7 @@ MA_API int ma_dr_mp3dec_decode_frame(ma_dr_mp3dec *dec, const ma_uint8 *mp3, int return 0; #else ma_dr_mp3_L12_scale_info sci[1]; - if (pcm == NULL) { + if (pcm == nullptr) { return ma_dr_mp3_hdr_frame_samples(hdr); } ma_dr_mp3_L12_read_scale_info(hdr, bs_frame, sci); @@ -94438,55 +94438,55 @@ static void ma_dr_mp3__free_default(void* p, void* pUserData) } static void* ma_dr_mp3__malloc_from_callbacks(size_t sz, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks == NULL) { - return NULL; + if (pAllocationCallbacks == nullptr) { + return nullptr; } - if (pAllocationCallbacks->onMalloc != NULL) { + if (pAllocationCallbacks->onMalloc != nullptr) { return pAllocationCallbacks->onMalloc(sz, pAllocationCallbacks->pUserData); } - if (pAllocationCallbacks->onRealloc != NULL) { - return pAllocationCallbacks->onRealloc(NULL, sz, pAllocationCallbacks->pUserData); + if (pAllocationCallbacks->onRealloc != nullptr) { + return pAllocationCallbacks->onRealloc(nullptr, sz, pAllocationCallbacks->pUserData); } - return NULL; + return nullptr; } static void* ma_dr_mp3__realloc_from_callbacks(void* p, size_t szNew, size_t szOld, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks == NULL) { - return NULL; + if (pAllocationCallbacks == nullptr) { + return nullptr; } - if (pAllocationCallbacks->onRealloc != NULL) { + if (pAllocationCallbacks->onRealloc != nullptr) { return pAllocationCallbacks->onRealloc(p, szNew, pAllocationCallbacks->pUserData); } - if (pAllocationCallbacks->onMalloc != NULL && pAllocationCallbacks->onFree != NULL) { + if (pAllocationCallbacks->onMalloc != nullptr && pAllocationCallbacks->onFree != nullptr) { void* p2; p2 = pAllocationCallbacks->onMalloc(szNew, pAllocationCallbacks->pUserData); - if (p2 == NULL) { - return NULL; + if (p2 == nullptr) { + return nullptr; } - if (p != NULL) { + if (p != nullptr) { MA_DR_MP3_COPY_MEMORY(p2, p, szOld); pAllocationCallbacks->onFree(p, pAllocationCallbacks->pUserData); } return p2; } - return NULL; + return nullptr; } static void ma_dr_mp3__free_from_callbacks(void* p, const ma_allocation_callbacks* pAllocationCallbacks) { - if (p == NULL || pAllocationCallbacks == NULL) { + if (p == nullptr || pAllocationCallbacks == nullptr) { return; } - if (pAllocationCallbacks->onFree != NULL) { + if (pAllocationCallbacks->onFree != nullptr) { pAllocationCallbacks->onFree(p, pAllocationCallbacks->pUserData); } } static ma_allocation_callbacks ma_dr_mp3_copy_allocation_callbacks_or_defaults(const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks != NULL) { + if (pAllocationCallbacks != nullptr) { return *pAllocationCallbacks; } else { ma_allocation_callbacks allocationCallbacks; - allocationCallbacks.pUserData = NULL; + allocationCallbacks.pUserData = nullptr; allocationCallbacks.onMalloc = ma_dr_mp3__malloc_default; allocationCallbacks.onRealloc = ma_dr_mp3__realloc_default; allocationCallbacks.onFree = ma_dr_mp3__free_default; @@ -94496,8 +94496,8 @@ static ma_allocation_callbacks ma_dr_mp3_copy_allocation_callbacks_or_defaults(c static size_t ma_dr_mp3__on_read(ma_dr_mp3* pMP3, void* pBufferOut, size_t bytesToRead) { size_t bytesRead; - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(pMP3->onRead != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(pMP3->onRead != nullptr); if (bytesToRead == 0) { return 0; } @@ -94507,8 +94507,8 @@ static size_t ma_dr_mp3__on_read(ma_dr_mp3* pMP3, void* pBufferOut, size_t bytes } static size_t ma_dr_mp3__on_read_clamped(ma_dr_mp3* pMP3, void* pBufferOut, size_t bytesToRead) { - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(pMP3->onRead != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(pMP3->onRead != nullptr); if (pMP3->streamLength == MA_UINT64_MAX) { return ma_dr_mp3__on_read(pMP3, pBufferOut, bytesToRead); } else { @@ -94572,8 +94572,8 @@ static void ma_dr_mp3__on_meta(ma_dr_mp3* pMP3, ma_dr_mp3_metadata_type type, co static ma_uint32 ma_dr_mp3_decode_next_frame_ex__callbacks(ma_dr_mp3* pMP3, ma_dr_mp3d_sample_t* pPCMFrames, ma_dr_mp3dec_frame_info* pMP3FrameInfo, const ma_uint8** ppMP3FrameData) { ma_uint32 pcmFramesRead = 0; - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(pMP3->onRead != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(pMP3->onRead != nullptr); if (pMP3->atEnd) { return 0; } @@ -94581,7 +94581,7 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex__callbacks(ma_dr_mp3* pMP3, ma_d ma_dr_mp3dec_frame_info info; if (pMP3->dataSize < MA_DR_MP3_MIN_DATA_CHUNK_SIZE) { size_t bytesRead; - if (pMP3->pData != NULL) { + if (pMP3->pData != nullptr) { MA_DR_MP3_MOVE_MEMORY(pMP3->pData, pMP3->pData + pMP3->dataConsumed, pMP3->dataSize); } pMP3->dataConsumed = 0; @@ -94590,7 +94590,7 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex__callbacks(ma_dr_mp3* pMP3, ma_d size_t newDataCap; newDataCap = MA_DR_MP3_DATA_CHUNK_SIZE; pNewData = (ma_uint8*)ma_dr_mp3__realloc_from_callbacks(pMP3->pData, newDataCap, pMP3->dataCapacity, &pMP3->allocationCallbacks); - if (pNewData == NULL) { + if (pNewData == nullptr) { return 0; } pMP3->pData = pNewData; @@ -94609,9 +94609,9 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex__callbacks(ma_dr_mp3* pMP3, ma_d pMP3->atEnd = MA_TRUE; return 0; } - MA_DR_MP3_ASSERT(pMP3->pData != NULL); + MA_DR_MP3_ASSERT(pMP3->pData != nullptr); MA_DR_MP3_ASSERT(pMP3->dataCapacity > 0); - if (pMP3->pData == NULL) { + if (pMP3->pData == nullptr) { return 0; } pcmFramesRead = ma_dr_mp3dec_decode_frame(&pMP3->decoder, pMP3->pData + pMP3->dataConsumed, (int)pMP3->dataSize, pPCMFrames, &info); @@ -94623,10 +94623,10 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex__callbacks(ma_dr_mp3* pMP3, ma_d pMP3->pcmFramesRemainingInMP3Frame = pcmFramesRead; pMP3->mp3FrameChannels = info.channels; pMP3->mp3FrameSampleRate = info.sample_rate; - if (pMP3FrameInfo != NULL) { + if (pMP3FrameInfo != nullptr) { *pMP3FrameInfo = info; } - if (ppMP3FrameData != NULL) { + if (ppMP3FrameData != nullptr) { *ppMP3FrameData = pMP3->pData + pMP3->dataConsumed - (size_t)info.frame_bytes; } break; @@ -94639,7 +94639,7 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex__callbacks(ma_dr_mp3* pMP3, ma_d size_t newDataCap; newDataCap = pMP3->dataCapacity + MA_DR_MP3_DATA_CHUNK_SIZE; pNewData = (ma_uint8*)ma_dr_mp3__realloc_from_callbacks(pMP3->pData, newDataCap, pMP3->dataCapacity, &pMP3->allocationCallbacks); - if (pNewData == NULL) { + if (pNewData == nullptr) { return 0; } pMP3->pData = pNewData; @@ -94659,8 +94659,8 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex__memory(ma_dr_mp3* pMP3, ma_dr_m { ma_uint32 pcmFramesRead = 0; ma_dr_mp3dec_frame_info info; - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(pMP3->memory.pData != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(pMP3->memory.pData != nullptr); if (pMP3->atEnd) { return 0; } @@ -94672,10 +94672,10 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex__memory(ma_dr_mp3* pMP3, ma_dr_m pMP3->pcmFramesRemainingInMP3Frame = pcmFramesRead; pMP3->mp3FrameChannels = info.channels; pMP3->mp3FrameSampleRate = info.sample_rate; - if (pMP3FrameInfo != NULL) { + if (pMP3FrameInfo != nullptr) { *pMP3FrameInfo = info; } - if (ppMP3FrameData != NULL) { + if (ppMP3FrameData != nullptr) { *ppMP3FrameData = pMP3->memory.pData + pMP3->memory.currentReadPos; } break; @@ -94692,7 +94692,7 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex__memory(ma_dr_mp3* pMP3, ma_dr_m } static ma_uint32 ma_dr_mp3_decode_next_frame_ex(ma_dr_mp3* pMP3, ma_dr_mp3d_sample_t* pPCMFrames, ma_dr_mp3dec_frame_info* pMP3FrameInfo, const ma_uint8** ppMP3FrameData) { - if (pMP3->memory.pData != NULL && pMP3->memory.dataSize > 0) { + if (pMP3->memory.pData != nullptr && pMP3->memory.dataSize > 0) { return ma_dr_mp3_decode_next_frame_ex__memory(pMP3, pPCMFrames, pMP3FrameInfo, ppMP3FrameData); } else { return ma_dr_mp3_decode_next_frame_ex__callbacks(pMP3, pPCMFrames, pMP3FrameInfo, ppMP3FrameData); @@ -94700,15 +94700,15 @@ static ma_uint32 ma_dr_mp3_decode_next_frame_ex(ma_dr_mp3* pMP3, ma_dr_mp3d_samp } static ma_uint32 ma_dr_mp3_decode_next_frame(ma_dr_mp3* pMP3) { - MA_DR_MP3_ASSERT(pMP3 != NULL); - return ma_dr_mp3_decode_next_frame_ex(pMP3, (ma_dr_mp3d_sample_t*)pMP3->pcmFrames, NULL, NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + return ma_dr_mp3_decode_next_frame_ex(pMP3, (ma_dr_mp3d_sample_t*)pMP3->pcmFrames, nullptr, nullptr); } #if 0 static ma_uint32 ma_dr_mp3_seek_next_frame(ma_dr_mp3* pMP3) { ma_uint32 pcmFrameCount; - MA_DR_MP3_ASSERT(pMP3 != NULL); - pcmFrameCount = ma_dr_mp3_decode_next_frame_ex(pMP3, NULL, NULL, NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + pcmFrameCount = ma_dr_mp3_decode_next_frame_ex(pMP3, nullptr, nullptr, nullptr); if (pcmFrameCount == 0) { return 0; } @@ -94724,8 +94724,8 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on const ma_uint8* pFirstFrameData; ma_uint32 firstFramePCMFrameCount; ma_uint32 detectedMP3FrameCount = 0xFFFFFFFF; - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(onRead != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(onRead != nullptr); ma_dr_mp3dec_init(&pMP3->decoder); pMP3->onRead = onRead; pMP3->onSeek = onSeek; @@ -94733,7 +94733,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on pMP3->pUserData = pUserData; pMP3->pUserDataMeta = pUserDataMeta; pMP3->allocationCallbacks = ma_dr_mp3_copy_allocation_callbacks_or_defaults(pAllocationCallbacks); - if (pMP3->allocationCallbacks.onFree == NULL || (pMP3->allocationCallbacks.onMalloc == NULL && pMP3->allocationCallbacks.onRealloc == NULL)) { + if (pMP3->allocationCallbacks.onFree == nullptr || (pMP3->allocationCallbacks.onMalloc == nullptr && pMP3->allocationCallbacks.onRealloc == nullptr)) { return MA_FALSE; } pMP3->streamCursor = 0; @@ -94743,7 +94743,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on pMP3->paddingInPCMFrames = 0; pMP3->totalPCMFrameCount = MA_UINT64_MAX; #if 1 - if (onSeek != NULL && onTell != NULL) { + if (onSeek != nullptr && onTell != nullptr) { if (onSeek(pUserData, 0, MA_DR_MP3_SEEK_END)) { ma_int64 streamLen; int streamEndOffset = 0; @@ -94754,7 +94754,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on if (onRead(pUserData, id3, 3) == 3 && id3[0] == 'T' && id3[1] == 'A' && id3[2] == 'G') { streamEndOffset -= 128; streamLen -= 128; - if (onMeta != NULL) { + if (onMeta != nullptr) { ma_uint8 tag[128]; tag[0] = 'T'; tag[1] = 'A'; tag[2] = 'G'; if (onRead(pUserData, tag + 3, 125) == 125) { @@ -94779,11 +94779,11 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on if (32 + tagSize < streamLen) { streamEndOffset -= 32 + tagSize; streamLen -= 32 + tagSize; - if (onMeta != NULL) { + if (onMeta != nullptr) { if (onSeek(pUserData, streamEndOffset, MA_DR_MP3_SEEK_END)) { size_t apeTagSize = (size_t)tagSize + 32; ma_uint8* pTagData = (ma_uint8*)ma_dr_mp3_malloc(apeTagSize, pAllocationCallbacks); - if (pTagData != NULL) { + if (pTagData != nullptr) { if (onRead(pUserData, pTagData, apeTagSize) == apeTagSize) { ma_dr_mp3__on_meta(pMP3, MA_DR_MP3_METADATA_TYPE_APE, pTagData, apeTagSize); } @@ -94801,7 +94801,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on return MA_FALSE; } pMP3->streamLength = (ma_uint64)streamLen; - if (pMP3->memory.pData != NULL) { + if (pMP3->memory.pData != nullptr) { pMP3->memory.dataSize = (size_t)pMP3->streamLength; } } else { @@ -94827,10 +94827,10 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on if (header[5] & 0x10) { tagSize += 10; } - if (onMeta != NULL) { + if (onMeta != nullptr) { size_t tagSizeWithHeader = 10 + tagSize; ma_uint8* pTagData = (ma_uint8*)ma_dr_mp3_malloc(tagSizeWithHeader, pAllocationCallbacks); - if (pTagData != NULL) { + if (pTagData != nullptr) { MA_DR_MP3_COPY_MEMORY(pTagData, header, 10); if (onRead(pUserData, pTagData + 10, tagSize) == tagSize) { ma_dr_mp3__on_meta(pMP3, MA_DR_MP3_METADATA_TYPE_ID3V2, pTagData, tagSizeWithHeader); @@ -94838,7 +94838,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on ma_dr_mp3_free(pTagData, pAllocationCallbacks); } } else { - if (onSeek != NULL) { + if (onSeek != nullptr) { if (!onSeek(pUserData, tagSize, MA_DR_MP3_SEEK_CUR)) { return MA_FALSE; } @@ -94859,7 +94859,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on pMP3->streamStartOffset += 10 + tagSize; pMP3->streamCursor = pMP3->streamStartOffset; } else { - if (onSeek != NULL) { + if (onSeek != nullptr) { if (!onSeek(pUserData, 0, MA_DR_MP3_SEEK_SET)) { return MA_FALSE; } @@ -94873,7 +94873,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on #endif firstFramePCMFrameCount = ma_dr_mp3_decode_next_frame_ex(pMP3, (ma_dr_mp3d_sample_t*)pMP3->pcmFrames, &firstFrameInfo, &pFirstFrameData); if (firstFramePCMFrameCount > 0) { - MA_DR_MP3_ASSERT(pFirstFrameData != NULL); + MA_DR_MP3_ASSERT(pFirstFrameData != nullptr); #if 1 MA_DR_MP3_ASSERT(firstFrameInfo.frame_bytes > 0); { @@ -94930,7 +94930,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on } else if (isInfo) { pMP3->isCBR = MA_TRUE; } - if (onMeta != NULL) { + if (onMeta != nullptr) { ma_dr_mp3_metadata_type metadataType = isXing ? MA_DR_MP3_METADATA_TYPE_XING : MA_DR_MP3_METADATA_TYPE_VBRI; size_t tagDataSize; tagDataSize = (size_t)firstFrameInfo.frame_bytes; @@ -94959,7 +94959,7 @@ static ma_bool32 ma_dr_mp3_init_internal(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc on } MA_API ma_bool32 ma_dr_mp3_init(ma_dr_mp3* pMP3, ma_dr_mp3_read_proc onRead, ma_dr_mp3_seek_proc onSeek, ma_dr_mp3_tell_proc onTell, ma_dr_mp3_meta_proc onMeta, void* pUserData, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pMP3 == NULL || onRead == NULL) { + if (pMP3 == nullptr || onRead == nullptr) { return MA_FALSE; } MA_DR_MP3_ZERO_OBJECT(pMP3); @@ -94969,7 +94969,7 @@ static size_t ma_dr_mp3__on_read_memory(void* pUserData, void* pBufferOut, size_ { ma_dr_mp3* pMP3 = (ma_dr_mp3*)pUserData; size_t bytesRemaining; - MA_DR_MP3_ASSERT(pMP3 != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); MA_DR_MP3_ASSERT(pMP3->memory.dataSize >= pMP3->memory.currentReadPos); bytesRemaining = pMP3->memory.dataSize - pMP3->memory.currentReadPos; if (bytesToRead > bytesRemaining) { @@ -94985,7 +94985,7 @@ static ma_bool32 ma_dr_mp3__on_seek_memory(void* pUserData, int byteOffset, ma_d { ma_dr_mp3* pMP3 = (ma_dr_mp3*)pUserData; ma_int64 newCursor; - MA_DR_MP3_ASSERT(pMP3 != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); if (origin == MA_DR_MP3_SEEK_SET) { newCursor = 0; } else if (origin == MA_DR_MP3_SEEK_CUR) { @@ -95009,19 +95009,19 @@ static ma_bool32 ma_dr_mp3__on_seek_memory(void* pUserData, int byteOffset, ma_d static ma_bool32 ma_dr_mp3__on_tell_memory(void* pUserData, ma_int64* pCursor) { ma_dr_mp3* pMP3 = (ma_dr_mp3*)pUserData; - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(pCursor != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(pCursor != nullptr); *pCursor = (ma_int64)pMP3->memory.currentReadPos; return MA_TRUE; } MA_API ma_bool32 ma_dr_mp3_init_memory_with_metadata(ma_dr_mp3* pMP3, const void* pData, size_t dataSize, ma_dr_mp3_meta_proc onMeta, void* pUserDataMeta, const ma_allocation_callbacks* pAllocationCallbacks) { ma_bool32 result; - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_FALSE; } MA_DR_MP3_ZERO_OBJECT(pMP3); - if (pData == NULL || dataSize == 0) { + if (pData == nullptr || dataSize == 0) { return MA_FALSE; } pMP3->memory.pData = (const ma_uint8*)pData; @@ -95041,7 +95041,7 @@ MA_API ma_bool32 ma_dr_mp3_init_memory_with_metadata(ma_dr_mp3* pMP3, const void } MA_API ma_bool32 ma_dr_mp3_init_memory(ma_dr_mp3* pMP3, const void* pData, size_t dataSize, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_mp3_init_memory_with_metadata(pMP3, pData, dataSize, NULL, NULL, pAllocationCallbacks); + return ma_dr_mp3_init_memory_with_metadata(pMP3, pData, dataSize, nullptr, nullptr, pAllocationCallbacks); } #ifndef MA_DR_MP3_NO_STDIO #include @@ -95064,8 +95064,8 @@ static ma_bool32 ma_dr_mp3__on_tell_stdio(void* pUserData, ma_int64* pCursor) { FILE* pFileStdio = (FILE*)pUserData; ma_int64 result; - MA_DR_MP3_ASSERT(pFileStdio != NULL); - MA_DR_MP3_ASSERT(pCursor != NULL); + MA_DR_MP3_ASSERT(pFileStdio != nullptr); + MA_DR_MP3_ASSERT(pCursor != nullptr); #if defined(_WIN32) && !defined(NXDK) #if defined(_MSC_VER) && _MSC_VER > 1200 result = _ftelli64(pFileStdio); @@ -95082,7 +95082,7 @@ MA_API ma_bool32 ma_dr_mp3_init_file_with_metadata(ma_dr_mp3* pMP3, const char* { ma_bool32 result; FILE* pFile; - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_FALSE; } MA_DR_MP3_ZERO_OBJECT(pMP3); @@ -95100,7 +95100,7 @@ MA_API ma_bool32 ma_dr_mp3_init_file_with_metadata_w(ma_dr_mp3* pMP3, const wcha { ma_bool32 result; FILE* pFile; - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_FALSE; } MA_DR_MP3_ZERO_OBJECT(pMP3); @@ -95116,24 +95116,24 @@ MA_API ma_bool32 ma_dr_mp3_init_file_with_metadata_w(ma_dr_mp3* pMP3, const wcha } MA_API ma_bool32 ma_dr_mp3_init_file(ma_dr_mp3* pMP3, const char* pFilePath, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_mp3_init_file_with_metadata(pMP3, pFilePath, NULL, NULL, pAllocationCallbacks); + return ma_dr_mp3_init_file_with_metadata(pMP3, pFilePath, nullptr, nullptr, pAllocationCallbacks); } MA_API ma_bool32 ma_dr_mp3_init_file_w(ma_dr_mp3* pMP3, const wchar_t* pFilePath, const ma_allocation_callbacks* pAllocationCallbacks) { - return ma_dr_mp3_init_file_with_metadata_w(pMP3, pFilePath, NULL, NULL, pAllocationCallbacks); + return ma_dr_mp3_init_file_with_metadata_w(pMP3, pFilePath, nullptr, nullptr, pAllocationCallbacks); } #endif MA_API void ma_dr_mp3_uninit(ma_dr_mp3* pMP3) { - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return; } #ifndef MA_DR_MP3_NO_STDIO if (pMP3->onRead == ma_dr_mp3__on_read_stdio) { FILE* pFile = (FILE*)pMP3->pUserData; - if (pFile != NULL) { + if (pFile != nullptr) { fclose(pFile); - pMP3->pUserData = NULL; + pMP3->pUserData = nullptr; } } #endif @@ -95188,8 +95188,8 @@ static void ma_dr_mp3_s16_to_f32(float* dst, const ma_int16* src, ma_uint64 samp static ma_uint64 ma_dr_mp3_read_pcm_frames_raw(ma_dr_mp3* pMP3, ma_uint64 framesToRead, void* pBufferOut) { ma_uint64 totalFramesRead = 0; - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(pMP3->onRead != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(pMP3->onRead != nullptr); while (framesToRead > 0) { ma_uint32 framesToConsume; if (pMP3->currentPCMFrame < pMP3->delayInPCMFrames) { @@ -95209,7 +95209,7 @@ static ma_uint64 ma_dr_mp3_read_pcm_frames_raw(ma_dr_mp3* pMP3, ma_uint64 frames break; } } - if (pBufferOut != NULL) { + if (pBufferOut != nullptr) { #if defined(MA_DR_MP3_FLOAT_OUTPUT) { float* pFramesOutF32 = (float*)MA_DR_MP3_OFFSET_PTR(pBufferOut, sizeof(float) * totalFramesRead * pMP3->channels); @@ -95244,7 +95244,7 @@ static ma_uint64 ma_dr_mp3_read_pcm_frames_raw(ma_dr_mp3* pMP3, ma_uint64 frames } MA_API ma_uint64 ma_dr_mp3_read_pcm_frames_f32(ma_dr_mp3* pMP3, ma_uint64 framesToRead, float* pBufferOut) { - if (pMP3 == NULL || pMP3->onRead == NULL) { + if (pMP3 == nullptr || pMP3->onRead == nullptr) { return 0; } #if defined(MA_DR_MP3_FLOAT_OUTPUT) @@ -95273,7 +95273,7 @@ MA_API ma_uint64 ma_dr_mp3_read_pcm_frames_f32(ma_dr_mp3* pMP3, ma_uint64 frames } MA_API ma_uint64 ma_dr_mp3_read_pcm_frames_s16(ma_dr_mp3* pMP3, ma_uint64 framesToRead, ma_int16* pBufferOut) { - if (pMP3 == NULL || pMP3->onRead == NULL) { + if (pMP3 == nullptr || pMP3->onRead == nullptr) { return 0; } #if !defined(MA_DR_MP3_FLOAT_OUTPUT) @@ -95302,7 +95302,7 @@ MA_API ma_uint64 ma_dr_mp3_read_pcm_frames_s16(ma_dr_mp3* pMP3, ma_uint64 frames } static void ma_dr_mp3_reset(ma_dr_mp3* pMP3) { - MA_DR_MP3_ASSERT(pMP3 != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); pMP3->pcmFramesConsumedInMP3Frame = 0; pMP3->pcmFramesRemainingInMP3Frame = 0; pMP3->currentPCMFrame = 0; @@ -95312,8 +95312,8 @@ static void ma_dr_mp3_reset(ma_dr_mp3* pMP3) } static ma_bool32 ma_dr_mp3_seek_to_start_of_stream(ma_dr_mp3* pMP3) { - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(pMP3->onSeek != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(pMP3->onSeek != nullptr); if (!ma_dr_mp3__on_seek_64(pMP3, pMP3->streamStartOffset, MA_DR_MP3_SEEK_SET)) { return MA_FALSE; } @@ -95324,9 +95324,9 @@ static ma_bool32 ma_dr_mp3_seek_forward_by_pcm_frames__brute_force(ma_dr_mp3* pM { ma_uint64 framesRead; #if defined(MA_DR_MP3_FLOAT_OUTPUT) - framesRead = ma_dr_mp3_read_pcm_frames_f32(pMP3, frameOffset, NULL); + framesRead = ma_dr_mp3_read_pcm_frames_f32(pMP3, frameOffset, nullptr); #else - framesRead = ma_dr_mp3_read_pcm_frames_s16(pMP3, frameOffset, NULL); + framesRead = ma_dr_mp3_read_pcm_frames_s16(pMP3, frameOffset, nullptr); #endif if (framesRead != frameOffset) { return MA_FALSE; @@ -95335,7 +95335,7 @@ static ma_bool32 ma_dr_mp3_seek_forward_by_pcm_frames__brute_force(ma_dr_mp3* pM } static ma_bool32 ma_dr_mp3_seek_to_pcm_frame__brute_force(ma_dr_mp3* pMP3, ma_uint64 frameIndex) { - MA_DR_MP3_ASSERT(pMP3 != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); if (frameIndex == pMP3->currentPCMFrame) { return MA_TRUE; } @@ -95350,7 +95350,7 @@ static ma_bool32 ma_dr_mp3_seek_to_pcm_frame__brute_force(ma_dr_mp3* pMP3, ma_ui static ma_bool32 ma_dr_mp3_find_closest_seek_point(ma_dr_mp3* pMP3, ma_uint64 frameIndex, ma_uint32* pSeekPointIndex) { ma_uint32 iSeekPoint; - MA_DR_MP3_ASSERT(pSeekPointIndex != NULL); + MA_DR_MP3_ASSERT(pSeekPointIndex != nullptr); *pSeekPointIndex = 0; if (frameIndex < pMP3->pSeekPoints[0].pcmFrameIndex) { return MA_FALSE; @@ -95369,8 +95369,8 @@ static ma_bool32 ma_dr_mp3_seek_to_pcm_frame__seek_table(ma_dr_mp3* pMP3, ma_uin ma_uint32 priorSeekPointIndex; ma_uint16 iMP3Frame; ma_uint64 leftoverFrames; - MA_DR_MP3_ASSERT(pMP3 != NULL); - MA_DR_MP3_ASSERT(pMP3->pSeekPoints != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); + MA_DR_MP3_ASSERT(pMP3->pSeekPoints != nullptr); MA_DR_MP3_ASSERT(pMP3->seekPointCount > 0); if (ma_dr_mp3_find_closest_seek_point(pMP3, frameIndex, &priorSeekPointIndex)) { seekPoint = pMP3->pSeekPoints[priorSeekPointIndex]; @@ -95387,11 +95387,11 @@ static ma_bool32 ma_dr_mp3_seek_to_pcm_frame__seek_table(ma_dr_mp3* pMP3, ma_uin for (iMP3Frame = 0; iMP3Frame < seekPoint.mp3FramesToDiscard; ++iMP3Frame) { ma_uint32 pcmFramesRead; ma_dr_mp3d_sample_t* pPCMFrames; - pPCMFrames = NULL; + pPCMFrames = nullptr; if (iMP3Frame == seekPoint.mp3FramesToDiscard-1) { pPCMFrames = (ma_dr_mp3d_sample_t*)pMP3->pcmFrames; } - pcmFramesRead = ma_dr_mp3_decode_next_frame_ex(pMP3, pPCMFrames, NULL, NULL); + pcmFramesRead = ma_dr_mp3_decode_next_frame_ex(pMP3, pPCMFrames, nullptr, nullptr); if (pcmFramesRead == 0) { return MA_FALSE; } @@ -95402,13 +95402,13 @@ static ma_bool32 ma_dr_mp3_seek_to_pcm_frame__seek_table(ma_dr_mp3* pMP3, ma_uin } MA_API ma_bool32 ma_dr_mp3_seek_to_pcm_frame(ma_dr_mp3* pMP3, ma_uint64 frameIndex) { - if (pMP3 == NULL || pMP3->onSeek == NULL) { + if (pMP3 == nullptr || pMP3->onSeek == nullptr) { return MA_FALSE; } if (frameIndex == 0) { return ma_dr_mp3_seek_to_start_of_stream(pMP3); } - if (pMP3->pSeekPoints != NULL && pMP3->seekPointCount > 0) { + if (pMP3->pSeekPoints != nullptr && pMP3->seekPointCount > 0) { return ma_dr_mp3_seek_to_pcm_frame__seek_table(pMP3, frameIndex); } else { return ma_dr_mp3_seek_to_pcm_frame__brute_force(pMP3, frameIndex); @@ -95419,10 +95419,10 @@ MA_API ma_bool32 ma_dr_mp3_get_mp3_and_pcm_frame_count(ma_dr_mp3* pMP3, ma_uint6 ma_uint64 currentPCMFrame; ma_uint64 totalPCMFrameCount; ma_uint64 totalMP3FrameCount; - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_FALSE; } - if (pMP3->onSeek == NULL) { + if (pMP3->onSeek == nullptr) { return MA_FALSE; } currentPCMFrame = pMP3->currentPCMFrame; @@ -95433,7 +95433,7 @@ MA_API ma_bool32 ma_dr_mp3_get_mp3_and_pcm_frame_count(ma_dr_mp3* pMP3, ma_uint6 totalMP3FrameCount = 0; for (;;) { ma_uint32 pcmFramesInCurrentMP3Frame; - pcmFramesInCurrentMP3Frame = ma_dr_mp3_decode_next_frame_ex(pMP3, NULL, NULL, NULL); + pcmFramesInCurrentMP3Frame = ma_dr_mp3_decode_next_frame_ex(pMP3, nullptr, nullptr, nullptr); if (pcmFramesInCurrentMP3Frame == 0) { break; } @@ -95446,10 +95446,10 @@ MA_API ma_bool32 ma_dr_mp3_get_mp3_and_pcm_frame_count(ma_dr_mp3* pMP3, ma_uint6 if (!ma_dr_mp3_seek_to_pcm_frame(pMP3, currentPCMFrame)) { return MA_FALSE; } - if (pMP3FrameCount != NULL) { + if (pMP3FrameCount != nullptr) { *pMP3FrameCount = totalMP3FrameCount; } - if (pPCMFrameCount != NULL) { + if (pPCMFrameCount != nullptr) { *pPCMFrameCount = totalPCMFrameCount; } return MA_TRUE; @@ -95457,7 +95457,7 @@ MA_API ma_bool32 ma_dr_mp3_get_mp3_and_pcm_frame_count(ma_dr_mp3* pMP3, ma_uint6 MA_API ma_uint64 ma_dr_mp3_get_pcm_frame_count(ma_dr_mp3* pMP3) { ma_uint64 totalPCMFrameCount; - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return 0; } if (pMP3->totalPCMFrameCount != MA_UINT64_MAX) { @@ -95472,7 +95472,7 @@ MA_API ma_uint64 ma_dr_mp3_get_pcm_frame_count(ma_dr_mp3* pMP3) } return totalPCMFrameCount; } else { - if (!ma_dr_mp3_get_mp3_and_pcm_frame_count(pMP3, NULL, &totalPCMFrameCount)) { + if (!ma_dr_mp3_get_mp3_and_pcm_frame_count(pMP3, nullptr, &totalPCMFrameCount)) { return 0; } return totalPCMFrameCount; @@ -95481,7 +95481,7 @@ MA_API ma_uint64 ma_dr_mp3_get_pcm_frame_count(ma_dr_mp3* pMP3) MA_API ma_uint64 ma_dr_mp3_get_mp3_frame_count(ma_dr_mp3* pMP3) { ma_uint64 totalMP3FrameCount; - if (!ma_dr_mp3_get_mp3_and_pcm_frame_count(pMP3, &totalMP3FrameCount, NULL)) { + if (!ma_dr_mp3_get_mp3_and_pcm_frame_count(pMP3, &totalMP3FrameCount, nullptr)) { return 0; } return totalMP3FrameCount; @@ -95509,7 +95509,7 @@ MA_API ma_bool32 ma_dr_mp3_calculate_seek_points(ma_dr_mp3* pMP3, ma_uint32* pSe ma_uint64 currentPCMFrame; ma_uint64 totalMP3FrameCount; ma_uint64 totalPCMFrameCount; - if (pMP3 == NULL || pSeekPointCount == NULL || pSeekPoints == NULL) { + if (pMP3 == nullptr || pSeekPointCount == nullptr || pSeekPoints == nullptr) { return MA_FALSE; } seekPointCount = *pSeekPointCount; @@ -95546,7 +95546,7 @@ MA_API ma_bool32 ma_dr_mp3_calculate_seek_points(ma_dr_mp3* pMP3, ma_uint32* pSe MA_DR_MP3_ASSERT(pMP3->streamCursor >= pMP3->dataSize); mp3FrameInfo[iMP3Frame].bytePos = pMP3->streamCursor - pMP3->dataSize; mp3FrameInfo[iMP3Frame].pcmFrameIndex = runningPCMFrameCount; - pcmFramesInCurrentMP3FrameIn = ma_dr_mp3_decode_next_frame_ex(pMP3, NULL, NULL, NULL); + pcmFramesInCurrentMP3FrameIn = ma_dr_mp3_decode_next_frame_ex(pMP3, nullptr, nullptr, nullptr); if (pcmFramesInCurrentMP3FrameIn == 0) { return MA_FALSE; } @@ -95570,7 +95570,7 @@ MA_API ma_bool32 ma_dr_mp3_calculate_seek_points(ma_dr_mp3* pMP3, ma_uint32* pSe } mp3FrameInfo[MA_DR_MP3_COUNTOF(mp3FrameInfo)-1].bytePos = pMP3->streamCursor - pMP3->dataSize; mp3FrameInfo[MA_DR_MP3_COUNTOF(mp3FrameInfo)-1].pcmFrameIndex = runningPCMFrameCount; - pcmFramesInCurrentMP3FrameIn = ma_dr_mp3_decode_next_frame_ex(pMP3, NULL, NULL, NULL); + pcmFramesInCurrentMP3FrameIn = ma_dr_mp3_decode_next_frame_ex(pMP3, nullptr, nullptr, nullptr); if (pcmFramesInCurrentMP3FrameIn == 0) { pSeekPoints[iSeekPoint].seekPosInBytes = mp3FrameInfo[0].bytePos; pSeekPoints[iSeekPoint].pcmFrameIndex = nextTargetPCMFrame; @@ -95594,12 +95594,12 @@ MA_API ma_bool32 ma_dr_mp3_calculate_seek_points(ma_dr_mp3* pMP3, ma_uint32* pSe } MA_API ma_bool32 ma_dr_mp3_bind_seek_table(ma_dr_mp3* pMP3, ma_uint32 seekPointCount, ma_dr_mp3_seek_point* pSeekPoints) { - if (pMP3 == NULL) { + if (pMP3 == nullptr) { return MA_FALSE; } - if (seekPointCount == 0 || pSeekPoints == NULL) { + if (seekPointCount == 0 || pSeekPoints == nullptr) { pMP3->seekPointCount = 0; - pMP3->pSeekPoints = NULL; + pMP3->pSeekPoints = nullptr; } else { pMP3->seekPointCount = seekPointCount; pMP3->pSeekPoints = pSeekPoints; @@ -95610,9 +95610,9 @@ static float* ma_dr_mp3__full_read_and_close_f32(ma_dr_mp3* pMP3, ma_dr_mp3_conf { ma_uint64 totalFramesRead = 0; ma_uint64 framesCapacity = 0; - float* pFrames = NULL; + float* pFrames = nullptr; float temp[4096]; - MA_DR_MP3_ASSERT(pMP3 != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); for (;;) { ma_uint64 framesToReadRightNow = MA_DR_MP3_COUNTOF(temp) / pMP3->channels; ma_uint64 framesJustRead = ma_dr_mp3_read_pcm_frames_f32(pMP3, framesToReadRightNow, temp); @@ -95634,9 +95634,9 @@ static float* ma_dr_mp3__full_read_and_close_f32(ma_dr_mp3* pMP3, ma_dr_mp3_conf break; } pNewFrames = (float*)ma_dr_mp3__realloc_from_callbacks(pFrames, (size_t)newFramesBufferSize, (size_t)oldFramesBufferSize, &pMP3->allocationCallbacks); - if (pNewFrames == NULL) { + if (pNewFrames == nullptr) { ma_dr_mp3__free_from_callbacks(pFrames, &pMP3->allocationCallbacks); - pFrames = NULL; + pFrames = nullptr; totalFramesRead = 0; break; } @@ -95649,7 +95649,7 @@ static float* ma_dr_mp3__full_read_and_close_f32(ma_dr_mp3* pMP3, ma_dr_mp3_conf break; } } - if (pConfig != NULL) { + if (pConfig != nullptr) { pConfig->channels = pMP3->channels; pConfig->sampleRate = pMP3->sampleRate; } @@ -95663,9 +95663,9 @@ static ma_int16* ma_dr_mp3__full_read_and_close_s16(ma_dr_mp3* pMP3, ma_dr_mp3_c { ma_uint64 totalFramesRead = 0; ma_uint64 framesCapacity = 0; - ma_int16* pFrames = NULL; + ma_int16* pFrames = nullptr; ma_int16 temp[4096]; - MA_DR_MP3_ASSERT(pMP3 != NULL); + MA_DR_MP3_ASSERT(pMP3 != nullptr); for (;;) { ma_uint64 framesToReadRightNow = MA_DR_MP3_COUNTOF(temp) / pMP3->channels; ma_uint64 framesJustRead = ma_dr_mp3_read_pcm_frames_s16(pMP3, framesToReadRightNow, temp); @@ -95687,9 +95687,9 @@ static ma_int16* ma_dr_mp3__full_read_and_close_s16(ma_dr_mp3* pMP3, ma_dr_mp3_c break; } pNewFrames = (ma_int16*)ma_dr_mp3__realloc_from_callbacks(pFrames, (size_t)newFramesBufferSize, (size_t)oldFramesBufferSize, &pMP3->allocationCallbacks); - if (pNewFrames == NULL) { + if (pNewFrames == nullptr) { ma_dr_mp3__free_from_callbacks(pFrames, &pMP3->allocationCallbacks); - pFrames = NULL; + pFrames = nullptr; totalFramesRead = 0; break; } @@ -95702,7 +95702,7 @@ static ma_int16* ma_dr_mp3__full_read_and_close_s16(ma_dr_mp3* pMP3, ma_dr_mp3_c break; } } - if (pConfig != NULL) { + if (pConfig != nullptr) { pConfig->channels = pMP3->channels; pConfig->sampleRate = pMP3->sampleRate; } @@ -95715,16 +95715,16 @@ static ma_int16* ma_dr_mp3__full_read_and_close_s16(ma_dr_mp3* pMP3, ma_dr_mp3_c MA_API float* ma_dr_mp3_open_and_read_pcm_frames_f32(ma_dr_mp3_read_proc onRead, ma_dr_mp3_seek_proc onSeek, ma_dr_mp3_tell_proc onTell, void* pUserData, ma_dr_mp3_config* pConfig, ma_uint64* pTotalFrameCount, const ma_allocation_callbacks* pAllocationCallbacks) { ma_dr_mp3 mp3; - if (!ma_dr_mp3_init(&mp3, onRead, onSeek, onTell, NULL, pUserData, pAllocationCallbacks)) { - return NULL; + if (!ma_dr_mp3_init(&mp3, onRead, onSeek, onTell, nullptr, pUserData, pAllocationCallbacks)) { + return nullptr; } return ma_dr_mp3__full_read_and_close_f32(&mp3, pConfig, pTotalFrameCount); } MA_API ma_int16* ma_dr_mp3_open_and_read_pcm_frames_s16(ma_dr_mp3_read_proc onRead, ma_dr_mp3_seek_proc onSeek, ma_dr_mp3_tell_proc onTell, void* pUserData, ma_dr_mp3_config* pConfig, ma_uint64* pTotalFrameCount, const ma_allocation_callbacks* pAllocationCallbacks) { ma_dr_mp3 mp3; - if (!ma_dr_mp3_init(&mp3, onRead, onSeek, onTell, NULL, pUserData, pAllocationCallbacks)) { - return NULL; + if (!ma_dr_mp3_init(&mp3, onRead, onSeek, onTell, nullptr, pUserData, pAllocationCallbacks)) { + return nullptr; } return ma_dr_mp3__full_read_and_close_s16(&mp3, pConfig, pTotalFrameCount); } @@ -95732,7 +95732,7 @@ MA_API float* ma_dr_mp3_open_memory_and_read_pcm_frames_f32(const void* pData, s { ma_dr_mp3 mp3; if (!ma_dr_mp3_init_memory(&mp3, pData, dataSize, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_mp3__full_read_and_close_f32(&mp3, pConfig, pTotalFrameCount); } @@ -95740,7 +95740,7 @@ MA_API ma_int16* ma_dr_mp3_open_memory_and_read_pcm_frames_s16(const void* pData { ma_dr_mp3 mp3; if (!ma_dr_mp3_init_memory(&mp3, pData, dataSize, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_mp3__full_read_and_close_s16(&mp3, pConfig, pTotalFrameCount); } @@ -95749,7 +95749,7 @@ MA_API float* ma_dr_mp3_open_file_and_read_pcm_frames_f32(const char* filePath, { ma_dr_mp3 mp3; if (!ma_dr_mp3_init_file(&mp3, filePath, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_mp3__full_read_and_close_f32(&mp3, pConfig, pTotalFrameCount); } @@ -95757,25 +95757,25 @@ MA_API ma_int16* ma_dr_mp3_open_file_and_read_pcm_frames_s16(const char* filePat { ma_dr_mp3 mp3; if (!ma_dr_mp3_init_file(&mp3, filePath, pAllocationCallbacks)) { - return NULL; + return nullptr; } return ma_dr_mp3__full_read_and_close_s16(&mp3, pConfig, pTotalFrameCount); } #endif MA_API void* ma_dr_mp3_malloc(size_t sz, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks != NULL) { + if (pAllocationCallbacks != nullptr) { return ma_dr_mp3__malloc_from_callbacks(sz, pAllocationCallbacks); } else { - return ma_dr_mp3__malloc_default(sz, NULL); + return ma_dr_mp3__malloc_default(sz, nullptr); } } MA_API void ma_dr_mp3_free(void* p, const ma_allocation_callbacks* pAllocationCallbacks) { - if (pAllocationCallbacks != NULL) { + if (pAllocationCallbacks != nullptr) { ma_dr_mp3__free_from_callbacks(p, pAllocationCallbacks); } else { - ma_dr_mp3__free_default(p, NULL); + ma_dr_mp3__free_default(p, nullptr); } } #endif diff --git a/Minecraft.Client/Common/Audio/stb_vorbis.h b/Minecraft.Client/Common/Audio/stb_vorbis.h index 9192b162a..0e5294136 100644 --- a/Minecraft.Client/Common/Audio/stb_vorbis.h +++ b/Minecraft.Client/Common/Audio/stb_vorbis.h @@ -112,8 +112,8 @@ extern "C" { // query get_info to find the exact amount required. yes I know // this is lame). // -// If you pass in a non-NULL buffer of the type below, allocation -// will occur from it as described above. Otherwise just pass NULL +// If you pass in a non-nullptr buffer of the type below, allocation +// will occur from it as described above. Otherwise just pass nullptr // to use malloc()/alloca() typedef struct @@ -191,8 +191,8 @@ extern stb_vorbis *stb_vorbis_open_pushdata( // the first N bytes of the file--you're told if it's not enough, see below) // on success, returns an stb_vorbis *, does not set error, returns the amount of // data parsed/consumed on this call in *datablock_memory_consumed_in_bytes; -// on failure, returns NULL on error and sets *error, does not change *datablock_memory_consumed -// if returns NULL and *error is VORBIS_need_more_data, then the input block was +// on failure, returns nullptr on error and sets *error, does not change *datablock_memory_consumed +// if returns nullptr and *error is VORBIS_need_more_data, then the input block was // incomplete and you need to pass in a larger block from the start of the file extern int stb_vorbis_decode_frame_pushdata( @@ -219,7 +219,7 @@ extern int stb_vorbis_decode_frame_pushdata( // without writing state-machiney code to record a partial detection. // // The number of channels returned are stored in *channels (which can be -// NULL--it is always the same as the number of channels reported by +// nullptr--it is always the same as the number of channels reported by // get_info). *output will contain an array of float* buffers, one per // channel. In other words, (*output)[0][0] contains the first sample from // the first channel, and (*output)[1][0] contains the first sample from @@ -269,18 +269,18 @@ extern int stb_vorbis_decode_memory(const unsigned char *mem, int len, int *chan extern stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *error, const stb_vorbis_alloc *alloc_buffer); // create an ogg vorbis decoder from an ogg vorbis stream in memory (note -// this must be the entire stream!). on failure, returns NULL and sets *error +// this must be the entire stream!). on failure, returns nullptr and sets *error #ifndef STB_VORBIS_NO_STDIO extern stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const stb_vorbis_alloc *alloc_buffer); // create an ogg vorbis decoder from a filename via fopen(). on failure, -// returns NULL and sets *error (possibly to VORBIS_file_open_failure). +// returns nullptr and sets *error (possibly to VORBIS_file_open_failure). extern stb_vorbis * stb_vorbis_open_file(FILE *f, int close_handle_on_close, int *error, const stb_vorbis_alloc *alloc_buffer); // create an ogg vorbis decoder from an open FILE *, looking for a stream at -// the _current_ seek point (ftell). on failure, returns NULL and sets *error. +// the _current_ seek point (ftell). on failure, returns nullptr and sets *error. // note that stb_vorbis must "own" this stream; if you seek it in between // calls to stb_vorbis, it will become confused. Moreover, if you attempt to // perform stb_vorbis_seek_*() operations on this file, it will assume it @@ -291,7 +291,7 @@ extern stb_vorbis * stb_vorbis_open_file_section(FILE *f, int close_handle_on_cl int *error, const stb_vorbis_alloc *alloc_buffer, unsigned int len); // create an ogg vorbis decoder from an open FILE *, looking for a stream at // the _current_ seek point (ftell); the stream will be of length 'len' bytes. -// on failure, returns NULL and sets *error. note that stb_vorbis must "own" +// on failure, returns nullptr and sets *error. note that stb_vorbis must "own" // this stream; if you seek it in between calls to stb_vorbis, it will become // confused. #endif @@ -314,7 +314,7 @@ extern float stb_vorbis_stream_length_in_seconds(stb_vorbis *f); extern int stb_vorbis_get_frame_float(stb_vorbis *f, int *channels, float ***output); // decode the next frame and return the number of samples. the number of -// channels returned are stored in *channels (which can be NULL--it is always +// channels returned are stored in *channels (which can be nullptr--it is always // the same as the number of channels reported by get_info). *output will // contain an array of float* buffers, one per channel. These outputs will // be overwritten on the next call to stb_vorbis_get_frame_*. @@ -588,7 +588,7 @@ enum STBVorbisError #include #endif #else // STB_VORBIS_NO_CRT - #define NULL 0 + #define nullptr 0 #define malloc(s) 0 #define free(s) ((void) 0) #define realloc(s) 0 @@ -949,11 +949,11 @@ static void *setup_malloc(vorb *f, int sz) f->setup_memory_required += sz; if (f->alloc.alloc_buffer) { void *p = (char *) f->alloc.alloc_buffer + f->setup_offset; - if (f->setup_offset + sz > f->temp_offset) return NULL; + if (f->setup_offset + sz > f->temp_offset) return nullptr; f->setup_offset += sz; return p; } - return sz ? malloc(sz) : NULL; + return sz ? malloc(sz) : nullptr; } static void setup_free(vorb *f, void *p) @@ -966,7 +966,7 @@ static void *setup_temp_malloc(vorb *f, int sz) { sz = (sz+7) & ~7; // round up to nearest 8 for alignment of future allocs. if (f->alloc.alloc_buffer) { - if (f->temp_offset - sz < f->setup_offset) return NULL; + if (f->temp_offset - sz < f->setup_offset) return nullptr; f->temp_offset -= sz; return (char *) f->alloc.alloc_buffer + f->temp_offset; } @@ -1654,12 +1654,12 @@ static int codebook_decode_scalar_raw(vorb *f, Codebook *c) int i; prep_huffman(f); - if (c->codewords == NULL && c->sorted_codewords == NULL) + if (c->codewords == nullptr && c->sorted_codewords == nullptr) return -1; // cases to use binary search: sorted_codewords && !c->codewords // sorted_codewords && c->entries > 8 - if (c->entries > 8 ? c->sorted_codewords!=NULL : !c->codewords) { + if (c->entries > 8 ? c->sorted_codewords!=nullptr : !c->codewords) { // binary search uint32 code = bit_reverse(f->acc); int x=0, n=c->sorted_entries, len; @@ -2629,7 +2629,7 @@ static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype) // @OPTIMIZE: reduce register pressure by using fewer variables? int save_point = temp_alloc_save(f); float *buf2 = (float *) temp_alloc(f, n2 * sizeof(*buf2)); - float *u=NULL,*v=NULL; + float *u=nullptr,*v=nullptr; // twiddle factors float *A = f->A[blocktype]; @@ -3057,7 +3057,7 @@ static float *get_window(vorb *f, int len) len <<= 1; if (len == f->blocksize_0) return f->window[0]; if (len == f->blocksize_1) return f->window[1]; - return NULL; + return nullptr; } #ifndef STB_VORBIS_NO_DEFER_FLOOR @@ -3306,7 +3306,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, if (map->chan[j].mux == i) { if (zero_channel[j]) { do_not_decode[ch] = TRUE; - residue_buffers[ch] = NULL; + residue_buffers[ch] = nullptr; } else { do_not_decode[ch] = FALSE; residue_buffers[ch] = f->channel_buffers[j]; @@ -3351,7 +3351,7 @@ static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, if (really_zero_channel[i]) { memset(f->channel_buffers[i], 0, sizeof(*f->channel_buffers[i]) * n2); } else { - do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], NULL); + do_floor(f, map, i, n, f->channel_buffers[i], f->finalY[i], nullptr); } } #else @@ -3464,7 +3464,7 @@ static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right) if (f->previous_length) { int i,j, n = f->previous_length; float *w = get_window(f, n); - if (w == NULL) return 0; + if (w == nullptr) return 0; for (i=0; i < f->channels; ++i) { for (j=0; j < n; ++j) f->channel_buffers[i][left+j] = @@ -3647,24 +3647,24 @@ static int start_decoder(vorb *f) //file vendor len = get32_packet(f); f->vendor = (char*)setup_malloc(f, sizeof(char) * (len+1)); - if (f->vendor == NULL) return error(f, VORBIS_outofmem); + if (f->vendor == nullptr) return error(f, VORBIS_outofmem); for(i=0; i < len; ++i) { f->vendor[i] = get8_packet(f); } f->vendor[len] = (char)'\0'; //user comments f->comment_list_length = get32_packet(f); - f->comment_list = NULL; + f->comment_list = nullptr; if (f->comment_list_length > 0) { f->comment_list = (char**) setup_malloc(f, sizeof(char*) * (f->comment_list_length)); - if (f->comment_list == NULL) return error(f, VORBIS_outofmem); + if (f->comment_list == nullptr) return error(f, VORBIS_outofmem); } for(i=0; i < f->comment_list_length; ++i) { len = get32_packet(f); f->comment_list[i] = (char*)setup_malloc(f, sizeof(char) * (len+1)); - if (f->comment_list[i] == NULL) return error(f, VORBIS_outofmem); + if (f->comment_list[i] == nullptr) return error(f, VORBIS_outofmem); for(j=0; j < len; ++j) { f->comment_list[i][j] = get8_packet(f); @@ -3710,7 +3710,7 @@ static int start_decoder(vorb *f) f->codebook_count = get_bits(f,8) + 1; f->codebooks = (Codebook *) setup_malloc(f, sizeof(*f->codebooks) * f->codebook_count); - if (f->codebooks == NULL) return error(f, VORBIS_outofmem); + if (f->codebooks == nullptr) return error(f, VORBIS_outofmem); memset(f->codebooks, 0, sizeof(*f->codebooks) * f->codebook_count); for (i=0; i < f->codebook_count; ++i) { uint32 *values; @@ -3771,7 +3771,7 @@ static int start_decoder(vorb *f) f->setup_temp_memory_required = c->entries; c->codeword_lengths = (uint8 *) setup_malloc(f, c->entries); - if (c->codeword_lengths == NULL) return error(f, VORBIS_outofmem); + if (c->codeword_lengths == nullptr) return error(f, VORBIS_outofmem); memcpy(c->codeword_lengths, lengths, c->entries); setup_temp_free(f, lengths, c->entries); // note this is only safe if there have been no intervening temp mallocs! lengths = c->codeword_lengths; @@ -3791,7 +3791,7 @@ static int start_decoder(vorb *f) } c->sorted_entries = sorted_count; - values = NULL; + values = nullptr; CHECK(f); if (!c->sparse) { @@ -3820,11 +3820,11 @@ static int start_decoder(vorb *f) if (c->sorted_entries) { // allocate an extra slot for sentinels c->sorted_codewords = (uint32 *) setup_malloc(f, sizeof(*c->sorted_codewords) * (c->sorted_entries+1)); - if (c->sorted_codewords == NULL) return error(f, VORBIS_outofmem); + if (c->sorted_codewords == nullptr) return error(f, VORBIS_outofmem); // allocate an extra slot at the front so that c->sorted_values[-1] is defined // so that we can catch that case without an extra if c->sorted_values = ( int *) setup_malloc(f, sizeof(*c->sorted_values ) * (c->sorted_entries+1)); - if (c->sorted_values == NULL) return error(f, VORBIS_outofmem); + if (c->sorted_values == nullptr) return error(f, VORBIS_outofmem); ++c->sorted_values; c->sorted_values[-1] = -1; compute_sorted_huffman(c, lengths, values); @@ -3834,7 +3834,7 @@ static int start_decoder(vorb *f) setup_temp_free(f, values, sizeof(*values)*c->sorted_entries); setup_temp_free(f, c->codewords, sizeof(*c->codewords)*c->sorted_entries); setup_temp_free(f, lengths, c->entries); - c->codewords = NULL; + c->codewords = nullptr; } compute_accelerated_huffman(c); @@ -3857,7 +3857,7 @@ static int start_decoder(vorb *f) } if (c->lookup_values == 0) return error(f, VORBIS_invalid_setup); mults = (uint16 *) setup_temp_malloc(f, sizeof(mults[0]) * c->lookup_values); - if (mults == NULL) return error(f, VORBIS_outofmem); + if (mults == nullptr) return error(f, VORBIS_outofmem); for (j=0; j < (int) c->lookup_values; ++j) { int q = get_bits(f, c->value_bits); if (q == EOP) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_invalid_setup); } @@ -3874,7 +3874,7 @@ static int start_decoder(vorb *f) c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->sorted_entries * c->dimensions); } else c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->entries * c->dimensions); - if (c->multiplicands == NULL) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } + if (c->multiplicands == nullptr) { setup_temp_free(f,mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } len = sparse ? c->sorted_entries : c->entries; for (j=0; j < len; ++j) { unsigned int z = sparse ? c->sorted_values[j] : j; @@ -3902,7 +3902,7 @@ static int start_decoder(vorb *f) float last=0; CHECK(f); c->multiplicands = (codetype *) setup_malloc(f, sizeof(c->multiplicands[0]) * c->lookup_values); - if (c->multiplicands == NULL) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } + if (c->multiplicands == nullptr) { setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values); return error(f, VORBIS_outofmem); } for (j=0; j < (int) c->lookup_values; ++j) { float val = mults[j] * c->delta_value + c->minimum_value + last; c->multiplicands[j] = val; @@ -3931,7 +3931,7 @@ static int start_decoder(vorb *f) // Floors f->floor_count = get_bits(f, 6)+1; f->floor_config = (Floor *) setup_malloc(f, f->floor_count * sizeof(*f->floor_config)); - if (f->floor_config == NULL) return error(f, VORBIS_outofmem); + if (f->floor_config == nullptr) return error(f, VORBIS_outofmem); for (i=0; i < f->floor_count; ++i) { f->floor_types[i] = get_bits(f, 16); if (f->floor_types[i] > 1) return error(f, VORBIS_invalid_setup); @@ -4007,7 +4007,7 @@ static int start_decoder(vorb *f) // Residue f->residue_count = get_bits(f, 6)+1; f->residue_config = (Residue *) setup_malloc(f, f->residue_count * sizeof(f->residue_config[0])); - if (f->residue_config == NULL) return error(f, VORBIS_outofmem); + if (f->residue_config == nullptr) return error(f, VORBIS_outofmem); memset(f->residue_config, 0, f->residue_count * sizeof(f->residue_config[0])); for (i=0; i < f->residue_count; ++i) { uint8 residue_cascade[64]; @@ -4029,7 +4029,7 @@ static int start_decoder(vorb *f) residue_cascade[j] = high_bits*8 + low_bits; } r->residue_books = (short (*)[8]) setup_malloc(f, sizeof(r->residue_books[0]) * r->classifications); - if (r->residue_books == NULL) return error(f, VORBIS_outofmem); + if (r->residue_books == nullptr) return error(f, VORBIS_outofmem); for (j=0; j < r->classifications; ++j) { for (k=0; k < 8; ++k) { if (residue_cascade[j] & (1 << k)) { @@ -4049,7 +4049,7 @@ static int start_decoder(vorb *f) int classwords = f->codebooks[r->classbook].dimensions; int temp = j; r->classdata[j] = (uint8 *) setup_malloc(f, sizeof(r->classdata[j][0]) * classwords); - if (r->classdata[j] == NULL) return error(f, VORBIS_outofmem); + if (r->classdata[j] == nullptr) return error(f, VORBIS_outofmem); for (k=classwords-1; k >= 0; --k) { r->classdata[j][k] = temp % r->classifications; temp /= r->classifications; @@ -4059,14 +4059,14 @@ static int start_decoder(vorb *f) f->mapping_count = get_bits(f,6)+1; f->mapping = (Mapping *) setup_malloc(f, f->mapping_count * sizeof(*f->mapping)); - if (f->mapping == NULL) return error(f, VORBIS_outofmem); + if (f->mapping == nullptr) return error(f, VORBIS_outofmem); memset(f->mapping, 0, f->mapping_count * sizeof(*f->mapping)); for (i=0; i < f->mapping_count; ++i) { Mapping *m = f->mapping + i; int mapping_type = get_bits(f,16); if (mapping_type != 0) return error(f, VORBIS_invalid_setup); m->chan = (MappingChannel *) setup_malloc(f, f->channels * sizeof(*m->chan)); - if (m->chan == NULL) return error(f, VORBIS_outofmem); + if (m->chan == nullptr) return error(f, VORBIS_outofmem); if (get_bits(f,1)) m->submaps = get_bits(f,4)+1; else @@ -4128,11 +4128,11 @@ static int start_decoder(vorb *f) f->channel_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1); f->previous_window[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2); f->finalY[i] = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist); - if (f->channel_buffers[i] == NULL || f->previous_window[i] == NULL || f->finalY[i] == NULL) return error(f, VORBIS_outofmem); + if (f->channel_buffers[i] == nullptr || f->previous_window[i] == nullptr || f->finalY[i] == nullptr) return error(f, VORBIS_outofmem); memset(f->channel_buffers[i], 0, sizeof(float) * f->blocksize_1); #ifdef STB_VORBIS_NO_DEFER_FLOOR f->floor_buffers[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2); - if (f->floor_buffers[i] == NULL) return error(f, VORBIS_outofmem); + if (f->floor_buffers[i] == nullptr) return error(f, VORBIS_outofmem); #endif } @@ -4232,7 +4232,7 @@ static void vorbis_deinit(stb_vorbis *p) setup_free(p, c->codewords); setup_free(p, c->sorted_codewords); // c->sorted_values[-1] is the first entry in the array - setup_free(p, c->sorted_values ? c->sorted_values-1 : NULL); + setup_free(p, c->sorted_values ? c->sorted_values-1 : nullptr); } setup_free(p, p->codebooks); } @@ -4266,14 +4266,14 @@ static void vorbis_deinit(stb_vorbis *p) void stb_vorbis_close(stb_vorbis *p) { - if (p == NULL) return; + if (p == nullptr) return; vorbis_deinit(p); setup_free(p,p); } static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z) { - memset(p, 0, sizeof(*p)); // NULL out all malloc'd pointers to start + memset(p, 0, sizeof(*p)); // nullptr out all malloc'd pointers to start if (z) { p->alloc = *z; p->alloc.alloc_buffer_length_in_bytes &= ~7; @@ -4281,12 +4281,12 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z) } p->eof = 0; p->error = VORBIS__no_error; - p->stream = NULL; - p->codebooks = NULL; + p->stream = nullptr; + p->codebooks = nullptr; p->page_crc_tests = -1; #ifndef STB_VORBIS_NO_STDIO p->close_on_free = FALSE; - p->f = NULL; + p->f = nullptr; #endif } @@ -4509,7 +4509,7 @@ int stb_vorbis_decode_frame_pushdata( stb_vorbis *stb_vorbis_open_pushdata( const unsigned char *data, int data_len, // the memory available for decoding - int *data_used, // only defined if result is not NULL + int *data_used, // only defined if result is not nullptr int *error, const stb_vorbis_alloc *alloc) { stb_vorbis *f, p; @@ -4523,7 +4523,7 @@ stb_vorbis *stb_vorbis_open_pushdata( else *error = p.error; vorbis_deinit(&p); - return NULL; + return nullptr; } f = vorbis_alloc(&p); if (f) { @@ -4533,7 +4533,7 @@ stb_vorbis *stb_vorbis_open_pushdata( return f; } else { vorbis_deinit(&p); - return NULL; + return nullptr; } } #endif // STB_VORBIS_NO_PUSHDATA_API @@ -4680,7 +4680,7 @@ static int go_to_page_before(stb_vorbis *f, unsigned int limit_offset) set_file_offset(f, previous_safe); - while (vorbis_find_page(f, &end, NULL)) { + while (vorbis_find_page(f, &end, nullptr)) { if (end >= limit_offset && stb_vorbis_get_file_offset(f) < limit_offset) return 1; set_file_offset(f, end); @@ -4770,7 +4770,7 @@ static int seek_to_sample_coarse(stb_vorbis *f, uint32 sample_number) set_file_offset(f, left.page_end + (delta / 2) - 32768); } - if (!vorbis_find_page(f, NULL, NULL)) goto error; + if (!vorbis_find_page(f, nullptr, nullptr)) goto error; } for (;;) { @@ -4920,7 +4920,7 @@ int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number) if (sample_number != f->current_loc) { int n; uint32 frame_start = f->current_loc; - stb_vorbis_get_frame_float(f, &n, NULL); + stb_vorbis_get_frame_float(f, &n, nullptr); assert(sample_number > frame_start); assert(f->channel_buffer_start + (int) (sample_number-frame_start) <= f->channel_buffer_end); f->channel_buffer_start += (sample_number - frame_start); @@ -5063,7 +5063,7 @@ stb_vorbis * stb_vorbis_open_file_section(FILE *file, int close_on_free, int *er } if (error) *error = p.error; vorbis_deinit(&p); - return NULL; + return nullptr; } stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, const stb_vorbis_alloc *alloc) @@ -5081,14 +5081,14 @@ stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const st FILE *f; #if defined(_WIN32) && defined(__STDC_WANT_SECURE_LIB__) if (0 != fopen_s(&f, filename, "rb")) - f = NULL; + f = nullptr; #else f = fopen(filename, "rb"); #endif if (f) return stb_vorbis_open_file(f, TRUE, error, alloc); if (error) *error = VORBIS_file_open_failure; - return NULL; + return nullptr; } #endif // STB_VORBIS_NO_STDIO @@ -5097,7 +5097,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err stb_vorbis *f, p; if (!data) { if (error) *error = VORBIS_unexpected_eof; - return NULL; + return nullptr; } vorbis_init(&p, alloc); p.stream = (uint8 *) data; @@ -5116,7 +5116,7 @@ stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, int *err } if (error) *error = p.error; vorbis_deinit(&p); - return NULL; + return nullptr; } #ifndef STB_VORBIS_NO_INTEGER_CONVERSION @@ -5255,8 +5255,8 @@ static void convert_samples_short(int buf_c, short **buffer, int b_offset, int d int stb_vorbis_get_frame_short(stb_vorbis *f, int num_c, short **buffer, int num_samples) { - float **output = NULL; - int len = stb_vorbis_get_frame_float(f, NULL, &output); + float **output = nullptr; + int len = stb_vorbis_get_frame_float(f, nullptr, &output); if (len > num_samples) len = num_samples; if (len) convert_samples_short(num_c, buffer, 0, f->channels, output, 0, len); @@ -5294,7 +5294,7 @@ int stb_vorbis_get_frame_short_interleaved(stb_vorbis *f, int num_c, short *buff float **output; int len; if (num_c == 1) return stb_vorbis_get_frame_short(f,num_c,&buffer, num_shorts); - len = stb_vorbis_get_frame_float(f, NULL, &output); + len = stb_vorbis_get_frame_float(f, nullptr, &output); if (len) { if (len*num_c > num_shorts) len = num_shorts / num_c; convert_channels_short_interleaved(num_c, buffer, f->channels, output, 0, len); @@ -5316,7 +5316,7 @@ int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels, short n += k; f->channel_buffer_start += k; if (n == len) break; - if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; + if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break; } return n; } @@ -5333,7 +5333,7 @@ int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **buffer, in n += k; f->channel_buffer_start += k; if (n == len) break; - if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) break; + if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break; } return n; } @@ -5343,8 +5343,8 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_ { int data_len, offset, total, limit, error; short *data; - stb_vorbis *v = stb_vorbis_open_filename(filename, &error, NULL); - if (v == NULL) return -1; + stb_vorbis *v = stb_vorbis_open_filename(filename, &error, nullptr); + if (v == nullptr) return -1; limit = v->channels * 4096; *channels = v->channels; if (sample_rate) @@ -5352,7 +5352,7 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_ offset = data_len = 0; total = limit; data = (short *) malloc(total * sizeof(*data)); - if (data == NULL) { + if (data == nullptr) { stb_vorbis_close(v); return -2; } @@ -5365,7 +5365,7 @@ int stb_vorbis_decode_filename(const char *filename, int *channels, int *sample_ short *data2; total *= 2; data2 = (short *) realloc(data, total * sizeof(*data)); - if (data2 == NULL) { + if (data2 == nullptr) { free(data); stb_vorbis_close(v); return -2; @@ -5383,8 +5383,8 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp { int data_len, offset, total, limit, error; short *data; - stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, NULL); - if (v == NULL) return -1; + stb_vorbis *v = stb_vorbis_open_memory(mem, len, &error, nullptr); + if (v == nullptr) return -1; limit = v->channels * 4096; *channels = v->channels; if (sample_rate) @@ -5392,7 +5392,7 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp offset = data_len = 0; total = limit; data = (short *) malloc(total * sizeof(*data)); - if (data == NULL) { + if (data == nullptr) { stb_vorbis_close(v); return -2; } @@ -5405,7 +5405,7 @@ int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, int *samp short *data2; total *= 2; data2 = (short *) realloc(data, total * sizeof(*data)); - if (data2 == NULL) { + if (data2 == nullptr) { free(data); stb_vorbis_close(v); return -2; @@ -5440,7 +5440,7 @@ int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels, float f->channel_buffer_start += k; if (n == len) break; - if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) + if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break; } return n; @@ -5466,7 +5466,7 @@ int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **buffer, in f->channel_buffer_start += k; if (n == num_samples) break; - if (!stb_vorbis_get_frame_float(f, NULL, &outputs)) + if (!stb_vorbis_get_frame_float(f, nullptr, &outputs)) break; } return n; diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 2eb87307b..9d9dce1b8 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, 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 = {}; @@ -838,7 +838,7 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con SetGameSettings(iPad,eGameSetting_Gamma,50); // 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); @@ -1400,7 +1400,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())) @@ -1464,7 +1464,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())) @@ -1493,7 +1493,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) { @@ -1539,7 +1539,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) break; case eGameSetting_BedrockFog: { - bool bInGame=pMinecraft->level!=NULL; + bool bInGame=pMinecraft->level!=nullptr; // Game Host only if(bInGame && g_NetworkManager.IsHost() && (iPad==ProfileManager.GetPrimaryPad())) @@ -1596,7 +1596,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); } @@ -1608,8 +1608,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]; @@ -1664,7 +1664,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) @@ -1734,7 +1734,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); @@ -1781,7 +1781,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; } @@ -1800,7 +1800,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; } @@ -2470,7 +2470,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlay shared_ptr player = Minecraft::GetInstance()->localplayers[iPad]; - if(bOverridePlayer || player==NULL) + if(bOverridePlayer || player==nullptr) { return GameSettingsA[iPad]->uiDebugBitmask; } @@ -2782,7 +2782,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); } @@ -2851,7 +2851,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); @@ -2927,7 +2927,7 @@ void CMinecraftApp::HandleXuiActions(void) // send the message for(int idx=0;idxlocalplayers[idx]!=NULL)) + if((i!=idx) && (pMinecraft->localplayers[idx]!=nullptr)) { XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg ); } @@ -3009,7 +3009,7 @@ void CMinecraftApp::HandleXuiActions(void) // send the message for(int idx=0;idxlocalplayers[idx]!=NULL)) + if((i!=idx) && (pMinecraft->localplayers[idx]!=nullptr)) { XuiBroadcastMessage( CXuiSceneBase::GetPlayerBaseScene(idx), &xuiMsg ); } @@ -3235,8 +3235,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; @@ -3348,7 +3348,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); @@ -3373,7 +3373,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); @@ -3687,7 +3687,7 @@ 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()) { @@ -3711,11 +3711,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(); } @@ -3735,7 +3735,7 @@ void CMinecraftApp::HandleXuiActions(void) { if(ProfileManager.IsSignedIn(index) ) { - if(index==i || pMinecraft->localplayers[index]!=NULL ) + if(index==i || pMinecraft->localplayers[index]!=nullptr ) { m_InviteData.dwLocalUsersMask |= g_NetworkManager.GetLocalPlayerMask( index ); } @@ -3843,7 +3843,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__ @@ -3924,7 +3924,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; @@ -4223,7 +4223,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 @@ -4320,7 +4320,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()); @@ -4370,10 +4370,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 ) { @@ -4389,7 +4389,7 @@ void CMinecraftApp::loadMediaArchive() m_fBody, dwFileSize, &m_fSize, - NULL ); + nullptr ); assert( m_fSize == dwFileSize ); @@ -4401,7 +4401,7 @@ void CMinecraftApp::loadMediaArchive() { assert( false ); // AHHHHHHHHHHHH - m_mediaArchive = NULL; + m_mediaArchive = nullptr; } #endif } @@ -4410,7 +4410,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; @@ -4424,7 +4424,7 @@ void CMinecraftApp::loadStringTable() } else { - m_stringTable = NULL; + m_stringTable = nullptr; assert(false); // AHHHHHHHHH. } @@ -4437,7 +4437,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 @@ -4458,7 +4458,7 @@ 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) + if(Minecraft::GetInstance()->player!=nullptr) { app.SetAction(pMinecraft->player->GetXboxPad(),eAppAction_EthernetDisconnectedReturned); } @@ -4490,7 +4490,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) bool saveStats = false; if (pMinecraft->isClientSide() || g_NetworkManager.IsInSession() ) { - if(lpParameter != NULL ) + if(lpParameter != nullptr ) { switch( app.GetDisconnectReason() ) { @@ -4522,16 +4522,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 @@ -4546,7 +4546,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc( void* lpParameter ) } else { - if(lpParameter != NULL ) + if(lpParameter != nullptr ) { switch( app.GetDisconnectReason() ) { @@ -4583,7 +4583,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 @@ -4609,7 +4609,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; } @@ -4621,7 +4621,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]; @@ -4666,7 +4666,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]; @@ -4731,7 +4731,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]; @@ -4804,7 +4804,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]; @@ -4948,7 +4948,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); @@ -4972,7 +4972,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); @@ -4983,7 +4983,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) { @@ -5080,7 +5080,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); @@ -5109,7 +5109,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 @@ -5117,11 +5117,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(); } @@ -5273,7 +5273,7 @@ int CMinecraftApp::GetLocalPlayerCount(void) Minecraft *pMinecraft = Minecraft::GetInstance(); for(int i=0;ilocalplayers[i] != NULL) + if(pMinecraft != nullptr && pMinecraft->localplayers[i] != nullptr) { iPlayerC++; } @@ -5423,15 +5423,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)); @@ -5484,7 +5484,7 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d // // 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 @@ -5656,7 +5656,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()) { @@ -5667,8 +5667,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; @@ -5764,7 +5764,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()) { @@ -5784,7 +5784,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()) { @@ -5799,7 +5799,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) { @@ -5817,7 +5817,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) { @@ -6018,7 +6018,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]; @@ -6037,7 +6037,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]; @@ -6087,7 +6087,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 } @@ -6120,7 +6120,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 @@ -6166,7 +6166,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; } @@ -6678,7 +6678,7 @@ wstring CMinecraftApp::GetVKReplacement(unsigned int uiVKey) default: break; } - return NULL; + return nullptr; #else wstring replacement = L""; switch(uiVKey) @@ -6777,7 +6777,7 @@ wstring CMinecraftApp::GetIconReplacement(unsigned int uiIcon) default: break; } - return NULL; + return nullptr; #else wchar_t string[128]; @@ -6832,10 +6832,10 @@ 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 ) { @@ -6875,7 +6875,7 @@ 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) // { @@ -6926,7 +6926,7 @@ HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGe } #endif - if(pType!=NULL) + if(pType!=nullptr) { if(wcscmp(pType,L"Skin")==0) { @@ -7111,7 +7111,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 @@ -7131,14 +7131,14 @@ 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) @@ -7153,7 +7153,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoFromTPackID(int iTPID) } ++it; } - return NULL; + return nullptr; } DLC_INFO *CMinecraftApp::GetDLCInfo(int iIndex) @@ -7209,12 +7209,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) { @@ -7268,7 +7268,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); @@ -7276,14 +7276,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) @@ -7333,14 +7333,14 @@ 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) { @@ -7357,7 +7357,7 @@ DLC_INFO *CMinecraftApp::GetDLCInfoForProductName(WCHAR *pwchProductName) ++it; } - return NULL; + return nullptr; } #elif defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) @@ -7373,14 +7373,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 @@ -7471,7 +7471,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) @@ -7489,7 +7489,7 @@ int CMinecraftApp::ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4 // Inform fullscreen progress scene that it's not being cancelled after all UIScene_FullscreenProgress *pScene = static_cast(ui.FindScene(eUIScene_FullscreenProgress)); #ifdef __PS3__ - if(pScene!=NULL) + if(pScene!=nullptr) #else if (pScene != nullptr) #endif @@ -7505,7 +7505,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<wchPlayerUID; @@ -7645,7 +7645,7 @@ void CMinecraftApp::RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, cha #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 @@ -7662,7 +7662,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; } @@ -8126,7 +8126,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) || @@ -8844,7 +8844,7 @@ 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 @@ -9197,7 +9197,7 @@ vector * CMinecraftApp::SetAdditionalSkinBoxes(DWORD dwSkinID, vect vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) { EnterCriticalSection( &csAdditionalModelParts ); - vector *pvModelParts=NULL; + vector *pvModelParts=nullptr; if(m_AdditionalModelParts.size()>0) { auto it = m_AdditionalModelParts.find(dwSkinID); @@ -9214,7 +9214,7 @@ vector *CMinecraftApp::GetAdditionalModelParts(DWORD dwSkinID) vector *CMinecraftApp::GetAdditionalSkinBoxes(DWORD dwSkinID) { EnterCriticalSection( &csAdditionalSkinBoxes ); - vector *pvSkinBoxes=NULL; + vector *pvSkinBoxes=nullptr; if(m_AdditionalSkinBoxes.size()>0) { auto it = m_AdditionalSkinBoxes.find(dwSkinID); @@ -9335,7 +9335,7 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E // we need to enable background downloading for the DLC XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(app.GetRequiredTexturePackID()); - if(pSONYDLCInfo!=NULL) + if(pSONYDLCInfo!=nullptr) { char chName[42]; char chKeyName[20]; @@ -9344,7 +9344,7 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E 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 + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -9390,13 +9390,13 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E 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 { DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full); ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); } } } @@ -9406,7 +9406,7 @@ int CMinecraftApp::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::E 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)) @@ -9418,7 +9418,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; @@ -9427,7 +9427,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)) diff --git a/Minecraft.Client/Common/Consoles_App.h b/Minecraft.Client/Common/Consoles_App.h index 0e4d66154..ef8b1a697 100644 --- a/Minecraft.Client/Common/Consoles_App.h +++ b/Minecraft.Client/Common/Consoles_App.h @@ -163,12 +163,12 @@ public: eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;} void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;} eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];} - void SetAction(int iPad, eXuiAction action, LPVOID param = NULL); + void SetAction(int iPad, eXuiAction action, LPVOID param = nullptr); void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; } eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];} eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];} LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];} - void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = NULL) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;} + void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = nullptr) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;} eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;} void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;} @@ -862,12 +862,12 @@ public: bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];} void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;} - void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;} + void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=nullptr;BannedListA[iPad].dwBytes=0;} DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;} void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;} - virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;} + virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = nullptr; *pdwBytes = 0;} //XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; } diff --git a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp index ff18b540a..3c2a4b198 100644 --- a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp @@ -8,7 +8,7 @@ DLCAudioFile::DLCAudioFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path) { - m_pbData = NULL; + m_pbData = nullptr; m_dwBytes = 0; } @@ -133,7 +133,7 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) if(uiVersion < CURRENT_AUDIO_VERSION_NUM) { - if(pbData!=NULL) delete [] pbData; + if(pbData!=nullptr) delete [] pbData; app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); return false; } diff --git a/Minecraft.Client/Common/DLC/DLCColourTableFile.cpp b/Minecraft.Client/Common/DLC/DLCColourTableFile.cpp index ec800dacf..a0c818a7c 100644 --- a/Minecraft.Client/Common/DLC/DLCColourTableFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCColourTableFile.cpp @@ -7,12 +7,12 @@ DLCColourTableFile::DLCColourTableFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_ColourTable,path) { - m_colourTable = NULL; + m_colourTable = nullptr; } DLCColourTableFile::~DLCColourTableFile() { - if(m_colourTable != NULL) + if(m_colourTable != nullptr) { app.DebugPrintf("Deleting DLCColourTableFile data\n"); delete m_colourTable; diff --git a/Minecraft.Client/Common/DLC/DLCFile.h b/Minecraft.Client/Common/DLC/DLCFile.h index 3a40dbc76..5836c509d 100644 --- a/Minecraft.Client/Common/DLC/DLCFile.h +++ b/Minecraft.Client/Common/DLC/DLCFile.h @@ -17,7 +17,7 @@ public: DWORD getSkinID() { return m_dwSkinId; } virtual void addData(PBYTE pbData, DWORD dwBytes) {} - virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return NULL; } + virtual PBYTE getData(DWORD &dwBytes) { dwBytes = 0; return nullptr; } virtual void addParameter(DLCManager::EDLCParameterType type, const wstring &value) {} virtual wstring getParameterAsString(DLCManager::EDLCParameterType type) { return L""; } diff --git a/Minecraft.Client/Common/DLC/DLCGameRulesFile.cpp b/Minecraft.Client/Common/DLC/DLCGameRulesFile.cpp index 8ca520d68..d84e2a609 100644 --- a/Minecraft.Client/Common/DLC/DLCGameRulesFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCGameRulesFile.cpp @@ -4,7 +4,7 @@ DLCGameRulesFile::DLCGameRulesFile(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRules,path) { - m_pbData = NULL; + m_pbData = nullptr; m_dwBytes = 0; } diff --git a/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp index 39b852190..2b7859987 100644 --- a/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp @@ -11,14 +11,14 @@ DLCGameRulesHeader::DLCGameRulesHeader(const wstring &path) : DLCGameRules(DLCManager::e_DLCType_GameRulesHeader,path) { - m_pbData = NULL; + m_pbData = nullptr; m_dwBytes = 0; m_hasData = false; m_grfPath = path.substr(0, path.length() - 4) + L".grf"; - lgo = NULL; + lgo = nullptr; } void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) diff --git a/Minecraft.Client/Common/DLC/DLCLocalisationFile.cpp b/Minecraft.Client/Common/DLC/DLCLocalisationFile.cpp index 358a93e50..909214345 100644 --- a/Minecraft.Client/Common/DLC/DLCLocalisationFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCLocalisationFile.cpp @@ -5,7 +5,7 @@ DLCLocalisationFile::DLCLocalisationFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_LocalisationData,path) { - m_strings = NULL; + m_strings = nullptr; } void DLCLocalisationFile::addData(PBYTE pbData, DWORD dwBytes) diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 89da3cebe..5fc5f3704 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -82,7 +82,7 @@ void DLCManager::addPack(DLCPack *pack) void DLCManager::removePack(DLCPack *pack) { - if(pack != NULL) + if(pack != nullptr) { auto it = find(m_packs.begin(), m_packs.end(), pack); if(it != m_packs.end() ) m_packs.erase(it); @@ -112,7 +112,7 @@ void DLCManager::LanguageChanged(void) DLCPack *DLCManager::getPack(const wstring &name) { - DLCPack *pack = NULL; + DLCPack *pack = nullptr; //DWORD currentIndex = 0; for( DLCPack * currentPack : m_packs ) { @@ -130,7 +130,7 @@ DLCPack *DLCManager::getPack(const wstring &name) #ifdef _XBOX_ONE DLCPack *DLCManager::getPackFromProductID(const wstring &productID) { - DLCPack *pack = NULL; + DLCPack *pack = nullptr; for( DLCPack *currentPack : m_packs ) { wstring wsName=currentPack->getPurchaseOfferId(); @@ -147,7 +147,7 @@ DLCPack *DLCManager::getPackFromProductID(const wstring &productID) DLCPack *DLCManager::getPack(DWORD index, EDLCType type /*= e_DLCType_All*/) { - DLCPack *pack = NULL; + DLCPack *pack = nullptr; if( type != e_DLCType_All ) { DWORD currentIndex = 0; @@ -181,9 +181,9 @@ DWORD DLCManager::getPackIndex(DLCPack *pack, bool &found, EDLCType type /*= e_D { DWORD foundIndex = 0; found = false; - if(pack == NULL) + if(pack == nullptr) { - app.DebugPrintf("DLCManager: Attempting to find the index for a NULL pack\n"); + app.DebugPrintf("DLCManager: Attempting to find the index for a nullptr pack\n"); //__debugbreak(); return foundIndex; } @@ -244,7 +244,7 @@ DWORD DLCManager::getPackIndexContainingSkin(const wstring &path, bool &found) DLCPack *DLCManager::getPackContainingSkin(const wstring &path) { - DLCPack *foundPack = NULL; + DLCPack *foundPack = nullptr; for( DLCPack *pack : m_packs ) { if(pack->getDLCItemsCount(e_DLCType_Skin)>0) @@ -261,11 +261,11 @@ DLCPack *DLCManager::getPackContainingSkin(const wstring &path) DLCSkinFile *DLCManager::getSkinFile(const wstring &path) { - DLCSkinFile *foundSkinfile = NULL; + DLCSkinFile *foundSkinfile = nullptr; for( DLCPack *pack : m_packs ) { foundSkinfile=pack->getSkinFile(path); - if(foundSkinfile!=NULL) + if(foundSkinfile!=nullptr) { break; } @@ -276,14 +276,14 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path) DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) { DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount; - DLCPack *firstCorruptPack = NULL; + DLCPack *firstCorruptPack = nullptr; for( DLCPack *pack : m_packs ) { if( pack->IsCorrupt() ) { ++corruptDLCCount; - if(firstCorruptPack == NULL) firstCorruptPack = pack; + if(firstCorruptPack == nullptr) firstCorruptPack = pack; } } @@ -291,13 +291,13 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - if(corruptDLCCount == 1 && firstCorruptPack != NULL) + if(corruptDLCCount == 1 && firstCorruptPack != nullptr) { // pass in the pack format string WCHAR wchFormat[132]; swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str()); - C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL,wchFormat); + C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),nullptr,nullptr,wchFormat); } else @@ -330,13 +330,13 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL #ifdef _WINDOWS64 string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #elif defined(_DURANGO) wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); if(finalPath.size() == 0) finalPath = wPath; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -347,9 +347,9 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL return false; } - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); + DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { // need to treat the file as corrupt, and flag it, so can't call fatal error @@ -391,7 +391,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD if(uiVersion < CURRENT_DLC_VERSION_NUM) { - if(pbData!=NULL) delete [] pbData; + if(pbData!=nullptr) delete [] pbData; app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); return false; } @@ -431,8 +431,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD { DLCManager::EDLCType type = static_cast(pFile->dwType); - DLCFile *dlcFile = NULL; - DLCPack *dlcTexturePack = NULL; + DLCFile *dlcFile = nullptr; + DLCPack *dlcTexturePack = nullptr; if(type == e_DLCType_TexturePack) { @@ -461,8 +461,8 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD } else { - if(dlcFile != NULL) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData); - else if(dlcTexturePack != NULL) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData); + if(dlcFile != nullptr) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData); + else if(dlcTexturePack != nullptr) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData); } } pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount); @@ -470,15 +470,15 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD } //pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); - if(dlcTexturePack != NULL) + if(dlcTexturePack != nullptr) { DWORD texturePackFilesProcessed = 0; bool validPack = processDLCDataFile(texturePackFilesProcessed,pbTemp,pFile->uiFileSize,dlcTexturePack); - pack->SetDataPointer(NULL); // If it's a child pack, it doesn't own the data + pack->SetDataPointer(nullptr); // If it's a child pack, it doesn't own the data if(!validPack || texturePackFilesProcessed == 0) { delete dlcTexturePack; - dlcTexturePack = NULL; + dlcTexturePack = nullptr; } else { @@ -491,7 +491,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD } ++dwFilesProcessed; } - else if(dlcFile != NULL) + else if(dlcFile != nullptr) { // Data dlcFile->addData(pbTemp,pFile->uiFileSize); @@ -537,22 +537,22 @@ DWORD DLCManager::retrievePackIDFromDLCDataFile(const string &path, DLCPack *pac #ifdef _WINDOWS64 string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #elif defined(_DURANGO) wstring finalPath = StorageManager.GetMountedPath(wPath.c_str()); if(finalPath.size() == 0) finalPath = wPath; - HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { return 0; } - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); + DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { // need to treat the file as corrupt, and flag it, so can't call fatal error diff --git a/Minecraft.Client/Common/DLC/DLCPack.cpp b/Minecraft.Client/Common/DLC/DLCPack.cpp index 7986bf6d6..110008c61 100644 --- a/Minecraft.Client/Common/DLC/DLCPack.cpp +++ b/Minecraft.Client/Common/DLC/DLCPack.cpp @@ -24,14 +24,14 @@ DLCPack::DLCPack(const wstring &name,DWORD dwLicenseMask) m_isCorrupt = false; m_packId = 0; m_packVersion = 0; - m_parentPack = NULL; + m_parentPack = nullptr; m_dlcMountIndex = -1; #ifdef _XBOX m_dlcDeviceID = XCONTENTDEVICE_ANY; #endif // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. - m_data = NULL; + m_data = nullptr; } #ifdef _XBOX_ONE @@ -44,11 +44,11 @@ DLCPack::DLCPack(const wstring &name,const wstring &productID,DWORD dwLicenseMas m_isCorrupt = false; m_packId = 0; m_packVersion = 0; - m_parentPack = NULL; + m_parentPack = nullptr; m_dlcMountIndex = -1; // This pointer is for all the data used for this pack, so deleting it invalidates ALL of it's children. - m_data = NULL; + m_data = nullptr; } #endif @@ -76,7 +76,7 @@ DLCPack::~DLCPack() wprintf(L"Deleting data for DLC pack %ls\n", m_packName.c_str()); #endif // For the same reason, don't delete data pointer for any child pack as it just points to a region within the parent pack that has already been freed - if( m_parentPack == NULL ) + if( m_parentPack == nullptr ) { delete [] m_data; } @@ -85,7 +85,7 @@ DLCPack::~DLCPack() DWORD DLCPack::GetDLCMountIndex() { - if(m_parentPack != NULL) + if(m_parentPack != nullptr) { return m_parentPack->GetDLCMountIndex(); } @@ -94,7 +94,7 @@ DWORD DLCPack::GetDLCMountIndex() XCONTENTDEVICEID DLCPack::GetDLCDeviceID() { - if(m_parentPack != NULL ) + if(m_parentPack != nullptr ) { return m_parentPack->GetDLCDeviceID(); } @@ -187,7 +187,7 @@ bool DLCPack::getParameterAsUInt(DLCManager::EDLCParameterType type, unsigned in DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) { - DLCFile *newFile = NULL; + DLCFile *newFile = nullptr; switch(type) { @@ -243,7 +243,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) break; }; - if( newFile != NULL ) + if( newFile != nullptr ) { m_files[newFile->getType()].push_back(newFile); } @@ -252,7 +252,7 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path) } // MGH - added this comp func, as the embedded func in find_if was confusing the PS3 compiler -static const wstring *g_pathCmpString = NULL; +static const wstring *g_pathCmpString = nullptr; static bool pathCmp(DLCFile *val) { return (g_pathCmpString->compare(val->getPath()) == 0); @@ -284,13 +284,13 @@ bool DLCPack::doesPackContainFile(DLCManager::EDLCType type, const wstring &path DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index) { - DLCFile *file = NULL; + DLCFile *file = nullptr; if(type == DLCManager::e_DLCType_All) { for(DLCManager::EDLCType currentType = static_cast(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast(currentType + 1)) { file = getFile(currentType,index); - if(file != NULL) break; + if(file != nullptr) break; } } else @@ -306,13 +306,13 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, DWORD index) DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path) { - DLCFile *file = NULL; + DLCFile *file = nullptr; if(type == DLCManager::e_DLCType_All) { for(DLCManager::EDLCType currentType = static_cast(0); currentType < DLCManager::e_DLCType_Max; currentType = static_cast(currentType + 1)) { file = getFile(currentType,path); - if(file != NULL) break; + if(file != nullptr) break; } } else @@ -323,7 +323,7 @@ DLCFile *DLCPack::getFile(DLCManager::EDLCType type, const wstring &path) if(it == m_files[type].end()) { // Not found - file = NULL; + file = nullptr; } else { @@ -420,7 +420,7 @@ void DLCPack::UpdateLanguage() { // find the language file DLCManager::e_DLCType_LocalisationData; - DLCFile *file = NULL; + DLCFile *file = nullptr; if(m_files[DLCManager::e_DLCType_LocalisationData].size() > 0) { diff --git a/Minecraft.Client/Common/DLC/DLCTextureFile.cpp b/Minecraft.Client/Common/DLC/DLCTextureFile.cpp index edf071c63..fb9c5b036 100644 --- a/Minecraft.Client/Common/DLC/DLCTextureFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCTextureFile.cpp @@ -7,7 +7,7 @@ DLCTextureFile::DLCTextureFile(const wstring &path) : DLCFile(DLCManager::e_DLCT m_bIsAnim = false; m_animString = L""; - m_pbData = NULL; + m_pbData = nullptr; m_dwBytes = 0; } diff --git a/Minecraft.Client/Common/DLC/DLCUIDataFile.cpp b/Minecraft.Client/Common/DLC/DLCUIDataFile.cpp index a2a56bca5..597c4b7bc 100644 --- a/Minecraft.Client/Common/DLC/DLCUIDataFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCUIDataFile.cpp @@ -4,14 +4,14 @@ DLCUIDataFile::DLCUIDataFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_UIData,path) { - m_pbData = NULL; + m_pbData = nullptr; m_dwBytes = 0; m_canDeleteData = false; } DLCUIDataFile::~DLCUIDataFile() { - if(m_canDeleteData && m_pbData != NULL) + if(m_canDeleteData && m_pbData != nullptr) { app.DebugPrintf("Deleting DLCUIDataFile data\n"); delete [] m_pbData; diff --git a/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp index 555ed8b47..f97bfdd1f 100644 --- a/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/AddEnchantmentRuleDefinition.cpp @@ -46,7 +46,7 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr item) { bool enchanted = false; - if (item != NULL) + if (item != nullptr) { // 4J-JEV: Ripped code from enchantmenthelpers // Maybe we want to add an addEnchantment method to EnchantmentHelpers @@ -58,7 +58,7 @@ bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr item) { Enchantment *e = Enchantment::enchantments[m_enchantmentId]; - if(e != NULL && e->category->canEnchant(item->getItem())) + if(e != nullptr && e->category->canEnchant(item->getItem())) { int level = min(e->getMaxLevel(), m_enchantmentLevel); item->enchant(e, m_enchantmentLevel); diff --git a/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp index 012a9f7b6..270909ecd 100644 --- a/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp @@ -41,7 +41,7 @@ void AddItemRuleDefinition::getChildren(vector *children) GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment) { rule = new AddEnchantmentRuleDefinition(); @@ -97,7 +97,7 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst bool AddItemRuleDefinition::addItemToContainer(shared_ptr container, int slotId) { bool added = false; - if(Item::items[m_itemId] != NULL) + if(Item::items[m_itemId] != nullptr) { int quantity = std::min(m_quantity, Item::items[m_itemId]->getMaxStackSize()); shared_ptr newItem = shared_ptr(new ItemInstance(m_itemId,quantity,m_auxValue) ); @@ -118,7 +118,7 @@ bool AddItemRuleDefinition::addItemToContainer(shared_ptr container, container->setItem( slotId, newItem ); added = true; } - else if(dynamic_pointer_cast(container) != NULL) + else if(dynamic_pointer_cast(container) != nullptr) { added = dynamic_pointer_cast(container)->add(newItem); } diff --git a/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp index 7c2b0d955..3c7e02a39 100644 --- a/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/ApplySchematicRuleDefinition.cpp @@ -13,20 +13,20 @@ ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(LevelGenerationOption { m_levelGenOptions = levelGenOptions; m_location = Vec3::newPermanent(0,0,0); - m_locationBox = NULL; + m_locationBox = nullptr; m_totalBlocksChanged = 0; m_totalBlocksChangedLighting = 0; m_rotation = ConsoleSchematicFile::eSchematicRot_0; m_completed = false; m_dimension = 0; - m_schematic = NULL; + m_schematic = nullptr; } ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition() { app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n"); if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName); - m_schematic = NULL; + m_schematic = nullptr; delete m_location; } @@ -130,7 +130,7 @@ void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, co void ApplySchematicRuleDefinition::updateLocationBox() { - if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); m_locationBox = AABB::newPermanent(0,0,0,0,0,0); @@ -162,9 +162,9 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk * if(chunk->level->dimension->id != m_dimension) return; PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition"); - if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); - if(m_locationBox == NULL) updateLocationBox(); + if(m_locationBox == nullptr) updateLocationBox(); if(chunkBox->intersects( m_locationBox )) { m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 ); @@ -189,7 +189,7 @@ void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk * { m_completed = true; //m_levelGenOptions->releaseSchematicFile(m_schematicName); - //m_schematic = NULL; + //m_schematic = nullptr; } } PIXEndNamedEvent(); @@ -201,9 +201,9 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve if(chunk->level->dimension->id != m_dimension) return; PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)"); - if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); + if(m_schematic == nullptr) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName); - if(m_locationBox == NULL) updateLocationBox(); + if(m_locationBox == nullptr) updateLocationBox(); if(chunkBox->intersects( m_locationBox )) { m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 ); @@ -223,7 +223,7 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve { m_completed = true; //m_levelGenOptions->releaseSchematicFile(m_schematicName); - //m_schematic = NULL; + //m_schematic = nullptr; } } PIXEndNamedEvent(); @@ -231,13 +231,13 @@ void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, Leve bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1) { - if( m_locationBox == NULL ) updateLocationBox(); + if( m_locationBox == nullptr ) updateLocationBox(); return m_locationBox->intersects(x0,y0,z0,x1,y1,z1); } int ApplySchematicRuleDefinition::getMinY() { - if( m_locationBox == NULL ) updateLocationBox(); + if( m_locationBox == nullptr ) updateLocationBox(); return m_locationBox->y0; } diff --git a/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp index f3b484459..85d382192 100644 --- a/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp @@ -77,7 +77,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr item) { bool statusChanged = false; - if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue) + if(item != nullptr && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue) { if(!getComplete(rule)) { @@ -92,9 +92,9 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptrgetConnection() != NULL) + if(rule->getConnection() != nullptr) { - rule->getConnection()->send( shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0))); + rule->getConnection()->send( shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,nullptr,0))); } } } @@ -106,7 +106,7 @@ wstring CollectItemRuleDefinition::generateXml(shared_ptr item) { // 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd wstring xml = L""; - if(item != NULL) + if(item != nullptr) { xml = L"id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\""; if(item->getAuxValue() != 0) xml += L" auxValue=\"" + std::to_wstring(item->getAuxValue()) + L"\""; diff --git a/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp index 65bf79ae3..ef83b32c0 100644 --- a/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/CompleteAllRuleDefinition.cpp @@ -36,7 +36,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule) progress += it.second.gr->getGameRuleDefinition()->getProgress(it.second.gr); } } - if(rule->getConnection() != NULL) + if(rule->getConnection() != nullptr) { PacketData data; data.goal = goal; @@ -45,11 +45,11 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule) int icon = -1; int auxValue = 0; - if(m_lastRuleStatusChanged != NULL) + if(m_lastRuleStatusChanged != nullptr) { icon = m_lastRuleStatusChanged->getIcon(); auxValue = m_lastRuleStatusChanged->getAuxValue(); - m_lastRuleStatusChanged = NULL; + m_lastRuleStatusChanged = nullptr; } rule->getConnection()->send( shared_ptr( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData)))); } diff --git a/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp index 395b4eebd..f75eddd40 100644 --- a/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp @@ -6,7 +6,7 @@ CompoundGameRuleDefinition::CompoundGameRuleDefinition() { - m_lastRuleStatusChanged = NULL; + m_lastRuleStatusChanged = nullptr; } CompoundGameRuleDefinition::~CompoundGameRuleDefinition() @@ -26,7 +26,7 @@ void CompoundGameRuleDefinition::getChildren(vector *child GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule) { rule = new CompleteAllRuleDefinition(); @@ -49,13 +49,13 @@ GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGame wprintf(L"CompoundGameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType ); #endif } - if(rule != NULL) m_children.push_back(rule); + if(rule != nullptr) m_children.push_back(rule); return rule; } void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule) { - GameRule *newRule = NULL; + GameRule *newRule = nullptr; int i = 0; for (auto& it : m_children ) { diff --git a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp index 62154cdcd..dd7776824 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp +++ b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp @@ -10,7 +10,7 @@ ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0) { m_x = m_y = m_z = 0; - boundingBox = NULL; + boundingBox = nullptr; orientation = Direction::NORTH; m_dimension = 0; } @@ -25,7 +25,7 @@ void ConsoleGenerateStructure::getChildren(vector *childre GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox) { rule = new XboxStructureActionGenerateBox(); @@ -112,7 +112,7 @@ void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const BoundingBox* ConsoleGenerateStructure::getBoundingBox() { - if(boundingBox == NULL) + if(boundingBox == nullptr) { // Find the max bounds int maxX, maxY, maxZ; diff --git a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp index 15009e5f4..574e72624 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp @@ -16,18 +16,18 @@ ConsoleSchematicFile::ConsoleSchematicFile() { m_xSize = m_ySize = m_zSize = 0; m_refCount = 1; - m_data.data = NULL; + m_data.data = nullptr; } ConsoleSchematicFile::~ConsoleSchematicFile() { app.DebugPrintf("Deleting schematic file\n"); - if(m_data.data != NULL) delete [] m_data.data; + if(m_data.data != nullptr) delete [] m_data.data; } void ConsoleSchematicFile::save(DataOutputStream *dos) { - if(dos != NULL) + if(dos != nullptr) { dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); @@ -52,7 +52,7 @@ void ConsoleSchematicFile::save(DataOutputStream *dos) void ConsoleSchematicFile::load(DataInputStream *dis) { - if(dis != NULL) + if(dis != nullptr) { // VERSION CHECK // int version = dis->readInt(); @@ -75,10 +75,10 @@ void ConsoleSchematicFile::load(DataInputStream *dis) byteArray compressedBuffer(compressedSize); dis->readFully(compressedBuffer); - if(m_data.data != NULL) + if(m_data.data != nullptr) { delete [] m_data.data; - m_data.data = NULL; + m_data.data = nullptr; } if(compressionType == Compression::eCompressionType_None) @@ -111,17 +111,17 @@ void ConsoleSchematicFile::load(DataInputStream *dis) // READ TAGS // CompoundTag *tag = NbtIo::read(dis); ListTag *tileEntityTags = (ListTag *) tag->getList(L"TileEntities"); - if (tileEntityTags != NULL) + if (tileEntityTags != nullptr) { for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); shared_ptr te = TileEntity::loadStatic(teTag); - if(te == NULL) + if(te == nullptr) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf("ConsoleSchematicFile has read a NULL tile entity\n"); + app.DebugPrintf("ConsoleSchematicFile has read a nullptr tile entity\n"); __debugbreak(); #endif } @@ -132,7 +132,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis) } } ListTag *entityTags = (ListTag *) tag->getList(L"Entities"); - if (entityTags != NULL) + if (entityTags != nullptr) { for (int i = 0; i < entityTags->size(); i++) { @@ -444,7 +444,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, { shared_ptr teCopy = chunk->getTileEntity( static_cast(targetX) & 15, static_cast(targetY) & 15, static_cast(targetZ) & 15 ); - if ( teCopy != NULL ) + if ( teCopy != nullptr ) { CompoundTag *teData = new CompoundTag(); te->save(teData); @@ -493,7 +493,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, } CompoundTag *eTag = it->second; - shared_ptr e = EntityIO::loadStatic(eTag, NULL); + shared_ptr e = EntityIO::loadStatic(eTag, nullptr); if( e->GetType() == eTYPE_PAINTING ) { @@ -582,18 +582,18 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l app.DebugPrintf("Generating schematic file for area (%d,%d,%d) to (%d,%d,%d), %dx%dx%d\n",xStart,yStart,zStart,xEnd,yEnd,zEnd,xSize,ySize,zSize); - if(dos != NULL) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); + if(dos != nullptr) dos->writeInt(XBOX_SCHEMATIC_CURRENT_VERSION); - if(dos != NULL) dos->writeByte(compressionType); + if(dos != nullptr) dos->writeByte(compressionType); //Write xSize - if(dos != NULL) dos->writeInt(xSize); + if(dos != nullptr) dos->writeInt(xSize); //Write ySize - if(dos != NULL) dos->writeInt(ySize); + if(dos != nullptr) dos->writeInt(ySize); //Write zSize - if(dos != NULL) dos->writeInt(zSize); + if(dos != nullptr) dos->writeInt(zSize); //byteArray rawBuffer = level->getBlocksAndData(xStart, yStart, zStart, xSize, ySize, zSize, false); int xRowSize = ySize * zSize; @@ -660,8 +660,8 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l delete [] result.data; byteArray buffer = byteArray(ucTemp,inputSize); - if(dos != NULL) dos->writeInt(inputSize); - if(dos != NULL) dos->write(buffer); + if(dos != nullptr) dos->writeInt(inputSize); + if(dos != nullptr) dos->write(buffer); delete [] buffer.data; CompoundTag tag; @@ -738,7 +738,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l tag.put(L"Entities", entitiesTag); - if(dos != NULL) NbtIo::write(&tag,dos); + if(dos != nullptr) NbtIo::write(&tag,dos); } void ConsoleSchematicFile::getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP) diff --git a/Minecraft.Client/Common/GameRules/GameRule.h b/Minecraft.Client/Common/GameRules/GameRule.h index bdc2ceff5..42e575718 100644 --- a/Minecraft.Client/Common/GameRules/GameRule.h +++ b/Minecraft.Client/Common/GameRules/GameRule.h @@ -40,7 +40,7 @@ public: stringValueMapType m_parameters; // These are the members of this rule that maintain it's state public: - GameRule(GameRuleDefinition *definition, Connection *connection = NULL); + GameRule(GameRuleDefinition *definition, Connection *connection = nullptr); virtual ~GameRule(); Connection *getConnection() { return m_connection; } diff --git a/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp index 80d029560..770b56d56 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp @@ -50,7 +50,7 @@ GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType #ifndef _CONTENT_PACKAGE wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType ); #endif - return NULL; + return nullptr; } void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue) diff --git a/Minecraft.Client/Common/GameRules/GameRuleDefinition.h b/Minecraft.Client/Common/GameRules/GameRuleDefinition.h index afec8fbcc..4a2c43a1c 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleDefinition.h +++ b/Minecraft.Client/Common/GameRules/GameRuleDefinition.h @@ -61,6 +61,6 @@ public: // Static functions static GameRulesInstance *generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection); - static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = NULL, int dataLength = 0); + static wstring generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data = nullptr, int dataLength = 0); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp index 9b4d0493c..96d4e8289 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp @@ -85,13 +85,13 @@ WCHAR *GameRuleManager::wchAttrNameA[] = GameRuleManager::GameRuleManager() { - m_currentGameRuleDefinitions = NULL; - m_currentLevelGenerationOptions = NULL; + m_currentGameRuleDefinitions = nullptr; + m_currentLevelGenerationOptions = nullptr; } void GameRuleManager::loadGameRules(DLCPack *pack) { - StringTable *strings = NULL; + StringTable *strings = nullptr; if(pack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData,L"languages.loc")) { @@ -237,11 +237,11 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT // 4J-JEV: Reverse of loadGameRules. void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) { - if (m_currentGameRuleDefinitions == NULL && - m_currentLevelGenerationOptions == NULL) + if (m_currentGameRuleDefinitions == nullptr && + m_currentLevelGenerationOptions == nullptr) { app.DebugPrintf("GameRuleManager:: Nothing here to save."); - *dOut = NULL; + *dOut = nullptr; *dSize = 0; return; } @@ -268,7 +268,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) ByteArrayOutputStream compr_baos; DataOutputStream compr_dos(&compr_baos); - if (m_currentGameRuleDefinitions == NULL) + if (m_currentGameRuleDefinitions == nullptr) { compr_dos.writeInt( 0 ); // numStrings for StringTable compr_dos.writeInt( version_number ); @@ -282,9 +282,9 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) { StringTable *st = m_currentGameRuleDefinitions->getStringTable(); - if (st == NULL) + if (st == nullptr) { - app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == NULL!"); + app.DebugPrintf("GameRuleManager::saveGameRules: StringTable == nullptr!"); } else { @@ -322,7 +322,7 @@ void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) *dSize = baos.buf.length; *dOut = baos.buf.data; - baos.buf.data = NULL; + baos.buf.data = nullptr; dos.close(); baos.close(); } @@ -399,8 +399,8 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT for(int i = 0; i < 8; ++i) dis.readBoolean(); } - ByteArrayInputStream *contentBais = NULL; - DataInputStream *contentDis = NULL; + ByteArrayInputStream *contentBais = nullptr; + DataInputStream *contentDis = nullptr; if(compressionType == Compression::eCompressionType_None) { @@ -521,7 +521,7 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT auto it = tagIdMap.find(tagId); if(it != tagIdMap.end()) tagVal = it->second; - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(tagVal == ConsoleGameRules::eGameRuleType_LevelGenerationOptions) { @@ -548,14 +548,14 @@ bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT { // Not default contentDis->close(); - if(contentBais != NULL) delete contentBais; + if(contentBais != nullptr) delete contentBais; delete contentDis; } dis.close(); bais.reset(); - //if(!levelGenAdded) { delete levelGenerator; levelGenerator = NULL; } + //if(!levelGenAdded) { delete levelGenerator; levelGenerator = nullptr; } if(!gameRulesAdded) delete gameRules; return true; @@ -583,7 +583,7 @@ void GameRuleManager::readAttributes(DataInputStream *dis, vector *tags int attID = dis->readInt(); wstring value = dis->readUTF(); - if(rule != NULL) rule->addAttribute(tagsAndAtts->at(attID),value); + if(rule != nullptr) rule->addAttribute(tagsAndAtts->at(attID),value); } } @@ -597,8 +597,8 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector *tagsAn auto it = tagIdMap->find(tagId); if(it != tagIdMap->end()) tagVal = it->second; - GameRuleDefinition *childRule = NULL; - if(rule != NULL) childRule = rule->addChild(tagVal); + GameRuleDefinition *childRule = nullptr; + if(rule != nullptr) childRule = rule->addChild(tagVal); readAttributes(dis,tagsAndAtts,childRule); readChildren(dis,tagsAndAtts,tagIdMap,childRule); @@ -607,7 +607,7 @@ void GameRuleManager::readChildren(DataInputStream *dis, vector *tagsAn void GameRuleManager::processSchematics(LevelChunk *levelChunk) { - if(getLevelGenerationOptions() != NULL) + if(getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions(); levelGenOptions->processSchematics(levelChunk); @@ -616,7 +616,7 @@ void GameRuleManager::processSchematics(LevelChunk *levelChunk) void GameRuleManager::processSchematicsLighting(LevelChunk *levelChunk) { - if(getLevelGenerationOptions() != NULL) + if(getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = getLevelGenerationOptions(); levelGenOptions->processSchematicsLighting(levelChunk); @@ -701,21 +701,21 @@ void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen { unloadCurrentGameRules(); - m_currentGameRuleDefinitions = NULL; + m_currentGameRuleDefinitions = nullptr; m_currentLevelGenerationOptions = levelGen; - if(m_currentLevelGenerationOptions != NULL && m_currentLevelGenerationOptions->requiresGameRules() ) + if(m_currentLevelGenerationOptions != nullptr && m_currentLevelGenerationOptions->requiresGameRules() ) { m_currentGameRuleDefinitions = m_currentLevelGenerationOptions->getRequiredGameRules(); } - if(m_currentLevelGenerationOptions != NULL) + if(m_currentLevelGenerationOptions != nullptr) m_currentLevelGenerationOptions->reset_start(); } LPCWSTR GameRuleManager::GetGameRulesString(const wstring &key) { - if(m_currentGameRuleDefinitions != NULL && !key.empty() ) + if(m_currentGameRuleDefinitions != nullptr && !key.empty() ) { return m_currentGameRuleDefinitions->getString(key); } @@ -739,9 +739,9 @@ LEVEL_GEN_ID GameRuleManager::addLevelGenerationOptions(LevelGenerationOptions * void GameRuleManager::unloadCurrentGameRules() { - if (m_currentLevelGenerationOptions != NULL) + if (m_currentLevelGenerationOptions != nullptr) { - if (m_currentGameRuleDefinitions != NULL + if (m_currentGameRuleDefinitions != nullptr && m_currentLevelGenerationOptions->isFromSave()) m_levelRules.removeLevelRule( m_currentGameRuleDefinitions ); @@ -757,6 +757,6 @@ void GameRuleManager::unloadCurrentGameRules() } } - m_currentGameRuleDefinitions = NULL; - m_currentLevelGenerationOptions = NULL; + m_currentGameRuleDefinitions = nullptr; + m_currentLevelGenerationOptions = nullptr; } diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp index 7232e9c65..9f72b0984 100644 --- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp @@ -44,8 +44,8 @@ bool JustGrSource::ready() { return true; } LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack) { - m_spawnPos = NULL; - m_stringTable = NULL; + m_spawnPos = nullptr; + m_stringTable = nullptr; m_hasLoadedData = false; @@ -56,7 +56,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack) m_minY = INT_MAX; m_bRequiresGameRules = false; - m_pbBaseSaveData = NULL; + m_pbBaseSaveData = nullptr; m_dwBaseSaveSize = 0; m_parentDLCPack = parentPack; @@ -66,7 +66,7 @@ LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack) LevelGenerationOptions::~LevelGenerationOptions() { clearSchematics(); - if(m_spawnPos != NULL) delete m_spawnPos; + if(m_spawnPos != nullptr) delete m_spawnPos; for (auto& it : m_schematicRules ) { delete it; @@ -141,7 +141,7 @@ void LevelGenerationOptions::getChildren(vector *children) GameRuleDefinition *LevelGenerationOptions::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(ruleType == ConsoleGameRules::eGameRuleType_ApplySchematic) { rule = new ApplySchematicRuleDefinition(this); @@ -180,21 +180,21 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws } else if(attributeName.compare(L"spawnX") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->x = value; app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnX=%d\n",value); } else if(attributeName.compare(L"spawnY") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->y = value; app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnY=%d\n",value); } else if(attributeName.compare(L"spawnZ") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->z = value; app.DebugPrintf("LevelGenerationOptions: Adding parameter spawnZ=%d\n",value); @@ -268,7 +268,7 @@ void LevelGenerationOptions::processSchematics(LevelChunk *chunk) if (structureStart->getBoundingBox()->intersects(cx, cz, cx + 15, cz + 15)) { BoundingBox *bb = new BoundingBox(cx, cz, cx + 15, cz + 15); - structureStart->postProcess(chunk->level, NULL, bb); + structureStart->postProcess(chunk->level, nullptr, bb); delete bb; } } @@ -353,7 +353,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f return it->second; } - ConsoleSchematicFile *schematic = NULL; + ConsoleSchematicFile *schematic = nullptr; byteArray data(pbData,dwLen); ByteArrayInputStream bais(data); DataInputStream dis(&bais); @@ -366,7 +366,7 @@ ConsoleSchematicFile *LevelGenerationOptions::loadSchematicFile(const wstring &f ConsoleSchematicFile *LevelGenerationOptions::getSchematicFile(const wstring &filename) { - ConsoleSchematicFile *schematic = NULL; + ConsoleSchematicFile *schematic = nullptr; // If we have already loaded this, just return auto it = m_schematics.find(filename); if(it != m_schematics.end()) @@ -399,7 +399,7 @@ void LevelGenerationOptions::loadStringTable(StringTable *table) LPCWSTR LevelGenerationOptions::getString(const wstring &key) { - if(m_stringTable == NULL) + if(m_stringTable == nullptr) { return L""; } @@ -456,7 +456,7 @@ unordered_map *LevelGenerationOptions::getUnfin void LevelGenerationOptions::loadBaseSaveData() { int mountIndex = -1; - if(m_parentDLCPack != NULL) mountIndex = m_parentDLCPack->GetDLCMountIndex(); + if(m_parentDLCPack != nullptr) mountIndex = m_parentDLCPack->GetDLCMountIndex(); if(mountIndex > -1) { @@ -513,10 +513,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -524,10 +524,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #endif @@ -536,7 +536,7 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD DWORD dwFileSize = grf.length(); DWORD bytesRead; PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -565,10 +565,10 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #else const char *pchFilename=wstringtofilename(save.getPath()); @@ -576,18 +576,18 @@ int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #endif if( fileHandle != INVALID_HANDLE_VALUE ) { - DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); + DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -624,8 +624,8 @@ void LevelGenerationOptions::reset_start() void LevelGenerationOptions::reset_finish() { - //if (m_spawnPos) { delete m_spawnPos; m_spawnPos = NULL; } - //if (m_stringTable) { delete m_stringTable; m_stringTable = NULL; } + //if (m_spawnPos) { delete m_spawnPos; m_spawnPos = nullptr; } + //if (m_stringTable) { delete m_stringTable; m_stringTable = nullptr; } if (isFromDLC()) { @@ -694,8 +694,8 @@ bool LevelGenerationOptions::ready() { return info()->ready(); } void LevelGenerationOptions::setBaseSaveData(PBYTE pbData, DWORD dwSize) { m_pbBaseSaveData = pbData; m_dwBaseSaveSize = dwSize; } PBYTE LevelGenerationOptions::getBaseSaveData(DWORD &size) { size = m_dwBaseSaveSize; return m_pbBaseSaveData; } -bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != NULL; } -void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = NULL; m_dwBaseSaveSize = 0; } +bool LevelGenerationOptions::hasBaseSaveData() { return m_dwBaseSaveSize > 0 && m_pbBaseSaveData != nullptr; } +void LevelGenerationOptions::deleteBaseSaveData() { if(m_pbBaseSaveData) delete m_pbBaseSaveData; m_pbBaseSaveData = nullptr; m_dwBaseSaveSize = 0; } bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; } void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; } diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h index aa128ff84..b94b312a7 100644 --- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h +++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.h @@ -167,7 +167,7 @@ private: bool m_bLoadingData; public: - LevelGenerationOptions(DLCPack *parentPack = NULL); + LevelGenerationOptions(DLCPack *parentPack = nullptr); ~LevelGenerationOptions(); virtual ConsoleGameRules::EGameRuleType getActionType(); @@ -202,7 +202,7 @@ public: LevelRuleset *getRequiredGameRules(); void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile); - bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = NULL); + bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = nullptr); void loadStringTable(StringTable *table); LPCWSTR getString(const wstring &key); diff --git a/Minecraft.Client/Common/GameRules/LevelRuleset.cpp b/Minecraft.Client/Common/GameRules/LevelRuleset.cpp index b6525b73d..de17bacca 100644 --- a/Minecraft.Client/Common/GameRules/LevelRuleset.cpp +++ b/Minecraft.Client/Common/GameRules/LevelRuleset.cpp @@ -6,7 +6,7 @@ LevelRuleset::LevelRuleset() { - m_stringTable = NULL; + m_stringTable = nullptr; } LevelRuleset::~LevelRuleset() @@ -26,7 +26,7 @@ void LevelRuleset::getChildren(vector *children) GameRuleDefinition *LevelRuleset::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(ruleType == ConsoleGameRules::eGameRuleType_NamedArea) { rule = new NamedAreaRuleDefinition(); @@ -46,7 +46,7 @@ void LevelRuleset::loadStringTable(StringTable *table) LPCWSTR LevelRuleset::getString(const wstring &key) { - if(m_stringTable == NULL) + if(m_stringTable == nullptr) { return L""; } diff --git a/Minecraft.Client/Common/GameRules/StartFeature.cpp b/Minecraft.Client/Common/GameRules/StartFeature.cpp index c2ad23505..14b6d9c93 100644 --- a/Minecraft.Client/Common/GameRules/StartFeature.cpp +++ b/Minecraft.Client/Common/GameRules/StartFeature.cpp @@ -58,6 +58,6 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation) { - if(orientation != NULL) *orientation = m_orientation; + if(orientation != nullptr) *orientation = m_orientation; return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature; } \ No newline at end of file diff --git a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp index 038ba5c78..99aee99b0 100644 --- a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp @@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;; m_health = 0; m_food = 0; - m_spawnPos = NULL; + m_spawnPos = nullptr; m_yRot = 0.0f; } @@ -65,7 +65,7 @@ void UpdatePlayerRuleDefinition::getChildren(vector *child GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) { rule = new AddItemRuleDefinition(); @@ -84,21 +84,21 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons { if(attributeName.compare(L"spawnX") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->x = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n",value); } else if(attributeName.compare(L"spawnY") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->y = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n",value); } else if(attributeName.compare(L"spawnZ") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->z = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n",value); @@ -148,7 +148,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr player) double z = player->z; float yRot = player->yRot; float xRot = player->xRot; - if(m_spawnPos != NULL) + if(m_spawnPos != nullptr) { x = m_spawnPos->x; y = m_spawnPos->y; @@ -160,7 +160,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr player) yRot = m_yRot; } - if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot); + if(m_spawnPos != nullptr || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot); for(auto& addItem : m_items) { diff --git a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp index cd26ad451..1f4946912 100644 --- a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp +++ b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceContainer.cpp @@ -33,7 +33,7 @@ void XboxStructureActionPlaceContainer::getChildren(vector GameRuleDefinition *XboxStructureActionPlaceContainer::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) { rule = new AddItemRuleDefinition(); @@ -70,7 +70,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st if ( chunkBB->isInside( worldX, worldY, worldZ ) ) { - if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL ) + if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr ) { // Remove the current tile entity level->removeTileEntity( worldX, worldY, worldZ ); @@ -81,7 +81,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st shared_ptr container = dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ); - if ( container != NULL ) + if ( container != nullptr ) { level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS); // Add items diff --git a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp index 3f6204af7..3e61154fc 100644 --- a/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp +++ b/Minecraft.Client/Common/GameRules/XboxStructureActionPlaceSpawner.cpp @@ -46,7 +46,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct if ( chunkBB->isInside( worldX, worldY, worldZ ) ) { - if ( level->getTileEntity( worldX, worldY, worldZ ) != NULL ) + if ( level->getTileEntity( worldX, worldY, worldZ ) != nullptr ) { // Remove the current tile entity level->removeTileEntity( worldX, worldY, worldZ ); @@ -59,7 +59,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct #ifndef _CONTENT_PACKAGE wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ); #endif - if( entity != NULL ) + if( entity != nullptr ) { entity->setEntityId(m_entityId); } diff --git a/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp b/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp index e93613c18..06f9a69bd 100644 --- a/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp +++ b/Minecraft.Client/Common/Leaderboards/LeaderboardInterface.cpp @@ -7,7 +7,7 @@ LeaderboardInterface::LeaderboardInterface(LeaderboardManager *man) m_pending = false; m_filter = static_cast(-1); - m_callback = NULL; + m_callback = nullptr; m_difficulty = 0; m_type = LeaderboardManager::eStatsType_UNDEFINED; m_startIndex = 0; diff --git a/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp b/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp index 33707b14c..2ba1efd60 100644 --- a/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp +++ b/Minecraft.Client/Common/Leaderboards/LeaderboardManager.cpp @@ -12,7 +12,7 @@ const wstring LeaderboardManager::filterNames[eNumFilterModes] = void LeaderboardManager::DeleteInstance() { delete m_instance; - m_instance = NULL; + m_instance = nullptr; } LeaderboardManager::LeaderboardManager() @@ -26,7 +26,7 @@ void LeaderboardManager::zeroReadParameters() { m_difficulty = -1; m_statsType = eStatsType_UNDEFINED; - m_readListener = NULL; + m_readListener = nullptr; m_startIndex = 0; m_readCount = 0; m_eFilterMode = eFM_UNDEFINED; diff --git a/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.cpp b/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.cpp index 78d62568c..f2d48947d 100644 --- a/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.cpp +++ b/Minecraft.Client/Common/Leaderboards/SonyLeaderboardManager.cpp @@ -35,7 +35,7 @@ SonyLeaderboardManager::SonyLeaderboardManager() m_myXUID = INVALID_XUID; - m_scores = NULL; + m_scores = nullptr; m_statsType = eStatsType_Kills; m_difficulty = 0; @@ -47,7 +47,7 @@ SonyLeaderboardManager::SonyLeaderboardManager() InitializeCriticalSection(&m_csViewsLock); m_running = false; - m_threadScoreboard = NULL; + m_threadScoreboard = nullptr; } SonyLeaderboardManager::~SonyLeaderboardManager() @@ -288,7 +288,7 @@ bool SonyLeaderboardManager::getScoreByIds() SonyRtcTick last_sort_date; SceNpScoreRankNumber mTotalRecord; - SceNpId *npIds = NULL; + SceNpId *npIds = nullptr; int ret; uint32_t num = 0; @@ -322,7 +322,7 @@ bool SonyLeaderboardManager::getScoreByIds() ZeroMemory(comments, sizeof(SceNpScoreComment) * num); /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\ - rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n", + rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount ); */ @@ -342,9 +342,9 @@ bool SonyLeaderboardManager::getScoreByIds() destroyTransactionContext(ret); - if (npIds != NULL) delete [] npIds; - if (ptr != NULL) delete [] ptr; - if (comments != NULL) delete [] comments; + if (npIds != nullptr) delete [] npIds; + if (ptr != nullptr) delete [] ptr; + if (comments != nullptr) delete [] comments; return false; } @@ -355,9 +355,9 @@ bool SonyLeaderboardManager::getScoreByIds() m_eStatsState = eStatsState_Failed; - if (npIds != NULL) delete [] npIds; - if (ptr != NULL) delete [] ptr; - if (comments != NULL) delete [] comments; + if (npIds != nullptr) delete [] npIds; + if (ptr != nullptr) delete [] ptr; + if (comments != nullptr) delete [] comments; return false; } @@ -387,14 +387,14 @@ bool SonyLeaderboardManager::getScoreByIds() comments, sizeof(SceNpScoreComment) * tmpNum, //OUT: Comments #endif - NULL, 0, // GameData. (unused) + nullptr, 0, // GameData. (unused) tmpNum, &last_sort_date, &mTotalRecord, - NULL // Reserved, specify null. + nullptr // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -425,7 +425,7 @@ bool SonyLeaderboardManager::getScoreByIds() m_readCount = num; // Filter scorers and construct output structure. - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_scores = new ReadScore[m_readCount]; convertToOutput(m_readCount, m_scores, ptr, comments); m_maxRank = m_readCount; @@ -458,7 +458,7 @@ error3: delete [] ptr; delete [] comments; error2: - if (npIds != NULL) delete [] npIds; + if (npIds != nullptr) delete [] npIds; error1: if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed; app.DebugPrintf("[SonyLeaderboardManager] getScoreByIds() FAILED, ret=0x%X\n", ret); @@ -511,14 +511,14 @@ bool SonyLeaderboardManager::getScoreByRange() comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data - NULL, 0, // GameData. + nullptr, 0, // GameData. num, &last_sort_date, &m_maxRank, // 'Total number of players registered in the target scoreboard.' - NULL // Reserved, specify null. + nullptr // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -539,7 +539,7 @@ bool SonyLeaderboardManager::getScoreByRange() delete [] ptr; delete [] comments; - m_scores = NULL; + m_scores = nullptr; m_readCount = 0; m_eStatsState = eStatsState_Ready; @@ -557,7 +557,7 @@ bool SonyLeaderboardManager::getScoreByRange() //m_stats = ptr; //Maybe: addPadding(num,ptr); - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_readCount = ret; m_scores = new ReadScore[m_readCount]; for (int i=0; i 0) ret = eStatsReturn_Success; - if (m_readListener != NULL) + if (m_readListener != nullptr) { app.DebugPrintf("[SonyLeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -716,16 +716,16 @@ void SonyLeaderboardManager::Tick() m_eStatsState = eStatsState_Idle; delete [] m_scores; - m_scores = NULL; + m_scores = nullptr; } break; case eStatsState_Failed: { view.m_numQueries = 0; - view.m_queries = NULL; + view.m_queries = nullptr; - if ( m_readListener != NULL ) + if ( m_readListener != nullptr ) m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); m_eStatsState = eStatsState_Idle; @@ -747,7 +747,7 @@ bool SonyLeaderboardManager::OpenSession() { if (m_openSessions == 0) { - if (m_threadScoreboard == NULL) + if (m_threadScoreboard == nullptr) { m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard"); m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS); @@ -837,7 +837,7 @@ void SonyLeaderboardManager::FlushStats() {} void SonyLeaderboardManager::CancelOperation() { - m_readListener = NULL; + m_readListener = nullptr; m_eStatsState = eStatsState_Canceled; if (m_requestId != 0) @@ -980,7 +980,7 @@ void SonyLeaderboardManager::fromBase32(void *out, SceNpScoreComment *in) for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) { ch[0] = getComment(in)[i]; - unsigned char fivebits = strtol(ch, NULL, 32) << 3; + unsigned char fivebits = strtol(ch, nullptr, 32) << 3; int sByte = (i*5) / 8; int eByte = (5+(i*5)) / 8; @@ -1041,7 +1041,7 @@ bool SonyLeaderboardManager::test_string(string testing) int ctx = createTransactionContext(m_titleContext); if (ctx<0) return false; - int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, NULL); + int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, nullptr); if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) { diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index f8d1f0dad..7d282db5d 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -56,8 +56,8 @@ CGameNetworkManager::CGameNetworkManager() m_bFullSessionMessageOnNextSessionChange = false; #ifdef __ORBIS__ - m_pUpsell = NULL; - m_pInviteInfo = NULL; + m_pUpsell = nullptr; + m_pInviteInfo = nullptr; #endif } @@ -120,26 +120,26 @@ void CGameNetworkManager::DoWork() s_pPlatformNetworkManager->DoWork(); #ifdef __ORBIS__ - if (m_pUpsell != NULL && m_pUpsell->hasResponse()) + if (m_pUpsell != nullptr && m_pUpsell->hasResponse()) { int iPad_invited = m_iPlayerInvited, iPad_checking = m_pUpsell->m_userIndex; m_iPlayerInvited = -1; delete m_pUpsell; - m_pUpsell = NULL; + m_pUpsell = nullptr; if (ProfileManager.HasPlayStationPlus(iPad_checking)) { this->GameInviteReceived(iPad_invited, m_pInviteInfo); // m_pInviteInfo deleted by GameInviteReceived. - m_pInviteInfo = NULL; + m_pInviteInfo = nullptr; } else { delete m_pInviteInfo; - m_pInviteInfo = NULL; + m_pInviteInfo = nullptr; } } #endif @@ -195,15 +195,15 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame #endif __int64 seed = 0; - if(lpParameter != NULL) + if(lpParameter != nullptr) { NetworkGameInitData *param = static_cast(lpParameter); seed = param->seed; app.setLevelGenerationOptions(param->levelGen); - if(param->levelGen != NULL) + if(param->levelGen != nullptr) { - if(app.getLevelGenerationOptions() == NULL) + if(app.getLevelGenerationOptions() == nullptr) { app.DebugPrintf("Game rule was not loaded, and seed is required. Exiting.\n"); return false; @@ -248,10 +248,10 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -259,18 +259,18 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #endif if( fileHandle != INVALID_HANDLE_VALUE ) { - DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); + DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -312,7 +312,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame } else { - Socket::Initialise(NULL); + Socket::Initialise(nullptr); } #ifndef _XBOX @@ -358,27 +358,27 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame if( g_NetworkManager.IsHost() ) { - connection = new ClientConnection(minecraft, NULL); + connection = new ClientConnection(minecraft, nullptr); } else { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(ProfileManager.GetLockedProfile()); - if(pNetworkPlayer == NULL) + if(pNetworkPlayer == nullptr) { MinecraftServer::HaltServer(); app.DebugPrintf("%d\n",ProfileManager.GetLockedProfile()); - // If the player is NULL here then something went wrong in the session setup, and continuing will end up in a crash + // If the player is nullptr here then something went wrong in the session setup, and continuing will end up in a crash return false; } Socket *socket = pNetworkPlayer->GetSocket(); // Fix for #13259 - CRASH: Gameplay: loading process is halted when player loads saved data - if(socket == NULL) + if(socket == nullptr) { assert(false); MinecraftServer::HaltServer(); - // If the socket is NULL here then something went wrong in the session setup, and continuing will end up in a crash + // If the socket is nullptr here then something went wrong in the session setup, and continuing will end up in a crash return false; } @@ -389,7 +389,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame { assert(false); delete connection; - connection = NULL; + connection = nullptr; MinecraftServer::HaltServer(); return false; } @@ -453,7 +453,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // Already have setup the primary pad if(idx == ProfileManager.GetPrimaryPad() ) continue; - if( GetLocalPlayerByUserIndex(idx) != NULL && !ProfileManager.IsSignedIn(idx) ) + if( GetLocalPlayerByUserIndex(idx) != nullptr && !ProfileManager.IsSignedIn(idx) ) { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); Socket *socket = pNetworkPlayer->GetSocket(); @@ -467,7 +467,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame // when joining any other way, so just because they are signed in doesn't mean they are in the session // 4J Stu - If they are in the session, then we should add them to the game. Otherwise we won't be able to add them later INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); - if( pNetworkPlayer == NULL ) + if( pNetworkPlayer == nullptr ) continue; ClientConnection *connection; @@ -801,9 +801,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin // Check if user-created content is allowed, as we cannot play multiplayer if it's not bool noUGC = false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,nullptr,nullptr); #elif defined(__ORBIS__) - ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,false,nullptr,&noUGC,nullptr); #endif if(noUGC) @@ -823,7 +823,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin { #if defined(__ORBIS__) || defined(__PSVITA__) bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,false,&chatRestricted,nullptr,nullptr); if(chatRestricted) { ProfileManager.DisplaySystemMessage( 0, ProfileManager.GetPrimaryPad() ); @@ -912,7 +912,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) app.SetDisconnectReason( DisconnectPacket::eDisconnect_ConnectionCreationFailed ); } // If we failed before the server started, clear the game rules. Otherwise the server will clear it up. - if(MinecraftServer::getInstance() == NULL) app.m_gameRules.unloadCurrentGameRules(); + if(MinecraftServer::getInstance() == nullptr) app.m_gameRules.unloadCurrentGameRules(); Tile::ReleaseThreadStorage(); return -1; } @@ -930,14 +930,14 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter ) int CGameNetworkManager::ServerThreadProc( void* lpParameter ) { __int64 seed = 0; - if(lpParameter != NULL) + if(lpParameter != nullptr) { NetworkGameInitData *param = static_cast(lpParameter); seed = param->seed; app.SetGameHostOption(eGameHostOption_All,param->settings); // 4J Stu - If we are loading a DLC save that's separate from the texture pack, load - if( param->levelGen != NULL && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) ) + if( param->levelGen != nullptr && (param->texturePackId == 0 || param->levelGen->getRequiredTexturePackId() != param->texturePackId) ) { while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin())) { @@ -966,7 +966,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter ) IntCache::ReleaseThreadStorage(); Level::destroyLightingCache(); - if(lpParameter != NULL) delete lpParameter; + if(lpParameter != nullptr) delete lpParameter; return S_OK; } @@ -979,7 +979,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam ) Compression::UseDefaultThreadStorage(); //app.SetGameStarted(false); - UIScene_PauseMenu::_ExitWorld(NULL); + UIScene_PauseMenu::_ExitWorld(nullptr); while( g_NetworkManager.IsInSession() ) { @@ -1216,14 +1216,14 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) #endif // Null the network player of all the server players that are local, to stop them being removed from the server when removed from the session - if( pServer != NULL ) + if( pServer != nullptr ) { PlayerList *players = pServer->getPlayers(); for(auto& servPlayer : players->players) { if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() ) { - servPlayer->connection->connection->getSocket()->setPlayer(NULL); + servPlayer->connection->connection->getSocket()->setPlayer(nullptr); } } } @@ -1259,7 +1259,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) char numLocalPlayers = 0; for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL ) + if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr ) { numLocalPlayers++; localUsersMask |= GetLocalPlayerMask(index); @@ -1277,11 +1277,11 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) } // Restore the network player of all the server players that are local - if( pServer != NULL ) + if( pServer != nullptr ) { for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) { - if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != NULL ) + if(ProfileManager.IsSignedIn(index) && pMinecraft->localplayers[index] != nullptr ) { PlayerUID localPlayerXuid = pMinecraft->localplayers[index]->getXuid(); @@ -1295,7 +1295,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam ) } // Player might have a pending connection - if (pMinecraft->m_pendingLocalConnections[index] != NULL) + if (pMinecraft->m_pendingLocalConnections[index] != nullptr) { // Update the network player pMinecraft->m_pendingLocalConnections[index]->getConnection()->getSocket()->setPlayer(g_NetworkManager.GetLocalPlayerByUserIndex(index)); @@ -1361,8 +1361,8 @@ void CGameNetworkManager::renderQueueMeter() #ifdef _XBOX int height = 720; - CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(NULL, false); - CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(NULL, false); + CGameNetworkManager::byteQueue[(CGameNetworkManager::messageQueuePos) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeBytes(nullptr, false); + CGameNetworkManager::messageQueue[(CGameNetworkManager::messageQueuePos++) & (CGameNetworkManager::messageQueue_length - 1)] = GetHostPlayer()->GetSendQueueSizeMessages(nullptr, false); Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->gui->renderGraph(CGameNetworkManager::messageQueue_length, CGameNetworkManager::messageQueuePos, CGameNetworkManager::messageQueue, 10, 1000, CGameNetworkManager::byteQueue, 100, 25000); @@ -1426,7 +1426,7 @@ void CGameNetworkManager::StateChange_AnyToStarting() { LoadingInputParams *loadingParams = new LoadingInputParams(); loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = NULL; + loadingParams->lpParam = nullptr; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); completionData->bShowBackground=TRUE; @@ -1447,7 +1447,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying) for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { INetworkPlayer *pNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(i); - if(pNetworkPlayer != NULL && ProfileManager.IsSignedIn( i ) ) + if(pNetworkPlayer != nullptr && ProfileManager.IsSignedIn( i ) ) { app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i ); Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex()); @@ -1482,12 +1482,12 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc { Minecraft *pMinecraft = Minecraft::GetInstance(); - Socket *socket = NULL; + Socket *socket = nullptr; shared_ptr mpPlayer = nullptr; int userIdx = pNetworkPlayer->GetUserIndex(); if (userIdx >= 0 && userIdx < XUSER_MAX_COUNT) mpPlayer = pMinecraft->localplayers[userIdx]; - if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL) + if( localPlayer && mpPlayer != nullptr && mpPlayer->connection != nullptr) { // If we already have a MultiplayerLocalPlayer here then we are doing a session type change socket = mpPlayer->connection->getSocket(); @@ -1530,7 +1530,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc { pMinecraft->connectionDisconnected( idx , DisconnectPacket::eDisconnect_ConnectionCreationFailed ); delete connection; - connection = NULL; + connection = nullptr; } } } @@ -1540,10 +1540,10 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc void CGameNetworkManager::CloseConnection( INetworkPlayer *pNetworkPlayer ) { MinecraftServer *server = MinecraftServer::getInstance(); - if( server != NULL ) + if( server != nullptr ) { PlayerList *players = server->getPlayers(); - if( players != NULL ) + if( players != nullptr ) { players->closePlayerConnectionBySmallId(pNetworkPlayer->GetSmallId()); } @@ -1559,7 +1559,7 @@ void CGameNetworkManager::PlayerJoining( INetworkPlayer *pNetworkPlayer ) for (int iPad=0; iPadlocalplayers[idx] != NULL) + if(Minecraft::GetInstance()->localplayers[idx] != nullptr) { TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } @@ -1609,7 +1609,7 @@ void CGameNetworkManager::PlayerLeaving( INetworkPlayer *pNetworkPlayer ) { for(int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(Minecraft::GetInstance()->localplayers[idx] != NULL) + if(Minecraft::GetInstance()->localplayers[idx] != nullptr) { TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, Minecraft::GetInstance()->level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } @@ -1632,7 +1632,7 @@ void CGameNetworkManager::WriteStats( INetworkPlayer *pNetworkPlayer ) void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *pInviteInfo) { #ifdef __ORBIS__ - if (m_pUpsell != NULL) + if (m_pUpsell != nullptr) { delete pInviteInfo; return; @@ -1721,7 +1721,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * { // 4J-PB we shouldn't bring any inactive players into the game, except for the invited player (who may be an inactive player) // 4J Stu - If we are not in a game, then bring in all players signed in - if(index==userIndex || pMinecraft->localplayers[index]!=NULL ) + if(index==userIndex || pMinecraft->localplayers[index]!=nullptr ) { ++joiningUsers; if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; @@ -1736,7 +1736,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * BOOL pccAllowed = TRUE; BOOL pccFriendsAllowed = TRUE; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(userIndex,false,&noUGC,&bContentRestricted,nullptr); #else ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); if(!pccAllowed && !pccFriendsAllowed) noUGC = true; @@ -1781,14 +1781,14 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO * uiIDA[0]=IDS_CONFIRM_OK; // 4J-PB - it's possible there is no primary pad here, when accepting an invite from the dashboard - //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()); ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,XUSER_INDEX_ANY); } else { #if defined(__ORBIS__) || defined(__PSVITA__) bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -1984,7 +1984,7 @@ const char *CGameNetworkManager::GetOnlineName(int playerIdx) void CGameNetworkManager::ServerReadyCreate(bool create) { - m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : NULL ); + m_hServerReadyEvent = ( create ? ( new C4JThread::Event ) : nullptr ); } void CGameNetworkManager::ServerReady() @@ -2000,17 +2000,17 @@ void CGameNetworkManager::ServerReadyWait() void CGameNetworkManager::ServerReadyDestroy() { delete m_hServerReadyEvent; - m_hServerReadyEvent = NULL; + m_hServerReadyEvent = nullptr; } bool CGameNetworkManager::ServerReadyValid() { - return ( m_hServerReadyEvent != NULL ); + return ( m_hServerReadyEvent != nullptr ); } void CGameNetworkManager::ServerStoppedCreate(bool create) { - m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : NULL ); + m_hServerStoppedEvent = ( create ? ( new C4JThread::Event ) : nullptr ); } void CGameNetworkManager::ServerStopped() @@ -2051,12 +2051,12 @@ void CGameNetworkManager::ServerStoppedWait() void CGameNetworkManager::ServerStoppedDestroy() { delete m_hServerStoppedEvent; - m_hServerStoppedEvent = NULL; + m_hServerStoppedEvent = nullptr; } bool CGameNetworkManager::ServerStoppedValid() { - return ( m_hServerStoppedEvent != NULL ); + return ( m_hServerStoppedEvent != nullptr ); } int CGameNetworkManager::GetJoiningReadyPercentage() diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.h b/Minecraft.Client/Common/Network/GameNetworkManager.h index bb7633c28..c5049320a 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Common/Network/GameNetworkManager.h @@ -108,7 +108,7 @@ public: static void CancelJoinGame(LPVOID lpParam); // Not part of the shared interface bool LeaveGame(bool bMigrateHost); static int JoinFromInvite_SignInReturned(void *pParam,bool bContinue, int iPad); - void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); + void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); void SendInviteGUI(int iPad); void ResetLeavingGame(); @@ -137,17 +137,17 @@ public: // Events - void ServerReadyCreate(bool create); // Create the signal (or set to NULL) + void ServerReadyCreate(bool create); // Create the signal (or set to nullptr) void ServerReady(); // Signal that we are ready void ServerReadyWait(); // Wait for the signal void ServerReadyDestroy(); // Destroy signal - bool ServerReadyValid(); // Is non-NULL + bool ServerReadyValid(); // Is non-nullptr void ServerStoppedCreate(bool create); // Create the signal void ServerStopped(); // Signal that we are ready void ServerStoppedWait(); // Wait for the signal void ServerStoppedDestroy(); // Destroy signal - bool ServerStoppedValid(); // Is non-NULL + bool ServerStoppedValid(); // Is non-nullptr #ifdef __PSVITA__ static bool usingAdhocMode(); diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h index 31c415a75..3ed0f888f 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerInterface.h @@ -93,7 +93,7 @@ private: public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL) = 0; + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr) = 0; private: virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer ) = 0; diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 486fe0671..997d055a4 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -101,7 +101,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != NULL) + if(playerChangedCallback[idx] != nullptr) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -110,7 +110,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerJoined(IQNetPlayer *pQNetPlayer ) int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; + if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -125,11 +125,11 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer) app.DebugPrintf("Player 0x%p \"%ls\" leaving.\n", pQNetPlayer, pQNetPlayer->GetGamertag()); INetworkPlayer* networkPlayer = getNetworkPlayer(pQNetPlayer); - if (networkPlayer == NULL) + if (networkPlayer == nullptr) return; Socket* socket = networkPlayer->GetSocket(); - if (socket != NULL) + if (socket != nullptr) { if (m_pIQNet->IsHost()) g_NetworkManager.CloseConnection(networkPlayer); @@ -144,7 +144,7 @@ void CPlatformNetworkManagerStub::NotifyPlayerLeaving(IQNetPlayer* pQNetPlayer) for (int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if (playerChangedCallback[idx] != NULL) + if (playerChangedCallback[idx] != nullptr) playerChangedCallback[idx](playerChangedCallbackParam[idx], networkPlayer, true); } @@ -160,7 +160,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = NULL; + playerChangedCallback[ i ] = nullptr; } m_bLeavingGame = false; @@ -171,8 +171,8 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = NULL; - m_SessionsUpdatedCallback = NULL; + m_pSearchParam = nullptr; + m_SessionsUpdatedCallback = nullptr; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -180,10 +180,10 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_lastSearchStartTime[i] = 0; // The results that will be filled in with the current search - m_pSearchResults[i] = NULL; - m_pQoSResult[i] = NULL; - m_pCurrentSearchResults[i] = NULL; - m_pCurrentQoSResult[i] = NULL; + m_pSearchResults[i] = nullptr; + m_pQoSResult[i] = nullptr; + m_pCurrentSearchResults[i] = nullptr; + m_pCurrentQoSResult[i] = nullptr; m_currentSearchResultsCount[i] = 0; } @@ -229,7 +229,7 @@ void CPlatformNetworkManagerStub::DoWork() while (WinsockNetLayer::PopDisconnectedSmallId(&disconnectedSmallId)) { IQNetPlayer* qnetPlayer = m_pIQNet->GetPlayerBySmallId(disconnectedSmallId); - if (qnetPlayer != NULL && qnetPlayer->m_smallId == disconnectedSmallId) + if (qnetPlayer != nullptr && qnetPlayer->m_smallId == disconnectedSmallId) { NotifyPlayerLeaving(qnetPlayer); qnetPlayer->m_smallId = 0; @@ -366,7 +366,7 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame, #ifdef _WINDOWS64 int port = WIN64_NET_DEFAULT_PORT; - const char* bindIp = NULL; + const char* bindIp = nullptr; if (g_Win64DedicatedServer) { if (g_Win64DedicatedServerPort > 0) @@ -399,7 +399,7 @@ bool CPlatformNetworkManagerStub::_StartGame() int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo* searchResult, int localUsersMask, int primaryUserIndex) { #ifdef _WINDOWS64 - if (searchResult == NULL) + if (searchResult == nullptr) return CGameNetworkManager::JOINGAME_FAIL_GENERAL; const char* hostIP = searchResult->data.hostIP; @@ -473,8 +473,8 @@ void CPlatformNetworkManagerStub::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = NULL; - playerChangedCallbackParam[iPad] = NULL; + playerChangedCallback[iPad] = nullptr; + playerChangedCallbackParam[iPad] = nullptr; } } @@ -494,7 +494,7 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame() if (IQNet::m_player[i].m_isRemote) { INetworkPlayer* pNetworkPlayer = getNetworkPlayer(&IQNet::m_player[i]); - if (pNetworkPlayer != NULL && pNetworkPlayer->GetSocket() != NULL) + if (pNetworkPlayer != nullptr && pNetworkPlayer->GetSocket() != nullptr) { Socket::addIncomingSocket(pNetworkPlayer->GetSocket()); } @@ -504,14 +504,14 @@ bool CPlatformNetworkManagerStub::_RunNetworkGame() return true; } -void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) +void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) { // DWORD playerCount = m_pIQNet->GetPlayerCount(); // // if( this->m_bLeavingGame ) // return; // -// if( GetHostPlayer() == NULL ) +// if( GetHostPlayer() == nullptr ) // return; // // for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) @@ -531,13 +531,13 @@ void CPlatformNetworkManagerStub::UpdateAndSetGameSessionData(INetworkPlayer *pN // } // else // { -// m_hostGameSessionData.players[i] = NULL; +// m_hostGameSessionData.players[i] = nullptr; // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); // } // } // else // { -// m_hostGameSessionData.players[i] = NULL; +// m_hostGameSessionData.players[i] = nullptr; // memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); // } // } @@ -552,14 +552,14 @@ int CPlatformNetworkManagerStub::RemovePlayerOnSocketClosedThreadProc( void* lpP Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( NULL ); + pNetworkPlayer->SetSocket( nullptr ); delete socket; } @@ -631,7 +631,7 @@ void CPlatformNetworkManagerStub::SystemFlagReset() void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == NULL ) return; + if( pNetworkPlayer == nullptr ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -647,7 +647,7 @@ void CPlatformNetworkManagerStub::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerStub::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == NULL ) + if( pNetworkPlayer == nullptr ) { return false; } @@ -690,7 +690,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() void CPlatformNetworkManagerStub::TickSearch() { #ifdef _WINDOWS64 - if (m_SessionsUpdatedCallback == NULL) + if (m_SessionsUpdatedCallback == nullptr) return; static DWORD lastSearchTime = 0; @@ -790,7 +790,7 @@ void CPlatformNetworkManagerStub::SearchForGames() m_searchResultsCount[0] = static_cast(friendsSessions[0].size()); - if (m_SessionsUpdatedCallback != NULL) + if (m_SessionsUpdatedCallback != nullptr) m_SessionsUpdatedCallback(m_pSearchParam); #endif } @@ -838,7 +838,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() m_searchResultsCount[i] = 0; m_lastSearchStartTime[i] = 0; delete m_pSearchResults[i]; - m_pSearchResults[i] = NULL; + m_pSearchResults[i] = nullptr; } } @@ -865,7 +865,7 @@ void CPlatformNetworkManagerStub::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) INetworkPlayer *CPlatformNetworkManagerStub::getNetworkPlayer(IQNetPlayer *pQNetPlayer) { - return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL; + return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : nullptr; } diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h index 28953cecb..bb4571bdc 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h @@ -81,7 +81,7 @@ private: GameSessionData m_hostGameSessionData; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Common/Network/SessionInfo.h b/Minecraft.Client/Common/Network/SessionInfo.h index ce6365bc4..7ae53c289 100644 --- a/Minecraft.Client/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Common/Network/SessionInfo.h @@ -113,7 +113,7 @@ public: FriendSessionInfo() { - displayLabel = NULL; + displayLabel = nullptr; displayLabelLength = 0; displayLabelViewableStartIndex = 0; hasPartyMember = false; @@ -121,7 +121,7 @@ public: ~FriendSessionInfo() { - if (displayLabel != NULL) + if (displayLabel != nullptr) delete displayLabel; } }; diff --git a/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp b/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp index 9b44418f7..293d680f5 100644 --- a/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp +++ b/Minecraft.Client/Common/Network/Sony/NetworkPlayerSony.cpp @@ -4,7 +4,7 @@ NetworkPlayerSony::NetworkPlayerSony(SQRNetworkPlayer *qnetPlayer) { m_sqrPlayer = qnetPlayer; - m_pSocket = NULL; + m_pSocket = nullptr; m_lastChunkPacketTime = 0; } diff --git a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp index a9799d265..107101f4a 100644 --- a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp +++ b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.cpp @@ -123,7 +123,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom); Socket *socket = pPlayerFrom->GetSocket(); - if(socket != NULL) + if(socket != nullptr) socket->pushDataToQueue(data, dataSize, false); } else @@ -132,7 +132,7 @@ void CPlatformNetworkManagerSony::HandleDataReceived(SQRNetworkPlayer *playerFro INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo); Socket *socket = pPlayerTo->GetSocket(); //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != NULL) + if(socket != nullptr) socket->pushDataToQueue(data, dataSize); } } @@ -226,7 +226,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer * for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != NULL) + if(playerChangedCallback[idx] != nullptr) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -235,7 +235,7 @@ void CPlatformNetworkManagerSony::HandlePlayerJoined(SQRNetworkPlayer * int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; + if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -258,7 +258,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay { // Get our wrapper object associated with this player. Socket *socket = networkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { // If we are in game then remove this player from the game as well. // We may get here either from the player requesting to exit the game, @@ -274,19 +274,19 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay // We need this as long as the game server still needs to communicate with the player //delete socket; - networkPlayer->SetSocket( NULL ); + networkPlayer->SetSocket( nullptr ); } if( m_pSQRNet->IsHost() && !m_bHostChanged ) { if( isSystemPrimaryPlayer(pSQRPlayer) ) { - SQRNetworkPlayer *pNewSQRPrimaryPlayer = NULL; + SQRNetworkPlayer *pNewSQRPrimaryPlayer = nullptr; for(unsigned int i = 0; i < m_pSQRNet->GetPlayerCount(); ++i ) { SQRNetworkPlayer *pSQRPlayer2 = m_pSQRNet->GetPlayerByIndex( i ); - if ( pSQRPlayer2 != NULL && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) ) + if ( pSQRPlayer2 != nullptr && pSQRPlayer2 != pSQRPlayer && pSQRPlayer2->IsSameSystem( pSQRPlayer ) ) { pNewSQRPrimaryPlayer = pSQRPlayer2; break; @@ -298,7 +298,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay m_machineSQRPrimaryPlayers.erase( it ); } - if( pNewSQRPrimaryPlayer != NULL ) + if( pNewSQRPrimaryPlayer != nullptr ) m_machineSQRPrimaryPlayers.push_back( pNewSQRPrimaryPlayer ); } @@ -311,7 +311,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != NULL) + if(playerChangedCallback[idx] != nullptr) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); } @@ -320,7 +320,7 @@ void CPlatformNetworkManagerSony::HandlePlayerLeaving(SQRNetworkPlayer *pSQRPlay int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; + if( m_pSQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -391,7 +391,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa if(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) { // we're signed into the PSN, but we won't be online yet, force a sign-in online here - m_pSQRNet_Vita->AttemptPSNSignIn(NULL, NULL); + m_pSQRNet_Vita->AttemptPSNSignIn(nullptr, nullptr); } @@ -402,7 +402,7 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = NULL; + playerChangedCallback[ i ] = nullptr; } m_bLeavingGame = false; @@ -413,11 +413,11 @@ bool CPlatformNetworkManagerSony::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = NULL; - m_SessionsUpdatedCallback = NULL; + m_pSearchParam = nullptr; + m_SessionsUpdatedCallback = nullptr; m_searchResultsCount = 0; - m_pSearchResults = NULL; + m_pSearchResults = nullptr; m_lastSearchStartTime = 0; @@ -622,11 +622,11 @@ bool CPlatformNetworkManagerSony::RemoveLocalPlayerByUserIndex( int userIndex ) SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(userIndex); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - if(pNetworkPlayer != NULL) + if(pNetworkPlayer != nullptr) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { // We can't remove the player from qnet until we have stopped using it to communicate C4JThread* thread = new C4JThread(&CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc, pNetworkPlayer, "RemovePlayerOnSocketClosed"); @@ -702,11 +702,11 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost) SQRNetworkPlayer *pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - if(pNetworkPlayer != NULL) + if(pNetworkPlayer != nullptr) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { //printf("Waiting for socket closed event\n"); DWORD result = socket->m_socketClosedEvent->WaitForSignal(INFINITE); @@ -718,13 +718,13 @@ bool CPlatformNetworkManagerSony::LeaveGame(bool bMigrateHost) // 4J Stu - Clear our reference to this socket pSQRPlayer = m_pSQRNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); pNetworkPlayer = getNetworkPlayer(pSQRPlayer); - pNetworkPlayer->SetSocket( NULL ); + pNetworkPlayer->SetSocket( nullptr ); } delete socket; } else { - //printf("Socket is already NULL\n"); + //printf("Socket is already nullptr\n"); } } @@ -878,8 +878,8 @@ void CPlatformNetworkManagerSony::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = NULL; - playerChangedCallbackParam[iPad] = NULL; + playerChangedCallback[iPad] = nullptr; + playerChangedCallbackParam[iPad] = nullptr; } } @@ -917,7 +917,7 @@ bool CPlatformNetworkManagerSony::_RunNetworkGame() // Note that this does less than the xbox equivalent as we have HandleResyncPlayerRequest that is called by the underlying SQRNetworkManager when players are added/removed etc., so this // call is only used to update the game host settings & then do the final push out of the data. -void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) +void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) { if( this->m_bLeavingGame ) return; @@ -934,7 +934,7 @@ void CPlatformNetworkManagerSony::UpdateAndSetGameSessionData(INetworkPlayer *pN // If this is called With a pNetworkPlayerLeaving, then the call has ultimately started within SQRNetworkManager::RemoveRemotePlayersAndSync, so we don't need to sync each change // as that function does a sync at the end of all changes. - if( pNetworkPlayerLeaving == NULL ) + if( pNetworkPlayerLeaving == nullptr ) { m_pSQRNet->UpdateExternalRoomData(); } @@ -946,14 +946,14 @@ int CPlatformNetworkManagerSony::RemovePlayerOnSocketClosedThreadProc( void* lpP Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( NULL ); + pNetworkPlayer->SetSocket( nullptr ); delete socket; } @@ -1030,7 +1030,7 @@ void CPlatformNetworkManagerSony::SystemFlagReset() void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == NULL ) return; + if( pNetworkPlayer == nullptr ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -1046,7 +1046,7 @@ void CPlatformNetworkManagerSony::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == NULL ) + if( pNetworkPlayer == nullptr ) { return false; } @@ -1064,8 +1064,8 @@ bool CPlatformNetworkManagerSony::SystemFlagGet(INetworkPlayer *pNetworkPlayer, wstring CPlatformNetworkManagerSony::GatherStats() { #if 0 - return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) - + L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); + return L"Queue messages: " + std::to_wstring(((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + + L" Queue bytes: " + std::to_wstring( ((NetworkPlayerXbox *)GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ) ); #else return L""; #endif @@ -1111,7 +1111,7 @@ void CPlatformNetworkManagerSony::TickSearch() } m_bSearchPending = false; - if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); + if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam); } } else @@ -1126,7 +1126,7 @@ void CPlatformNetworkManagerSony::TickSearch() if( usingAdhocMode()) searchDelay = 5000; #endif - if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + searchDelay) < GetTickCount() ) + if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + searchDelay) < GetTickCount() ) { if( m_pSQRNet->FriendRoomManagerSearch() ) { @@ -1189,7 +1189,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session if(memcmp( &pSearchResult->info.sessionID, &sessionId, sizeof(SessionID) ) != 0) continue; bool foundSession = false; - FriendSessionInfo *sessionInfo = NULL; + FriendSessionInfo *sessionInfo = nullptr; auto itFriendSession = friendsSessions[iPad].begin(); for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession) { @@ -1231,7 +1231,7 @@ bool CPlatformNetworkManagerSony::GetGameSessionInfo(int iPad, SessionID session sessionInfo->data.isJoinable) { foundSessionInfo->data = sessionInfo->data; - if(foundSessionInfo->displayLabel != NULL) delete [] foundSessionInfo->displayLabel; + if(foundSessionInfo->displayLabel != nullptr) delete [] foundSessionInfo->displayLabel; foundSessionInfo->displayLabel = new wchar_t[100]; memcpy(foundSessionInfo->displayLabel, sessionInfo->displayLabel, 100 * sizeof(wchar_t) ); foundSessionInfo->displayLabelLength = sessionInfo->displayLabelLength; @@ -1267,7 +1267,7 @@ void CPlatformNetworkManagerSony::ForceFriendsSessionRefresh() m_lastSearchStartTime = 0; m_searchResultsCount = 0; delete m_pSearchResults; - m_pSearchResults = NULL; + m_pSearchResults = nullptr; } INetworkPlayer *CPlatformNetworkManagerSony::addNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) @@ -1293,7 +1293,7 @@ void CPlatformNetworkManagerSony::removeNetworkPlayer(SQRNetworkPlayer *pSQRPlay INetworkPlayer *CPlatformNetworkManagerSony::getNetworkPlayer(SQRNetworkPlayer *pSQRPlayer) { - return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : NULL; + return pSQRPlayer ? (INetworkPlayer *)(pSQRPlayer->GetCustomDataValue()) : nullptr; } diff --git a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h index 258acd833..9131e8979 100644 --- a/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h +++ b/Minecraft.Client/Common/Network/Sony/PlatformNetworkManagerSony.h @@ -102,7 +102,7 @@ private: GameSessionData m_hostGameSessionData; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp b/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp index f23a0a630..7561c17d4 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkManager.cpp @@ -16,7 +16,7 @@ int SQRNetworkManager::GetSendQueueSizeBytes() for(int i = 0; i < playerCount; ++i) { SQRNetworkPlayer *player = GetPlayerByIndex( i ); - if( player != NULL ) + if( player != nullptr ) { queueSize += player->GetTotalSendQueueBytes(); } @@ -31,7 +31,7 @@ int SQRNetworkManager::GetSendQueueSizeMessages() for(int i = 0; i < playerCount; ++i) { SQRNetworkPlayer *player = GetPlayerByIndex( i ); - if( player != NULL ) + if( player != nullptr ) { queueSize += player->GetTotalSendQueueMessages(); } diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp index a040b28bd..cd9045249 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp @@ -279,12 +279,12 @@ void SQRNetworkPlayer::SendInternal(const void *data, unsigned int dataSize, Ack { // no data, just the flag assert(dataSize == 0); - assert(data == NULL); + assert(data == nullptr); int dataSize = dataRemaining; if( dataSize > SNP_MAX_PAYLOAD ) dataSize = SNP_MAX_PAYLOAD; - sendBlock.start = NULL; - sendBlock.end = NULL; - sendBlock.current = NULL; + sendBlock.start = nullptr; + sendBlock.end = nullptr; + sendBlock.current = nullptr; sendBlock.ack = ackFlags; m_sendQueue.push(sendBlock); } @@ -387,9 +387,9 @@ int SQRNetworkPlayer::ReadDataPacket(void* data, int dataSize) unsigned char* packetData = new unsigned char[packetSize]; #ifdef __PS3__ - int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL ); + int bytesRead = cellRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr ); #else // __ORBIS__ && __PSVITA__ - int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, NULL ); + int bytesRead = sceRudpRead( m_rudpCtx, packetData, packetSize, 0, nullptr ); #endif if(bytesRead == sc_wouldBlockFlag) { @@ -426,9 +426,9 @@ void SQRNetworkPlayer::ReadAck() { DataPacketHeader header; #ifdef __PS3__ - int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL ); + int bytesRead = cellRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr ); #else // __ORBIS__ && __PSVITA__ - int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, NULL ); + int bytesRead = sceRudpRead( m_rudpCtx, &header, sizeof(header), 0, nullptr ); #endif if(bytesRead == sc_wouldBlockFlag) { @@ -459,7 +459,7 @@ void SQRNetworkPlayer::ReadAck() void SQRNetworkPlayer::WriteAck() { - SendInternal(NULL, 0, e_flag_AckReturning); + SendInternal(nullptr, 0, e_flag_AckReturning); } int SQRNetworkPlayer::GetOutstandingAckCount() diff --git a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp index 6ea168c3e..7dccb73f6 100644 --- a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp +++ b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.cpp @@ -30,7 +30,7 @@ static SceRemoteStorageStatus statParams; // { // app.DebugPrintf("remoteStorageCallback err : 0x%08x\n"); // -// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, NULL); +// app.getRemoteStorage()->getRemoteFileInfo(&statParams, remoteStorageGetInfoCallback, nullptr); // } @@ -181,7 +181,7 @@ const char* SonyRemoteStorage::getLocalFilename() const char* SonyRemoteStorage::getSaveNameUTF8() { if(m_getInfoStatus != e_infoFound) - return NULL; + return nullptr; return m_retrievedDescData.m_saveNameUTF8; } @@ -261,12 +261,12 @@ int SonyRemoteStorage::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThum } else { - app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); - pClass->m_thumbnailData = NULL; + app.DebugPrintf("Thumbnail data is nullptr, or has size 0\n"); + pClass->m_thumbnailData = nullptr; pClass->m_thumbnailDataSize = 0; } - if(pClass->m_SetDataThread != NULL) + if(pClass->m_SetDataThread != nullptr) delete pClass->m_SetDataThread; pClass->m_SetDataThread = new C4JThread(setDataThread, pClass, "setDataThread"); @@ -346,7 +346,7 @@ bool SonyRemoteStorage::shutdown() app.DebugPrintf("Term request done \n"); m_bInitialised = false; free(m_memPoolBuffer); - m_memPoolBuffer = NULL; + m_memPoolBuffer = nullptr; return true; } else @@ -409,7 +409,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData& descData) char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - __int64 iSeed = strtoll(seed,NULL,10); + __int64 iSeed = strtoll(seed,nullptr,10); SetU64HexBytes(descData.m_seed, iSeed); // Save the host options that this world was last played with SetU32HexBytes(descData.m_hostOptions, uiHostOptions); @@ -448,7 +448,7 @@ void SonyRemoteStorage::GetDescriptionData( DescriptionData_V2& descData) char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - __int64 iSeed = strtoll(seed,NULL,10); + __int64 iSeed = strtoll(seed,nullptr,10); SetU64HexBytes(descData.m_seed, iSeed); // Save the host options that this world was last played with SetU32HexBytes(descData.m_hostOptions, uiHostOptions); diff --git a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h index d38a06e2c..a545911e2 100644 --- a/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h +++ b/Minecraft.Client/Common/Network/Sony/SonyRemoteStorage.h @@ -140,7 +140,7 @@ public: static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); static int setDataThread(void* lpParam); - SonyRemoteStorage() : m_memPoolBuffer(NULL), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {} + SonyRemoteStorage() : m_memPoolBuffer(nullptr), m_bInitialised(false),m_getInfoStatus(e_noInfoFound) {} protected: const char* getRemoteSaveFilename(); diff --git a/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp b/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp index cc47e9287..5561e2a17 100644 --- a/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp +++ b/Minecraft.Client/Common/Telemetry/TelemetryManager.cpp @@ -165,7 +165,7 @@ INT CTelemetryManager::GetMode(DWORD dwUserId) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localplayers[dwUserId] != NULL && pMinecraft->localplayers[dwUserId]->level != NULL && pMinecraft->localplayers[dwUserId]->level->getLevelData() != NULL ) + if( pMinecraft->localplayers[dwUserId] != nullptr && pMinecraft->localplayers[dwUserId]->level != nullptr && pMinecraft->localplayers[dwUserId]->level->getLevelData() != nullptr ) { GameType *gameType = pMinecraft->localplayers[dwUserId]->level->getLevelData()->getGameType(); @@ -237,7 +237,7 @@ INT CTelemetryManager::GetSubLevelId(DWORD dwUserId) Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[dwUserId] != NULL) + if(pMinecraft->localplayers[dwUserId] != nullptr) { switch(pMinecraft->localplayers[dwUserId]->dimension) { diff --git a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp index f01db84e9..df2f5b2b2 100644 --- a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp +++ b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.cpp @@ -61,7 +61,7 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) + if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) { player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } @@ -89,7 +89,7 @@ void ChangeStateConstraint::tick(int iPad) if(m_changeGameMode) { - if(minecraft->localgameModes[iPad] != NULL) + if(minecraft->localgameModes[iPad] != nullptr) { m_changedFromGameMode = minecraft->localplayers[iPad]->abilities.instabuild ? GameType::CREATIVE : GameType::SURVIVAL; @@ -102,7 +102,7 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) + if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) { player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } @@ -126,7 +126,7 @@ void ChangeStateConstraint::tick(int iPad) // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = minecraft->localplayers[iPad]; - if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL) + if(player != nullptr && player->connection && player->connection->getNetworkPlayer() != nullptr) { player->connection->send( shared_ptr( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) ); } diff --git a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h index 2156870d4..e5f2d74bf 100644 --- a/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h +++ b/Minecraft.Client/Common/Tutorial/ChangeStateConstraint.h @@ -30,7 +30,7 @@ private: public: virtual ConstraintType getType() { return e_ConstraintChangeState; } - ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], DWORD sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = NULL ); + ChangeStateConstraint( Tutorial *tutorial, eTutorial_State targetState, eTutorial_State sourceStates[], DWORD sourceStatesCount, double x0, double y0, double z0, double x1, double y1, double z1, bool contains = true, bool changeGameMode = false, GameType *targetGameMode = nullptr ); ~ChangeStateConstraint(); virtual void tick(int iPad); diff --git a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp index 1ea34ace6..987ad6eb1 100644 --- a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp @@ -12,7 +12,7 @@ ChoiceTask::ChoiceTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, int iConfirmMapping /*= 0*/, int iCancelMapping /*= 0*/, eTutorial_CompletionAction cancelAction /*= e_Tutorial_Completion_None*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) + : TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false ) { if(requiresUserInput == true) { diff --git a/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp b/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp index 43b2f7f31..f2fb8c127 100644 --- a/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp +++ b/Minecraft.Client/Common/Tutorial/CompleteUsingItemTask.cpp @@ -3,7 +3,7 @@ #include "CompleteUsingItemTask.h" CompleteUsingItemTask::CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr) { m_iValidItemsA= new int [itemIdsLength]; for(int i=0;i *inConstraints /*= NULL*/, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector *inConstraints /*= nullptr*/, bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_quantity( quantity ), @@ -17,7 +17,7 @@ CraftTask::CraftTask( int itemId, int auxValue, int quantity, } CraftTask::CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector *inConstraints /*= NULL*/, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion /*= true*/, vector *inConstraints /*= nullptr*/, bool bShowMinimumTime /*=false*/, bool bAllowFade /*=true*/, bool m_bTaskReminders /*=true*/ ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_quantity( quantity ), diff --git a/Minecraft.Client/Common/Tutorial/CraftTask.h b/Minecraft.Client/Common/Tutorial/CraftTask.h index 1496f07a4..4246711e0 100644 --- a/Minecraft.Client/Common/Tutorial/CraftTask.h +++ b/Minecraft.Client/Common/Tutorial/CraftTask.h @@ -5,10 +5,10 @@ class CraftTask : public TutorialTask { public: CraftTask( int itemId, int auxValue, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); CraftTask( int *items, int *auxValues, int numItems, int quantity, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ); ~CraftTask(); diff --git a/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp b/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp index 86dbe5005..428bbe3c0 100644 --- a/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp +++ b/Minecraft.Client/Common/Tutorial/DiggerItemHint.cpp @@ -22,7 +22,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri int DiggerItemHint::startDestroyBlock(shared_ptr item, Tile *tile) { - if(item != NULL) + if(item != nullptr) { bool itemFound = false; for(unsigned int i=0;i item, Tile *tile) int DiggerItemHint::attack(shared_ptr item, shared_ptr entity) { - if(item != NULL) + if(item != nullptr) { bool itemFound = false; for(unsigned int i=0;iid, this, IDS_TUTORIAL_TASK_PLACE_DOOR) ); addTask(e_Tutorial_State_Gameplay, new CraftTask( Tile::torch_Id, -1, 1, this, IDS_TUTORIAL_TASK_CREATE_TORCH) ); - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tutorialArea"); - if(area != NULL) + if(area != nullptr) { vector *areaConstraints = new vector(); areaConstraints->push_back( new AreaConstraint( IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -283,10 +283,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * MINECART * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"minecartArea"); - if(area != NULL) + if(area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Minecart, IDS_TUTORIAL_HINT_MINECART, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -298,10 +298,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BOAT * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"boatArea"); - if(area != NULL) + if(area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Riding_Boat, IDS_TUTORIAL_HINT_BOAT, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -313,10 +313,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FISHING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fishingArea"); - if(area != NULL) + if(area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_Fishing, IDS_TUTORIAL_HINT_FISHING, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1 ) ); } @@ -328,10 +328,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PISTON - SELF-REPAIRING BRIDGE * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonBridgeArea"); - if(area != NULL) + if(area != nullptr) { addHint(e_Tutorial_State_Gameplay, new AreaHint(e_Tutorial_Hint_Always_On, this, e_Tutorial_State_Gameplay, e_Tutorial_State_None, IDS_TUTORIAL_HINT_PISTON_SELF_REPAIRING_BRIDGE, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1, true ) ); } @@ -343,10 +343,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PISTON - PISTON AND REDSTONE CIRCUITS * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"pistonArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State redstoneAndPistonStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Redstone_And_Piston, redstoneAndPistonStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -368,10 +368,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * PORTAL * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"portalArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State portalStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Portal, portalStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -391,10 +391,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * CREATIVE * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"creativeArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State creativeStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_CreativeMode, creativeStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1,true,true,GameType::CREATIVE) ); @@ -411,7 +411,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) ProcedureCompoundTask *creativeFinalTask = new ProcedureCompoundTask( this ); AABB *exitArea = app.getGameRuleDefinitions()->getNamedArea(L"creativeExitArea"); - if(exitArea != NULL) + if(exitArea != nullptr) { vector *creativeExitAreaConstraints = new vector(); creativeExitAreaConstraints->push_back( new AreaConstraint( -1, exitArea->x0,exitArea->y0,exitArea->z0,exitArea->x1,exitArea->y1,exitArea->z1,true,false) ); @@ -434,10 +434,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BREWING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"brewingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State brewingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Brewing, brewingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -467,10 +467,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ENCHANTING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enchantingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enchanting, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -492,10 +492,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ANVIL * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"anvilArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Anvil, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -517,10 +517,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * TRADING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"tradingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State tradingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Trading, tradingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -541,10 +541,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FIREWORKS * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"fireworksArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State fireworkStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Fireworks, fireworkStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -563,10 +563,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BEACON * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"beaconArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State beaconStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Beacon, beaconStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -585,10 +585,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * HOPPER * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"hopperArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State hopperStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Hopper, hopperStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -610,10 +610,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * ENDERCHEST * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"enderchestArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State enchantingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Enderchests, enchantingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -632,10 +632,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * FARMING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"farmingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State farmingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Farming, farmingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -661,10 +661,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * BREEDING * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"breedingArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State breedingStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Breeding, breedingStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); @@ -689,10 +689,10 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/) * SNOW AND IRON GOLEM * */ - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { AABB *area = app.getGameRuleDefinitions()->getNamedArea(L"golemArea"); - if(area != NULL) + if(area != nullptr) { eTutorial_State golemStates[] = {e_Tutorial_State_Gameplay}; AddGlobalConstraint( new ChangeStateConstraint(this, e_Tutorial_State_Golem, golemStates, 1, area->x0,area->y0,area->z0,area->x1,area->y1,area->z1) ); diff --git a/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp b/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp index 54985d218..f1357c6c5 100644 --- a/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp +++ b/Minecraft.Client/Common/Tutorial/FullTutorialActiveTask.cpp @@ -3,7 +3,7 @@ #include "FullTutorialActiveTask.h" FullTutorialActiveTask::FullTutorialActiveTask(Tutorial *tutorial, eTutorial_CompletionAction completeAction /*= e_Tutorial_Completion_None*/) - : TutorialTask( tutorial, -1, false, NULL, false, false, false ) + : TutorialTask( tutorial, -1, false, nullptr, false, false, false ) { m_completeAction = completeAction; } diff --git a/Minecraft.Client/Common/Tutorial/InfoTask.cpp b/Minecraft.Client/Common/Tutorial/InfoTask.cpp index 6a78ed92a..340ea5187 100644 --- a/Minecraft.Client/Common/Tutorial/InfoTask.cpp +++ b/Minecraft.Client/Common/Tutorial/InfoTask.cpp @@ -11,7 +11,7 @@ InfoTask::InfoTask(Tutorial *tutorial, int descriptionId, int promptId /*= -1*/, bool requiresUserInput /*= false*/, int iMapping /*= 0*/, ETelemetryChallenges telemetryEvent /*= eTelemetryTutorial_NoEvent*/) - : TutorialTask( tutorial, descriptionId, false, NULL, true, false, false ) + : TutorialTask( tutorial, descriptionId, false, nullptr, true, false, false ) { if(requiresUserInput == true) { diff --git a/Minecraft.Client/Common/Tutorial/PickupTask.h b/Minecraft.Client/Common/Tutorial/PickupTask.h index 68e1d4793..9f2d2426e 100644 --- a/Minecraft.Client/Common/Tutorial/PickupTask.h +++ b/Minecraft.Client/Common/Tutorial/PickupTask.h @@ -8,7 +8,7 @@ class PickupTask : public TutorialTask { public: PickupTask( int itemId, unsigned int quantity, int auxValue, - Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = NULL, + Tutorial *tutorial, int descriptionId, bool enablePreCompletion = true, vector *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_itemId( itemId), diff --git a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp index 0e3b3e377..ddf15a55c 100644 --- a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.cpp @@ -11,7 +11,7 @@ ProcedureCompoundTask::~ProcedureCompoundTask() void ProcedureCompoundTask::AddTask(TutorialTask *task) { - if(task != NULL) + if(task != nullptr) { m_taskSequence.push_back(task); } diff --git a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h index 36b327984..0a5b7eee4 100644 --- a/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h +++ b/Minecraft.Client/Common/Tutorial/ProcedureCompoundTask.h @@ -8,7 +8,7 @@ class ProcedureCompoundTask : public TutorialTask { public: ProcedureCompoundTask(Tutorial *tutorial ) - : TutorialTask(tutorial, -1, false, NULL, false, true, false ) + : TutorialTask(tutorial, -1, false, nullptr, false, true, false ) {} ~ProcedureCompoundTask(); diff --git a/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h b/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h index b96e1bc01..9baea5a57 100644 --- a/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h +++ b/Minecraft.Client/Common/Tutorial/ProgressFlagTask.h @@ -17,7 +17,7 @@ private: EProgressFlagType m_type; public: ProgressFlagTask(char *flags, char mask, EProgressFlagType type, Tutorial *tutorial ) : - TutorialTask(tutorial, -1, false, NULL ), + TutorialTask(tutorial, -1, false, nullptr ), flags( flags ), m_mask( mask ), m_type( type ) {} diff --git a/Minecraft.Client/Common/Tutorial/RideEntityTask.h b/Minecraft.Client/Common/Tutorial/RideEntityTask.h index d9b6d41e4..749b187f8 100644 --- a/Minecraft.Client/Common/Tutorial/RideEntityTask.h +++ b/Minecraft.Client/Common/Tutorial/RideEntityTask.h @@ -13,7 +13,7 @@ protected: public: RideEntityTask(const int eTYPE, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = NULL, + bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); virtual bool isCompleted(); diff --git a/Minecraft.Client/Common/Tutorial/StatTask.cpp b/Minecraft.Client/Common/Tutorial/StatTask.cpp index e06db393c..c2dc82aa4 100644 --- a/Minecraft.Client/Common/Tutorial/StatTask.cpp +++ b/Minecraft.Client/Common/Tutorial/StatTask.cpp @@ -6,7 +6,7 @@ #include "StatTask.h" StatTask::StatTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, Stat *stat, int variance /*= 1*/) - : TutorialTask( tutorial, descriptionId, enablePreCompletion, NULL ) + : TutorialTask( tutorial, descriptionId, enablePreCompletion, nullptr ) { this->stat = stat; diff --git a/Minecraft.Client/Common/Tutorial/StateChangeTask.h b/Minecraft.Client/Common/Tutorial/StateChangeTask.h index fb9e63966..ab34d35dc 100644 --- a/Minecraft.Client/Common/Tutorial/StateChangeTask.h +++ b/Minecraft.Client/Common/Tutorial/StateChangeTask.h @@ -9,7 +9,7 @@ private: eTutorial_State m_state; public: StateChangeTask(eTutorial_State state, - Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector *inConstraints = NULL, + Tutorial *tutorial, int descriptionId = -1, bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_state( state ) diff --git a/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp b/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp index a1a5c37a9..3a3184889 100644 --- a/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp +++ b/Minecraft.Client/Common/Tutorial/TakeItemHint.cpp @@ -19,7 +19,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], u bool TakeItemHint::onTake(shared_ptr item) { - if(item != NULL) + if(item != nullptr) { bool itemFound = false; for(unsigned int i=0;im_messageId) && (m_messageString.compare(other->m_messageString) == 0); bool titleTheSame = (m_titleId == other->m_titleId) && (m_titleString.compare(other->m_titleString) == 0); @@ -360,12 +360,12 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) m_hintDisplayed = false; m_freezeTime = false; m_timeFrozen = false; - m_UIScene = NULL; + m_UIScene = nullptr; m_allowShow = true; m_bHasTickedOnce = false; m_firstTickTime = 0; - m_lastMessage = NULL; + m_lastMessage = nullptr; lastMessageTime = 0; m_iTaskReminders = 0; @@ -374,13 +374,13 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) m_CurrentState = e_Tutorial_State_Gameplay; m_hasStateChanged = false; #ifdef _XBOX - m_hTutorialScene=NULL; + m_hTutorialScene=nullptr; #endif for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i) { - currentTask[i] = NULL; - currentFailedConstraint[i] = NULL; + currentTask[i] = nullptr; + currentFailedConstraint[i] = nullptr; } // DEFAULT TASKS THAT ALL TUTORIALS SHARE @@ -1012,7 +1012,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); // 4J-JEV: Only force the RideEntityTask if we're on the full-tutorial. - if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, NULL, false, false, false) ); + if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, nullptr, false, false, false) ); else addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) ); @@ -1163,8 +1163,8 @@ Tutorial::~Tutorial() delete it; } - currentTask[i] = NULL; - currentFailedConstraint[i] = NULL; + currentTask[i] = nullptr; + currentFailedConstraint[i] = nullptr; } } @@ -1362,7 +1362,7 @@ void Tutorial::tick() if(!m_allowShow) { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1412,7 +1412,7 @@ void Tutorial::tick() if(ui.IsPauseMenuDisplayed( m_iPad ) ) { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1460,12 +1460,12 @@ void Tutorial::tick() // Check constraints // Only need to update these if we aren't already failing something - if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == NULL || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) ) + if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == nullptr || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) ) { - if( currentFailedConstraint[m_CurrentState] != NULL && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) ) + if( currentFailedConstraint[m_CurrentState] != nullptr && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) ) { constraintChanged = true; - currentFailedConstraint[m_CurrentState] = NULL; + currentFailedConstraint[m_CurrentState] = nullptr; } for (auto& constraint : constraints[m_CurrentState]) { @@ -1477,7 +1477,7 @@ void Tutorial::tick() } } - if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == NULL ) + if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == nullptr ) { // Update tasks bool isCurrentTask = true; @@ -1496,7 +1496,7 @@ void Tutorial::tick() eTutorial_CompletionAction compAction = task->getCompletionAction(); it = activeTasks[m_CurrentState].erase( it ); delete task; - task = NULL; + task = nullptr; if( activeTasks[m_CurrentState].size() > 0 ) { @@ -1552,12 +1552,12 @@ void Tutorial::tick() { setStateCompleted( m_CurrentState ); - currentTask[m_CurrentState] = NULL; + currentTask[m_CurrentState] = nullptr; } taskChanged = true; // If we can complete this early, check if we can complete it right now - if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isPreCompletionEnabled() ) + if( currentTask[m_CurrentState] != nullptr && currentTask[m_CurrentState]->isPreCompletionEnabled() ) { isCurrentTask = true; } @@ -1566,7 +1566,7 @@ void Tutorial::tick() { ++it; } - if( task != NULL && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) + if( task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) { task->setShownForMinimumTime(); @@ -1587,7 +1587,7 @@ void Tutorial::tick() } } - if( currentTask[m_CurrentState] == NULL && activeTasks[m_CurrentState].size() > 0 ) + if( currentTask[m_CurrentState] == nullptr && activeTasks[m_CurrentState].size() > 0 ) { currentTask[m_CurrentState] = activeTasks[m_CurrentState][0]; currentTask[m_CurrentState]->setAsCurrentTask(); @@ -1616,17 +1616,17 @@ void Tutorial::tick() } if( constraintChanged || taskChanged || m_hasStateChanged || - (currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_lastMessage == NULL || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed) + (currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_lastMessage == nullptr || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed) ) { - if( currentFailedConstraint[m_CurrentState] != NULL ) + if( currentFailedConstraint[m_CurrentState] != nullptr ) { PopupMessageDetails *message = new PopupMessageDetails(); message->m_messageId = currentFailedConstraint[m_CurrentState]->getDescriptionId(); message->m_allowFade = false; setMessage( message ); } - else if( currentTask[m_CurrentState] != NULL ) + else if( currentTask[m_CurrentState] != nullptr ) { PopupMessageDetails *message = new PopupMessageDetails(); message->m_messageId = currentTask[m_CurrentState]->getDescriptionId(); @@ -1637,7 +1637,7 @@ void Tutorial::tick() } else { - setMessage( NULL ); + setMessage( nullptr ); } } @@ -1646,7 +1646,7 @@ void Tutorial::tick() m_hintDisplayed = false; } - if( currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() ) + if( currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() ) { // Reminder PopupMessageDetails *message = new PopupMessageDetails(); @@ -1671,7 +1671,7 @@ void Tutorial::tick() bool Tutorial::setMessage(PopupMessageDetails *message) { - if(message != NULL && !message->m_forceDisplay && + if(message != nullptr && !message->m_forceDisplay && m_lastMessageState == m_CurrentState && message->isSameContent(m_lastMessage) && ( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() && message->m_isReminder ) ) @@ -1681,7 +1681,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) return false; } - if(message != NULL && (message->m_messageId > 0 || !message->m_messageString.empty()) ) + if(message != nullptr && (message->m_messageId > 0 || !message->m_messageString.empty()) ) { m_lastMessageState = m_CurrentState; @@ -1695,7 +1695,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) else { auto it = messages.find(message->m_messageId); - if( it != messages.end() && it->second != NULL ) + if( it != messages.end() && it->second != nullptr ) { TutorialMessage *messageString = it->second; text = wstring( messageString->getMessageForDisplay() ); @@ -1725,7 +1725,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) else if(message->m_promptId >= 0) { auto it = messages.find(message->m_promptId); - if(it != messages.end() && it->second != NULL) + if(it != messages.end() && it->second != nullptr) { TutorialMessage *prompt = it->second; text.append( prompt->getMessageForDisplay() ); @@ -1754,7 +1754,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) ui.SetTutorialDescription( m_iPad, &popupInfo ); } } - else if( (m_lastMessage != NULL && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() ) + else if( (m_lastMessage != nullptr && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() ) { // This should cause the popup to dissappear TutorialPopupInfo popupInfo; @@ -1763,7 +1763,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) ui.SetTutorialDescription( m_iPad, &popupInfo ); } - if(m_lastMessage != NULL) delete m_lastMessage; + if(m_lastMessage != nullptr) delete m_lastMessage; m_lastMessage = message; return true; @@ -1777,7 +1777,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) bool messageShown = false; DWORD time = GetTickCount(); - if(message != NULL && (message->m_forceDisplay || hintsOn) && + if(message != nullptr && (message->m_forceDisplay || hintsOn) && (!message->m_delay || ( (m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) || @@ -1792,7 +1792,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) { m_lastHintDisplayedTime = time; m_hintDisplayed = true; - if(hint!=NULL) setHintCompleted( hint ); + if(hint!=nullptr) setHintCompleted( hint ); } } return messageShown; @@ -1815,7 +1815,7 @@ void Tutorial::showTutorialPopup(bool show) if(!show) { - if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) { uiTempDisabled = true; } @@ -1926,7 +1926,7 @@ void Tutorial::handleUIInput(int iAction) { if( m_hintDisplayed ) return; - if(currentTask[m_CurrentState] != NULL) + if(currentTask[m_CurrentState] != nullptr) currentTask[m_CurrentState]->handleUIInput(iAction); } @@ -1988,7 +1988,7 @@ void Tutorial::onSelectedItemChanged(shared_ptr item) // Menus and states like riding in a minecart will NOT allow this if( isSelectedItemState() ) { - if(item != NULL) + if(item != nullptr) { switch(item->id) { @@ -2151,7 +2151,7 @@ void Tutorial::AddConstraint(TutorialConstraint *c) void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= false*/) { if( currentFailedConstraint[m_CurrentState] == c ) - currentFailedConstraint[m_CurrentState] = NULL; + currentFailedConstraint[m_CurrentState] = nullptr; if( c->getQueuedForRemoval() ) { @@ -2211,16 +2211,16 @@ void Tutorial::addMessage(int messageId, bool limitRepeats /*= false*/, unsigned } #ifdef _XBOX -void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= NULL*/) +void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= nullptr*/) #else -void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= NULL*/) +void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= nullptr*/) #endif { if(newState == m_CurrentState) { // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed #ifndef _XBOX - if( scene == NULL ) + if( scene == nullptr ) { ui.RemoveInteractSceneReference(m_iPad, m_UIScene); } @@ -2241,7 +2241,7 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= } // The action that caused the change of state may also have completed the current task - if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() ) + if( currentTask[m_CurrentState] != nullptr && currentTask[m_CurrentState]->isCompleted() ) { activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) ); @@ -2252,21 +2252,21 @@ void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= } else { - currentTask[m_CurrentState] = NULL; + currentTask[m_CurrentState] = nullptr; } } - if( currentTask[m_CurrentState] != NULL ) + if( currentTask[m_CurrentState] != nullptr ) { currentTask[m_CurrentState]->onStateChange(newState); } // Make sure that the current message is cleared - setMessage( NULL ); + setMessage( nullptr ); // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed #ifndef _XBOX - if( scene == NULL ) + if( scene == nullptr ) { ui.RemoveInteractSceneReference(m_iPad, m_UIScene); } diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.h b/Minecraft.Client/Common/Tutorial/Tutorial.h index 169c33e3e..c36a9086e 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.h +++ b/Minecraft.Client/Common/Tutorial/Tutorial.h @@ -139,9 +139,9 @@ public: bool getCompleted( int completableId ); #ifdef _XBOX - void changeTutorialState(eTutorial_State newState, CXuiScene *scene = NULL); + void changeTutorialState(eTutorial_State newState, CXuiScene *scene = nullptr); #else - void changeTutorialState(eTutorial_State newState, UIScene *scene = NULL); + void changeTutorialState(eTutorial_State newState, UIScene *scene = nullptr); #endif bool isSelectedItemState(); diff --git a/Minecraft.Client/Common/Tutorial/TutorialHint.cpp b/Minecraft.Client/Common/Tutorial/TutorialHint.cpp index 5f0808bf2..d80d7d16e 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialHint.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialHint.cpp @@ -9,7 +9,7 @@ TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade /*= true*/) : m_id( id ), m_tutorial(tutorial), m_descriptionId( descriptionId ), m_type( type ), m_counter( 0 ), - m_lastTile( NULL ), m_hintNeeded( true ), m_allowFade(allowFade) + m_lastTile( nullptr ), m_hintNeeded( true ), m_allowFade(allowFade) { tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients); } diff --git a/Minecraft.Client/Common/Tutorial/TutorialMode.cpp b/Minecraft.Client/Common/Tutorial/TutorialMode.cpp index 82c81598f..50a45a42d 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialMode.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialMode.cpp @@ -15,7 +15,7 @@ TutorialMode::TutorialMode(int iPad, Minecraft *minecraft, ClientConnection *con TutorialMode::~TutorialMode() { - if(tutorial != NULL) + if(tutorial != nullptr) delete tutorial; } @@ -38,7 +38,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face) } shared_ptr item = minecraft->player->getSelectedItem(); int damageBefore; - if(item != NULL) + if(item != nullptr) { damageBefore = item->getDamageValue(); } @@ -46,7 +46,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face) if(!tutorial->m_allTutorialsComplete) { - if ( item != NULL && item->isDamageableItem() ) + if ( item != nullptr && item->isDamageableItem() ) { int max = item->getMaxDamage(); int damageNow = item->getDamageValue(); @@ -88,7 +88,7 @@ bool TutorialMode::useItemOn(shared_ptr player, Level *level, shared_ptr if(!bTestUseOnly) { - if(item != NULL) + if(item != nullptr) { haveItem = true; itemCount = item->count; diff --git a/Minecraft.Client/Common/Tutorial/TutorialMode.h b/Minecraft.Client/Common/Tutorial/TutorialMode.h index 75e24edf0..2263a91c6 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialMode.h +++ b/Minecraft.Client/Common/Tutorial/TutorialMode.h @@ -19,7 +19,7 @@ public: virtual void startDestroyBlock(int x, int y, int z, int face); virtual bool destroyBlock(int x, int y, int z, int face); virtual void tick(); - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); + virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=nullptr); virtual void attack(shared_ptr player, shared_ptr entity); virtual bool isInputAllowed(int mapping); diff --git a/Minecraft.Client/Common/Tutorial/TutorialTask.cpp b/Minecraft.Client/Common/Tutorial/TutorialTask.cpp index 53fdd275a..1b6d84b2a 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialTask.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialTask.cpp @@ -9,7 +9,7 @@ TutorialTask::TutorialTask(Tutorial *tutorial, int descriptionId, bool enablePre areConstraintsEnabled( false ), bIsCompleted( false ), bHasBeenActivated( false ), m_bAllowFade(bAllowFade), m_bTaskReminders(bTaskReminders), m_bShowMinimumTime( bShowMinimumTime), m_bShownForMinimumTime( false ) { - if(inConstraints != NULL) + if(inConstraints != nullptr) { for(auto& constraint : *inConstraints) { diff --git a/Minecraft.Client/Common/Tutorial/UseItemTask.h b/Minecraft.Client/Common/Tutorial/UseItemTask.h index 6c7295407..9c8f01921 100644 --- a/Minecraft.Client/Common/Tutorial/UseItemTask.h +++ b/Minecraft.Client/Common/Tutorial/UseItemTask.h @@ -13,7 +13,7 @@ private: public: UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); + bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); virtual bool isCompleted(); virtual void useItem(shared_ptr item, bool bTestUseOnly=false); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/UseTileTask.h b/Minecraft.Client/Common/Tutorial/UseTileTask.h index 74b3a40cc..1f72fb2ed 100644 --- a/Minecraft.Client/Common/Tutorial/UseTileTask.h +++ b/Minecraft.Client/Common/Tutorial/UseTileTask.h @@ -16,9 +16,9 @@ private: public: UseTileTask(const int tileId, int x, int y, int z, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); + bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true ); UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId, - bool enablePreCompletion = false, vector *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); + bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true); virtual bool isCompleted(); virtual void useItemOn(Level *level, shared_ptr item, int x, int y, int z, bool bTestUseOnly=false); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp index 71b884790..d0217d195 100644 --- a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp +++ b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.cpp @@ -22,13 +22,13 @@ bool XuiCraftingTask::isCompleted() switch(m_type) { case e_Crafting_SelectGroup: - if(craftScene != NULL && craftScene->getCurrentGroup() == m_group) + if(craftScene != nullptr && craftScene->getCurrentGroup() == m_group) { completed = true; } break; case e_Crafting_SelectItem: - if(craftScene != NULL && craftScene->isItemSelected(m_item)) + if(craftScene != nullptr && craftScene->isItemSelected(m_item)) { completed = true; } diff --git a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h index 2dc48709d..146b1554a 100644 --- a/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h +++ b/Minecraft.Client/Common/Tutorial/XuiCraftingTask.h @@ -12,7 +12,7 @@ public: }; // Select group - XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector *inConstraints = NULL, + XuiCraftingTask(Tutorial *tutorial, int descriptionId, Recipy::_eGroupType groupToSelect, bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_group(groupToSelect), @@ -20,7 +20,7 @@ public: {} // Select Item - XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector *inConstraints = NULL, + XuiCraftingTask(Tutorial *tutorial, int descriptionId, int itemId, bool enablePreCompletion = false, vector *inConstraints = nullptr, bool bShowMinimumTime=false, bool bAllowFade=true, bool m_bTaskReminders=true ) : TutorialTask(tutorial, descriptionId, enablePreCompletion, inConstraints, bShowMinimumTime, bAllowFade, m_bTaskReminders ), m_item(itemId), diff --git a/Minecraft.Client/Common/UI/IUIController.h b/Minecraft.Client/Common/UI/IUIController.h index 3040c2ccd..35a808c5d 100644 --- a/Minecraft.Client/Common/UI/IUIController.h +++ b/Minecraft.Client/Common/UI/IUIController.h @@ -12,7 +12,7 @@ public: virtual void StartReloadSkinThread() = 0; virtual bool IsReloadingSkin() = 0; virtual void CleanUpSkinReload() = 0; - virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = NULL, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD) = 0; + virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = nullptr, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD) = 0; virtual bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT) = 0; virtual void CloseUIScenes(int iPad, bool forceIPad = false) = 0; virtual void CloseAllPlayersScenes() = 0; diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index 41dc28c87..6df5571a8 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -21,9 +21,9 @@ SavedInventoryCursorPos g_savedInventoryCursorPos = { 0.0f, 0.0f, false }; IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() { - m_menu = NULL; + m_menu = nullptr; m_autoDeleteMenu = false; - m_lastPointerLabelSlot = NULL; + m_lastPointerLabelSlot = nullptr; m_pointerPos.x = 0.0f; m_pointerPos.y = 0.0f; @@ -41,7 +41,7 @@ IUIScene_AbstractContainerMenu::~IUIScene_AbstractContainerMenu() void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack) { - assert( menu != NULL ); + assert( menu != nullptr ); m_menu = menu; m_autoDeleteMenu = autoDeleteMenu; @@ -267,10 +267,10 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips() void IUIScene_AbstractContainerMenu::onMouseTick() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != NULL) + if( pMinecraft->localgameModes[getPad()] != nullptr) { Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != NULL) + if(tutorial != nullptr) { if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(ACTION_MENU_UP)) { @@ -758,17 +758,17 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // What are we carrying on pointer. shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; shared_ptr carriedItem = nullptr; - if(player != NULL) carriedItem = player->inventory->getCarried(); + if(player != nullptr) carriedItem = player->inventory->getCarried(); shared_ptr slotItem = nullptr; - Slot *slot = NULL; + Slot *slot = nullptr; int slotIndex = 0; if(bPointerIsOverSlot) { slotIndex = iNewSlotIndex + getSectionStartOffset( eSectionUnderPointer ); slot = m_menu->getSlot(slotIndex); } - bool bIsItemCarried = carriedItem != NULL; + bool bIsItemCarried = carriedItem != nullptr; int iCarriedCount = 0; bool bCarriedIsSameAsSlot = false; // Indicates if same item is carried on pointer as is in slot under pointer. if ( bIsItemCarried ) @@ -788,7 +788,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() if ( bPointerIsOverSlot ) { slotItem = slot->getItem(); - bSlotHasItem = slotItem != NULL; + bSlotHasItem = slotItem != nullptr; if ( bSlotHasItem ) { iSlotCount = slotItem->GetCount(); @@ -829,13 +829,13 @@ void IUIScene_AbstractContainerMenu::onMouseTick() { vector *desc = GetSectionHoverText(eSectionUnderPointer); SetPointerText(desc, false); - m_lastPointerLabelSlot = NULL; + m_lastPointerLabelSlot = nullptr; delete desc; } else { - SetPointerText(NULL, false); - m_lastPointerLabelSlot = NULL; + SetPointerText(nullptr, false); + m_lastPointerLabelSlot = nullptr; } EToolTipItem buttonA, buttonX, buttonY, buttonRT, buttonBack; @@ -1021,7 +1021,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // Get the info on this item. shared_ptr item = getSlotItem(eSectionUnderPointer, iNewSlotIndex); bool bValidFuel = FurnaceTileEntity::isFuel(item); - bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL; + bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != nullptr; if(bValidIngredient) { @@ -1036,7 +1036,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } else { - if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL) + if(FurnaceRecipes::getInstance()->getResult(item->id)==nullptr) { buttonY = eToolTipQuickMove; } @@ -1076,7 +1076,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } else { - if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL) + if(FurnaceRecipes::getInstance()->getResult(item->id)==nullptr) { buttonY = eToolTipQuickMove; } @@ -1322,10 +1322,10 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b bool bHandled = false; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != NULL ) + if( pMinecraft->localgameModes[getPad()] != nullptr ) { Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != NULL) + if(tutorial != nullptr) { tutorial->handleUIInput(iAction); if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction)) @@ -1513,12 +1513,12 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b if ( bSlotHasItem ) { shared_ptr item = getSlotItem(m_eCurrSection, currentIndex); - if( Minecraft::GetInstance()->localgameModes[iPad] != NULL ) + if( Minecraft::GetInstance()->localgameModes[iPad] != nullptr ) { Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails; message->m_messageId = item->getUseDescriptionId(); - if(Item::items[item->id] != NULL) message->m_titleString = Item::items[item->id]->getHoverName(item); + if(Item::items[item->id] != nullptr) message->m_titleString = Item::items[item->id]->getHoverName(item); message->m_titleId = item->getDescriptionId(); message->m_icon = item->id; @@ -1526,7 +1526,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b message->m_forceDisplay = true; TutorialMode *gameMode = static_cast(Minecraft::GetInstance()->localgameModes[iPad]); - gameMode->getTutorial()->setMessage(NULL, message); + gameMode->getTutorial()->setMessage(nullptr, message); ui.PlayUISFX(eSFX_Press); } } @@ -1628,7 +1628,7 @@ void IUIScene_AbstractContainerMenu::handleSlotListClicked(ESceneSection eSectio void IUIScene_AbstractContainerMenu::slotClicked(int slotId, int buttonNum, bool quickKey) { // 4J Stu - Removed this line as unused - //if (slot != NULL) slotId = slot->index; + //if (slot != nullptr) slotId = slot->index; Minecraft *pMinecraft = Minecraft::GetInstance(); pMinecraft->localgameModes[getPad()]->handleInventoryMouseClick(m_menu->containerId, slotId, buttonNum, quickKey, pMinecraft->localplayers[getPad()] ); @@ -1645,7 +1645,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection) bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr itemA, shared_ptr itemB) { - if(itemA == NULL || itemB == NULL) return false; + if(itemA == nullptr || itemB == nullptr) return false; return (itemA->id == itemB->id && (!itemB->isStackedByData() || itemB->getAuxValue() == itemA->getAuxValue()) && ItemInstance::tagMatches(itemB, itemA) ); } @@ -1654,7 +1654,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot) { int iResult = 0; - if(slot != NULL && slot->hasItem()) + if(slot != nullptr && slot->hasItem()) { shared_ptr item = slot->getItem(); if ( item->isStackable() ) @@ -1673,7 +1673,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot) vector *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot) { - if(slot == NULL) return NULL; + if(slot == nullptr) return nullptr; vector *lines = slot->getItem()->getHoverText(nullptr, false); @@ -1693,5 +1693,5 @@ vector *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slo vector *IUIScene_AbstractContainerMenu::GetSectionHoverText(ESceneSection eSection) { - return NULL; + return nullptr; } diff --git a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp index 10d1bcc41..2c1469bcd 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp @@ -10,7 +10,7 @@ IUIScene_AnvilMenu::IUIScene_AnvilMenu() { m_inventory = nullptr; - m_repairMenu = NULL; + m_repairMenu = nullptr; m_itemName = L""; } @@ -231,7 +231,7 @@ void IUIScene_AnvilMenu::handleTick() void IUIScene_AnvilMenu::updateItemName() { Slot *slot = m_repairMenu->getSlot(AnvilMenu::INPUT_SLOT); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { if (!slot->getItem()->hasCustomHoverName() && m_itemName.compare(slot->getItem()->getHoverName())==0) { @@ -257,10 +257,10 @@ void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotI { if (slotIndex == AnvilMenu::INPUT_SLOT) { - m_itemName = item == NULL ? L"" : item->getHoverName(); + m_itemName = item == nullptr ? L"" : item->getHoverName(); setEditNameValue(m_itemName); - setEditNameEditable(item != NULL); - if (item != NULL) + setEditNameEditable(item != nullptr); + if (item != nullptr) { updateItemName(); } diff --git a/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp index bb13deb89..efe4c2e11 100644 --- a/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp @@ -216,7 +216,7 @@ void IUIScene_BeaconMenu::handleOtherClicked(int iPad, ESceneSection eSection, i { case eSectionBeaconConfirm: { - if( (m_beacon->getItem(0) == NULL) || (m_beacon->getPrimaryPower() <= 0) ) return; + if( (m_beacon->getItem(0) == nullptr) || (m_beacon->getPrimaryPower() <= 0) ) return; ByteArrayOutputStream baos; DataOutputStream dos(&baos); dos.writeInt(m_beacon->getPrimaryPower()); @@ -286,7 +286,7 @@ void IUIScene_BeaconMenu::handleTick() for (int c = 0; c < count; c++) { - if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue; + if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue; int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id; int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon(); @@ -315,7 +315,7 @@ void IUIScene_BeaconMenu::handleTick() for (int c = 0; c < count - 1; c++) { - if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue; + if(BeaconTileEntity::BEACON_EFFECTS[tier][c] == nullptr) continue; int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id; int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon(); @@ -355,7 +355,7 @@ void IUIScene_BeaconMenu::handleTick() } } - SetConfirmButtonEnabled( (m_beacon->getItem(0) != NULL) && (m_beacon->getPrimaryPower() > 0) ); + SetConfirmButtonEnabled( (m_beacon->getItem(0) != nullptr) && (m_beacon->getPrimaryPower() > 0) ); } int IUIScene_BeaconMenu::GetId(int tier, int effectId) @@ -365,7 +365,7 @@ int IUIScene_BeaconMenu::GetId(int tier, int effectId) vector *IUIScene_BeaconMenu::GetSectionHoverText(ESceneSection eSection) { - vector *desc = NULL; + vector *desc = nullptr; switch(eSection) { case eSectionBeaconSecondaryTwo: diff --git a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp index e0d8472a1..e056fd68b 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp @@ -154,10 +154,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != NULL ) + if( pMinecraft->localgameModes[getPad()] != nullptr ) { Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != NULL) + if(tutorial != nullptr) { tutorial->handleUIInput(iAction); if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction)) @@ -211,10 +211,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); - if( pMinecraft->localgameModes[iPad] != NULL) + if( pMinecraft->localgameModes[iPad] != nullptr) { Tutorial *tutorial = pMinecraft->localgameModes[iPad]->getTutorial(); - if(tutorial != NULL) + if(tutorial != nullptr) { tutorial->onCrafted(pTempItemInst); } @@ -247,10 +247,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) shared_ptr pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr); //int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue()); - if( pMinecraft->localgameModes[iPad] != NULL ) + if( pMinecraft->localgameModes[iPad] != nullptr ) { Tutorial *tutorial = pMinecraft->localgameModes[iPad]->getTutorial(); - if(tutorial != NULL) + if(tutorial != nullptr) { tutorial->createItemSelected(pTempItemInst, pRecipeIngredientsRequired[iRecipe].bCanMake[iPad]); } @@ -288,7 +288,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) } // 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when crafting Cake - if (ingItemInst != NULL) + if (ingItemInst != nullptr) { if (ingItemInst->getItem()->hasCraftingRemainingItem()) { @@ -608,7 +608,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() // dump out the inventory /* for (unsigned int k = 0; k < m_pPlayer->inventory->items.length; k++) { - if (m_pPlayer->inventory->items[k] != NULL) + if (m_pPlayer->inventory->items[k] != nullptr) { wstring itemstring=m_pPlayer->inventory->items[k]->toString(); @@ -627,8 +627,8 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() // for (int i = 0; i < iRecipeC; i++) // { - // shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL); - // if (pTempItemInst != NULL) + // shared_ptr pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr); + // if (pTempItemInst != nullptr) // { // wstring itemstring=pTempItemInst->toString(); // @@ -683,7 +683,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() // Does the player have this ingredient? for (unsigned int k = 0; k < m_pPlayer->inventory->items.length; k++) { - if (m_pPlayer->inventory->items[k] != NULL) + if (m_pPlayer->inventory->items[k] != nullptr) { // do they have the ingredient, and the aux value matches, and enough off it? if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) && @@ -703,7 +703,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() for(unsigned int l=0;linventory->items.length;l++) { - if (m_pPlayer->inventory->items[l] != NULL) + if (m_pPlayer->inventory->items[l] != nullptr) { if( (m_pPlayer->inventory->items[l]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) && diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index efe19ce9d..4719a69f7 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -13,7 +13,7 @@ #include "..\..\..\Minecraft.World\JavaMath.h" // 4J JEV - Images for each tab. -IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL; +IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = nullptr; vector< shared_ptr > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount]; @@ -488,7 +488,7 @@ void IUIScene_CreativeMenu::staticCtor() for(unsigned int i = 0; i < Enchantment::enchantments.length; ++i) { Enchantment *enchantment = Enchantment::enchantments[i]; - if (enchantment == NULL || enchantment->category == NULL) continue; + if (enchantment == nullptr || enchantment->category == nullptr) continue; list->push_back(Item::enchantedBook->createForEnchantment(new EnchantmentInstance(enchantment, enchantment->getMaxLevel()))); } @@ -673,7 +673,7 @@ void IUIScene_CreativeMenu::staticCtor() #ifndef _CONTENT_PACKAGE ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration}; ECreative_Inventory_Groups debugDecorationsGroup[] = {eCreativeInventory_ArtToolsDecorations}; - specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, NULL, 1, debugDecorationsGroup); + specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, nullptr, 1, debugDecorationsGroup); #else ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration}; specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup); @@ -707,7 +707,7 @@ void IUIScene_CreativeMenu::staticCtor() #ifndef _CONTENT_PACKAGE ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc}; ECreative_Inventory_Groups debugMiscGroup[] = {eCreativeInventory_ArtToolsMisc}; - specs[eCreativeInventoryTab_Misc] = new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, NULL, 1, debugMiscGroup); + specs[eCreativeInventoryTab_Misc] = new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, nullptr, 1, debugMiscGroup); #else ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc}; specs[eCreativeInventoryTab_Misc] = new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup); @@ -766,12 +766,12 @@ void IUIScene_CreativeMenu::ScrollBar(UIVec2D pointerPos) // 4J JEV - Tab Spec Struct -IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= NULL*/) +IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups, int debugGroupsCount /*= 0*/, ECreative_Inventory_Groups *debugGroups /*= nullptr*/) : m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount), m_debugGroupsCount(debugGroupsCount) { m_pages = 0; - m_staticGroupsA = NULL; + m_staticGroupsA = nullptr; unsigned int dynamicItems = 0; m_staticItems = 0; @@ -786,7 +786,7 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int sta } } - m_debugGroupsA = NULL; + m_debugGroupsA = nullptr; m_debugItems = 0; if(debugGroupsCount > 0) { @@ -798,8 +798,8 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int sta } } - m_dynamicGroupsA = NULL; - if(dynamicGroupsCount > 0 && dynamicGroups != NULL) + m_dynamicGroupsA = nullptr; + if(dynamicGroupsCount > 0 && dynamicGroups != nullptr) { m_dynamicGroupsA = new ECreative_Inventory_Groups[dynamicGroupsCount]; for(int i = 0; i < dynamicGroupsCount; ++i) @@ -816,9 +816,9 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int sta IUIScene_CreativeMenu::TabSpec::~TabSpec() { - if(m_staticGroupsA != NULL) delete [] m_staticGroupsA; - if(m_dynamicGroupsA != NULL) delete [] m_dynamicGroupsA; - if(m_debugGroupsA != NULL) delete [] m_debugGroupsA; + if(m_staticGroupsA != nullptr) delete [] m_staticGroupsA; + if(m_dynamicGroupsA != nullptr) delete [] m_dynamicGroupsA; + if(m_debugGroupsA != nullptr) delete [] m_debugGroupsA; } void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page) @@ -826,7 +826,7 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i int lastSlotIndex = 0; // Fill the dynamic group - if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != NULL) + if(m_dynamicGroupsCount > 0 && m_dynamicGroupsA != nullptr) { for (auto it = categoryGroups[m_dynamicGroupsA[dynamicIndex]].rbegin(); it != categoryGroups[m_dynamicGroupsA[dynamicIndex]].rend() && lastSlotIndex < MAX_SIZE; ++it) { @@ -957,7 +957,7 @@ IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptrsize(); - Slot *slot = NULL; + Slot *slot = nullptr; for (int i = 0; i < TabSpec::MAX_SIZE; i++) { // 4J JEV - These values get set by addSlot anyway. @@ -1036,7 +1036,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu { shared_ptr newItem = m_menu->getSlot(i)->getItem(); - if(newItem != NULL) + if(newItem != nullptr) { m_menu->getSlot(i)->set(nullptr); // call this function to synchronize multiplayer item bar @@ -1054,7 +1054,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr playerInventory = pMinecraft->localplayers[iPad]->inventory; - if (playerInventory->getCarried() != NULL) + if (playerInventory->getCarried() != nullptr) { if (buttonNum == 0) { @@ -1155,7 +1155,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu shared_ptr playerInventory = pMinecraft->localplayers[getPad()]->inventory; shared_ptr carried = playerInventory->getCarried(); shared_ptr clicked = m_menu->getSlot(currentIndex)->getItem(); - if (clicked != NULL) + if (clicked != nullptr) { playerInventory->setCarried(ItemInstance::clone(clicked)); carried = playerInventory->getCarried(); @@ -1236,7 +1236,7 @@ bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr item, for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) { shared_ptr slotItem = m_menu->getSlot(i)->getItem(); - if( slotItem != NULL && slotItem->sameItemWithTags(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() )) + if( slotItem != nullptr && slotItem->sameItemWithTags(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() )) { sameItemFound = true; slotX = i - TabSpec::MAX_SIZE; @@ -1249,7 +1249,7 @@ bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr item, // Find an empty slot for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) { - if( m_menu->getSlot(i)->getItem() == NULL ) + if( m_menu->getSlot(i)->getItem() == nullptr ) { slotX = i - TabSpec::MAX_SIZE; emptySlotFound = true; @@ -1328,7 +1328,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector > *lis // diamonds give trails if (trail) expTag->putBoolean(FireworksItem::TAG_E_TRAIL, true); - intArray colorArray(colors.size()); + intArray colorArray(static_cast(colors.size())); for (int i = 0; i < colorArray.length; i++) { colorArray[i] = colors.at(i); @@ -1347,7 +1347,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector > *lis vector colors; colors.push_back(DyePowderItem::COLOR_RGB[fadeColor]); - intArray colorArray(colors.size()); + intArray colorArray(static_cast(colors.size())); for (int i = 0; i < colorArray.length; i++) { colorArray[i] = colors.at(i); diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h index 64b78029b..864fb5606 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h @@ -69,7 +69,7 @@ public: unsigned int m_debugItems; public: - TabSpec( LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount = 0, ECreative_Inventory_Groups *dynamicGroups = NULL, int debugGroupsCount = 0, ECreative_Inventory_Groups *debugGroups = NULL ); + TabSpec( LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount = 0, ECreative_Inventory_Groups *dynamicGroups = nullptr, int debugGroupsCount = 0, ECreative_Inventory_Groups *debugGroups = nullptr ); ~TabSpec(); void populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page); diff --git a/Minecraft.Client/Common/UI/IUIScene_HUD.cpp b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp index 294816ed6..27c62a13e 100644 --- a/Minecraft.Client/Common/UI/IUIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp @@ -79,7 +79,7 @@ void IUIScene_HUD::updateFrameTick() { //SetRidingHorse(false, 0); shared_ptr riding = pMinecraft->localplayers[iPad]->riding; - if(riding == NULL) + if(riding == nullptr) { SetRidingHorse(false, false, 0); } @@ -171,7 +171,7 @@ void IUIScene_HUD::updateFrameTick() SetOpacity(fVal); bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(iPad) && !(app.GetXuiAction(iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(iPad,eGameSetting_DisplayHUD)!=0; - if(bDisplayGui && pMinecraft->localplayers[iPad] != NULL) + if(bDisplayGui && pMinecraft->localplayers[iPad] != nullptr) { SetVisible(true); } @@ -219,7 +219,7 @@ void IUIScene_HUD::renderPlayerHealth() shared_ptr riding = pMinecraft->localplayers[iPad]->riding; - if(riding == NULL || riding && !riding->instanceof(eTYPE_LIVINGENTITY)) + if(riding == nullptr || riding && !riding->instanceof(eTYPE_LIVINGENTITY)) { SetRidingHorse(false, false, 0); diff --git a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp index 852928785..e88ed08cd 100644 --- a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp @@ -229,7 +229,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 { // 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]; @@ -248,7 +248,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 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]; @@ -300,7 +300,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 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 } @@ -336,7 +336,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4 // 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 @@ -421,7 +421,7 @@ void IUIScene_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 ) @@ -522,17 +522,17 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) 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 @@ -548,7 +548,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) } else { - if(lpParameter != NULL && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) + if(lpParameter != nullptr && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()) ) { switch( app.GetDisconnectReason() ) { @@ -625,7 +625,7 @@ void IUIScene_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/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp index 08be958aa..735da438a 100644 --- a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp @@ -45,7 +45,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() // 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; @@ -86,7 +86,7 @@ void IUIScene_StartGame::HandleDLCMountingComplete() // 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; } @@ -135,13 +135,13 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) { TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackByIndex(index); - if(tp==NULL) + if(tp==nullptr) { #if TO_BE_IMPLEMENTED // 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 @@ -171,7 +171,7 @@ void IUIScene_StartGame::UpdateTexturePackDescription(int index) } else { - m_texturePackComparison->UseBrush(NULL); + m_texturePackComparison->UseBrush(nullptr); } #endif } @@ -214,7 +214,7 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackByIndex(m_currentTexturePackIndex); // if the texture pack is null, you don't have it yet - if(tp==NULL) + if(tp==nullptr) { #if TO_BE_IMPLEMENTED // Upsell @@ -279,7 +279,7 @@ int IUIScene_StartGame::UnlockTexturePackReturned(void *pParam,int iPad,C4JStora ULONGLONG ullIndexA[1]; DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId()); - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { ullIndexA[0]=pDLCInfo->ullOfferID_Full; } @@ -289,9 +289,9 @@ int IUIScene_StartGame::UnlockTexturePackReturned(void *pParam,int iPad,C4JStora } - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); #elif defined _XBOX_ONE - //StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,NULL,NULL); + //StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,nullptr,nullptr); #endif // the license change coming in when the offer has been installed will cause this scene to refresh @@ -332,7 +332,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora 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 @@ -343,7 +343,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora { ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); } } } @@ -360,7 +360,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora app.GetDLCFullOfferIDForPackID(pClass->m_MoreOptionsParams.dwTexturePack,ProductId); - StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); + StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),nullptr,nullptr); // the license change coming in when the offer has been installed will cause this scene to refresh } diff --git a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp index 059f9b755..1f9cf7bd9 100644 --- a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp @@ -13,7 +13,7 @@ IUIScene_TradingMenu::IUIScene_TradingMenu() m_validOffersCount = 0; m_selectedSlot = 0; m_offersStartIndex = 0; - m_menu = NULL; + m_menu = nullptr; m_bHasUpdatedOnce = false; } @@ -31,10 +31,10 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[getPad()] != NULL ) + if( pMinecraft->localgameModes[getPad()] != nullptr ) { Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial(); - if(tutorial != NULL) + if(tutorial != nullptr) { tutorial->handleUIInput(iAction); if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction)) @@ -76,7 +76,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) shared_ptr player = Minecraft::GetInstance()->localplayers[getPad()]; int buyAMatches = player->inventory->countMatches(buyAItem); int buyBMatches = player->inventory->countMatches(buyBItem); - if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) ) + if( (buyAItem != nullptr && buyAMatches >= buyAItem->count) && (buyBItem == nullptr || buyBMatches >= buyBItem->count) ) { // 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple �Enchanted Books� will cause the title to crash. int actualShopItem = m_activeOffers.at(selectedShopItem).second; @@ -162,7 +162,7 @@ void IUIScene_TradingMenu::handleTick() { int offerCount = 0; MerchantRecipeList *offers = m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]); - if (offers != NULL) + if (offers != nullptr) { offerCount = offers->size(); @@ -181,7 +181,7 @@ void IUIScene_TradingMenu::updateDisplay() int iA = -1; MerchantRecipeList *unfilteredOffers = m_merchant->getOffers(Minecraft::GetInstance()->localplayers[getPad()]); - if (unfilteredOffers != NULL) + if (unfilteredOffers != nullptr) { m_activeOffers.clear(); int unfilteredIndex = 0; @@ -255,10 +255,10 @@ void IUIScene_TradingMenu::updateDisplay() setRequest1Item(buyAItem); setRequest2Item(buyBItem); - if(buyAItem != NULL) setRequest1Name(buyAItem->getHoverName()); + if(buyAItem != nullptr) setRequest1Name(buyAItem->getHoverName()); else setRequest1Name(L""); - if(buyBItem != NULL) setRequest2Name(buyBItem->getHoverName()); + if(buyBItem != nullptr) setRequest2Name(buyBItem->getHoverName()); else setRequest2Name(L""); bool canMake = true; @@ -284,15 +284,15 @@ void IUIScene_TradingMenu::updateDisplay() } else { - if(buyBItem!=NULL) + if(buyBItem!=nullptr) { setRequest2RedBox(true); canMake = false; } else { - setRequest2RedBox(buyBItem != NULL); - canMake = canMake && buyBItem == NULL; + setRequest2RedBox(buyBItem != nullptr); + canMake = canMake && buyBItem == nullptr; } } @@ -320,7 +320,7 @@ void IUIScene_TradingMenu::updateDisplay() bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe) { bool canMake = false; - if (recipe != NULL) + if (recipe != nullptr) { if(recipe->isDeprecated()) return false; @@ -335,7 +335,7 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe) } else { - canMake = buyAItem == NULL; + canMake = buyAItem == nullptr; } int buyBMatches = player->inventory->countMatches(buyBItem); @@ -345,7 +345,7 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe) } else { - canMake = canMake && buyBItem == NULL; + canMake = canMake && buyBItem == nullptr; } } return canMake; diff --git a/Minecraft.Client/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Common/UI/UIBitmapFont.cpp index 98c19dc87..e9d110b71 100644 --- a/Minecraft.Client/Common/UI/UIBitmapFont.cpp +++ b/Minecraft.Client/Common/UI/UIBitmapFont.cpp @@ -351,7 +351,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte bitmap->stride_in_bytes = m_cFontData->getFontData()->m_uiGlyphMapX; // 4J-JEV: Additional information needed to release memory afterwards. - bitmap->user_context_for_free = NULL; + bitmap->user_context_for_free = nullptr; return true; } diff --git a/Minecraft.Client/Common/UI/UIComponent_Chat.cpp b/Minecraft.Client/Common/UI/UIComponent_Chat.cpp index 49999255f..f8bd66ad9 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Chat.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Chat.cpp @@ -46,7 +46,7 @@ void UIComponent_Chat::handleTimerComplete(int id) Minecraft *pMinecraft = Minecraft::GetInstance(); bool anyVisible = false; - if(pMinecraft->localplayers[m_iPad]!= NULL) + if(pMinecraft->localplayers[m_iPad]!= nullptr) { Gui *pGui = pMinecraft->gui; //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); diff --git a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp index 6a0065034..7ac13115b 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp @@ -45,7 +45,7 @@ void UIComponent_Panorama::tick() Minecraft *pMinecraft = Minecraft::GetInstance(); EnterCriticalSection(&pMinecraft->m_setLevelCS); - if(pMinecraft->level!=NULL) + if(pMinecraft->level!=nullptr) { __int64 i64TimeOfDay =0; // are we in the Nether? - Leave the time as 0 if we are, so we show daylight diff --git a/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp b/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp index 9b672939d..856611256 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp @@ -351,7 +351,7 @@ void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId, UIString label, void UIComponent_Tooltips::_Relayout() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcUpdateLayout, 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcUpdateLayout, 0 , nullptr ); #ifdef __PSVITA__ // rebuild touchboxes diff --git a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp index 01f124bd8..06dcd64ca 100644 --- a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp @@ -12,8 +12,8 @@ UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void *initData, U // Setup all the Iggy references we need for this scene initialiseMovie(); - m_interactScene = NULL; - m_lastInteractSceneMoved = NULL; + m_interactScene = nullptr; + m_lastInteractSceneMoved = nullptr; m_lastSceneMovedLeft = false; m_bAllowFade = false; m_iconItem = nullptr; @@ -90,7 +90,7 @@ void UIComponent_TutorialPopup::RemoveInteractSceneReference(UIScene *scene) { if( m_interactScene == scene ) { - m_interactScene = NULL; + m_interactScene = nullptr; } } @@ -132,7 +132,7 @@ void UIComponent_TutorialPopup::_SetDescription(UIScene *interactScene, const ws { m_interactScene = interactScene; app.DebugPrintf("Setting m_interactScene to %08x\n", m_interactScene); - if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL; + if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = nullptr; if(desc.empty()) { SetVisible( false ); @@ -327,8 +327,8 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, m_iconItem = nullptr; } } - if(!isFixedIcon && m_iconItem != NULL) setupIconHolder(e_ICON_TYPE_IGGY); - m_controlIconHolder.setVisible( isFixedIcon || m_iconItem != NULL); + if(!isFixedIcon && m_iconItem != nullptr) setupIconHolder(e_ICON_TYPE_IGGY); + m_controlIconHolder.setVisible( isFixedIcon || m_iconItem != nullptr); return temp; } @@ -425,7 +425,7 @@ wstring UIComponent_TutorialPopup::ParseDescription(int iPad, wstring &text) void UIComponent_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; @@ -529,7 +529,7 @@ void UIComponent_TutorialPopup::render(S32 width, S32 height, C4JRender::eViewpo void UIComponent_TutorialPopup::customDraw(IggyCustomDrawCallbackRegion *region) { - if(m_iconItem != NULL) customDrawSlotControl(region,m_iPad,m_iconItem,1.0f,m_iconItem->isFoil() || m_iconIsFoil,false); + if(m_iconItem != nullptr) customDrawSlotControl(region,m_iPad,m_iconItem,1.0f,m_iconItem->isFoil() || m_iconIsFoil,false); } void UIComponent_TutorialPopup::setupIconHolder(EIcons icon) diff --git a/Minecraft.Client/Common/UI/UIControl.cpp b/Minecraft.Client/Common/UI/UIControl.cpp index cbbbf7cac..fddcffcbf 100644 --- a/Minecraft.Client/Common/UI/UIControl.cpp +++ b/Minecraft.Client/Common/UI/UIControl.cpp @@ -6,7 +6,7 @@ UIControl::UIControl() { - m_parentScene = NULL; + m_parentScene = nullptr; m_lastOpacity = 1.0f; m_controlName = ""; m_isVisible = true; @@ -29,10 +29,10 @@ bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string m_nameVisible = registerFastName(L"visible"); F64 fx, fy, fwidth, fheight; - IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , NULL , &fx ); - IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , NULL , &fy ); - IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , NULL , &fwidth ); - IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , NULL , &fheight ); + IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , nullptr , &fx ); + IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , nullptr , &fy ); + IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , nullptr , &fwidth ); + IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , nullptr , &fheight ); m_x = static_cast(fx); m_y = static_cast(fy); @@ -45,10 +45,10 @@ bool UIControl::setupControl(UIScene *scene, IggyValuePath *parent, const string void UIControl::UpdateControl() { F64 fx, fy, fwidth, fheight; - IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , NULL , &fx ); - IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , NULL , &fy ); - IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , NULL , &fwidth ); - IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , NULL , &fheight ); + IggyValueGetF64RS( getIggyValuePath() , m_nameXPos , nullptr , &fx ); + IggyValueGetF64RS( getIggyValuePath() , m_nameYPos , nullptr , &fy ); + IggyValueGetF64RS( getIggyValuePath() , m_nameWidth , nullptr , &fwidth ); + IggyValueGetF64RS( getIggyValuePath() , m_nameHeight , nullptr , &fheight ); m_x = static_cast(fx); m_y = static_cast(fy); m_width = static_cast(Math::round(fwidth)); @@ -74,7 +74,7 @@ void UIControl::ReInit() IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, m_parentScene->m_rootPath , m_funcSetAlpha , 2 , value ); } - IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, NULL, m_isVisible ); + IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, nullptr, m_isVisible ); } IggyValuePath *UIControl::getIggyValuePath() @@ -128,7 +128,7 @@ void UIControl::setVisible(bool visible) { if(visible != m_isVisible) { - rrbool succ = IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, NULL, visible ); + rrbool succ = IggyValueSetBooleanRS( getIggyValuePath(), m_nameVisible, nullptr, visible ); if(succ) m_isVisible = visible; else app.DebugPrintf("Failed to set visibility for control\n"); } @@ -138,7 +138,7 @@ bool UIControl::getVisible() { rrbool bVisible = false; - IggyResult result = IggyValueGetBooleanRS ( getIggyValuePath() , m_nameVisible, NULL, &bVisible ); + IggyResult result = IggyValueGetBooleanRS ( getIggyValuePath() , m_nameVisible, nullptr, &bVisible ); m_isVisible = bVisible; diff --git a/Minecraft.Client/Common/UI/UIControl_Base.cpp b/Minecraft.Client/Common/UI/UIControl_Base.cpp index 743aaa92b..87c2862f4 100644 --- a/Minecraft.Client/Common/UI/UIControl_Base.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Base.cpp @@ -72,7 +72,7 @@ void UIControl_Base::setLabel(UIString label, bool instant, bool force) const wchar_t* UIControl_Base::getLabel() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetLabel, 0, NULL); + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetLabel, 0, nullptr); if(result.type == IGGY_DATATYPE_string_UTF16) { diff --git a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp index 9591be9cf..27e0b72ad 100644 --- a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp @@ -60,7 +60,7 @@ void UIControl_ButtonList::ReInit() void UIControl_ButtonList::clearList() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_removeAllItemsFunc , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_removeAllItemsFunc , 0 , nullptr ); m_itemCount = 0; } diff --git a/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp b/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp index 1c3e8afee..e5f4da7a5 100644 --- a/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp +++ b/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp @@ -60,7 +60,7 @@ void UIControl_CheckBox::init(UIString label, int id, bool checked) bool UIControl_CheckBox::IsChecked() { rrbool checked = false; - IggyResult result = IggyValueGetBooleanRS ( &m_iggyPath , m_checkedProp, NULL, &checked ); + IggyResult result = IggyValueGetBooleanRS ( &m_iggyPath , m_checkedProp, nullptr, &checked ); m_bChecked = checked; return checked; } diff --git a/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp b/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp index ab2d5a44a..8c2758931 100644 --- a/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp +++ b/Minecraft.Client/Common/UI/UIControl_DynamicLabel.cpp @@ -74,7 +74,7 @@ void UIControl_DynamicLabel::TouchScroll(S32 iY, bool bActive) S32 UIControl_DynamicLabel::GetRealWidth() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , nullptr ); S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) @@ -87,7 +87,7 @@ S32 UIControl_DynamicLabel::GetRealWidth() S32 UIControl_DynamicLabel::GetRealHeight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , nullptr ); S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) diff --git a/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp b/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp index b8b41c3d0..f091b0fcc 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp @@ -12,7 +12,7 @@ UIControl_EnchantmentBook::UIControl_EnchantmentBook() { UIControl::setControlType(UIControl::eEnchantmentBook); - model = NULL; + model = nullptr; last = nullptr; time = 0; @@ -69,12 +69,12 @@ void UIControl_EnchantmentBook::render(IggyCustomDrawCallbackRegion *region) glEnable(GL_CULL_FACE); - if(model == NULL) + if(model == nullptr) { // Share the model the the EnchantTableRenderer EnchantTableRenderer *etr = static_cast(TileEntityRenderDispatcher::instance->getRenderer(eTYPE_ENCHANTMENTTABLEENTITY)); - if(etr != NULL) + if(etr != nullptr) { model = etr->bookModel; } diff --git a/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp b/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp index 1e2e85993..b6bd3e472 100644 --- a/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp +++ b/Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp @@ -23,7 +23,7 @@ bool UIControl_HTMLLabel::setupControl(UIScene *scene, IggyValuePath *parent, co void UIControl_HTMLLabel::startAutoScroll() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcStartAutoScroll , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcStartAutoScroll , 0 , nullptr ); } void UIControl_HTMLLabel::ReInit() @@ -79,7 +79,7 @@ void UIControl_HTMLLabel::TouchScroll(S32 iY, bool bActive) S32 UIControl_HTMLLabel::GetRealWidth() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth, 0 , nullptr ); S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) @@ -92,7 +92,7 @@ S32 UIControl_HTMLLabel::GetRealWidth() S32 UIControl_HTMLLabel::GetRealHeight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , nullptr ); S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) diff --git a/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp b/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp index c34b5e875..3920e0040 100644 --- a/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp @@ -45,7 +45,7 @@ void UIControl_LeaderboardList::ReInit() void UIControl_LeaderboardList::clearList() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcResetLeaderboard , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcResetLeaderboard , 0 , nullptr ); } void UIControl_LeaderboardList::setupTitles(const wstring &rank, const wstring &gamertag) diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp index b03c858f5..b8c439b1a 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -55,7 +55,7 @@ UIControl_PlayerSkinPreview::UIControl_PlayerSkinPreview() m_fOriginalRotation = 0.0f; m_framesAnimatingRotation = 0; m_bAnimatingToFacing = false; - m_pvAdditionalModelParts=NULL; + m_pvAdditionalModelParts=nullptr; m_uiAnimOverrideBitmask=0L; } @@ -218,7 +218,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region) //EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1); EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_LOCALPLAYER); - if (renderer != NULL) + if (renderer != nullptr) { // 4J-PB - any additional parts to turn on for this player (skin dependent) //vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); @@ -260,9 +260,9 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou HumanoidModel *model = static_cast(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; diff --git a/Minecraft.Client/Common/UI/UIControl_Slider.cpp b/Minecraft.Client/Common/UI/UIControl_Slider.cpp index 7f8a8180f..2d56a29c0 100644 --- a/Minecraft.Client/Common/UI/UIControl_Slider.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Slider.cpp @@ -92,7 +92,7 @@ void UIControl_Slider::SetSliderTouchPos(float fTouchPos) S32 UIControl_Slider::GetRealWidth() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealWidth , 0 , nullptr ); S32 iRealWidth = m_width; if(result.type == IGGY_DATATYPE_number) diff --git a/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp b/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp index 8e81ac28b..7f721493a 100644 --- a/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_TexturePackList.cpp @@ -83,7 +83,7 @@ void UIControl_TexturePackList::selectSlot(int id) void UIControl_TexturePackList::clearSlots() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_clearSlotsFunc ,0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_clearSlotsFunc ,0 , nullptr ); } void UIControl_TexturePackList::setEnabled(bool enable) @@ -133,7 +133,7 @@ bool UIControl_TexturePackList::CanTouchTrigger(S32 iX, S32 iY) S32 UIControl_TexturePackList::GetRealHeight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetRealHeight, 0 , nullptr ); S32 iRealHeight = m_height; if(result.type == IGGY_DATATYPE_number) diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 2972db99a..93b58d1a7 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -60,14 +60,14 @@ DWORD UIController::m_dwTrialTimerLimitSecs=DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; static UIControl_Slider *FindSliderById(UIScene *pScene, int sliderId) { vector *controls = pScene->GetControls(); - if (!controls) return NULL; + if (!controls) return nullptr; for (size_t i = 0; i < controls->size(); ++i) { UIControl *ctrl = (*controls)[i]; if (ctrl && ctrl->getControlType() == UIControl::eSlider && ctrl->getId() == sliderId) return static_cast(ctrl); } - return NULL; + return nullptr; } #endif @@ -180,15 +180,15 @@ static void RADLINK DeallocateFunction ( void * alloc_callback_user_data , void UIController::UIController() { - m_uiDebugConsole = NULL; - m_reloadSkinThread = NULL; + m_uiDebugConsole = nullptr; + m_reloadSkinThread = nullptr; m_navigateToHomeOnReload = false; m_bCleanupOnReload = false; - m_mcTTFFont = NULL; - m_moj7 = NULL; - m_moj11 = NULL; + m_mcTTFFont = nullptr; + m_moj7 = nullptr; + m_moj11 = nullptr; // 4J-JEV: It's important that these remain the same, unless updateCurrentLanguage is going to be called. m_eCurrentFont = m_eTargetFont = eFont_NotLoaded; @@ -313,7 +313,7 @@ void UIController::postInit() #ifdef ENABLE_IGGY_EXPLORER iggy_explorer = IggyExpCreate("127.0.0.1", 9190, malloc(IGGYEXP_MIN_STORAGE), IGGYEXP_MIN_STORAGE); - if ( iggy_explorer == NULL ) + if ( iggy_explorer == nullptr ) { // not normally an error, just an error for this demo! app.DebugPrintf( "Couldn't connect to Iggy Explorer, did you run it first?" ); @@ -326,7 +326,7 @@ void UIController::postInit() #ifdef ENABLE_IGGY_PERFMON m_iggyPerfmonEnabled = false; - iggy_perfmon = IggyPerfmonCreate(perf_malloc, perf_free, NULL); + iggy_perfmon = IggyPerfmonCreate(perf_malloc, perf_free, nullptr); IggyInstallPerfmon(iggy_perfmon); #endif @@ -367,7 +367,7 @@ UITTFFont *UIController::createFont(EFont fontLanguage) #endif // 4J-JEV, Cyrillic characters have been added to this font now, (4/July/14) // XC_LANGUAGE_RUSSIAN and XC_LANGUAGE_GREEK: - default: return NULL; + default: return nullptr; } } @@ -394,17 +394,17 @@ void UIController::SetupFont() if (m_eCurrentFont != eFont_NotLoaded) app.DebugPrintf("[UIController] Font switch required for language transition to %i.\n", nextLanguage); else app.DebugPrintf("[UIController] Initialising font for language %i.\n", nextLanguage); - if (m_mcTTFFont != NULL) + if (m_mcTTFFont != nullptr) { delete m_mcTTFFont; - m_mcTTFFont = NULL; + m_mcTTFFont = nullptr; } if(m_eTargetFont == eFont_Bitmap) { // these may have been set up by a previous language being chosen - if (m_moj7 == NULL) m_moj7 = new UIBitmapFont(SFontData::Mojangles_7); - if (m_moj11 == NULL) m_moj11 = new UIBitmapFont(SFontData::Mojangles_11); + if (m_moj7 == nullptr) m_moj7 = new UIBitmapFont(SFontData::Mojangles_7); + if (m_moj11 == nullptr) m_moj11 = new UIBitmapFont(SFontData::Mojangles_11); // 4J-JEV: Ensure we redirect to them correctly, even if the objects were previously initialised. m_moj7->registerFont(); @@ -612,7 +612,7 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN if(!skinPath.empty() && app.hasArchiveFile(skinPath)) { byteArray baFile = app.getArchiveFile(skinPath); - lib = IggyLibraryCreateFromMemoryUTF16( (IggyUTF16 *)skinName.c_str() , (void *)baFile.data, baFile.length, NULL ); + lib = IggyLibraryCreateFromMemoryUTF16( (IggyUTF16 *)skinName.c_str() , (void *)baFile.data, baFile.length, nullptr ); delete[] baFile.data; #ifdef _DEBUG @@ -620,7 +620,7 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN rrbool res; int iteration = 0; __int64 totalStatic = 0; - while(res = IggyDebugGetMemoryUseInfo ( NULL , + while(res = IggyDebugGetMemoryUseInfo ( nullptr , lib , "" , 0 , @@ -724,7 +724,7 @@ bool UIController::IsExpectingOrReloadingSkin() void UIController::CleanUpSkinReload() { delete m_reloadSkinThread; - m_reloadSkinThread = NULL; + m_reloadSkinThread = nullptr; if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) { @@ -786,7 +786,7 @@ void UIController::tickInput() #ifdef _WINDOWS64 if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { - UIScene *pScene = NULL; + UIScene *pScene = nullptr; for (int grp = 0; grp < eUIGroup_COUNT && !pScene; ++grp) { pScene = m_groups[grp]->GetTopScene(eUILayer_Debug); @@ -1006,7 +1006,7 @@ void UIController::handleInput() if(ProfileManager.GetLockedProfile() >= 0 && !InputManager.IsPadLocked( ProfileManager.GetLockedProfile() ) && firstUnfocussedUnhandledPad >= 0) { - ProfileManager.RequestSignInUI(false, false, false, false, true, NULL, NULL, firstUnfocussedUnhandledPad ); + ProfileManager.RequestSignInUI(false, false, false, false, true, nullptr, nullptr, firstUnfocussedUnhandledPad ); } } #endif @@ -1033,8 +1033,8 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) if((m_bTouchscreenPressed==false) && pTouchData->reportNum==1) { // no active touch? clear active and highlighted touch UI elements - m_ActiveUIElement = NULL; - m_HighlightedUIElement = NULL; + m_ActiveUIElement = nullptr; + m_HighlightedUIElement = nullptr; // fullscreen first UIScene *pScene=m_groups[(int)eUIGroup_Fullscreen]->getCurrentScene(); @@ -1316,7 +1316,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) IggyMemoryUseInfo memoryInfo; rrbool res; int iteration = 0; - while(res = IggyDebugGetMemoryUseInfo ( NULL , + while(res = IggyDebugGetMemoryUseInfo ( nullptr , m_iggyLibraries[i] , "" , 0 , @@ -1360,7 +1360,7 @@ rrbool RADLINK UIController::ExternalFunctionCallback( void * user_callback_data { UIScene *scene = static_cast(IggyPlayerGetUserdata(player)); - if(scene != NULL) + if(scene != nullptr) { scene->externalCallback(call); } @@ -1576,7 +1576,7 @@ void UIController::setupCustomDrawMatrices(UIScene *scene, CustomDrawData *custo if(!m_bScreenWidthSetup) { Minecraft *pMinecraft=Minecraft::GetInstance(); - if(pMinecraft != NULL) + if(pMinecraft != nullptr) { m_fScreenWidth=static_cast(pMinecraft->width_phys); m_fScreenHeight=static_cast(pMinecraft->height_phys); @@ -1625,7 +1625,7 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl { UIScene *scene = static_cast(IggyPlayerGetUserdata(player)); - if(scene != NULL) + if(scene != nullptr) { scene->customDraw(region); } @@ -1637,7 +1637,7 @@ void RADLINK UIController::CustomDrawCallback(void *user_callback_data, Iggy *pl //width - Input value: optional number of pixels wide specified from AS3, or -1 if not defined. Output value: the number of pixels wide to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. //height - Input value: optional number of pixels high specified from AS3, or -1 if not defined. Output value: the number of pixels high to pretend to Iggy that the bitmap is. SWF and AS3 scales bitmaps based on their pixel dimensions, so you can use this to substitute a texture that is higher or lower resolution that ActionScript thinks it is. //destroy_callback_data - Optional additional output value you can set; the value will be passed along to the corresponding Iggy_TextureSubstitutionDestroyCallback (e.g. you can store the pointer to your own internal structure here). -//return - A platform-independent wrapped texture handle provided by GDraw, or NULL (NULL with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. +//return - A platform-independent wrapped texture handle provided by GDraw, or nullptr (nullptr with throw an ActionScript 3 ArgumentError that the Flash developer can catch) Use by calling IggySetTextureSubstitutionCallbacks. // //Discussion // @@ -1652,7 +1652,7 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * app.DebugPrintf("Found substitution texture %ls, with %d bytes\n", texture_name,it->second.length); BufferedImage image(it->second.data, it->second.length); - if( image.getData() != NULL ) + if( image.getData() != nullptr ) { image.preMultiplyAlpha(); Textures *t = Minecraft::GetInstance()->textures; @@ -1675,13 +1675,13 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * } else { - return NULL; + return nullptr; } } else { app.DebugPrintf("Could not find substitution texture %ls\n", static_cast(texture_name)); - return NULL; + return nullptr; } } @@ -1866,7 +1866,7 @@ void UIController::NavigateToHomeMenu() TexturePack *pTexPack=Minecraft::GetInstance()->skins->getSelected(); - DLCTexturePack *pDLCTexPack=NULL; + DLCTexturePack *pDLCTexPack=nullptr; if(pTexPack->hasAudio()) { // get the dlc texture pack, and store it @@ -1887,11 +1887,11 @@ void UIController::NavigateToHomeMenu() eStream_CD_1); pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1); - // 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(); // } @@ -1962,7 +1962,7 @@ void UIController::UnregisterCallbackId(size_t id) UIScene *UIController::GetSceneFromCallbackId(size_t id) { - UIScene *scene = NULL; + UIScene *scene = nullptr; auto it = m_registeredCallbackScenes.find(id); if(it != m_registeredCallbackScenes.end() ) { @@ -2439,7 +2439,7 @@ void UIController::HandleInventoryUpdated(int iPad) group = static_cast(iPad + 1); } - m_groups[group]->HandleMessage(eUIMessage_InventoryUpdated, NULL); + m_groups[group]->HandleMessage(eUIMessage_InventoryUpdated, nullptr); } void UIController::HandleGameTick() @@ -2540,7 +2540,7 @@ void UIController::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) { @@ -2628,7 +2628,7 @@ void UIController::UpdateTrialTimer(unsigned int iPad) // bring up the pause menu to stop the trial over message box being called again? if(!ui.GetMenuDisplayed( iPad ) ) { - ui.NavigateToScene(iPad, eUIScene_PauseMenu, NULL, eUILayer_Scene); + ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, eUILayer_Scene); app.SetAction(iPad,eAppAction_TrialOver); } @@ -2703,7 +2703,7 @@ void UIController::ShowUIDebugConsole(bool show) else { m_groups[eUIGroup_Fullscreen]->removeComponent(eUIComponent_DebugUIConsole, eUILayer_Debug); - m_uiDebugConsole = NULL; + m_uiDebugConsole = nullptr; } #endif } @@ -2719,7 +2719,7 @@ void UIController::ShowUIDebugMarketingGuide(bool show) else { m_groups[eUIGroup_Fullscreen]->removeComponent(eUIComponent_DebugUIMarketingGuide, eUILayer_Debug); - m_uiDebugMarketingGuide = NULL; + m_uiDebugMarketingGuide = nullptr; } #endif } @@ -2806,7 +2806,7 @@ C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT ui } } -C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) +C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = nullptr*/, LPVOID lpParam/* = nullptr*/) { // Default title / messages if (title == -1) @@ -2838,7 +2838,7 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1 #endif } -C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) +C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = nullptr*/, LPVOID lpParam/* = nullptr*/) { // Default title / messages if (title == -1) @@ -2876,7 +2876,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT void UIController::setFontCachingCalculationBuffer(int length) { /* 4J-JEV: As described in an email from Sean. - If your `optional_temp_buffer` is NULL, Iggy will allocate the temp + If your `optional_temp_buffer` is nullptr, Iggy will allocate the temp buffer on the stack during Iggy draw calls. The size of the buffer it will allocate is 16 bytes times `max_chars` in 32-bit, and 24 bytes times `max_chars` in 64-bit. If the stack of the thread making the @@ -2889,10 +2889,10 @@ void UIController::setFontCachingCalculationBuffer(int length) static const int CHAR_SIZE = 16; #endif - if (m_tempBuffer != NULL) delete [] m_tempBuffer; + if (m_tempBuffer != nullptr) delete [] m_tempBuffer; if (length<0) { - if (m_defaultBuffer == NULL) m_defaultBuffer = new char[CHAR_SIZE*5000]; + if (m_defaultBuffer == nullptr) m_defaultBuffer = new char[CHAR_SIZE*5000]; IggySetFontCachingCalculationBuffer(5000, m_defaultBuffer, CHAR_SIZE*5000); } else @@ -2902,16 +2902,16 @@ void UIController::setFontCachingCalculationBuffer(int length) } } -// Returns the first scene of given type if it exists, NULL otherwise +// Returns the first scene of given type if it exists, nullptr otherwise UIScene *UIController::FindScene(EUIScene sceneType) { - UIScene *pScene = NULL; + UIScene *pScene = nullptr; for (int i = 0; i < eUIGroup_COUNT; i++) { pScene = m_groups[i]->FindScene(sceneType); #ifdef __PS3__ - if (pScene != NULL) return pScene; + if (pScene != nullptr) return pScene; #else if (pScene != nullptr) return pScene; #endif @@ -3077,7 +3077,7 @@ bool UIController::TouchBoxHit(UIScene *pUIScene,S32 x, S32 y) } //app.DebugPrintf("MISS at x = %i y = %i\n", (int)x, (int)y); - m_HighlightedUIElement = NULL; + m_HighlightedUIElement = nullptr; return false; } diff --git a/Minecraft.Client/Common/UI/UIController.h b/Minecraft.Client/Common/UI/UIController.h index f4b365b51..81947eef4 100644 --- a/Minecraft.Client/Common/UI/UIController.h +++ b/Minecraft.Client/Common/UI/UIController.h @@ -291,7 +291,7 @@ protected: static GDrawTexture * RADLINK TextureSubstitutionCreateCallback( void * user_callback_data , IggyUTF16 * texture_name , S32 * width , S32 * height , void **destroy_callback_data ); static void RADLINK TextureSubstitutionDestroyCallback( void * user_callback_data , void * destroy_callback_data , GDrawTexture * handle ); - virtual GDrawTexture *getSubstitutionTexture(int textureId) { return NULL; } + virtual GDrawTexture *getSubstitutionTexture(int textureId) { return nullptr; } virtual void destroySubstitutionTexture(void *destroyCallBackData, GDrawTexture *handle) {} public: @@ -300,7 +300,7 @@ public: public: // NAVIGATION - bool NavigateToScene(int iPad, EUIScene scene, void *initData = NULL, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); + bool NavigateToScene(int iPad, EUIScene scene, void *initData = nullptr, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT); void NavigateToHomeMenu(); UIScene *GetTopScene(int iPad, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); @@ -380,14 +380,14 @@ public: virtual void HidePressStart(); void ClearPressStart(); - virtual C4JStorage::EMessageResult RequestAlertMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, WCHAR *pwchFormatString=NULL); - virtual C4JStorage::EMessageResult RequestErrorMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, WCHAR *pwchFormatString=NULL); + virtual C4JStorage::EMessageResult RequestAlertMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, WCHAR *pwchFormatString=nullptr); + virtual C4JStorage::EMessageResult RequestErrorMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, WCHAR *pwchFormatString=nullptr); private: virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad,int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, WCHAR *pwchFormatString,DWORD dwFocusButton, bool bIsError); public: - C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); - C4JStorage::EMessageResult RequestContentRestrictedMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); + C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = nullptr, LPVOID lpParam = nullptr); + C4JStorage::EMessageResult RequestContentRestrictedMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = nullptr, LPVOID lpParam = nullptr); virtual void SetWinUserIndex(unsigned int iPad); unsigned int GetWinUserIndex(); diff --git a/Minecraft.Client/Common/UI/UIFontData.cpp b/Minecraft.Client/Common/UI/UIFontData.cpp index c5ad46ef0..715d08ddc 100644 --- a/Minecraft.Client/Common/UI/UIFontData.cpp +++ b/Minecraft.Client/Common/UI/UIFontData.cpp @@ -145,9 +145,9 @@ CFontData::CFontData() { m_unicodeMap = unordered_map(); - m_sFontData = NULL; - m_kerningTable = NULL; - m_pbRawImage = NULL; + m_sFontData = nullptr; + m_kerningTable = nullptr; + m_pbRawImage = nullptr; } CFontData::CFontData(SFontData &sFontData, int *pbRawImage) diff --git a/Minecraft.Client/Common/UI/UIGroup.cpp b/Minecraft.Client/Common/UI/UIGroup.cpp index 769fd83d6..be9054c99 100644 --- a/Minecraft.Client/Common/UI/UIGroup.cpp +++ b/Minecraft.Client/Common/UI/UIGroup.cpp @@ -25,9 +25,9 @@ UIGroup::UIGroup(EUIGroup group, int iPad) m_tooltips = (UIComponent_Tooltips *)m_layers[static_cast(eUILayer_Tooltips)]->addComponent(0, eUIComponent_Tooltips); - m_tutorialPopup = NULL; - m_hud = NULL; - m_pressStartToPlay = NULL; + m_tutorialPopup = nullptr; + m_hud = nullptr; + m_pressStartToPlay = nullptr; if(m_group != eUIGroup_Fullscreen) { m_tutorialPopup = (UIComponent_TutorialPopup *)m_layers[static_cast(eUILayer_Popup)]->addComponent(m_iPad, eUIComponent_TutorialPopup); @@ -151,7 +151,7 @@ void UIGroup::closeAllScenes() Minecraft *pMinecraft = Minecraft::GetInstance(); if( m_iPad >= 0 ) { - if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) + if(pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); @@ -214,10 +214,10 @@ UIScene *UIGroup::getCurrentScene() { pScene=m_layers[i]->getCurrentScene(); - if(pScene!=NULL) return pScene; + if(pScene!=nullptr) return pScene; } - return NULL; + return nullptr; } #endif @@ -412,16 +412,16 @@ int UIGroup::getCommandBufferList() return m_commandBufferList; } -// Returns the first scene of given type if it exists, NULL otherwise +// Returns the first scene of given type if it exists, nullptr otherwise UIScene *UIGroup::FindScene(EUIScene sceneType) { - UIScene *pScene = NULL; + UIScene *pScene = nullptr; for (int i = 0; i < eUILayer_COUNT; i++) { pScene = m_layers[i]->FindScene(sceneType); #ifdef __PS3__ - if (pScene != NULL) return pScene; + if (pScene != nullptr) return pScene; #else if (pScene != nullptr) return pScene; #endif diff --git a/Minecraft.Client/Common/UI/UILayer.cpp b/Minecraft.Client/Common/UI/UILayer.cpp index b3cf72a0c..d4dc445b6 100644 --- a/Minecraft.Client/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Common/UI/UILayer.cpp @@ -197,7 +197,7 @@ bool UILayer::GetMenuDisplayed() bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) { - UIScene *newScene = NULL; + UIScene *newScene = nullptr; switch(scene) { // Debug @@ -424,7 +424,7 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) break; }; - if(newScene == NULL) + if(newScene == nullptr) { app.DebugPrintf("WARNING: Scene %d was not created. Add it to UILayer::NavigateToScene\n", scene); return false; @@ -451,7 +451,7 @@ bool UILayer::NavigateBack(int iPad, EUIScene eScene) bool navigated = false; if(eScene < eUIScene_COUNT) { - UIScene *scene = NULL; + UIScene *scene = nullptr; do { scene = m_sceneStack.back(); @@ -523,9 +523,9 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData) return itComp; } } - return NULL; + return nullptr; } - UIScene *newScene = NULL; + UIScene *newScene = nullptr; switch(scene) { @@ -573,7 +573,7 @@ UIScene *UILayer::addComponent(int iPad, EUIScene scene, void *initData) break; }; - if(newScene == NULL) return NULL; + if(newScene == nullptr) return nullptr; m_components.push_back(newScene); @@ -661,12 +661,12 @@ void UILayer::closeAllScenes() } } -// Get top scene on stack (or NULL if stack is empty) +// Get top scene on stack (or nullptr if stack is empty) UIScene *UILayer::GetTopScene() { if(m_sceneStack.size() == 0) { - return NULL; + return nullptr; } else { @@ -789,7 +789,7 @@ UIScene *UILayer::getCurrentScene() } } - return NULL; + return nullptr; } #endif @@ -894,7 +894,7 @@ void UILayer::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic) totalDynamic += layerDynamic; } -// Returns the first scene of given type if it exists, NULL otherwise +// Returns the first scene of given type if it exists, nullptr otherwise UIScene *UILayer::FindScene(EUIScene sceneType) { for (int i = 0; i < m_sceneStack.size(); i++) @@ -905,5 +905,5 @@ UIScene *UILayer::FindScene(EUIScene sceneType) } } - return NULL; + return nullptr; } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UILayer.h b/Minecraft.Client/Common/UI/UILayer.h index 47c776ab7..074637ca4 100644 --- a/Minecraft.Client/Common/UI/UILayer.h +++ b/Minecraft.Client/Common/UI/UILayer.h @@ -61,7 +61,7 @@ public: // E.g. you can keep a component active while performing navigation with other scenes on this layer void showComponent(int iPad, EUIScene scene, bool show); bool isComponentVisible(EUIScene scene); - UIScene *addComponent(int iPad, EUIScene scene, void *initData = NULL); + UIScene *addComponent(int iPad, EUIScene scene, void *initData = nullptr); void removeComponent(EUIScene scene); // INPUT diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index e736d25cb..9029e9ffc 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -11,8 +11,8 @@ UIScene::UIScene(int iPad, UILayer *parentLayer) { m_parentLayer = parentLayer; m_iPad = iPad; - swf = NULL; - m_pItemRenderer = NULL; + swf = nullptr; + m_pItemRenderer = nullptr; bHasFocus = false; m_hasTickedOnce = false; @@ -26,7 +26,7 @@ UIScene::UIScene(int iPad, UILayer *parentLayer) m_lastOpacity = 1.0f; m_bUpdateOpacity = false; - m_backScene = NULL; + m_backScene = nullptr; m_cacheSlotRenders = false; m_needsCacheRendered = true; @@ -49,14 +49,14 @@ UIScene::~UIScene() ui.UnregisterCallbackId(m_callbackUniqueId); } - if(m_pItemRenderer != NULL) delete m_pItemRenderer; + if(m_pItemRenderer != nullptr) delete m_pItemRenderer; } void UIScene::destroyMovie() { /* Destroy the Iggy player. */ IggyPlayerDestroy( swf ); - swf = NULL; + swf = nullptr; // Clear out the controls collection (doesn't delete the controls, and they get re-setup later) m_controls.clear(); @@ -115,7 +115,7 @@ bool UIScene::needsReloaded() bool UIScene::hasMovie() { - return swf != NULL; + return swf != nullptr; } F64 UIScene::getSafeZoneHalfHeight() @@ -330,7 +330,7 @@ void UIScene::loadMovie() byteArray baFile = ui.getMovieData(moviePath.c_str()); __int64 beforeLoad = ui.iggyAllocCount; - swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, NULL); + swf = IggyPlayerCreateFromMemory ( baFile.data , baFile.length, nullptr); __int64 afterLoad = ui.iggyAllocCount; IggyPlayerInitializeAndTickRS ( swf ); __int64 afterTick = ui.iggyAllocCount; @@ -365,7 +365,7 @@ void UIScene::loadMovie() __int64 totalStatic = 0; __int64 totalDynamic = 0; while(res = IggyDebugGetMemoryUseInfo ( swf , - NULL , + nullptr , 0 , 0 , iteration , @@ -393,7 +393,7 @@ void UIScene::getDebugMemoryUseRecursive(const wstring &moviePath, IggyMemoryUse IggyMemoryUseInfo internalMemoryInfo; int internalIteration = 0; while(res = IggyDebugGetMemoryUseInfo ( swf , - NULL , + nullptr , memoryInfo.subcategory , memoryInfo.subcategory_stringlen , internalIteration , @@ -416,7 +416,7 @@ void UIScene::PrintTotalMemoryUsage(__int64 &totalStatic, __int64 &totalDynamic) __int64 sceneStatic = 0; __int64 sceneDynamic = 0; while(res = IggyDebugGetMemoryUseInfo ( swf , - NULL , + nullptr , "" , 0 , iteration , @@ -451,7 +451,7 @@ void UIScene::tick() UIControl* UIScene::GetMainPanel() { - return NULL; + return nullptr; } @@ -545,19 +545,19 @@ void UIScene::removeControl( UIControl_Base *control, bool centreScene) void UIScene::slideLeft() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideLeft , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideLeft , 0 , nullptr ); } void UIScene::slideRight() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideRight , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSlideRight , 0 , nullptr ); } void UIScene::doHorizontalResizeCheck() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHorizontalResizeCheck , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHorizontalResizeCheck , 0 , nullptr ); } void UIScene::render(S32 width, S32 height, C4JRender::eViewportType viewport) @@ -600,7 +600,7 @@ void UIScene::customDraw(IggyCustomDrawCallbackRegion *region) void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr item, float fAlpha, bool isFoil, bool bDecorations) { - if (item!= NULL) + if (item!= nullptr) { if(m_cacheSlotRenders) { @@ -739,7 +739,7 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt } PIXBeginNamedEvent(0,"Render and decorate"); - if(m_pItemRenderer == NULL) m_pItemRenderer = new ItemRenderer(); + if(m_pItemRenderer == nullptr) m_pItemRenderer = new ItemRenderer(); RenderManager.StateSetBlendEnable(true); RenderManager.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); RenderManager.StateSetBlendFactor(0xffffffff); @@ -776,9 +776,9 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt // 4J Stu - Not threadsafe //void UIScene::navigateForward(int iPad, EUIScene scene, void *initData) //{ -// if(m_parentLayer == NULL) +// if(m_parentLayer == nullptr) // { -// app.DebugPrintf("A scene is trying to navigate forwards, but it's parent layer is NULL!\n"); +// app.DebugPrintf("A scene is trying to navigate forwards, but it's parent layer is nullptr!\n"); //#ifndef _CONTENT_PACKAGE // __debugbreak(); //#endif @@ -796,9 +796,9 @@ void UIScene::navigateBack() ui.NavigateBack(m_iPad); - if(m_parentLayer == NULL) + if(m_parentLayer == nullptr) { -// app.DebugPrintf("A scene is trying to navigate back, but it's parent layer is NULL!\n"); +// app.DebugPrintf("A scene is trying to navigate back, but it's parent layer is nullptr!\n"); #ifndef _CONTENT_PACKAGE // __debugbreak(); #endif diff --git a/Minecraft.Client/Common/UI/UIScene.h b/Minecraft.Client/Common/UI/UIScene.h index b4008fa01..458e3e62c 100644 --- a/Minecraft.Client/Common/UI/UIScene.h +++ b/Minecraft.Client/Common/UI/UIScene.h @@ -245,7 +245,7 @@ public: // NAVIGATION protected: - //void navigateForward(int iPad, EUIScene scene, void *initData = NULL); + //void navigateForward(int iPad, EUIScene scene, void *initData = nullptr); void navigateBack(); public: diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index a354ba7ae..b8193bac0 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -49,15 +49,15 @@ void UIScene_AbstractContainerMenu::handleDestroy() #endif Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != NULL ) + if( pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + 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(pMinecraft->localplayers[m_iPad] != NULL && pMinecraft->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) + if(pMinecraft->localplayers[m_iPad] != nullptr && pMinecraft->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) { pMinecraft->localplayers[m_iPad]->closeContainer(); } @@ -149,8 +149,8 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) m_fPointerMaxX = m_fPanelMaxX + fPointerWidth; m_fPointerMaxY = m_fPanelMaxY + (fPointerHeight/2); -// m_hPointerText=NULL; -// m_hPointerTextBkg=NULL; +// m_hPointerText=nullptr; +// m_hPointerTextBkg=nullptr; // Put the pointer over first item in use row to start with. UIVec2D itemPos; @@ -254,7 +254,7 @@ void UIScene_AbstractContainerMenu::render(S32 width, S32 height, C4JRender::eVi void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; shared_ptr item = nullptr; int slotId = -1; @@ -278,7 +278,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg } } - if(item != NULL) customDrawSlotControl(region,m_iPad,item,m_menu->isValidIngredient(item, slotId)?1.0f:0.5f,item->isFoil(),true); + if(item != nullptr) customDrawSlotControl(region,m_iPad,item,m_menu->isValidIngredient(item, slotId)?1.0f:0.5f,item->isFoil(),true); } void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) @@ -337,7 +337,7 @@ Slot *UIScene_AbstractContainerMenu::getSlot(ESceneSection eSection, int iSlot) { Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot ); if(slot) return slot; - else return NULL; + else return nullptr; } bool UIScene_AbstractContainerMenu::isSlotEmpty(ESceneSection eSection, int iSlot) diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h index 605f5dbdf..c6ef29bbd 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h @@ -53,7 +53,7 @@ protected: virtual bool isSlotEmpty(ESceneSection eSection, int iSlot); virtual void adjustPointerForSafeZone(); - virtual UIControl *getSection(ESceneSection eSection) { return NULL; } + virtual UIControl *getSection(ESceneSection eSection) { return nullptr; } virtual int GetBaseSlotCount() { return 0; } public: diff --git a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp index 79117bb43..c9d879a36 100644 --- a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp @@ -20,7 +20,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL m_inventory = initData->inventory; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[iPad] != NULL ) + if( pMinecraft->localgameModes[iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -250,7 +250,7 @@ void UIScene_AnvilMenu::setSectionSelectedSlot(ESceneSection eSection, int x, in int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionAnvilItem1: @@ -278,7 +278,7 @@ void UIScene_AnvilMenu::setSectionSelectedSlot(ESceneSection eSection, int x, in UIControl *UIScene_AnvilMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionAnvilItem1: diff --git a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp index 64e0fdd8b..cf1ff7f33 100644 --- a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp @@ -24,7 +24,7 @@ UIScene_BeaconMenu::UIScene_BeaconMenu(int iPad, void *_initData, UILayer *paren BeaconScreenInput *initData = static_cast(_initData); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -254,7 +254,7 @@ void UIScene_BeaconMenu::setSectionSelectedSlot(ESceneSection eSection, int x, i int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionBeaconItem: @@ -276,7 +276,7 @@ void UIScene_BeaconMenu::setSectionSelectedSlot(ESceneSection eSection, int x, i UIControl *UIScene_BeaconMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionBeaconItem: @@ -324,7 +324,7 @@ UIControl *UIScene_BeaconMenu::getSection(ESceneSection eSection) void UIScene_BeaconMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; shared_ptr item = nullptr; int slotId = -1; @@ -351,7 +351,7 @@ void UIScene_BeaconMenu::customDraw(IggyCustomDrawCallbackRegion *region) assert(false); break; }; - if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true); + if(item != nullptr) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true); } else { diff --git a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp index 4df5fa039..129868fd0 100644 --- a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp @@ -20,7 +20,7 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void *_initData, UI m_labelBrewingStand.init( m_brewingStand->getName() ); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -249,7 +249,7 @@ void UIScene_BrewingStandMenu::setSectionSelectedSlot(ESceneSection eSection, in int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionBrewingBottle1: @@ -280,7 +280,7 @@ void UIScene_BrewingStandMenu::setSectionSelectedSlot(ESceneSection eSection, in UIControl *UIScene_BrewingStandMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionBrewingBottle1: diff --git a/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp b/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp index a387fb294..e10a5a62a 100644 --- a/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp @@ -210,7 +210,7 @@ void UIScene_ConnectingProgress::handleInput(int iPad, int key, bool repeat, boo // 4J-PB - Removed the option to cancel join - it didn't work anyway // case ACTION_MENU_CANCEL: // { -// if(m_cancelFunc != NULL) +// if(m_cancelFunc != nullptr) // { // m_cancelFunc(m_cancelFuncParam); // } diff --git a/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp index 7a3051eff..b26ae48e9 100644 --- a/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp @@ -24,7 +24,7 @@ UIScene_ContainerMenu::UIScene_ContainerMenu(int iPad, void *_initData, UILayer ContainerMenu* menu = new ContainerMenu( initData->inventory, initData->container ); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[iPad] != NULL ) + if( pMinecraft->localgameModes[iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -181,7 +181,7 @@ void UIScene_ContainerMenu::setSectionSelectedSlot(ESceneSection eSection, int x int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionContainerChest: @@ -203,7 +203,7 @@ void UIScene_ContainerMenu::setSectionSelectedSlot(ESceneSection eSection, int x UIControl *UIScene_ContainerMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionContainerChest: diff --git a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp index 07db23904..939efde11 100644 --- a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp @@ -25,7 +25,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void *initData, UILayer *pa #endif IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetPlatform , 1 , value ); - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { diff --git a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp index 676feb989..64441ff65 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp @@ -109,7 +109,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *p // Update the tutorial state Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != NULL ) + if( pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -190,14 +190,14 @@ void UIScene_CraftingMenu::handleDestroy() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != NULL ) + if( pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + if(gameMode != nullptr) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); } // 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]->containerMenu->containerId == m_menu->containerId) + if(Minecraft::GetInstance()->localplayers[m_iPad] != nullptr && Minecraft::GetInstance()->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) { Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer(); } @@ -436,7 +436,7 @@ void UIScene_CraftingMenu::handleReload() void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; shared_ptr item = nullptr; int slotId = -1; @@ -511,7 +511,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) } } - if(item != NULL) + if(item != nullptr) { if(!inventoryItem) { @@ -627,7 +627,7 @@ void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, shared_ptrgetId(); - m_pDLCPack = NULL; + m_pDLCPack = nullptr; m_bRebuildTouchBoxes = false; #ifdef _WINDOWS64 m_bDirectEditing = false; @@ -100,7 +100,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay // #ifdef __PS3__ // if(ProfileManager.IsSignedInLive( m_iPad )) // { - // ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&bChatRestricted,&bContentRestricted,NULL); + // ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&bChatRestricted,&bContentRestricted,nullptr); // } // #endif @@ -188,7 +188,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay #if TO_BE_IMPLEMENTED // 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; @@ -565,7 +565,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() // 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) { #if TO_BE_IMPLEMENTED // They've selected a texture pack they don't have yet @@ -643,7 +643,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_pDLCPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -762,7 +762,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) 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); @@ -771,7 +771,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) if(dwBytes > 0 && pbData) { DWORD dwImageBytes=0; - PBYTE pbImageData=NULL; + PBYTE pbImageData=nullptr; app.GetFileFromTPD(eTPDFileType_Icon,pbData,dwBytes,&pbImageData,&dwImageBytes ); ListInfo.fEnabled = TRUE; @@ -928,7 +928,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); return; } @@ -948,7 +948,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),NULL,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); return; } } @@ -988,7 +988,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() #if defined(__PS3__) || defined(__PSVITA__) if(isOnlineGame && isSignedInLive) { - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,nullptr,&bContentRestricted,nullptr); } #endif @@ -1017,7 +1017,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); return; } @@ -1035,7 +1035,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),NULL,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); } #endif @@ -1077,7 +1077,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); return; } @@ -1099,7 +1099,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),NULL,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); } #endif @@ -1109,7 +1109,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() if(isOnlineGame) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -1211,7 +1211,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD param->seed = seedValue; - param->saveData = NULL; + param->saveData = nullptr; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -1469,7 +1469,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor if(isOnlineGame) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); diff --git a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp index 902b987c4..1ac0c91a0 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp @@ -42,7 +42,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p } Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -400,7 +400,7 @@ void UIScene_CreativeMenu::setSectionSelectedSlot(ESceneSection eSection, int x, int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionInventoryCreativeSelector: @@ -419,7 +419,7 @@ void UIScene_CreativeMenu::setSectionSelectedSlot(ESceneSection eSection, int x, UIControl *UIScene_CreativeMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionInventoryCreativeSelector: diff --git a/Minecraft.Client/Common/UI/UIScene_Credits.cpp b/Minecraft.Client/Common/UI/UIScene_Credits.cpp index 187bf689a..9900169ce 100644 --- a/Minecraft.Client/Common/UI/UIScene_Credits.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Credits.cpp @@ -593,7 +593,7 @@ void UIScene_Credits::tick() } // Set up the new text element. - if(pDef->m_Text!=NULL) // 4J-PB - think the RAD logo ones aren't set up yet and are coming is as null + if(pDef->m_Text!=nullptr) // 4J-PB - think the RAD logo ones aren't set up yet and are coming is as null { if ( pDef->m_iStringID[0] == CREDIT_ICON ) { diff --git a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp index cd9f6d6ca..5e644803b 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -21,7 +21,7 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void *initData, UILayer * m_iCurrentDLC=0; m_iTotalDLC=0; #if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - m_pvProductInfo=NULL; + m_pvProductInfo=nullptr; #endif m_bAddAllDLCButtons=true; @@ -51,7 +51,7 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void *initData, UILayer * } #ifdef _DURANGO - m_pNoImageFor_DLC = NULL; + m_pNoImageFor_DLC = nullptr; // If we don't yet have this DLC, we need to display a timer m_bDLCRequiredIsRetrieved=false; m_bIgnorePress=true; @@ -261,13 +261,13 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) #endif // __PS3__ #elif defined _XBOX_ONE int iIndex = (int)childId; - StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,NULL,NULL); + StorageManager.InstallOffer(1,StorageManager.GetOffer(iIndex).wszProductID,nullptr,nullptr); #else int iIndex = static_cast(childId); ULONGLONG ullIndexA[1]; ullIndexA[0]=StorageManager.GetOffer(iIndex).qwOfferID; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + StorageManager.InstallOffer(1,ullIndexA,nullptr,nullptr); #endif } break; @@ -343,10 +343,10 @@ void UIScene_DLCOffersMenu::tick() { m_bAddAllDLCButtons=false; // add the categories to the list box - if(m_pvProductInfo==NULL) + if(m_pvProductInfo==nullptr) { m_pvProductInfo=app.GetProductList(m_iProductInfoIndex); - if(m_pvProductInfo==NULL) + if(m_pvProductInfo==nullptr) { m_iTotalDLC=0; // need to display text to say no downloadable content available yet @@ -690,7 +690,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // Check that this is in the list of known DLC DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.wszProductID); - if(pDLC!=NULL) + if(pDLC!=nullptr) { OrderA[uiDLCCount].uiContentIndex=i; OrderA[uiDLCCount++].uiSortIndex=pDLC->uiSortIndex; @@ -710,7 +710,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // Check that this is in the list of known DLC DLC_INFO *pDLC=app.GetDLCInfoForFullOfferID(xOffer.wszProductID); - if(pDLC==NULL) + if(pDLC==nullptr) { // skip this one app.DebugPrintf("Unknown offer - %ls\n",xOffer.wszOfferName); @@ -736,7 +736,7 @@ void UIScene_DLCOffersMenu::GetDLCInfo( int iOfferC, bool bUpdateOnly ) // find the DLC in the installed packages XCONTENT_DATA *pContentData=StorageManager.GetInstalledDLC(xOffer.wszProductID); - if(pContentData!=NULL) + if(pContentData!=nullptr) { m_buttonListOffers.addItem(wstrTemp,!pContentData->bTrialLicense,OrderA[i].uiContentIndex); } @@ -809,7 +809,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) DLC_INFO *dlc = app.GetDLCInfoForFullOfferID(xOffer.wszOfferName); #endif - if (dlc != NULL) + if (dlc != nullptr) { WCHAR *cString = dlc->wchBanner; @@ -844,7 +844,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(MARKETPLACE_CONTENTOFFER_INFO& xOffer) { if(hasRegisteredSubstitutionTexture(cString)==false) { - BYTE *pData=NULL; + BYTE *pData=nullptr; DWORD dwSize=0; app.GetMemFileDetails(cString,&pData,&dwSize); // set the image diff --git a/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp index 7d02367ab..a4dbe8a82 100644 --- a/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp @@ -18,7 +18,7 @@ UIScene_DeathMenu::UIScene_DeathMenu(int iPad, void *initData, UILayer *parentLa m_bIgnoreInput = false; Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) + if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); @@ -30,7 +30,7 @@ UIScene_DeathMenu::UIScene_DeathMenu(int iPad, void *initData, UILayer *parentLa UIScene_DeathMenu::~UIScene_DeathMenu() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) + if(pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); @@ -104,7 +104,7 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) { UINT uiIDA[3]; int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != NULL ) + if( pMinecraft->localplayers[m_iPad] != nullptr ) { playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); } diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp index 86b515c35..eed4bbe1b 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp @@ -44,7 +44,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa std::vector> sortedItems; for (size_t i = 0; i < Item::items.length; ++i) { - if (Item::items[i] != NULL) + if (Item::items[i] != nullptr) { sortedItems.emplace_back(std::wstring(app.GetString(Item::items[i]->getDescriptionId())), i); } @@ -137,18 +137,18 @@ wstring UIScene_DebugOverlay::getMoviePath() void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; int itemId = -1; swscanf(static_cast(region->name),L"item_%d",&itemId); - if (itemId == -1 || itemId > Item::ITEM_NUM_COUNT || Item::items[itemId] == NULL) + if (itemId == -1 || itemId > Item::ITEM_NUM_COUNT || Item::items[itemId] == nullptr) { app.DebugPrintf("This is not the control we are looking for\n"); } else { shared_ptr item = shared_ptr( new ItemInstance(itemId,1,0) ); - if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,false,false); + if(item != nullptr) customDrawSlotControl(region,m_iPad,item,1.0f,false,false); } } @@ -211,14 +211,14 @@ void UIScene_DebugOverlay::handlePress(F64 controlId, F64 childId) case eControl_Schematic: { #ifndef _CONTENT_PACKAGE - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic,NULL,eUILayer_Debug); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugCreateSchematic,nullptr,eUILayer_Debug); #endif } break; case eControl_SetCamera: { #ifndef _CONTENT_PACKAGE - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugSetCamera,NULL,eUILayer_Debug); + ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DebugSetCamera,nullptr,eUILayer_Debug); #endif } break; diff --git a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp index de200868e..2ebb6c71c 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp @@ -17,7 +17,7 @@ UIScene_DebugSetCamera::UIScene_DebugSetCamera(int iPad, void *initData, UILayer currentPosition->player = playerNo; Minecraft *pMinecraft = Minecraft::GetInstance(); - if (pMinecraft != NULL) + if (pMinecraft != nullptr) { Vec3 *vec = pMinecraft->localplayers[playerNo]->getPos(1.0); diff --git a/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp index f7fe65d69..2e47dda43 100644 --- a/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp @@ -15,7 +15,7 @@ UIScene_DispenserMenu::UIScene_DispenserMenu(int iPad, void *_initData, UILayer m_labelDispenser.init(initData->trap->getName()); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -156,7 +156,7 @@ void UIScene_DispenserMenu::setSectionSelectedSlot(ESceneSection eSection, int x int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionTrapTrap: @@ -177,7 +177,7 @@ void UIScene_DispenserMenu::setSectionSelectedSlot(ESceneSection eSection, int x UIControl *UIScene_DispenserMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionTrapTrap: diff --git a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp index ced0c45a2..f90c4b12b 100644 --- a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp @@ -19,7 +19,7 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void *_initData, UILaye m_labelEnchant.init( initData->name.empty() ? app.GetString(IDS_ENCHANT) : initData->name ); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -194,7 +194,7 @@ void UIScene_EnchantingMenu::setSectionSelectedSlot(ESceneSection eSection, int int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionEnchantSlot: @@ -216,7 +216,7 @@ void UIScene_EnchantingMenu::setSectionSelectedSlot(ESceneSection eSection, int UIControl *UIScene_EnchantingMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionEnchantSlot: @@ -247,7 +247,7 @@ UIControl *UIScene_EnchantingMenu::getSection(ESceneSection eSection) void UIScene_EnchantingMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; if(wcscmp((wchar_t *)region->name,L"EnchantmentBook")==0) diff --git a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp index f06343fe5..5b10e8cfe 100644 --- a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp @@ -50,7 +50,7 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer) Minecraft *pMinecraft = Minecraft::GetInstance(); wstring playerName = L""; - if(pMinecraft->localplayers[ui.GetWinUserIndex()] != NULL) + if(pMinecraft->localplayers[ui.GetWinUserIndex()] != nullptr) { playerName = escapeXML( pMinecraft->localplayers[ui.GetWinUserIndex()]->getDisplayName() ); } @@ -159,14 +159,14 @@ void UIScene_EndPoem::handleInput(int iPad, int key, bool repeat, bool pressed, Minecraft *pMinecraft = Minecraft::GetInstance(); 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); } } // 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); updateTooltips(); navigateBack(); diff --git a/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp index 533c280f0..b33e086a7 100644 --- a/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp @@ -16,7 +16,7 @@ UIScene_FireworksMenu::UIScene_FireworksMenu(int iPad, void *_initData, UILayer m_labelFireworks.init(app.GetString(IDS_HOW_TO_PLAY_MENU_FIREWORKS)); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -174,7 +174,7 @@ void UIScene_FireworksMenu::setSectionSelectedSlot(ESceneSection eSection, int x int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionFireworksIngredients: @@ -198,7 +198,7 @@ void UIScene_FireworksMenu::setSectionSelectedSlot(ESceneSection eSection, int x UIControl *UIScene_FireworksMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionFireworksIngredients: diff --git a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp index 66a2c5ee8..0dfde06d6 100644 --- a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp @@ -102,7 +102,7 @@ void UIScene_FullscreenProgress::handleDestroy() DWORD exitcode = *((DWORD *)&code); // If we're active, have a cancel func, and haven't already cancelled, call cancel func - if( exitcode == STILL_ACTIVE && m_cancelFunc != NULL && !m_bWasCancelled) + if( exitcode == STILL_ACTIVE && m_cancelFunc != nullptr && !m_bWasCancelled) { m_bWasCancelled = true; m_cancelFunc(m_cancelFuncParam); @@ -224,7 +224,7 @@ void UIScene_FullscreenProgress::tick() // 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(); navigateBack(); } @@ -286,7 +286,7 @@ void UIScene_FullscreenProgress::handleInput(int iPad, int key, bool repeat, boo break; case ACTION_MENU_B: case ACTION_MENU_CANCEL: - if( pressed && m_cancelFunc != NULL && !m_bWasCancelled ) + if( pressed && m_cancelFunc != nullptr && !m_bWasCancelled ) { m_bWasCancelled = true; m_cancelFunc( m_cancelFuncParam ); diff --git a/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp index 3be86b109..9dcbe45b4 100644 --- a/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp @@ -21,7 +21,7 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void *_initData, UILayer *par m_progressFurnaceArrow.init(L"",0,0,24,0); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -202,7 +202,7 @@ void UIScene_FurnaceMenu::setSectionSelectedSlot(ESceneSection eSection, int x, int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionFurnaceResult: @@ -230,7 +230,7 @@ void UIScene_FurnaceMenu::setSectionSelectedSlot(ESceneSection eSection, int x, UIControl *UIScene_FurnaceMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionFurnaceResult: diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Common/UI/UIScene_HUD.cpp index 0e80c1f99..a6f0f81b8 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HUD.cpp @@ -114,7 +114,7 @@ void UIScene_HUD::tick() if(getMovie() && app.GetGameStarted()) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) { return; } @@ -155,7 +155,7 @@ void UIScene_HUD::tick() void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; int slot = -1; swscanf(static_cast(region->name),L"slot_%d",&slot); @@ -167,7 +167,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) { Slot *invSlot = pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + slot); shared_ptr item = invSlot->getItem(); - if(item != NULL) + if(item != nullptr) { unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); float fVal; @@ -254,7 +254,7 @@ void UIScene_HUD::handleReload() int iGuiScale; Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) { iGuiScale=app.GetGameSettings(m_iPad,eGameSetting_UISize); } @@ -595,7 +595,7 @@ void UIScene_HUD::SetSelectedLabel(const wstring &label) void UIScene_HUD::HideSelectedLabel() { IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHideSelectedLabel , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHideSelectedLabel , 0 , nullptr ); } @@ -744,7 +744,7 @@ void UIScene_HUD::handleTimerComplete(int id) Minecraft *pMinecraft = Minecraft::GetInstance(); bool anyVisible = false; - if(pMinecraft->localplayers[m_iPad]!= NULL) + if(pMinecraft->localplayers[m_iPad]!= nullptr) { Gui *pGui = pMinecraft->gui; //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); @@ -859,7 +859,7 @@ void UIScene_HUD::handleGameTick() if(getMovie() && app.GetGameStarted()) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) { m_parentLayer->showComponent(m_iPad, eUIScene_HUD,false); return; diff --git a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp index 089848113..e9231fed8 100644 --- a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -8,7 +8,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, // Setup all the Iggy references we need for this scene initialiseMovie(); - m_bNotInGame=(Minecraft::GetInstance()->level==NULL); + m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); m_buttons[BUTTON_HAO_CHANGESKIN].init(IDS_CHANGE_SKIN,BUTTON_HAO_CHANGESKIN); m_buttons[BUTTON_HAO_HOWTOPLAY].init(IDS_HOW_TO_PLAY,BUTTON_HAO_HOWTOPLAY); @@ -41,7 +41,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, // 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); // any content to be re-installed? if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame) @@ -103,7 +103,7 @@ void UIScene_HelpAndOptionsMenu::updateTooltips() void UIScene_HelpAndOptionsMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -128,7 +128,7 @@ void UIScene_HelpAndOptionsMenu::handleReload() #endif // 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); // any content to be re-installed? if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame) diff --git a/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp index d651ecdb8..8c657c973 100644 --- a/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp @@ -15,7 +15,7 @@ UIScene_HopperMenu::UIScene_HopperMenu(int iPad, void *_initData, UILayer *paren m_labelDispenser.init(initData->hopper->getName()); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -156,7 +156,7 @@ void UIScene_HopperMenu::setSectionSelectedSlot(ESceneSection eSection, int x, i int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionHopperContents: @@ -177,7 +177,7 @@ void UIScene_HopperMenu::setSectionSelectedSlot(ESceneSection eSection, int x, i UIControl *UIScene_HopperMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionHopperContents: diff --git a/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp index 290085f70..c062df4ed 100644 --- a/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp @@ -18,7 +18,7 @@ UIScene_HorseInventoryMenu::UIScene_HorseInventoryMenu(int iPad, void *_initData m_horse = initData->horse; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[iPad] != NULL ) + if( pMinecraft->localgameModes[iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -240,7 +240,7 @@ void UIScene_HorseInventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionHorseArmor: @@ -268,7 +268,7 @@ void UIScene_HorseInventoryMenu::setSectionSelectedSlot(ESceneSection eSection, UIControl *UIScene_HorseInventoryMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionHorseArmor: @@ -296,7 +296,7 @@ UIControl *UIScene_HorseInventoryMenu::getSection(ESceneSection eSection) void UIScene_HorseInventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; if(wcscmp((wchar_t *)region->name,L"horse")==0) { diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp index 80492d914..728bd4c07 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp @@ -122,7 +122,7 @@ void UIScene_HowToPlayMenu::updateTooltips() void UIScene_HowToPlayMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp index 74291b1a7..dc11b524d 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp @@ -23,7 +23,7 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != NULL ) + if( player != nullptr ) { PlayerInfo *info = BuildPlayerInfo(player); @@ -36,7 +36,7 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer 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 localPlayer = pMinecraft->localplayers[m_iPad]; @@ -109,7 +109,7 @@ void UIScene_InGameInfoMenu::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)) @@ -134,7 +134,7 @@ void UIScene_InGameInfoMenu::updateTooltips() if(!m_buttonGameOptions.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; } @@ -172,7 +172,7 @@ void UIScene_InGameInfoMenu::handleReload() { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != NULL ) + if( player != nullptr ) { PlayerInfo *info = BuildPlayerInfo(player); @@ -183,7 +183,7 @@ void UIScene_InGameInfoMenu::handleReload() 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 localPlayer = pMinecraft->localplayers[m_iPad]; @@ -209,7 +209,7 @@ void UIScene_InGameInfoMenu::tick() { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if(player != NULL) + if(player != nullptr) { PlayerInfo *info = BuildPlayerInfo(player); @@ -283,7 +283,7 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr if(pressed && m_playerList.hasFocus() && (m_playerList.getItemCount() > 0) && (m_playerList.getCurrentSelection() < m_players.size()) ) { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId); - if( player != NULL ) + if( player != nullptr ) { PlayerUID uid = player->GetUID(); if( uid != INVALID_XUID ) @@ -344,7 +344,7 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; bool trust = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; - if( isOp && selectedPlayer != NULL) + if( isOp && selectedPlayer != nullptr) { bool editingHost = selectedPlayer->IsHost(); if( (cheats && (m_isHostPlayer || !editingHost ) ) || (!trust && (m_isHostPlayer || !editingHost)) @@ -473,7 +473,7 @@ UIScene_InGameInfoMenu::PlayerInfo *UIScene_InGameInfoMenu::BuildPlayerInfo(INet } int voiceStatus = 0; - if(player != NULL && player->HasVoice() ) + if(player != nullptr && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { diff --git a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index 8872b0f3a..fb570fdc4 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -24,14 +24,14 @@ UIScene_InGamePlayerOptionsMenu::UIScene_InGamePlayerOptionsMenu(int iPad, void INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); - if(editingPlayer != NULL) + if(editingPlayer != nullptr) { m_labelGamertag.init(editingPlayer->GetDisplayName()); } 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()) { @@ -241,7 +241,7 @@ void UIScene_InGamePlayerOptionsMenu::handleReload() 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()) { @@ -372,7 +372,7 @@ void UIScene_InGamePlayerOptionsMenu::handleInput(int iPad, int key, bool repeat 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()); @@ -473,9 +473,9 @@ void UIScene_InGamePlayerOptionsMenu::OnPlayerChanged(void *callbackParam, INetw UIScene_InGamePlayerOptionsMenu *scene = static_cast(callbackParam); UIScene_InGameInfoMenu *infoScene = static_cast(scene->getBackScene()); - if(infoScene != NULL) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving); + if(infoScene != nullptr) UIScene_InGameInfoMenu::OnPlayerChanged(infoScene,pPlayer,leaving); - if(leaving && pPlayer != NULL && pPlayer->GetSmallId() == scene->m_networkSmallId) + if(leaving && pPlayer != nullptr && pPlayer->GetSmallId() == scene->m_networkSmallId) { scene->m_bShouldNavBack = true; } diff --git a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp index 561899897..fb118b154 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -20,9 +20,9 @@ int UIScene_InGameSaveManagementMenu::LoadSaveDataThumbnailReturned(LPVOID lpPar } else { - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = NULL; + pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = nullptr; pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = 0; - app.DebugPrintf("Save thumbnail data is NULL, or has size 0\n"); + app.DebugPrintf("Save thumbnail data is nullptr, or has size 0\n"); } pClass->m_bSaveThumbnailReady = true; @@ -55,9 +55,9 @@ UIScene_InGameSaveManagementMenu::UIScene_InGameSaveManagementMenu(int iPad, voi m_bRetrievingSaveThumbnails = false; m_bSaveThumbnailReady = false; m_bExitScene=false; - m_pSaveDetails=NULL; + m_pSaveDetails=nullptr; m_bSavesDisplayed=false; - m_saveDetails = NULL; + m_saveDetails = nullptr; m_iSaveDetailsCount = 0; #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) @@ -198,17 +198,17 @@ void UIScene_InGameSaveManagementMenu::tick() if(!m_bSavesDisplayed) { m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails!=NULL) + if(m_pSaveDetails!=nullptr) { m_spaceIndicatorSaves.reset(); m_bSavesDisplayed=true; - if(m_saveDetails!=NULL) + if(m_saveDetails!=nullptr) { for(unsigned int i = 0; i < m_pSaveDetails->iSaveC; ++i) { - if(m_saveDetails[i].pbThumbnailData!=NULL) + if(m_saveDetails[i].pbThumbnailData!=nullptr) { delete m_saveDetails[i].pbThumbnailData; } @@ -371,9 +371,9 @@ void UIScene_InGameSaveManagementMenu::GetSaveInfo( ) m_controlSavesTimer.setVisible(true); m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails==NULL) + if(m_pSaveDetails==nullptr) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,nullptr,this,"save"); } diff --git a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp index f2bdbd177..4e217c772 100644 --- a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp @@ -26,7 +26,7 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer InventoryScreenInput *initData = static_cast(_initData); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[initData->iPad] != NULL ) + if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[initData->iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -182,7 +182,7 @@ void UIScene_InventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x int index = (y * cols) + x; - UIControl_SlotList *slotList = NULL; + UIControl_SlotList *slotList = nullptr; switch( eSection ) { case eSectionInventoryArmor: @@ -201,7 +201,7 @@ void UIScene_InventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x UIControl *UIScene_InventoryMenu::getSection(ESceneSection eSection) { - UIControl *control = NULL; + UIControl *control = nullptr; switch( eSection ) { case eSectionInventoryArmor: @@ -220,7 +220,7 @@ UIControl *UIScene_InventoryMenu::getSection(ESceneSection eSection) void UIScene_InventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; if(wcscmp((wchar_t *)region->name,L"player")==0) { @@ -253,7 +253,7 @@ void UIScene_InventoryMenu::updateEffectsDisplay() Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player == NULL) return; + if(player == nullptr) return; vector *activeEffects = player->getActiveEffects(); diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index c25a10855..8ef80b279 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -62,7 +62,7 @@ void UIScene_JoinMenu::tick() #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ ) { - if( m_selectedSession->data.players[i] != NULL ) + if( m_selectedSession->data.players[i] != nullptr ) { #ifndef _CONTENT_PACKAGE if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L< 0) + if(m_selectedSession != nullptr && getControlFocus() == eControl_GamePlayers && m_buttonListPlayers.getItemCount() > 0) { PlayerUID uid = m_selectedSession->searchResult.m_playerXuids[m_buttonListPlayers.getCurrentSelection()]; if( uid != INVALID_XUID ) ProfileManager.ShowProfileCard(ProfileManager.GetLockedProfile(),uid); @@ -473,7 +473,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) #if defined(__PS3__) || defined(__PSVITA__) if(isSignedInLive) { - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&noUGC,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&noUGC,nullptr,nullptr); } #else ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); @@ -511,7 +511,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { #if defined(__ORBIS__) || defined(__PSVITA__) bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -566,7 +566,7 @@ void UIScene_JoinMenu::handleTimerComplete(int id) 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); @@ -583,7 +583,7 @@ void UIScene_JoinMenu::handleTimerComplete(int id) } 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/UI/UIScene_Keyboard.cpp b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp index 15de62bfc..5b98f2136 100644 --- a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp @@ -17,8 +17,8 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye initialiseMovie(); #ifdef _WINDOWS64 - m_win64Callback = NULL; - m_win64CallbackParam = NULL; + m_win64Callback = nullptr; + m_win64CallbackParam = nullptr; m_win64TextBuffer = L""; m_win64MaxChars = 25; @@ -109,7 +109,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye { IggyValuePath keyPath; if (IggyValuePathMakeNameRef(&keyPath, root, s_keyNames[i])) - IggyValueSetBooleanRS(&keyPath, nameVisible, NULL, false); + IggyValueSetBooleanRS(&keyPath, nameVisible, nullptr, false); } } #endif @@ -223,33 +223,33 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, handled = true; break; case ACTION_MENU_X: // X - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcBackspaceButtonPressed, 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcBackspaceButtonPressed, 0 , nullptr ); handled = true; break; case ACTION_MENU_PAGEUP: // LT - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSymbolButtonPressed, 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSymbolButtonPressed, 0 , nullptr ); handled = true; break; case ACTION_MENU_Y: // Y - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSpaceButtonPressed, 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSpaceButtonPressed, 0 , nullptr ); handled = true; break; case ACTION_MENU_STICK_PRESS: // LS - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCapsButtonPressed, 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCapsButtonPressed, 0 , nullptr ); handled = true; break; case ACTION_MENU_LEFT_SCROLL: // LB - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCursorLeftButtonPressed, 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCursorLeftButtonPressed, 0 , nullptr ); handled = true; break; case ACTION_MENU_RIGHT_SCROLL: // RB - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCursorRightButtonPressed, 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcCursorRightButtonPressed, 0 , nullptr ); handled = true; break; case ACTION_MENU_PAUSEMENU: // Start if(!m_bKeyboardDonePressed) { - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcDoneButtonPressed, 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcDoneButtonPressed, 0 , nullptr ); // kick off done timer addTimer(KEYBOARD_DONE_TIMER_ID,KEYBOARD_DONE_TIMER_TIME); diff --git a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp index 4950f3229..d899858a8 100644 --- a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp @@ -58,7 +58,7 @@ void UIScene_LanguageSelector::updateTooltips() void UIScene_LanguageSelector::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index c48cab3ac..184a6cd0a 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -305,7 +305,7 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, m_tabIndex = m_tabIndex == 0 ? 1 : 0; updateTooltips(); IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , nullptr ); } break; } @@ -327,7 +327,7 @@ void UIScene_LaunchMoreOptionsMenu::handleTouchInput(unsigned int iPad, S32 x, S m_tabIndex = iNewTabIndex; updateTooltips(); IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , nullptr ); } ui.TouchBoxRebuild(this); break; diff --git a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp index 59268cb86..a5b8947b3 100644 --- a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -11,9 +11,9 @@ // if the value is greater than 32000, it's an xzp icon that needs displayed, rather than the game icon const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] = { - { UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, NULL }, + { UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, nullptr }, { Tile::dirt_Id, Tile::cobblestone_Id, Tile::sand_Id, Tile::stone_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id }, - { Item::egg_Id, Item::wheat_Id, Tile::mushroom_brown_Id, Tile::reeds_Id, Item::bucket_milk_Id, Tile::pumpkin_Id, NULL }, + { Item::egg_Id, Item::wheat_Id, Tile::mushroom_brown_Id, Tile::reeds_Id, Item::bucket_milk_Id, Tile::pumpkin_Id, nullptr }, { UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIE, UIControl_LeaderboardList::e_ICON_TYPE_SKELETON, UIControl_LeaderboardList::e_ICON_TYPE_CREEPER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDERJOKEY, UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIEPIGMAN, UIControl_LeaderboardList::e_ICON_TYPE_SLIME }, }; const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu::LEADERBOARD_DESCRIPTORS[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][4] = { @@ -576,7 +576,7 @@ bool UIScene_LeaderboardsMenu::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(); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index 51a3bb610..d61a79022 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -50,7 +50,7 @@ int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumb } else { - app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); + app.DebugPrintf("Thumbnail data is nullptr, or has size 0\n"); pClass->m_bThumbnailGetFailed = true; } pClass->m_bRetrievingSaveThumbnail = false; @@ -102,7 +102,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_bSaveThumbnailReady = false; m_bRetrievingSaveThumbnail = true; m_bShowTimer = false; - m_pDLCPack = NULL; + m_pDLCPack = nullptr; m_bAvailableTexturePacksChecked=false; m_bRequestQuadrantSignin = false; m_iTexturePacksNotInstalled=0; @@ -249,7 +249,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye #endif #endif #ifdef _WINDOWS64 - if (params->saveDetails != NULL && params->saveDetails->UTF8SaveName[0] != '\0') + if (params->saveDetails != nullptr && params->saveDetails->UTF8SaveName[0] != '\0') { wchar_t wSaveName[128]; ZeroMemory(wSaveName, sizeof(wSaveName)); @@ -305,7 +305,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye if(!m_bAvailableTexturePacksChecked) #endif { - 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; @@ -451,9 +451,9 @@ void UIScene_LoadMenu::tick() // #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 @@ -771,7 +771,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() // 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) { #if TO_BE_IMPLEMENTED // They've selected a texture pack they don't have yet @@ -849,7 +849,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_pDLCPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -1107,7 +1107,7 @@ void UIScene_LoadMenu::LaunchGame(void) // inform them that leaderboard writes and achievements will be disabled //ui.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) { m_bIsCorrupt = false; LoadDataComplete(this); @@ -1150,7 +1150,7 @@ void UIScene_LoadMenu::LaunchGame(void) } else { - if(m_levelGen != NULL) + if(m_levelGen != nullptr) { m_bIsCorrupt = false; LoadDataComplete(this); @@ -1210,7 +1210,7 @@ int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMes if(result==C4JStorage::EMessage_ResultAccept) { - if(pClass->m_levelGen != NULL) + if(pClass->m_levelGen != nullptr) { pClass->m_bIsCorrupt = false; pClass->LoadDataComplete(pClass); @@ -1312,7 +1312,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) #if defined(__PS3__) || defined(__PSVITA__) if(isOnlineGame) { - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,nullptr,&bContentRestricted,nullptr); } #endif @@ -1362,7 +1362,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); return 0; } @@ -1381,7 +1381,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),NULL,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),nullptr,0,false); } #endif @@ -1392,7 +1392,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) if(isOnlineGame) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); @@ -1431,7 +1431,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); return 0; } @@ -1450,7 +1450,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // UINT uiIDA[2]; // uiIDA[0]=IDS_PLAY_OFFLINE; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; -// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),NULL,0,false); +// ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),nullptr,0,false); } #endif else @@ -1554,7 +1554,7 @@ int UIScene_LoadMenu::DeleteSaveDataReturned(void *pParam,bool bSuccess) // 4J Stu - Shared functionality that is the same whether we needed a quadrant sign-in or not void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask) { - if(pClass->m_levelGen == NULL) + if(pClass->m_levelGen == nullptr) { INT saveOrCheckpointId = 0; bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); @@ -1582,7 +1582,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal NetworkGameInitData *param = new NetworkGameInitData(); param->seed = pClass->m_seed; - param->saveData = NULL; + param->saveData = nullptr; param->levelGen = pClass->m_levelGen; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; param->levelName = pClass->m_levelName; @@ -1779,7 +1779,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int if(ProfileManager.IsSignedInLive(i)) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,nullptr,nullptr); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, i ); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index ed49a701b..fc668ff2e 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -36,7 +36,7 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) if (slashPos != wstring::npos) { wstring sidecarPath = filePath.substr(0, slashPos + 1) + L"worldname.txt"; - FILE *fr = NULL; + FILE *fr = nullptr; if (_wfopen_s(&fr, sidecarPath.c_str(), L"r") == 0 && fr) { char buf[128] = {}; @@ -57,15 +57,15 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) } } - HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); if (hFile == INVALID_HANDLE_VALUE) return L""; - DWORD fileSize = GetFileSize(hFile, NULL); + DWORD fileSize = GetFileSize(hFile, nullptr); if (fileSize < 12 || fileSize == INVALID_FILE_SIZE) { CloseHandle(hFile); return L""; } unsigned char *rawData = new unsigned char[fileSize]; DWORD bytesRead = 0; - if (!ReadFile(hFile, rawData, fileSize, &bytesRead, NULL) || bytesRead != fileSize) + if (!ReadFile(hFile, rawData, fileSize, &bytesRead, nullptr) || bytesRead != fileSize) { CloseHandle(hFile); delete[] rawData; @@ -73,7 +73,7 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) } CloseHandle(hFile); - unsigned char *saveData = NULL; + unsigned char *saveData = nullptr; unsigned int saveSize = 0; bool freeSaveData = false; @@ -120,10 +120,10 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) ba.data = (byte*)(saveData + off); ba.length = len; CompoundTag *root = NbtIo::decompress(ba); - if (root != NULL) + if (root != nullptr) { CompoundTag *dataTag = root->getCompound(L"Data"); - if (dataTag != NULL) + if (dataTag != nullptr) result = dataTag->getString(L"LevelName"); delete root; } @@ -184,9 +184,9 @@ int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE p } else { - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = NULL; + pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = nullptr; pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = 0; - app.DebugPrintf("Save thumbnail data is NULL, or has size 0\n"); + app.DebugPrintf("Save thumbnail data is nullptr, or has size 0\n"); } pClass->m_bSaveThumbnailReady = true; @@ -215,7 +215,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer m_bIgnoreInput = false; m_bShowingPartyGamesOnly = false; m_bInParty = false; - m_currentSessions = NULL; + m_currentSessions = nullptr; m_iState=e_SavesIdle; //m_bRetrievingSaveInfo=false; @@ -239,9 +239,9 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer m_bRetrievingSaveThumbnails = false; m_bSaveThumbnailReady = false; m_bExitScene=false; - m_pSaveDetails=NULL; + m_pSaveDetails=nullptr; m_bSavesDisplayed=false; - m_saveDetails = NULL; + m_saveDetails = nullptr; m_iSaveDetailsCount = 0; m_iTexturePacksNotInstalled = 0; m_bCopying = false; @@ -320,7 +320,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer #ifdef _XBOX // 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; @@ -399,11 +399,11 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer UIScene_LoadOrJoinMenu::~UIScene_LoadOrJoinMenu() { - g_NetworkManager.SetSessionsUpdatedCallback( NULL, NULL ); + g_NetworkManager.SetSessionsUpdatedCallback( nullptr, nullptr ); app.SetLiveLinkRequired( false ); delete m_currentSessions; - m_currentSessions = NULL; + m_currentSessions = nullptr; #if TO_BE_IMPLEMENTED // Reset the background downloading, in case we changed it by attempting to download a texture pack @@ -705,7 +705,7 @@ void UIScene_LoadOrJoinMenu::tick() if(!m_bSavesDisplayed) { m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails!=NULL) + if(m_pSaveDetails!=nullptr) { //CD - Fix - Adding define for ORBIS/XBOXONE #if defined(_XBOX_ONE) || defined(__ORBIS__) @@ -716,11 +716,11 @@ void UIScene_LoadOrJoinMenu::tick() m_bSavesDisplayed=true; UpdateGamesList(); - if(m_saveDetails!=NULL) + if(m_saveDetails!=nullptr) { for(unsigned int i = 0; i < m_iSaveDetailsCount; ++i) { - if(m_saveDetails[i].pbThumbnailData!=NULL) + if(m_saveDetails[i].pbThumbnailData!=nullptr) { delete m_saveDetails[i].pbThumbnailData; } @@ -1000,9 +1000,9 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() #ifdef __ORBIS__ // We need to make sure this is non-null so that we have an idea of free space m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails==NULL) + if(m_pSaveDetails==nullptr) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,nullptr,this,"save"); } #endif @@ -1049,9 +1049,9 @@ void UIScene_LoadOrJoinMenu::GetSaveInfo() m_controlSavesTimer.setVisible(true); m_pSaveDetails=StorageManager.ReturnSavesInfo(); - if(m_pSaveDetails==NULL) + if(m_pSaveDetails==nullptr) { - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,NULL,this,"save"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(m_iPad,nullptr,this,"save"); } #if TO_BE_IMPLEMENTED @@ -1389,7 +1389,7 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo mbstowcs(wFilename, pClass->m_saveDetails[listPos].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); wstring sidecarPath = wstring(L"Windows64\\GameHDD\\") + wstring(wFilename) + wstring(L"\\worldname.txt"); - FILE *fw = NULL; + FILE *fw = nullptr; if (_wfopen_s(&fw, sidecarPath.c_str(), L"w") == 0 && fw) { fputs(narrowName, fw); @@ -1497,7 +1497,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) params->iSaveGameInfoIndex=-1; //params->pbSaveRenamed=&m_bSaveRenamed; params->levelGen = levelGen; - params->saveDetails = NULL; + params->saveDetails = nullptr; // navigate to the settings scene ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_LoadMenu, params); @@ -1508,7 +1508,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) #ifdef __ORBIS__ // check if this is a damaged save PSAVE_INFO pSaveInfo = &m_pSaveDetails->SaveInfoA[((int)childId)-m_iDefaultButtonsC]; - if(pSaveInfo->thumbnailData == NULL && pSaveInfo->modifiedTime == 0) // no thumbnail data and time of zero and zero blocks useset for corrupt files + if(pSaveInfo->thumbnailData == nullptr && pSaveInfo->modifiedTime == 0) // no thumbnail data and time of zero and zero blocks useset for corrupt files { // give the option to delete the save UINT uiIDA[2]; @@ -1533,7 +1533,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) // 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_saveDetails[static_cast(childId)-m_iDefaultButtonsC].saveId; //params->pbSaveRenamed=&m_bSaveRenamed; - params->levelGen = NULL; + params->levelGen = nullptr; params->saveDetails = &m_saveDetails[ static_cast(childId)-m_iDefaultButtonsC ]; #ifdef _XBOX_ONE @@ -1588,7 +1588,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) bool bContentRestricted=false; // we're online, since we are joining a game - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&noUGC,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&noUGC,&bContentRestricted,nullptr); #ifdef __ORBIS__ // 4J Stu - On PS4 we don't restrict playing multiplayer based on chat restriction, so remove this check @@ -1632,7 +1632,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; // Not allowed to play online - ui.RequestAlertMessage(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad,NULL,this); + ui.RequestAlertMessage(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad,nullptr,this); #else // Not allowed to play online ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, 0 ); @@ -1677,7 +1677,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL); + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); return; } @@ -1697,7 +1697,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) // UINT uiIDA[2]; // uiIDA[0]=IDS_CONFIRM_OK; // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; - // ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::PSPlusReturned,this, app.GetStringTable(),NULL,0,false); + // ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); m_bIgnoreInput=false; return; @@ -1799,7 +1799,7 @@ void UIScene_LoadOrJoinMenu::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; @@ -1832,7 +1832,7 @@ void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) void UIScene_LoadOrJoinMenu::UpdateGamesListCallback(LPVOID pParam) { - if(pParam != NULL) + if(pParam != nullptr) { UIScene_LoadOrJoinMenu *pScene = static_cast(pParam); pScene->UpdateGamesList(); @@ -1854,7 +1854,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() } - FriendSessionInfo *pSelectedSession = NULL; + FriendSessionInfo *pSelectedSession = nullptr; if(DoesGamesListHaveFocus() && m_buttonListGames.getItemCount() > 0) { unsigned int nIndex = m_buttonListGames.getCurrentSelection(); @@ -1863,8 +1863,8 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() SessionID selectedSessionId; ZeroMemory(&selectedSessionId,sizeof(SessionID)); - if( pSelectedSession != NULL )selectedSessionId = pSelectedSession->sessionId; - pSelectedSession = NULL; + if( pSelectedSession != nullptr )selectedSessionId = pSelectedSession->sessionId; + pSelectedSession = nullptr; m_controlJoinTimer.setVisible( false ); @@ -1930,12 +1930,12 @@ void UIScene_LoadOrJoinMenu::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 ? @@ -2136,7 +2136,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform save __int64 fileSize = saveFile->length(); FileInputStream fis(*saveFile); - byteArray ba(fileSize); + byteArray ba(static_cast(fileSize)); fis.read(ba); fis.close(); @@ -2298,7 +2298,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt if (pClass->m_saveDetails && displayIdx >= 0 && pClass->m_saveDetails[displayIdx].UTF8SaveFilename[0]) { wchar_t wFilename[MAX_SAVEFILENAME_LENGTH] = {}; - mbstowcs_s(NULL, wFilename, MAX_SAVEFILENAME_LENGTH, pClass->m_saveDetails[displayIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); + mbstowcs_s(nullptr, wFilename, MAX_SAVEFILENAME_LENGTH, pClass->m_saveDetails[displayIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); wchar_t wFolderPath[MAX_PATH] = {}; swprintf_s(wFolderPath, MAX_PATH, L"Windows64\\GameHDD\\%s", wFilename); bSuccess = Win64_DeleteSaveDirectory(wFolderPath); @@ -2387,7 +2387,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS { wchar_t wSaveName[128]; ZeroMemory(wSaveName, 128 * sizeof(wchar_t)); - mbstowcs_s(NULL, wSaveName, 128, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, _TRUNCATE); + mbstowcs_s(nullptr, wSaveName, 128, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, _TRUNCATE); UIKeyboardInitData kbData; kbData.title = app.GetString(IDS_RENAME_WORLD_TITLE); kbData.defaultText = wSaveName; @@ -2504,7 +2504,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon if(bContinue==true) { SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - if(pSONYDLCInfo!=NULL) + if(pSONYDLCInfo!=nullptr) { char chName[42]; char chKeyName[20]; @@ -2513,7 +2513,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bCon 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 + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -2567,7 +2567,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS #endif SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - if(pSONYDLCInfo!=NULL) + if(pSONYDLCInfo!=nullptr) { char chName[42]; char chKeyName[20]; @@ -2576,7 +2576,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS 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 + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -2610,7 +2610,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS wstring ProductId; app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId,ProductId); - StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),NULL,NULL); + StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),nullptr,nullptr); } else { @@ -2802,7 +2802,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter pMinecraft->progressRenderer->progressStart(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD); pMinecraft->progressRenderer->progressStage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD ); - ConsoleSaveFile* pSave = NULL; + ConsoleSaveFile* pSave = nullptr; pClass->m_eSaveTransferState = eSaveTransfer_GetRemoteSaveInfo; @@ -2857,10 +2857,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8)+1); // plus null StorageManager.SetSaveTitle(wSaveName); - PBYTE pbThumbnailData=NULL; + PBYTE pbThumbnailData=nullptr; DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=NULL; + PBYTE pbDataSaveImage=nullptr; DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t @@ -3021,10 +3021,10 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter StorageManager.ResetSaveData(); { - PBYTE pbThumbnailData=NULL; + PBYTE pbThumbnailData=nullptr; DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=NULL; + PBYTE pbDataSaveImage=nullptr; DWORD dwDataSizeSaveImage=0; StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t @@ -3232,7 +3232,7 @@ void UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam, SonyRemoteStor } ConsoleSaveFile* UIScene_LoadOrJoinMenu::SonyCrossSaveConvert() { - return NULL; + return nullptr; } void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) @@ -3455,7 +3455,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) SaveTransferStateContainer *pStateContainer = (SaveTransferStateContainer *) lpParameter; Minecraft *pMinecraft=Minecraft::GetInstance(); - ConsoleSaveFile* pSave = NULL; + ConsoleSaveFile* pSave = nullptr; while(StorageManager.SaveTransferClearState()!=C4JStorage::eSaveTransfer_Idle) { @@ -3557,7 +3557,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, seedVal, true, uiHostOptions, dwTexturePack); // set the icon and save image - StorageManager.SetSaveImages(ba.data, ba.length, NULL, 0, bTextMetadata, iTextMetadataBytes); + StorageManager.SetSaveImages(ba.data, ba.length, nullptr, 0, bTextMetadata, iTextMetadataBytes); delete ba.data; } @@ -3720,12 +3720,12 @@ void UIScene_LoadOrJoinMenu::RequestFileData( SaveTransferStateContainer *pClass File targetFile( wstring(L"FakeTMSPP\\").append(filename) ); if(targetFile.exists()) { - HANDLE hSaveFile = CreateFile( targetFile.getPath().c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, NULL); + HANDLE hSaveFile = CreateFile( targetFile.getPath().c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, nullptr); m_debugTransferDetails.pbData = new BYTE[m_debugTransferDetails.ulFileLen]; DWORD numberOfBytesRead = 0; - ReadFile( hSaveFile,m_debugTransferDetails.pbData,m_debugTransferDetails.ulFileLen,&numberOfBytesRead,NULL); + ReadFile( hSaveFile,m_debugTransferDetails.pbData,m_debugTransferDetails.ulFileLen,&numberOfBytesRead,nullptr); assert(numberOfBytesRead == m_debugTransferDetails.ulFileLen); CloseHandle(hSaveFile); @@ -3753,7 +3753,7 @@ int UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVE app.DebugPrintf("Save Transfer - size is %d\n",pSaveTransferDetails->ulFileLen); // if the file data is null, then assume this is the file size retrieval - if(pSaveTransferDetails->pbData==NULL) + if(pSaveTransferDetails->pbData==nullptr) { pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_FileSizeRetrieved; UIScene_LoadOrJoinMenu::s_ulFileSize=pSaveTransferDetails->ulFileLen; diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index d8d6d66ae..a1cbc1449 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -104,7 +104,7 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLaye m_bLoadTrialOnNetworkManagerReady = false; // 4J Stu - Clear out any loaded game rules - app.setLevelGenerationOptions(NULL); + app.setLevelGenerationOptions(nullptr); // 4J Stu - Reset the leaving game flag so that we correctly handle signouts while in the menus g_NetworkManager.ResetLeavingGame(); @@ -303,9 +303,9 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) int primaryPad = ProfileManager.GetPrimaryPad(); #ifdef _XBOX_ONE - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad, const int iController) = NULL; + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad, const int iController) = nullptr; #else - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = nullptr; #endif switch(static_cast(controlId)) @@ -396,7 +396,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) bool confirmUser = false; // Note: if no sign in returned func, assume this isn't required - if (signInReturnedFunc != NULL) + if (signInReturnedFunc != nullptr) { if(ProfileManager.IsSignedIn(primaryPad)) { @@ -940,7 +940,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in { bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); #endif if(bContentRestricted) { @@ -1098,7 +1098,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = nullptr; // 4J-PB - Check if there is a patch for the game pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); @@ -1141,7 +1141,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * // UINT uiIDA[1]; // uiIDA[0]=IDS_OK; -// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,pClass); +// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,nullptr,pClass); } // Check if PSN is unavailable because of age restriction @@ -1157,7 +1157,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * bool confirmUser = false; // Note: if no sign in returned func, assume this isn't required - if (signInReturnedFunc != NULL) + if (signInReturnedFunc != nullptr) { if(ProfileManager.IsSignedIn(primaryPad)) { @@ -1187,7 +1187,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = nullptr; // 4J-PB - Check if there is a patch for the game pClass->m_errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); @@ -1228,7 +1228,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo // UINT uiIDA[1]; // uiIDA[0]=IDS_OK; -// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,pClass); +// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,nullptr,pClass); } bool confirmUser = false; @@ -1247,7 +1247,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo } // Note: if no sign in returned func, assume this isn't required - if (signInReturnedFunc != NULL) + if (signInReturnedFunc != nullptr) { if(ProfileManager.IsSignedIn(primaryPad)) { @@ -1600,7 +1600,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); #endif if(bContentRestricted) { @@ -1608,7 +1608,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) // you can't see leaderboards UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),nullptr,this); #endif } else @@ -1669,7 +1669,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) // UINT uiIDA[1]; // uiIDA[0]=IDS_OK; -// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,NULL,this); +// ui.RequestMessageBox(IDS_PATCH_AVAILABLE_TITLE, IDS_PATCH_AVAILABLE_TEXT, uiIDA, 1, XUSER_INDEX_ANY,nullptr,this); return; } @@ -1704,7 +1704,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) { bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); #endif if(bContentRestricted) { @@ -1713,7 +1713,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) // you can't see the store UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),nullptr,this); #endif } else @@ -1925,7 +1925,7 @@ void UIScene_MainMenu::tick() // 4J-PB - need to check this user can access the store bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -2102,7 +2102,7 @@ void UIScene_MainMenu::LoadTrial(void) NetworkGameInitData *param = new NetworkGameInitData(); param->seed = 0; - param->saveData = NULL; + param->saveData = nullptr; param->settings = app.GetGameHostOption( eGameHostOption_Tutorial ) | app.GetGameHostOption(eGameHostOption_DisableSaving); vector *generators = app.getLevelGenerators(); diff --git a/Minecraft.Client/Common/UI/UIScene_MessageBox.cpp b/Minecraft.Client/Common/UI/UIScene_MessageBox.cpp index 52a878e8b..7a0749d4a 100644 --- a/Minecraft.Client/Common/UI/UIScene_MessageBox.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MessageBox.cpp @@ -41,7 +41,7 @@ UIScene_MessageBox::UIScene_MessageBox(int iPad, void *initData, UILayer *parent m_labelTitle.init(app.GetString(param->uiTitle)); m_labelContent.init(app.GetString(param->uiText)); - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , nullptr ); m_Func = param->Func; m_lpParam = param->lpParam; @@ -87,7 +87,7 @@ void UIScene_MessageBox::handleReload() value[1].number = static_cast(getControlFocus()); IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcInit , 2 , value ); - out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , NULL ); + out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , nullptr ); } void UIScene_MessageBox::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index 772971370..7cec38b3c 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -101,7 +101,7 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa TelemetryManager->RecordPauseOrInactive(m_iPad); Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) + if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); @@ -114,7 +114,7 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa UIScene_PauseMenu::~UIScene_PauseMenu() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) + if(pMinecraft != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); @@ -593,7 +593,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(m_iPad,true,nullptr,&bContentRestricted,nullptr); #endif if(bContentRestricted) { @@ -654,7 +654,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) if(m_iPad==ProfileManager.GetPrimaryPad()) { int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != NULL ) + if( pMinecraft->localplayers[m_iPad] != nullptr ) { playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); } @@ -723,7 +723,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) else { int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != NULL ) + if( pMinecraft->localplayers[m_iPad] != nullptr ) { playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); } @@ -741,7 +741,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) if(m_iPad==ProfileManager.GetPrimaryPad()) { int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != NULL ) + if( pMinecraft->localplayers[m_iPad] != nullptr ) { playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); } @@ -759,7 +759,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) else { int playTime = -1; - if( pMinecraft->localplayers[m_iPad] != NULL ) + if( pMinecraft->localplayers[m_iPad] != nullptr ) { playTime = static_cast(pMinecraft->localplayers[m_iPad]->getSessionTimer()); } @@ -979,7 +979,7 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage:: // 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]; @@ -1112,7 +1112,7 @@ int UIScene_PauseMenu::ViewLeaderboards_SignInReturned(void *pParam,bool bContin { #ifndef __ORBIS__ bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(pClass->m_iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(pClass->m_iPad,true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { // you can't see leaderboards @@ -1183,7 +1183,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J #ifndef __ORBIS__ // 4J-PB - need to check this user can access the store bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -1203,7 +1203,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J app.DebugPrintf("Texture Pack - %s\n",pchPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if(pSONYDLCInfo!=NULL) + if(pSONYDLCInfo!=nullptr) { char chName[42]; char chKeyName[20]; @@ -1214,7 +1214,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J // 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 + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -1260,7 +1260,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue #ifndef __ORBIS__ // 4J-PB - need to check this user can access the store bool bContentRestricted=false; - ProfileManager.GetChatAndContentRestrictions(iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); if(bContentRestricted) { UINT uiIDA[1]; @@ -1280,7 +1280,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue app.DebugPrintf("Texture Pack - %s\n",pchPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if(pSONYDLCInfo!=NULL) + if(pSONYDLCInfo!=nullptr) { char chName[42]; char chKeyName[20]; @@ -1291,7 +1291,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue // 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 + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); diff --git a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp index 445c6ffcd..766765614 100644 --- a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp @@ -274,7 +274,7 @@ int UIScene_QuadrantSignin::AvatarReturned(LPVOID lpParam,PBYTE pbThumbnail,DWOR { UIScene_QuadrantSignin *pClass = static_cast(lpParam); app.DebugPrintf(app.USER_SR,"AvatarReturned callback\n"); - if(pbThumbnail != NULL) + if(pbThumbnail != nullptr) { // 4J-JEV - Added to ensure each new texture gets a unique name. static unsigned int quadrantImageCount = 0; diff --git a/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp index 3b67f79e7..c713a3900 100644 --- a/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp @@ -36,7 +36,7 @@ void UIScene_ReinstallMenu::updateTooltips() void UIScene_ReinstallMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp index 98bcab7e0..0b8e0ca4a 100644 --- a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp @@ -19,7 +19,7 @@ UIScene_SaveMessage::UIScene_SaveMessage(int iPad, void *initData, UILayer *pare IggyDataValue result; // Russian needs to resize the box - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , NULL ); + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAutoResize , 0 , nullptr ); // 4J-PB - If we have a signed in user connected, let's get the DLC now for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp index c1b38fa04..083fbd358 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp @@ -47,7 +47,7 @@ void UIScene_SettingsAudioMenu::updateTooltips() void UIScene_SettingsAudioMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp index 3a81775dc..7dbd243b7 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsControlMenu.cpp @@ -47,7 +47,7 @@ void UIScene_SettingsControlMenu::updateTooltips() void UIScene_SettingsControlMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index be92bd62d..cf4f5bb50 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -37,7 +37,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD initialiseMovie(); Minecraft* pMinecraft = Minecraft::GetInstance(); - m_bNotInGame=(Minecraft::GetInstance()->level==NULL); + m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); m_checkboxClouds.init(app.GetString(IDS_CHECKBOX_RENDER_CLOUDS),eControl_Clouds,(app.GetGameSettings(m_iPad,eGameSetting_Clouds)!=0)); m_checkboxBedrockFog.init(app.GetString(IDS_CHECKBOX_RENDER_BEDROCKFOG),eControl_BedrockFog,(app.GetGameSettings(m_iPad,eGameSetting_BedrockFog)!=0)); @@ -58,7 +58,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD doHorizontalResizeCheck(); - bool bInGame=(Minecraft::GetInstance()->level!=NULL); + bool bInGame=(Minecraft::GetInstance()->level!=nullptr); bool bIsPrimaryPad=(ProfileManager.GetPrimaryPad()==m_iPad); // if we're not in the game, we need to use basescene 0 if(bInGame) @@ -113,7 +113,7 @@ void UIScene_SettingsGraphicsMenu::updateTooltips() void UIScene_SettingsGraphicsMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp index 4f15d1081..2ae9c897d 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp @@ -8,7 +8,7 @@ UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void *initData, UILayer *pa // Setup all the Iggy references we need for this scene initialiseMovie(); - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); m_buttons[BUTTON_ALL_OPTIONS].init(IDS_OPTIONS,BUTTON_ALL_OPTIONS); m_buttons[BUTTON_ALL_AUDIO].init(IDS_AUDIO,BUTTON_ALL_AUDIO); @@ -51,7 +51,7 @@ wstring UIScene_SettingsMenu::getMoviePath() void UIScene_SettingsMenu::handleReload() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(ProfileManager.GetPrimaryPad()!=m_iPad) { removeControl( &m_buttons[BUTTON_ALL_AUDIO], bNotInGame); @@ -68,7 +68,7 @@ void UIScene_SettingsMenu::updateTooltips() void UIScene_SettingsMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp index 6780e05bc..7b4d3d9dd 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -29,7 +29,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat // Setup all the Iggy references we need for this scene initialiseMovie(); - m_bNotInGame=(Minecraft::GetInstance()->level==NULL); + m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); m_checkboxViewBob.init(IDS_VIEW_BOBBING,eControl_ViewBob,(app.GetGameSettings(m_iPad,eGameSetting_ViewBob)!=0)); m_checkboxShowHints.init(IDS_HINTS,eControl_ShowHints,(app.GetGameSettings(m_iPad,eGameSetting_Hints)!=0)); @@ -99,7 +99,7 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat bool bRemoveAutosave=false; bool bRemoveInGameGamertags=false; - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; if(!bPrimaryPlayer) { @@ -196,7 +196,7 @@ void UIScene_SettingsOptionsMenu::updateTooltips() void UIScene_SettingsOptionsMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); @@ -324,7 +324,7 @@ void UIScene_SettingsOptionsMenu::handleReload() bool bRemoveAutosave=false; bool bRemoveInGameGamertags=false; - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; if(!bPrimaryPlayer) { diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp index 5a515c4b3..873564f62 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp @@ -7,7 +7,7 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer // Setup all the Iggy references we need for this scene initialiseMovie(); - m_bNotInGame=(Minecraft::GetInstance()->level==NULL); + m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); m_checkboxDisplayHUD.init(app.GetString(IDS_CHECKBOX_DISPLAY_HUD),eControl_DisplayHUD,(app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)!=0)); m_checkboxDisplayHand.init(app.GetString(IDS_CHECKBOX_DISPLAY_HAND),eControl_DisplayHand,(app.GetGameSettings(m_iPad,eGameSetting_DisplayHand)!=0)); @@ -26,7 +26,7 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer doHorizontalResizeCheck(); - bool bInGame=(Minecraft::GetInstance()->level!=NULL); + bool bInGame=(Minecraft::GetInstance()->level!=nullptr); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; // if we're not in the game, we need to use basescene 0 @@ -57,7 +57,7 @@ void UIScene_SettingsUIMenu::updateTooltips() void UIScene_SettingsUIMenu::updateComponents() { - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); diff --git a/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp index 74e7e2dcb..679daff1e 100644 --- a/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp @@ -95,7 +95,7 @@ void UIScene_SignEntryMenu::tick() if (pMinecraft->level->isClientSide) { shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player != NULL && player->connection && player->connection->isStarted()) + if(player != nullptr && player->connection && player->connection->isStarted()) { player->connection->send( shared_ptr( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) ); } diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 168c96b64..20a741236 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -40,7 +40,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer m_bIgnoreInput=false; m_bNoSkinsToShow = false; - m_currentPack = NULL; + m_currentPack = nullptr; m_packIndex = SKIN_SELECT_PACK_DEFAULT; m_skinIndex = 0; @@ -48,7 +48,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer m_currentSkinPath = app.GetPlayerSkinName(iPad); m_selectedSkinPath = L""; m_selectedCapePath = L""; - m_vAdditionalSkinBoxes = NULL; + m_vAdditionalSkinBoxes = nullptr; m_bSlidingSkins = false; m_bAnimatingMove = false; @@ -107,7 +107,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer // 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; } @@ -436,7 +436,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) } break; default: - if( m_currentPack != NULL ) + if( m_currentPack != nullptr ) { bool renableInputAfterOperation = true; m_bIgnoreInput = true; @@ -520,7 +520,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_currentPack->getPurchaseOfferId()); ULONGLONG ullOfferID_Full; - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { ullOfferID_Full=pDLCInfo->ullOfferID_Full; } @@ -534,7 +534,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) #endif bool bContentRestricted=false; #if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,NULL,&bContentRestricted,NULL); + ProfileManager.GetChatAndContentRestrictions(m_iPad,true,nullptr,&bContentRestricted,nullptr); #endif if(bContentRestricted) { @@ -635,8 +635,8 @@ void UIScene_SkinSelectMenu::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; m_bNoSkinsToShow=false; @@ -646,7 +646,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() m_controlSkinNamePlate.setVisible( false ); - if( m_currentPack != NULL ) + if( m_currentPack != nullptr ) { skinFile = m_currentPack->getSkinFile(m_skinIndex); m_selectedSkinPath = skinFile->getPath(); @@ -673,7 +673,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { m_selectedSkinPath = L""; m_selectedCapePath = L""; - m_vAdditionalSkinBoxes = NULL; + m_vAdditionalSkinBoxes = nullptr; switch(m_packIndex) { @@ -758,13 +758,13 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() // add the boxes to the humanoid model, but only if we've not done this already vector *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()); } @@ -779,7 +779,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() wstring otherSkinPath = L""; wstring otherCapePath = L""; - vector *othervAdditionalSkinBoxes=NULL; + vector *othervAdditionalSkinBoxes=nullptr; wchar_t chars[256]; // turn off all displays @@ -824,11 +824,11 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { if(showNext) { - skinFile=NULL; + skinFile=nullptr; m_characters[eCharacter_Next1 + i].setVisible(true); - if( m_currentPack != NULL ) + if( m_currentPack != nullptr ) { skinFile = m_currentPack->getSkinFile(nextIndex); otherSkinPath = skinFile->getPath(); @@ -840,7 +840,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { otherSkinPath = L""; otherCapePath = L""; - othervAdditionalSkinBoxes=NULL; + othervAdditionalSkinBoxes=nullptr; switch(m_packIndex) { case SKIN_SELECT_PACK_DEFAULT: @@ -872,13 +872,13 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { vector *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()); } @@ -895,11 +895,11 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { if(showPrevious) { - skinFile=NULL; + skinFile=nullptr; m_characters[eCharacter_Previous1 + i].setVisible(true); - if( m_currentPack != NULL ) + if( m_currentPack != nullptr ) { skinFile = m_currentPack->getSkinFile(previousIndex); otherSkinPath = skinFile->getPath(); @@ -911,7 +911,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() { otherSkinPath = L""; otherCapePath = L""; - othervAdditionalSkinBoxes=NULL; + othervAdditionalSkinBoxes=nullptr; switch(m_packIndex) { case SKIN_SELECT_PACK_DEFAULT: @@ -943,7 +943,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() if(othervAdditionalSkinBoxes && othervAdditionalSkinBoxes->size()!=0) { vector *pAdditionalModelParts = app.GetAdditionalModelParts(skinFile->getSkinID()); - if(pAdditionalModelParts==NULL) + if(pAdditionalModelParts==nullptr) { pAdditionalModelParts = app.SetAdditionalSkinBoxes(skinFile->getSkinID(),othervAdditionalSkinBoxes); } @@ -1021,7 +1021,7 @@ int UIScene_SkinSelectMenu::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; } @@ -1055,7 +1055,7 @@ int UIScene_SkinSelectMenu::getPreviousSkinIndex(DWORD sourceIndex) { previousSkin = eDefaultSkins_Count - 1; } - else if(m_currentPack != NULL) + else if(m_currentPack != nullptr) { previousSkin = m_currentPack->getSkinCount()-1; } @@ -1079,10 +1079,10 @@ void UIScene_SkinSelectMenu::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); @@ -1130,7 +1130,7 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() std::wstring fakeWideToRealWide(const wchar_t* original) { const char* name = reinterpret_cast(original); - int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0); + int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, nullptr, 0); std::wstring wName(len, 0); MultiByteToWideChar(CP_UTF8, 0, name, -1, &wName[0], len); return wName.c_str(); @@ -1500,7 +1500,7 @@ void UIScene_SkinSelectMenu::HandleDLCMountingComplete() 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; @@ -1520,7 +1520,7 @@ void UIScene_SkinSelectMenu::HandleDLCMountingComplete() m_bIgnoreInput=false; app.m_dlcManager.checkForCorruptDLCAndAlert(); - bool bInGame=(Minecraft::GetInstance()->level!=NULL); + bool bInGame=(Minecraft::GetInstance()->level!=nullptr); #if TO_BE_IMPLEMENTED if(bInGame) XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); @@ -1534,7 +1534,7 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) { // need to be signed in to live. get them to sign in to online #if defined(__PS3__) - SQRNetworkManager_PS3::AttemptPSNSignIn(NULL, this); + SQRNetworkManager_PS3::AttemptPSNSignIn(nullptr, this); #elif defined(__PSVITA__) if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) @@ -1543,15 +1543,15 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) UINT uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_CANCEL; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_SkinSelectMenu::MustSignInReturned,NULL); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_SkinSelectMenu::MustSignInReturned,nullptr); } else { - SQRNetworkManager_Vita::AttemptPSNSignIn(NULL, this); + SQRNetworkManager_Vita::AttemptPSNSignIn(nullptr, this); } #elif defined(__ORBIS__) - SQRNetworkManager_Orbis::AttemptPSNSignIn(NULL, this, false, iPad); + SQRNetworkManager_Orbis::AttemptPSNSignIn(nullptr, this, false, iPad); #elif defined(_DURANGO) @@ -1579,7 +1579,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: const char *pchPackName=wstringtofilename(wStrPackName); SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo((char *)pchPackName); - if (pSONYDLCInfo != NULL) + if (pSONYDLCInfo != nullptr) { char chName[42]; char chKeyName[20]; @@ -1593,7 +1593,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: // while the store is screwed, hardcode the sku //sprintf(chName,"%s-%s-%s",app.GetCommerceCategory(),pSONYDLCInfo->chDLCKeyname,"EURO"); - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char memset(chKeyName, 0, sizeof(chKeyName)); strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); @@ -1623,7 +1623,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: // need to re-enable input because the user can back out of the store purchase, and we'll be stuck pScene->m_bIgnoreInput = false; // MGH - moved this to outside the pSONYDLCInfo, so we don't get stuck #elif defined _XBOX_ONE - StorageManager.InstallOffer(1,(WCHAR *)(pScene->m_currentPack->getPurchaseOfferId().c_str()), &RenableInput, pScene, NULL); + StorageManager.InstallOffer(1,(WCHAR *)(pScene->m_currentPack->getPurchaseOfferId().c_str()), &RenableInput, pScene, nullptr); #endif } else // Is signed in, but not live. diff --git a/Minecraft.Client/Common/UI/UIScene_TeleportMenu.cpp b/Minecraft.Client/Common/UI/UIScene_TeleportMenu.cpp index 5d49196c9..017af93ef 100644 --- a/Minecraft.Client/Common/UI/UIScene_TeleportMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TeleportMenu.cpp @@ -41,7 +41,7 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa { 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; @@ -59,7 +59,7 @@ UIScene_TeleportMenu::UIScene_TeleportMenu(int iPad, void *initData, UILayer *pa } int voiceStatus = 0; - if(player != NULL && player->HasVoice() ) + if(player != nullptr && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { @@ -131,7 +131,7 @@ void UIScene_TeleportMenu::handleReload() { 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; @@ -149,7 +149,7 @@ void UIScene_TeleportMenu::handleReload() } int voiceStatus = 0; - if(player != NULL && player->HasVoice() ) + if(player != nullptr && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { @@ -189,7 +189,7 @@ void UIScene_TeleportMenu::tick() { INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId( m_players[i] ); - if( player != NULL ) + if( player != nullptr ) { m_players[i] = player->GetSmallId(); @@ -320,7 +320,7 @@ void UIScene_TeleportMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer * } int voiceStatus = 0; - if(pPlayer != NULL && pPlayer->HasVoice() ) + if(pPlayer != nullptr && pPlayer->HasVoice() ) { if( pPlayer->IsMutedByLocalUser(scene->m_iPad) ) { diff --git a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp index d806c49ff..bb9e30af4 100644 --- a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp @@ -29,7 +29,7 @@ UIScene_TradingMenu::UIScene_TradingMenu(int iPad, void *_initData, UILayer *par m_merchant = initData->trader; Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[iPad] != NULL ) + if( pMinecraft->localgameModes[iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -87,15 +87,15 @@ void UIScene_TradingMenu::handleDestroy() { app.DebugPrintf("UIScene_TradingMenu::handleDestroy\n"); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != NULL ) + if( pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + 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(pMinecraft->localplayers[m_iPad] != NULL) pMinecraft->localplayers[m_iPad]->closeContainer(); + if(pMinecraft->localplayers[m_iPad] != nullptr) pMinecraft->localplayers[m_iPad]->closeContainer(); ui.OverrideSFX(m_iPad,ACTION_MENU_A,false); ui.OverrideSFX(m_iPad,ACTION_MENU_OK,false); @@ -155,7 +155,7 @@ void UIScene_TradingMenu::handleInput(int iPad, int key, bool repeat, bool press void UIScene_TradingMenu::customDraw(IggyCustomDrawCallbackRegion *region) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; shared_ptr item = nullptr; int slotId = -1; @@ -190,7 +190,7 @@ void UIScene_TradingMenu::customDraw(IggyCustomDrawCallbackRegion *region) }; } } - if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true); + if(item != nullptr) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true); } void UIScene_TradingMenu::showScrollRightArrow(bool show) diff --git a/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp b/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp index 9ef8f189a..9338daba7 100644 --- a/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp @@ -50,7 +50,7 @@ void UIScene_TrialExitUpsell::handleInput(int iPad, int key, bool repeat, bool p // 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]; diff --git a/Minecraft.Client/Common/UI/UIString.cpp b/Minecraft.Client/Common/UI/UIString.cpp index 288fa87a9..04d8b8e37 100644 --- a/Minecraft.Client/Common/UI/UIString.cpp +++ b/Minecraft.Client/Common/UI/UIString.cpp @@ -139,7 +139,7 @@ UIString::~UIString() bool UIString::empty() { - return m_core.get() == NULL; + return m_core.get() == nullptr; } bool UIString::compare(const UIString &uiString) @@ -149,19 +149,19 @@ bool UIString::compare(const UIString &uiString) bool UIString::needsUpdating() { - if (m_core != NULL) return m_core->needsUpdating(); + if (m_core != nullptr) return m_core->needsUpdating(); else return false; } void UIString::setUpdated() { - if (m_core != NULL) m_core->setUpdated(); + if (m_core != nullptr) m_core->setUpdated(); } wstring &UIString::getString() { static wstring blank(L""); - if (m_core != NULL) return m_core->getString(); + if (m_core != nullptr) return m_core->getString(); else return blank; } diff --git a/Minecraft.Client/Common/UI/UIStructs.h b/Minecraft.Client/Common/UI/UIStructs.h index ac83458fc..e5f5a8333 100644 --- a/Minecraft.Client/Common/UI/UIStructs.h +++ b/Minecraft.Client/Common/UI/UIStructs.h @@ -196,8 +196,8 @@ typedef struct _ConnectionProgressParams showTooltips = false; setFailTimer = false; timerTime = 0; - cancelFunc = NULL; - cancelFuncParam = NULL; + cancelFunc = nullptr; + cancelFuncParam = nullptr; } } ConnectionProgressParams; @@ -250,7 +250,7 @@ typedef struct _SaveListDetails _SaveListDetails() { saveId = 0; - pbThumbnailData = NULL; + pbThumbnailData = nullptr; dwThumbnailSize = 0; #ifdef _DURANGO ZeroMemory(UTF16SaveName,sizeof(wchar_t)*128); @@ -403,15 +403,15 @@ typedef struct _LoadingInputParams _LoadingInputParams() { - func = NULL; - lpParam = NULL; - completionData = NULL; + func = nullptr; + lpParam = nullptr; + completionData = nullptr; cancelText = -1; - cancelFunc = NULL; - completeFunc = NULL; - m_cancelFuncParam = NULL; - m_completeFuncParam = NULL; + cancelFunc = nullptr; + completeFunc = nullptr; + m_cancelFuncParam = nullptr; + m_completeFuncParam = nullptr; waitForThreadToDelete = false; } } LoadingInputParams; @@ -439,7 +439,7 @@ typedef struct _TutorialPopupInfo _TutorialPopupInfo() { - interactScene = NULL; + interactScene = nullptr; desc = L""; title = L""; icon = -1; @@ -447,7 +447,7 @@ typedef struct _TutorialPopupInfo isFoil = false; allowFade = true; isReminder = false; - tutorial = NULL; + tutorial = nullptr; } } TutorialPopupInfo; diff --git a/Minecraft.Client/Common/UI/UITTFFont.cpp b/Minecraft.Client/Common/UI/UITTFFont.cpp index 5d72ed97c..359ac76b8 100644 --- a/Minecraft.Client/Common/UI/UITTFFont.cpp +++ b/Minecraft.Client/Common/UI/UITTFFont.cpp @@ -11,9 +11,9 @@ UITTFFont::UITTFFont(const string &name, const string &path, S32 fallbackCharact #ifdef _UNICODE wstring wPath = convStringToWstring(path); - HANDLE file = CreateFile(wPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(wPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #else - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -30,7 +30,7 @@ UITTFFont::UITTFFont(const string &name, const string &path, S32 fallbackCharact DWORD bytesRead; pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { app.FatalLoadError(); diff --git a/Minecraft.Client/Common/XUI/XUI_Chat.cpp b/Minecraft.Client/Common/XUI/XUI_Chat.cpp index a1c43c63f..640056217 100644 --- a/Minecraft.Client/Common/XUI/XUI_Chat.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Chat.cpp @@ -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 ab99c00dc..5ae736a3d 100644 --- a/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_ConnectingProgress.cpp @@ -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 65118fa5d..576b75577 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) ); @@ -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)) diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_4JIcon.cpp index 8895b60e3..a4ff8d376 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 15695fd6d..7523c523f 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; } @@ -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 69f775d49..e74b92b4b 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BrewProgress.cpp @@ -10,7 +10,7 @@ int CXuiCtrlBrewProgress::GetValue() void* pvUserData; this->GetUserData( &pvUserData ); - if( pvUserData != NULL ) + if( pvUserData != nullptr ) { BrewingStandTileEntity *pBrewingStandTileEntity = static_cast(pvUserData); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp index 981f49960..48a130c42 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BubblesProgress.cpp @@ -8,7 +8,7 @@ int CXuiCtrlBubblesProgress::GetValue() void* pvUserData; this->GetUserData( &pvUserData ); - if( pvUserData != NULL ) + if( pvUserData != nullptr ) { BrewingStandTileEntity *pBrewingStandTileEntity = static_cast(pvUserData); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp index b618f8c6d..5a1a36743 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_BurnProgress.cpp @@ -10,7 +10,7 @@ int CXuiCtrlBurnProgress::GetValue() void* pvUserData; this->GetUserData( &pvUserData ); - if( pvUserData != NULL ) + if( pvUserData != nullptr ) { FurnaceTileEntity *pFurnaceTileEntity = static_cast(pvUserData); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_CraftIngredientSlot.cpp index 82b6c3eda..46bcc9831 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 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 050fcdc41..9a312287e 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantButton.cpp @@ -28,9 +28,9 @@ 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 ); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp index 584cbe661..a83b7811e 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentBook.cpp @@ -35,7 +35,7 @@ CXuiCtrlEnchantmentBook::CXuiCtrlEnchantmentBook() : m_fScreenHeight=static_cast(pMinecraft->height_phys); m_fRawHeight=static_cast(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,9 +60,9 @@ 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 ); @@ -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 a7700e79c..ecb6132d7 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_EnchantmentButtonText.cpp @@ -38,9 +38,9 @@ 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 ); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp index 35b9d534e..3d55db197 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_FireProgress.cpp @@ -10,7 +10,7 @@ int CXuiCtrlFireProgress::GetValue() void* pvUserData; this->GetUserData( &pvUserData ); - if( pvUserData != NULL ) + if( pvUserData != nullptr ) { FurnaceTileEntity *pFurnaceTileEntity = static_cast(pvUserData); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp index 7af2ea389..98ff1c267 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftPlayer.cpp @@ -41,9 +41,9 @@ 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 ); @@ -116,7 +116,7 @@ HRESULT CXuiCtrlMinecraftPlayer::OnRender(XUIMessageRender *pRenderData, BOOL &b // // for(int i=0;ilocalplayers[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 ffa386a06..1fa44d3f7 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSkinPreview.cpp @@ -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; } @@ -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 *pAdditionalModelParts=mob->GetAdditionalModelParts(); @@ -297,9 +297,9 @@ void CXuiCtrlMinecraftSkinPreview::render(EntityRenderer *renderer, double x, do HumanoidModel *model = static_cast(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; diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MinecraftSlot.cpp index a61ca6459..49217c5cd 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,7 +60,7 @@ CXuiCtrlMinecraftSlot::CXuiCtrlMinecraftSlot() : Minecraft *pMinecraft=Minecraft::GetInstance(); - if(pMinecraft != NULL) + if(pMinecraft != nullptr) { m_fScreenWidth=static_cast(pMinecraft->width_phys); m_fScreenHeight=static_cast(pMinecraft->height_phys); @@ -109,7 +109,7 @@ 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; @@ -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( new ItemInstance(m_iID, m_iCount, m_iAuxVal) ); + if(m_item == nullptr) m_item = shared_ptr( new ItemInstance(m_iID, m_iCount, m_iAuxVal) ); // build and render with the game call @@ -225,7 +225,7 @@ HRESULT CXuiCtrlMinecraftSlot::OnRender(XUIMessageRender *pRenderData, BOOL &bHa if(!m_bScreenWidthSetup) { Minecraft *pMinecraft=Minecraft::GetInstance(); - if(pMinecraft != NULL) + if(pMinecraft != nullptr) { m_fScreenWidth=static_cast(pMinecraft->width_phys); m_fScreenHeight=static_cast(pMinecraft->height_phys); diff --git a/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp b/Minecraft.Client/Common/XUI/XUI_Ctrl_MobEffect.cpp index 23b225738..6a76980dd 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 d52d560e7..18995854c 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SliderWrapper.cpp @@ -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 5c820fb5f..8a45d6fcb 100644 --- a/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Ctrl_SlotItemCtrlBase.cpp @@ -26,7 +26,7 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnDestroy( HXUIOBJ hObj ) void* pvUserData; hr = XuiElementGetUserData( hObj, &pvUserData ); - if( pvUserData != NULL ) + if( pvUserData != nullptr ) { delete pvUserData; } @@ -43,17 +43,17 @@ HRESULT CXuiCtrlSlotItemCtrlBase::OnCustomMessage_GetSlotItem(HXUIOBJ hObj, Cust SlotControlUserDataContainer* pUserDataContainer = static_cast(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 = dynamic_pointer_cast( 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()); @@ -113,14 +113,14 @@ bool CXuiCtrlSlotItemCtrlBase::isEmpty( HXUIOBJ hObj ) XuiElementGetUserData( hObj, &pvUserData ); SlotControlUserDataContainer* pUserDataContainer = static_cast(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 = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); - if(player != NULL) return player->inventory->getCarried() == NULL; + if(player != nullptr) return player->inventory->getCarried() == nullptr; } return true; @@ -132,7 +132,7 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vector(pvUserData); - if(pUserDataContainer->slot != NULL) + if(pUserDataContainer->slot != nullptr) { wstring desc = L""; vector *strings = pUserDataContainer->slot->getItem()->getHoverText(Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad], false, unformattedStrings); @@ -167,10 +167,10 @@ wstring CXuiCtrlSlotItemCtrlBase::GetItemDescription( HXUIOBJ hObj, vectorm_iPad >= 0 && pUserDataContainer->m_iPad < XUSER_MAX_COUNT) { shared_ptr player = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); - if(player != NULL) + if(player != nullptr) { shared_ptr item = player->inventory->getCarried(); - if(item != NULL) return app.GetString( item->getDescriptionId() ); + if(item != nullptr) return app.GetString( item->getDescriptionId() ); } } @@ -183,14 +183,14 @@ shared_ptr CXuiCtrlSlotItemCtrlBase::getItemInstance( HXUIOBJ hObj XuiElementGetUserData( hObj, &pvUserData ); SlotControlUserDataContainer* pUserDataContainer = static_cast(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 = dynamic_pointer_cast( Minecraft::GetInstance()->localplayers[pUserDataContainer->m_iPad] ); - if(player != NULL) return player->inventory->getCarried(); + if(player != nullptr) return player->inventory->getCarried(); } return nullptr; @@ -258,7 +258,7 @@ int CXuiCtrlSlotItemCtrlBase::GetObjectCount( HXUIOBJ hObj ) 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 = dynamic_pointer_cast( 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; } @@ -296,7 +296,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj XuiElementGetUserData( hThisObj, &pvThisUserData ); SlotControlUserDataContainer* pThisUserDataContainer = static_cast(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 = dynamic_pointer_cast( 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(); @@ -324,7 +324,7 @@ bool CXuiCtrlSlotItemCtrlBase::IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj XuiElementGetUserData( hOtherObj, &pvOtherUserData ); SlotControlUserDataContainer* pOtherUserDataContainer = static_cast(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 = dynamic_pointer_cast( 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(); @@ -369,7 +369,7 @@ int CXuiCtrlSlotItemCtrlBase::GetEmptyStackSpace( HXUIOBJ hObj ) 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 2fd217494..ac237ac92 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 67accbe25..a34f2a7e4 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; } } diff --git a/Minecraft.Client/Common/XUI/XUI_CustomMessages.h b/Minecraft.Client/Common/XUI/XUI_CustomMessages.h index cd5e28652..e16f891c3 100644 --- a/Minecraft.Client/Common/XUI/XUI_CustomMessages.h +++ b/Minecraft.Client/Common/XUI/XUI_CustomMessages.h @@ -43,7 +43,7 @@ static __declspec(noinline) void CustomMessage_GetSlotItem(XUIMessage *pMsg, Cus pData->item = nullptr; pData->iDataBitField = iDataBitField; pData->iItemBitField = iItemBitField; - pData->szPath = NULL; + pData->szPath = nullptr; pData->bDirty = false; } diff --git a/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp b/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp index e65f5a923..c5150249a 100644 --- a/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DLCOffers.cpp @@ -187,9 +187,9 @@ HRESULT CScene_DLCOffers::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 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,7 +223,7 @@ 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 = static_cast(pObj); @@ -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 @@ -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 @@ -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; } } @@ -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 e4c786f26..1788ceffd 100644 --- a/Minecraft.Client/Common/XUI/XUI_Death.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Death.cpp @@ -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,7 +105,7 @@ 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 = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } diff --git a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp index e4565acbf..01a4b573b 100644 --- a/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp +++ b/Minecraft.Client/Common/XUI/XUI_DebugItemEditor.cpp @@ -18,9 +18,9 @@ HRESULT CScene_DebugItemEditor::OnInit( XUIMessageInit *pInitData, BOOL &bHandle 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 player = pMinecraft->localplayers[m_iPad]; - if(player != NULL && player->connection) player->connection->send( shared_ptr( new ContainerSetSlotPacket(m_menu->containerId, m_slot->index, m_item) ) ); + if(player != nullptr && player->connection) player->connection->send( shared_ptr( new 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( new ItemInstance(0,1,0) ); + if(m_item == nullptr) m_item = shared_ptr( new 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( 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 7c3d491ca..338eb853c 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); @@ -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 @@ -274,7 +274,7 @@ 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( static_cast(pMinecraft->gameRenderer->GetFovVal())); @@ -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>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 90046c4e9..fb6339ce2 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); @@ -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_FullscreenProgress.cpp b/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp index bfa953e89..cc2359156 100644 --- a/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp +++ b/Minecraft.Client/Common/XUI/XUI_FullscreenProgress.cpp @@ -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; @@ -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 90b929686..e188cbf68 100644 --- a/Minecraft.Client/Common/XUI/XUI_HUD.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HUD.cpp @@ -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; @@ -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,17 +240,17 @@ 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"); } } @@ -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"); } } } @@ -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 @@ -399,12 +399,12 @@ HRESULT CXuiSceneHud::OnCustomMessage_TickScene() 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(pInitData->pvInitData); - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + 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 5e72a8d1e..3c4e80a22 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpControls.cpp @@ -93,7 +93,7 @@ HRESULT CScene_Controls::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) m_iPad=*static_cast(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,7 +159,7 @@ 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 @@ -172,7 +172,7 @@ HRESULT CScene_Controls::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 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]); } diff --git a/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp b/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp index 18435716c..c0584e946 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpCredits.cpp @@ -391,7 +391,7 @@ HRESULT CScene_Credits::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 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; } diff --git a/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp b/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp index b2d57f883..cd9e962d0 100644 --- a/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HelpHowToPlay.cpp @@ -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 8e5d21c44..a99921e06 100644 --- a/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp +++ b/Minecraft.Client/Common/XUI/XUI_HowToPlayMenu.cpp @@ -67,9 +67,9 @@ HRESULT CScene_HowToPlayMenu::OnInit( XUIMessageInit* pInitData, BOOL& bHandled { m_iPad = *static_cast(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(); diff --git a/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp b/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp index 71125b685..64f1f22c6 100644 --- a/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_InGameHostOptions.cpp @@ -76,7 +76,7 @@ HRESULT CScene_InGameHostOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& r { Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player != NULL && player->connection) + if(player != nullptr && player->connection) { player->connection->send( shared_ptr( new 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 7bd71336f..d22230a91 100644 --- a/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp +++ b/Minecraft.Client/Common/XUI/XUI_InGameInfo.cpp @@ -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 localPlayer = pMinecraft->localplayers[m_iPad]; @@ -140,7 +140,7 @@ 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 = static_cast(player)->GetUID(); if( xuid != INVALID_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 ) ) @@ -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<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; } @@ -527,7 +527,7 @@ int CScene_InGameInfo::KickPlayerReturned(void *pParam,int iPad,C4JStorage::EMes { Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr localPlayer = pMinecraft->localplayers[iPad]; - if(localPlayer != NULL && localPlayer->connection) + if(localPlayer != nullptr && localPlayer->connection) { localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); } diff --git a/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp b/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp index bb3419678..7903ff8eb 100644 --- a/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_InGamePlayerOptions.cpp @@ -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,7 +278,7 @@ HRESULT CScene_InGamePlayerOptions::OnKeyDown(XUIMessageInput* pInputData, BOOL& // Send update settings packet to server Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player != NULL && player->connection) + if(player != nullptr && player->connection) { player->connection->send( shared_ptr( new 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; } @@ -337,7 +337,7 @@ int CScene_InGamePlayerOptions::KickPlayerReturned(void *pParam,int iPad,C4JStor { Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr localPlayer = pMinecraft->localplayers[iPad]; - if(localPlayer != NULL && localPlayer->connection) + if(localPlayer != nullptr && localPlayer->connection) { localPlayer->connection->send( shared_ptr( new KickPlayerPacket(smallId) ) ); } @@ -360,9 +360,9 @@ void CScene_InGamePlayerOptions::OnPlayerChanged(void *callbackParam, INetworkPl VOID *pObj; XuiObjectFromHandle( hBackScene, &pObj ); infoScene = static_cast(pObj); - if(infoScene != NULL) CScene_InGameInfo::OnPlayerChanged(infoScene,pPlayer,leaving); + 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 35fa6250c..7fde530bf 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,33 +43,33 @@ 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 ), }, }; @@ -80,7 +80,7 @@ HRESULT CScene_Leaderboards::OnInit(XUIMessageInit *pInitData, BOOL &bHandled) 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; } @@ -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; @@ -511,7 +511,7 @@ void CScene_Leaderboards::GetFriends() m_friends, resultsSize, &numFriends, - NULL ); + nullptr ); if( ret != ERROR_SUCCESS ) numFriends = 0; @@ -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(); @@ -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; @@ -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 @@ -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 55e967887..e12957959 100644 --- a/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp +++ b/Minecraft.Client/Common/XUI/XUI_LoadSettings.cpp @@ -42,10 +42,10 @@ 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]; @@ -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 @@ -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); } @@ -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; } @@ -707,7 +707,7 @@ int CScene_LoadGameSettings::ConfirmLoadReturned(void *pParam,int iPad,C4JStorag 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; @@ -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 { @@ -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(); @@ -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 @@ -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()) @@ -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; } @@ -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 b5f722eb1..4126c5591 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); @@ -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; } @@ -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 *generators = app.getLevelGenerators(); diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameCreate.cpp index 4034f3c20..6e9fe6da2 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(); @@ -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; @@ -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 @@ -391,7 +391,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) { // corrupt DLC so set it to the default textures m_MoreOptionsParams.dwTexturePack=0; @@ -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; } @@ -485,7 +485,7 @@ HRESULT CScene_MultiGameCreate::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPr 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 { @@ -531,7 +531,7 @@ int CScene_MultiGameCreate::UnlockTexturePackReturned(void *pParam,int iPad,C4JS ULONGLONG ullIndexA[1]; DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(pScene->m_pDLCPack->getPurchaseOfferId()); - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { ullIndexA[0]=pDLCInfo->ullOfferID_Full; } @@ -540,7 +540,7 @@ 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 } @@ -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 { @@ -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; } @@ -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,7 +715,7 @@ 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; @@ -787,7 +787,7 @@ int CScene_MultiGameCreate::ConfirmCreateReturned(void *pParam,int iPad,C4JStora 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 { @@ -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 @@ -889,7 +889,7 @@ void CScene_MultiGameCreate::CreateGame(CScene_MultiGameCreate* pClass, DWORD dw // 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) @@ -946,7 +946,7 @@ 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(); @@ -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 @@ -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,7 +1246,7 @@ 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); } } } @@ -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 671b9e8ee..c1dba2829 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameInfo.cpp @@ -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 ) @@ -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 83cb240f6..c3f73a8ab 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameJoinLoad.cpp @@ -41,7 +41,7 @@ HRESULT CScene_MultiGameJoinLoad::OnInit( XUIMessageInit* pInitData, BOOL& bHand 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; @@ -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; @@ -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 ) { @@ -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,7 +1111,7 @@ bool CScene_MultiGameJoinLoad::DoesGamesListHaveFocus() void CScene_MultiGameJoinLoad::UpdateGamesListCallback(LPVOID lpParam) { - if(lpParam != NULL) + if(lpParam != nullptr) { CScene_MultiGameJoinLoad* pClass = static_cast(lpParam); // check this there's no save transfer in progress @@ -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 ) { @@ -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); @@ -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); @@ -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; @@ -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; @@ -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) { @@ -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); @@ -2322,14 +2322,14 @@ int CScene_MultiGameJoinLoad::TransferComplete(void *pParam,int iPad, int iResul CScene_MultiGameJoinLoad* pClass = static_cast(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 @@ -2391,7 +2391,7 @@ int CScene_MultiGameJoinLoad::LoadSaveDataForRenameReturned(void *pParam,bool bC 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); } } @@ -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); } } } @@ -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"); @@ -2750,7 +2750,7 @@ 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) diff --git a/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp b/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp index 69f474d58..63d28498f 100644 --- a/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MultiGameLaunchMoreOptions.cpp @@ -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_PauseMenu.cpp b/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp index f6d71b07b..0879ba278 100644 --- a/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp +++ b/Minecraft.Client/Common/XUI/XUI_PauseMenu.cpp @@ -317,7 +317,7 @@ 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 = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } @@ -357,7 +357,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* else { int playTime = -1; - if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) + if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr ) { playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } @@ -375,7 +375,7 @@ 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 = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } @@ -392,7 +392,7 @@ HRESULT UIScene_PauseMenu::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* else { int playTime = -1; - if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != NULL ) + if( pMinecraft->localplayers[pNotifyPressData->UserIndex] != nullptr ) { playTime = static_cast(pMinecraft->localplayers[pNotifyPressData->UserIndex]->getSessionTimer()); } @@ -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; } @@ -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 @@ -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 5f8b585cd..c0650335c 100644 --- a/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Reinstall.cpp @@ -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; diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_AbstractContainer.cpp index 1ccc031cd..2692c8f1c 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; @@ -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 a10c101b0..bd63d1963 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Anvil.cpp @@ -40,7 +40,7 @@ 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 = static_cast(pMinecraft->localgameModes[m_iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -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 = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + 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; } @@ -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 217e68f90..39b43bc6a 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Base.cpp @@ -22,14 +22,14 @@ #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 @@ -41,7 +41,7 @@ HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 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; } } @@ -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 @@ -206,7 +206,7 @@ void CXuiSceneBase::_TickAllBaseScenes() } } - if (EnderDragonRenderer::bossInstance == NULL) + if (EnderDragonRenderer::bossInstance == nullptr) { if(m_ticksWithNoBoss<=20) { @@ -221,7 +221,7 @@ 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; @@ -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); @@ -470,7 +470,7 @@ void CXuiSceneBase::_TickAllBaseScenes() 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); } @@ -498,7 +498,7 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti 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) @@ -507,17 +507,17 @@ HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiToolti 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]); @@ -858,7 +858,7 @@ 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; // are we in the Nether? - Leave the time as 0 if we are, so we show daylight @@ -911,7 +911,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)); @@ -1038,7 +1038,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); } @@ -1268,7 +1268,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); @@ -1339,7 +1339,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad) 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) @@ -1428,7 +1428,7 @@ void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad) { 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); } @@ -1471,7 +1471,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) { @@ -1607,7 +1607,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) { - 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()); @@ -1864,7 +1864,7 @@ void CXuiSceneBase::ReLayout( unsigned int iPad ) void CXuiSceneBase::TickAllBaseScenes() { - if( CXuiSceneBase::Instance != NULL ) + if( CXuiSceneBase::Instance != nullptr ) { CXuiSceneBase::Instance->_TickAllBaseScenes(); } @@ -1872,7 +1872,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 +1881,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 +1890,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 +1899,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 +1908,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 +1917,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 ); @@ -1978,7 +1978,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); } @@ -2078,7 +2078,7 @@ HRESULT CXuiSceneBase::UpdatePlayerBasePositions() 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 +2105,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) { @@ -2186,7 +2186,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 +2238,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 51a019cfd..a55e8f777 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_BrewingStand.cpp @@ -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 70eb7c3cf..25f5cffcb 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Container.cpp @@ -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(); @@ -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 cea213939..f1c51ff0d 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_CraftingPanel.cpp @@ -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;iiItem; 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 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 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 6e5159b20..dabe6d6d1 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Enchant.cpp @@ -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 54f3591b9..c5e2d22c3 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Furnace.cpp @@ -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 a5532fefc..e86ff67e0 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory.cpp @@ -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 = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + 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,7 +156,7 @@ void CXuiSceneInventory::updateEffectsDisplay() Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr player = pMinecraft->localplayers[m_iPad]; - if(player == NULL) return; + if(player == nullptr) return; vector *activeEffects = player->getActiveEffects(); diff --git a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp index 415d7b51e..345d426dd 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Inventory_Creative.cpp @@ -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(); @@ -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;im_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); } } @@ -148,7 +148,7 @@ CXuiControl* CXuiSceneInventoryCreative::GetSectionControl( ESceneSection eSecti 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 b6f3df50e..3fbca979e 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Trading.cpp @@ -39,7 +39,7 @@ 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 = static_cast(pMinecraft->localgameModes[m_iPad]); m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); @@ -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 = static_cast(pMinecraft->localgameModes[m_iPad]); - if(gameMode != NULL) gameMode->getTutorial()->changeTutorialState(m_previousTutorialState); + 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 4453185ea..326e62639 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Trap.cpp @@ -27,7 +27,7 @@ HRESULT CXuiSceneTrap::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(); @@ -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 9c491be67..e61815d9b 100644 --- a/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Scene_Win.cpp @@ -68,7 +68,7 @@ HRESULT CScene_Win::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 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 26219376e..3c37b8d85 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsAll.cpp @@ -12,7 +12,7 @@ HRESULT CScene_SettingsAll::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) //WCHAR TempString[256]; m_iPad=*static_cast(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 f654a3764..6f399d55e 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsAudio.cpp @@ -9,7 +9,7 @@ HRESULT CScene_SettingsAudio::OnInit( XUIMessageInit* pInitData, BOOL& bHandled WCHAR TempString[256]; m_iPad=*static_cast(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(); @@ -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 7bedc2fa2..4fa335fb5 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsControl.cpp @@ -12,7 +12,7 @@ HRESULT CScene_SettingsControl::OnInit( XUIMessageInit* pInitData, BOOL& bHandle WCHAR TempString[256]; m_iPad=*static_cast(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(); @@ -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 3ce414c57..d73baa0b3 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsGraphics.cpp @@ -12,7 +12,7 @@ HRESULT CScene_SettingsGraphics::OnInit( XUIMessageInit* pInitData, BOOL& bHandl WCHAR TempString[256]; m_iPad=*static_cast(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(); @@ -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 f8fb5ae98..683ee175e 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsOptions.cpp @@ -28,7 +28,7 @@ HRESULT CScene_SettingsOptions::OnInit( XUIMessageInit* pInitData, BOOL& bHandle WCHAR TempString[256]; m_iPad=*static_cast(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(); @@ -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 1dc837757..ab9cc53b4 100644 --- a/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SettingsUI.cpp @@ -12,7 +12,7 @@ HRESULT CScene_SettingsUI::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) WCHAR TempString[256]; m_iPad=*static_cast(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(); @@ -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 32336cb72..6c54c3e31 100644 --- a/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SignEntry.cpp @@ -75,7 +75,7 @@ HRESULT CScene_SignEntry::OnNotifyPressEx(HXUIOBJ hObjPressed, XUINotifyPress* p if (pMinecraft->level->isClientSide) { shared_ptr 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( new SignUpdatePacket(m_sign->x, m_sign->y, m_sign->z, m_sign->IsVerified(), m_sign->IsCensored(), m_sign->GetMessages()) ) ); } diff --git a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp index b2f2f0a39..b92159c05 100644 --- a/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SkinSelect.cpp @@ -28,7 +28,7 @@ HRESULT CScene_SkinSelect::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) { m_iPad=*static_cast(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 *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 *othervAdditionalSkinBoxes=NULL; + vector *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 *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 *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); @@ -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; } @@ -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 26dd220b7..2bd842638 100644 --- a/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp +++ b/Minecraft.Client/Common/XUI/XUI_SocialPost.cpp @@ -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 5b13a376e..bbf0005e9 100644 --- a/Minecraft.Client/Common/XUI/XUI_Teleport.cpp +++ b/Minecraft.Client/Common/XUI/XUI_Teleport.cpp @@ -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; @@ -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<HasVoice() ) + if(player != nullptr && player->HasVoice() ) { if( player->IsMutedByLocalUser(m_iPad) ) { diff --git a/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp b/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp index 07304e604..da224f7a3 100644 --- a/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp +++ b/Minecraft.Client/Common/XUI/XUI_TransferToXboxOne.cpp @@ -28,7 +28,7 @@ HRESULT CScene_TransferToXboxOne::OnInit( XUIMessageInit* pInitData, BOOL& bHand XuiObjectFromHandle( m_SavesSlotList, &pObj ); m_pSavesSlotList = static_cast(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")) @@ -103,7 +103,7 @@ int CScene_TransferToXboxOne::TMSPPDeleteReturned(LPVOID pParam,int iPad,int iUs // 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; @@ -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; } @@ -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_TutorialPopup.cpp b/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp index 9fe644e06..02b7d9db2 100644 --- a/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp +++ b/Minecraft.Client/Common/XUI/XUI_TutorialPopup.cpp @@ -29,7 +29,7 @@ HRESULT CScene_TutorialPopup::OnInit( XUIMessageInit* pInitData, BOOL& bHandled m_textFontSize = _fromString( 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); @@ -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 { diff --git a/Minecraft.Client/Common/zlib/crc32.c b/Minecraft.Client/Common/zlib/crc32.c index 979a7190a..9837724b0 100644 --- a/Minecraft.Client/Common/zlib/crc32.c +++ b/Minecraft.Client/Common/zlib/crc32.c @@ -143,7 +143,7 @@ local void make_crc_table() FILE *out; out = fopen("crc32.h", "w"); - if (out == NULL) return; + if (out == nullptr) return; fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); fprintf(out, "local const z_crc_t FAR "); diff --git a/Minecraft.Client/Common/zlib/trees.c b/Minecraft.Client/Common/zlib/trees.c index 1fd7759ef..2f8891748 100644 --- a/Minecraft.Client/Common/zlib/trees.c +++ b/Minecraft.Client/Common/zlib/trees.c @@ -115,8 +115,8 @@ local int base_dist[D_CODES]; #endif /* GEN_TREES_H */ struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ + const ct_data *static_tree; /* static tree or nullptr */ + const intf *extra_bits; /* extra bits for each code or nullptr */ int extra_base; /* base index for extra_bits */ int elems; /* max number of elements in the tree */ int max_length; /* max bit length for the codes */ @@ -330,7 +330,7 @@ void gen_trees_header() FILE *header = fopen("trees.h", "w"); int i; - Assert (header != NULL, "Can't open trees.h"); + Assert (header != nullptr, "Can't open trees.h"); fprintf(header, "/* header created automatically with -DGEN_TREES_H */\n\n"); @@ -906,7 +906,7 @@ void ZLIB_INTERNAL _tr_align(s) */ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) deflate_state *s; - charf *buf; /* input block, or NULL if too old */ + charf *buf; /* input block, or nullptr if too old */ ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { @@ -958,7 +958,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) if (stored_len+4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + /* The test buf != nullptr is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to diff --git a/Minecraft.Client/Common/zlib/zlib.h b/Minecraft.Client/Common/zlib/zlib.h index 3e0c7672a..b0e74c454 100644 --- a/Minecraft.Client/Common/zlib/zlib.h +++ b/Minecraft.Client/Common/zlib/zlib.h @@ -91,7 +91,7 @@ typedef struct z_stream_s { uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total number of bytes output so far */ - z_const char *msg; /* last error message, NULL if no error */ + z_const char *msg; /* last error message, nullptr if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ @@ -1254,7 +1254,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); reading, this will be detected automatically by looking for the magic two- byte gzip header. - gzopen returns NULL if the file could not be opened, if there was + gzopen returns nullptr if the file could not be opened, if there was insufficient memory to allocate the gzFile state, or if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). errno can be checked to determine if the reason gzopen failed was that the @@ -1277,7 +1277,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); close the associated file descriptor, so they need to have different file descriptors. - gzdopen returns NULL if there was insufficient memory to allocate the + gzdopen returns nullptr if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided), or if fd is -1. The file descriptor is not used until the next gz* read, write, seek, or close operation, so gzdopen @@ -1377,7 +1377,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); string is terminated with a null character. If no characters are read due to an end-of-file or len < 1, then the buffer is left untouched. - gzgets returns buf which is a null-terminated string, or it returns NULL + gzgets returns buf which is a null-terminated string, or it returns nullptr for end-of-file or in case of error. If there was an error, the contents at buf are indeterminate. */ @@ -1393,7 +1393,7 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. - it does not check to see if file is NULL, nor whether the structure file + it does not check to see if file is nullptr, nor whether the structure file points to has been clobbered or not. */ diff --git a/Minecraft.Client/Common/zlib/zutil.c b/Minecraft.Client/Common/zlib/zutil.c index 23d2ebef0..209af2ce3 100644 --- a/Minecraft.Client/Common/zlib/zutil.c +++ b/Minecraft.Client/Common/zlib/zutil.c @@ -231,7 +231,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) } else { buf = farmalloc(bsize + 16L); } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + if (buf == nullptr || next_ptr >= MAX_PTR) return nullptr; table[next_ptr].org_ptr = buf; /* Normalize the pointer to seg:0 */ diff --git a/Minecraft.Client/Common/zlib/zutil.h b/Minecraft.Client/Common/zlib/zutil.h index 24ab06b1c..61becfe0a 100644 --- a/Minecraft.Client/Common/zlib/zutil.h +++ b/Minecraft.Client/Common/zlib/zutil.h @@ -125,7 +125,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # include /* for fdopen */ # else # ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ # endif # endif # endif @@ -146,12 +146,12 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #endif #if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX # if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ +# define fdopen(fd,mode) nullptr /* No fdopen() */ # ifndef _PTRDIFF_T_DEFINED typedef int ptrdiff_t; # define _PTRDIFF_T_DEFINED diff --git a/Minecraft.Client/CompassTexture.cpp b/Minecraft.Client/CompassTexture.cpp index 1a73783f8..148069916 100644 --- a/Minecraft.Client/CompassTexture.cpp +++ b/Minecraft.Client/CompassTexture.cpp @@ -7,13 +7,13 @@ #include "Texture.h" #include "CompassTexture.h" -CompassTexture *CompassTexture::instance = NULL; +CompassTexture *CompassTexture::instance = nullptr; CompassTexture::CompassTexture() : StitchedTexture(L"compass",L"compass") { instance = this; - m_dataTexture = NULL; + m_dataTexture = nullptr; m_iPad = XUSER_INDEX_ANY; rot = rota = 0.0; @@ -31,21 +31,21 @@ void CompassTexture::cycleFrames() { Minecraft *mc = Minecraft::GetInstance(); - if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != NULL && mc->localplayers[m_iPad] != NULL) + if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != nullptr && mc->localplayers[m_iPad] != nullptr) { updateFromPosition(mc->localplayers[m_iPad]->level, mc->localplayers[m_iPad]->x, mc->localplayers[m_iPad]->z, mc->localplayers[m_iPad]->yRot, false, false); } else { frame = 1; - updateFromPosition(NULL, 0, 0, 0, false, true); + updateFromPosition(nullptr, 0, 0, 0, false, true); } } void CompassTexture::updateFromPosition(Level *level, double x, double z, double yRot, bool noNeedle, bool instant) { double rott = 0; - if (level != NULL && !noNeedle) + if (level != nullptr && !noNeedle) { Pos *spawnPos = level->getSharedSpawnPos(); double xa = spawnPos->x - x; @@ -78,7 +78,7 @@ void CompassTexture::updateFromPosition(Level *level, double x, double z, double } // 4J Stu - We share data with another texture - if(m_dataTexture != NULL) + if(m_dataTexture != nullptr) { int newFrame = static_cast(((rot / (PI * 2)) + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); while (newFrame < 0) @@ -118,7 +118,7 @@ int CompassTexture::getSourceHeight() const int CompassTexture::getFrames() { - if(m_dataTexture == NULL) + if(m_dataTexture == nullptr) { return StitchedTexture::getFrames(); } @@ -130,7 +130,7 @@ int CompassTexture::getFrames() void CompassTexture::freeFrameTextures() { - if(m_dataTexture == NULL) + if(m_dataTexture == nullptr) { StitchedTexture::freeFrameTextures(); } @@ -138,5 +138,5 @@ void CompassTexture::freeFrameTextures() bool CompassTexture::hasOwnData() { - return m_dataTexture == NULL; + return m_dataTexture == nullptr; } \ No newline at end of file diff --git a/Minecraft.Client/ConnectScreen.cpp b/Minecraft.Client/ConnectScreen.cpp index 2cf005b6d..c34a219e0 100644 --- a/Minecraft.Client/ConnectScreen.cpp +++ b/Minecraft.Client/ConnectScreen.cpp @@ -12,7 +12,7 @@ ConnectScreen::ConnectScreen(Minecraft *minecraft, const wstring& ip, int port) { aborted = false; // System.out.println("Connecting to " + ip + ", " + port); - minecraft->setLevel(NULL); + minecraft->setLevel(nullptr); #if 1 // 4J - removed from separate thread, but need to investigate what we actually need here connection = new ClientConnection(minecraft, ip, port); @@ -45,7 +45,7 @@ ConnectScreen::ConnectScreen(Minecraft *minecraft, const wstring& ip, int port) void ConnectScreen::tick() { - if (connection != NULL) + if (connection != nullptr) { connection->tick(); } @@ -69,7 +69,7 @@ void ConnectScreen::buttonClicked(Button *button) if (button->id == 0) { aborted = true; - if (connection != NULL) connection->close(); + if (connection != nullptr) connection->close(); minecraft->setScreen(new TitleScreen()); } } @@ -80,7 +80,7 @@ void ConnectScreen::render(int xm, int ym, float a) Language *language = Language::getInstance(); - if (connection == NULL) + if (connection == nullptr) { drawCenteredString(font, language->getElement(L"connect.connecting"), width / 2, height / 2 - 50, 0xffffff); drawCenteredString(font, L"", width / 2, height / 2 - 10, 0xffffff); diff --git a/Minecraft.Client/CreateWorldScreen.cpp b/Minecraft.Client/CreateWorldScreen.cpp index b9856c7e3..4fc0a3531 100644 --- a/Minecraft.Client/CreateWorldScreen.cpp +++ b/Minecraft.Client/CreateWorldScreen.cpp @@ -70,7 +70,7 @@ wstring CreateWorldScreen::findAvailableFolderName(LevelStorageSource *levelSour wstring folder2 = folder; // 4J - copy input as it is const #if 0 - while (levelSource->getDataTagFor(folder2) != NULL) + while (levelSource->getDataTagFor(folder2) != nullptr) { folder2 = folder2 + L"-"; } @@ -93,7 +93,7 @@ void CreateWorldScreen::buttonClicked(Button *button) else if (button->id == 0) { // note: code copied from SelectWorldScreen - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); if (done) return; done = true; @@ -119,7 +119,7 @@ void CreateWorldScreen::buttonClicked(Button *button) #if 0 minecraft->gameMode = new SurvivalMode(minecraft); minecraft->selectLevel(resultFolder, nameEdit->getValue(), seedValue); - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); #endif } diff --git a/Minecraft.Client/DLCTexturePack.cpp b/Minecraft.Client/DLCTexturePack.cpp index 752b1cc27..1e72bb260 100644 --- a/Minecraft.Client/DLCTexturePack.cpp +++ b/Minecraft.Client/DLCTexturePack.cpp @@ -16,22 +16,22 @@ #include "Xbox\XML\xmlFilesCallback.h" #endif -DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, NULL, pack->getName(), fallback) +DLCTexturePack::DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback) : AbstractTexturePack(id, nullptr, pack->getName(), fallback) { m_dlcInfoPack = pack; - m_dlcDataPack = NULL; + m_dlcDataPack = nullptr; bUILoaded = false; m_bLoadingData = false; m_bHasLoadedData = false; - m_archiveFile = NULL; + m_archiveFile = nullptr; if (app.getLevelGenerationOptions()) app.getLevelGenerationOptions()->setLoadedData(); m_bUsingDefaultColourTable = true; - m_stringTable = NULL; + m_stringTable = nullptr; #ifdef _XBOX - m_pStreamedWaveBank=NULL; - m_pSoundBank=NULL; + m_pStreamedWaveBank=nullptr; + m_pSoundBank=nullptr; #endif if(m_dlcInfoPack->doesPackContainFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc")) @@ -75,7 +75,7 @@ void DLCTexturePack::loadName() if(m_dlcInfoPack->GetPackID()&1024) { - if(m_stringTable != NULL) + if(m_stringTable != nullptr) { texname = m_stringTable->getString(L"IDS_DISPLAY_NAME"); m_wsWorldName=m_stringTable->getString(L"IDS_WORLD_NAME"); @@ -83,7 +83,7 @@ void DLCTexturePack::loadName() } else { - if(m_stringTable != NULL) + if(m_stringTable != nullptr) { texname = m_stringTable->getString(L"IDS_DISPLAY_NAME"); } @@ -95,7 +95,7 @@ void DLCTexturePack::loadDescription() { desc1 = L""; - if(m_stringTable != NULL) + if(m_stringTable != nullptr) { desc1 = m_stringTable->getString(L"IDS_TP_DESCRIPTION"); } @@ -115,15 +115,15 @@ InputStream *DLCTexturePack::getResourceImplementation(const wstring &name) //th // 4J Stu - We should never call this function #ifndef _CONTENT_PACKAGE __debugbreak(); - if(hasFile(name)) return NULL; + if(hasFile(name)) return nullptr; #endif - return NULL; //resource; + return nullptr; //resource; } bool DLCTexturePack::hasFile(const wstring &name) { bool hasFile = false; - if(m_dlcDataPack != NULL) hasFile = m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_Texture, name); + if(m_dlcDataPack != nullptr) hasFile = m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_Texture, name); return hasFile; } @@ -164,7 +164,7 @@ DLCPack * DLCTexturePack::getDLCPack() void DLCTexturePack::loadColourTable() { // Load the game colours - if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_ColourTable, L"colours.col")) + if(m_dlcDataPack != nullptr && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_ColourTable, L"colours.col")) { DLCColourTableFile *colourFile = static_cast(m_dlcDataPack->getFile(DLCManager::e_DLCType_ColourTable, L"colours.col")); m_colourTable = colourFile->getColourTable(); @@ -173,14 +173,14 @@ void DLCTexturePack::loadColourTable() else { // 4J Stu - We can delete the default colour table, but not the one from the DLCColourTableFile - if(!m_bUsingDefaultColourTable) m_colourTable = NULL; + if(!m_bUsingDefaultColourTable) m_colourTable = nullptr; loadDefaultColourTable(); m_bUsingDefaultColourTable = true; } // Load the text colours #ifdef _XBOX - if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) + if(m_dlcDataPack != nullptr && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); @@ -205,7 +205,7 @@ void DLCTexturePack::loadColourTable() swprintf(szResourceLocator, LOCATOR_SIZE,L"memory://%08X,%04X#xuiscene_colourtable.xur",pbData, dwSize); HXUIOBJ hScene; - HRESULT hr = XuiSceneCreate(szResourceLocator,szResourceLocator, NULL, &hScene); + HRESULT hr = XuiSceneCreate(szResourceLocator,szResourceLocator, nullptr, &hScene); if(HRESULT_SUCCEEDED(hr)) { @@ -294,11 +294,11 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen if(!app.m_dlcManager.readDLCDataFile(dwFilesProcessed, getFilePath(texturePack->m_dlcInfoPack->GetPackID(), dataFilePath),texturePack->m_dlcDataPack)) { delete texturePack->m_dlcDataPack; - texturePack->m_dlcDataPack = NULL; + texturePack->m_dlcDataPack = nullptr; } // Load the UI data - if(texturePack->m_dlcDataPack != NULL) + if(texturePack->m_dlcDataPack != nullptr) { #ifdef _XBOX File xzpPath(getFilePath(texturePack->m_dlcInfoPack->GetPackID(), wstring(L"TexturePack.xzp") ) ); @@ -310,10 +310,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); if( fileHandle != INVALID_HANDLE_VALUE ) @@ -321,7 +321,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen DWORD dwFileSize = xzpPath.length(); DWORD bytesRead; PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL success = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); + BOOL success = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); CloseHandle(fileHandle); if(success) { @@ -342,7 +342,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen */ DLCPack *pack = texturePack->m_dlcInfoPack->GetParentPack(); LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); - if (levelGen != NULL && !levelGen->hasLoadedData()) + if (levelGen != nullptr && !levelGen->hasLoadedData()) { int gameRulesCount = pack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader); for(int i = 0; i < gameRulesCount; ++i) @@ -361,10 +361,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -372,10 +372,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #endif @@ -384,7 +384,7 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen DWORD dwFileSize = grf.length(); DWORD bytesRead; PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -413,10 +413,10 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #else const char *pchFilename=wstringtofilename(grf.getPath()); @@ -424,18 +424,18 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #endif if( fileHandle != INVALID_HANDLE_VALUE ) { - DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL); + DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,nullptr); PBYTE pbData = (PBYTE) new BYTE[dwFileSize]; - BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { app.FatalLoadError(); @@ -513,7 +513,7 @@ void DLCTexturePack::loadUI() //L"memory://0123ABCD,21A3#skin_default.xur" // Load new skin - if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) + if(m_dlcDataPack != nullptr && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) { DLCUIDataFile *dataFile = (DLCUIDataFile *)m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp"); @@ -527,7 +527,7 @@ void DLCTexturePack::loadUI() XuiFreeVisuals(L""); - HRESULT hr = app.LoadSkin(szResourceLocator,NULL);//L"TexturePack"); + HRESULT hr = app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack"); if(HRESULT_SUCCEEDED(hr)) { bUILoaded = true; @@ -577,7 +577,7 @@ void DLCTexturePack::unloadUI() AbstractTexturePack::unloadUI(); app.m_dlcManager.removePack(m_dlcDataPack); - m_dlcDataPack = NULL; + m_dlcDataPack = nullptr; delete m_archiveFile; m_bHasLoadedData = false; @@ -587,7 +587,7 @@ void DLCTexturePack::unloadUI() wstring DLCTexturePack::getXuiRootPath() { wstring path = L""; - if(m_dlcDataPack != NULL && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) + if(m_dlcDataPack != nullptr && m_dlcDataPack->doesPackContainFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")) { DLCUIDataFile *dataFile = static_cast(m_dlcDataPack->getFile(DLCManager::e_DLCType_UIData, L"TexturePack.xzp")); diff --git a/Minecraft.Client/DLCTexturePack.h b/Minecraft.Client/DLCTexturePack.h index 153f3d438..595c47dac 100644 --- a/Minecraft.Client/DLCTexturePack.h +++ b/Minecraft.Client/DLCTexturePack.h @@ -50,7 +50,7 @@ public: bool isTerrainUpdateCompatible(); // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=NULL); + virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=nullptr); virtual wstring getAnimationString(const wstring &textureName, const wstring &path); virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); virtual void loadColourTable(); diff --git a/Minecraft.Client/DeathScreen.cpp b/Minecraft.Client/DeathScreen.cpp index e7ab13285..0e9cfb191 100644 --- a/Minecraft.Client/DeathScreen.cpp +++ b/Minecraft.Client/DeathScreen.cpp @@ -11,7 +11,7 @@ void DeathScreen::init() buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 3, L"Respawn")); buttons.push_back(new Button(2, width / 2 - 100, height / 4 + 24 * 4, L"Title menu")); - if (minecraft->user == NULL) + if (minecraft->user == nullptr) { buttons[1]->active = false; } @@ -30,12 +30,12 @@ void DeathScreen::buttonClicked(Button *button) if (button->id == 1) { minecraft->player->respawn(); - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); // minecraft.setScreen(new NewLevelScreen(this)); } if (button->id == 2) { - minecraft->setLevel(NULL); + minecraft->setLevel(nullptr); minecraft->setScreen(new TitleScreen()); } } diff --git a/Minecraft.Client/DefaultRenderer.h b/Minecraft.Client/DefaultRenderer.h index 04b953907..28630de29 100644 --- a/Minecraft.Client/DefaultRenderer.h +++ b/Minecraft.Client/DefaultRenderer.h @@ -5,5 +5,5 @@ class DefaultRenderer : public EntityRenderer { public: virtual void render(shared_ptr entity, double x, double y, double z, float rot, float a); - virtual ResourceLocation *getTextureLocation(shared_ptr mob) { return NULL; }; + virtual ResourceLocation *getTextureLocation(shared_ptr mob) { return nullptr; }; }; \ No newline at end of file diff --git a/Minecraft.Client/DefaultTexturePack.cpp b/Minecraft.Client/DefaultTexturePack.cpp index d2974b6d0..d2712404b 100644 --- a/Minecraft.Client/DefaultTexturePack.cpp +++ b/Minecraft.Client/DefaultTexturePack.cpp @@ -4,7 +4,7 @@ #include "..\Minecraft.World\StringHelpers.h" -DefaultTexturePack::DefaultTexturePack() : AbstractTexturePack(0, NULL, L"Minecraft", NULL) +DefaultTexturePack::DefaultTexturePack() : AbstractTexturePack(0, nullptr, L"Minecraft", nullptr) { // 4J Stu - These calls need to be in the most derived version of the class loadIcon(); @@ -20,7 +20,7 @@ void DefaultTexturePack::loadIcon() 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"); UINT size = 0; @@ -102,7 +102,7 @@ InputStream *DefaultTexturePack::getResourceImplementation(const wstring &name)/ #endif InputStream *resource = InputStream::getResourceAsStream(wDrive + name); //InputStream *stream = DefaultTexturePack::class->getResourceAsStream(name); - //if (stream == NULL) + //if (stream == nullptr) //{ // throw new FileNotFoundException(name); //} diff --git a/Minecraft.Client/DefaultTexturePack.h b/Minecraft.Client/DefaultTexturePack.h index 9aa87a07a..5fd0b40c4 100644 --- a/Minecraft.Client/DefaultTexturePack.h +++ b/Minecraft.Client/DefaultTexturePack.h @@ -5,7 +5,7 @@ class DefaultTexturePack : public AbstractTexturePack { public: DefaultTexturePack(); - DLCPack * getDLCPack() {return NULL;} + DLCPack * getDLCPack() {return nullptr;} protected: //@Override diff --git a/Minecraft.Client/DerivedServerLevel.cpp b/Minecraft.Client/DerivedServerLevel.cpp index a67408d70..78de818de 100644 --- a/Minecraft.Client/DerivedServerLevel.cpp +++ b/Minecraft.Client/DerivedServerLevel.cpp @@ -10,7 +10,7 @@ DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, shared_ptrsavedDataStorage) { delete this->savedDataStorage; - this->savedDataStorage=NULL; + this->savedDataStorage=nullptr; } this->savedDataStorage = wrapped->savedDataStorage; levelData = new DerivedLevelData(wrapped->getLevelData()); @@ -19,7 +19,7 @@ DerivedServerLevel::DerivedServerLevel(MinecraftServer *server, shared_ptrsavedDataStorage=NULL; + this->savedDataStorage=nullptr; } void DerivedServerLevel::saveLevelData() diff --git a/Minecraft.Client/DisconnectedScreen.cpp b/Minecraft.Client/DisconnectedScreen.cpp index b445e4d07..800df73f4 100644 --- a/Minecraft.Client/DisconnectedScreen.cpp +++ b/Minecraft.Client/DisconnectedScreen.cpp @@ -9,7 +9,7 @@ DisconnectedScreen::DisconnectedScreen(const wstring& title, const wstring reaso Language *language = Language::getInstance(); this->title = language->getElement(title); - if (reasonObjects != NULL) + if (reasonObjects != nullptr) { this->reason = language->getElement(reason, reasonObjects); } diff --git a/Minecraft.Client/Durango/4JLibs/inc/4J_Input.h b/Minecraft.Client/Durango/4JLibs/inc/4J_Input.h index 884f281e1..a24d61169 100644 --- a/Minecraft.Client/Durango/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Durango/4JLibs/inc/4J_Input.h @@ -61,8 +61,8 @@ STRING_VERIFY_RESPONSE; class C4JStringTable { public: - LPCWSTR Lookup(LPCWSTR szId) {return NULL;} - LPCWSTR Lookup(UINT nIndex) {return NULL;} + LPCWSTR Lookup(LPCWSTR szId) {return nullptr;} + LPCWSTR Lookup(UINT nIndex) {return nullptr;} void Clear(); HRESULT Load(LPCWSTR szId) {return S_OK;} }; @@ -126,8 +126,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); -// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); -// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); +// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); +// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, int iMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); void DestroyKeyboard(); diff --git a/Minecraft.Client/Durango/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Durango/4JLibs/inc/4J_Profile.h index dab464171..961b5d2a7 100644 --- a/Minecraft.Client/Durango/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Durango/4JLibs/inc/4J_Profile.h @@ -132,7 +132,7 @@ public: // ACHIEVEMENTS & AWARDS //void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - // CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); + // CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); //int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/Durango/4JLibs/inc/4J_Render.h b/Minecraft.Client/Durango/4JLibs/inc/4J_Render.h index 737caa98b..fb16ccb32 100644 --- a/Minecraft.Client/Durango/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/Durango/4JLibs/inc/4J_Render.h @@ -16,8 +16,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { free(m_pBuffer); m_pBuffer = NULL; } - bool Allocated() { return m_pBuffer != NULL; } + void Release() { free(m_pBuffer); m_pBuffer = nullptr; } + bool Allocated() { return m_pBuffer != nullptr; } }; typedef struct @@ -60,7 +60,7 @@ public: void StartFrame(); void DoScreenGrabOnNextPresent(); void Present(); - void Clear(int flags, D3D11_RECT *pRect = NULL); + void Clear(int flags, D3D11_RECT *pRect = nullptr); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h index be5d57fd7..624939520 100644 --- a/Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h @@ -378,7 +378,7 @@ public: // Get details of existing savedata C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName); // Start search - PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or NULL if not yet received) + PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or nullptr if not yet received) void ClearSavesInfo(); // Clears results C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam, bool force=false); // Get the thumbnail for an individual save referenced by pSaveInfo @@ -442,8 +442,8 @@ public: void SetLicenseChangeFn(void( *Func)(void)); XCONTENT_DATA& GetDLC(DWORD dw); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPWSTR szMountDrive = NULL); - DWORD UnmountInstalledDLC(LPWSTR szMountDrive = NULL); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPWSTR szMountDrive = nullptr); + DWORD UnmountInstalledDLC(LPWSTR szMountDrive = nullptr); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::wstring GetMountedPath(std::wstring szMount); XCONTENT_DATA * GetInstalledDLC(WCHAR *wszProductID); @@ -470,10 +470,10 @@ public: // TMS++ C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(C4JStorage::eGlobalStorage eStorageFacility,int iPad);//,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0); - eTitleStorageState TMSPP_WriteFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,BYTE *pbBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0); + eTitleStorageState TMSPP_WriteFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,BYTE *pbBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); eTitleStorageState TMSPP_ReadFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,int( *Func)(LPVOID,int,int,LPVOID, WCHAR *),LPVOID lpParam, int iUserData); eTitleStorageState TMSPP_DeleteFile(int iQuadrant,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPWSTR wszFilename,int( *Func)(LPVOID,int,int),LPVOID lpParam, int iUserData); - eTitleStorageState TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,int( *Func)(LPVOID,int,int,LPVOID,WCHAR *)=NULL,LPVOID lpParam=NULL, int iUserData=0); + eTitleStorageState TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,int( *Func)(LPVOID,int,int,LPVOID,WCHAR *)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); eTitleStorageState TMSPP_GetTitleStorageState(int iPad); diff --git a/Minecraft.Client/Durango/Durango_App.cpp b/Minecraft.Client/Durango/Durango_App.cpp index e58a57c12..cb8e4fd82 100644 --- a/Minecraft.Client/Durango/Durango_App.cpp +++ b/Minecraft.Client/Durango/Durango_App.cpp @@ -42,7 +42,7 @@ void CConsoleMinecraftApp::HandleDLCLicenseChange() XCONTENT_DATA *pContentData=StorageManager.GetInstalledDLC(xOffer.wszProductID); - if((pContentData!=NULL) &&(pContentData->bTrialLicense==false)) + if((pContentData!=nullptr) &&(pContentData->bTrialLicense==false)) { DLCPack *pack = app.m_dlcManager.getPackFromProductID(xOffer.wszProductID); if(pack) @@ -193,7 +193,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages() { free(pDLCInfo->pbImageData); pDLCInfo->dwImageBytes=0; - pDLCInfo->pbImageData=NULL; + pDLCInfo->pbImageData=nullptr; } } } @@ -207,7 +207,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds swprintf(wchFilename,L"DLCImages/%s",wchName); - HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(wchFilename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( hFile == INVALID_HANDLE_VALUE ) { @@ -223,7 +223,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(WCHAR *wchName,PBYTE *ppbImageData,D DWORD dwBytesRead; PBYTE pbImageData=static_cast(malloc(*pdwBytes)); - if(ReadFile(hFile,pbImageData,*pdwBytes,&dwBytesRead,NULL)==FALSE) + if(ReadFile(hFile,pbImageData,*pdwBytes,&dwBytesRead,nullptr)==FALSE) { // failed free(pbImageData); @@ -244,7 +244,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(NULL); + app.setLevelGenerationOptions(nullptr); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -273,7 +273,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = NULL; + param->saveData = nullptr; app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -386,7 +386,7 @@ bool CConsoleMinecraftApp::UpdateProductId(XCONTENT_DATA &Data) // Do we have a product id for this? DLC_INFO *pDLCInfo=app.GetDLCInfoForProductName(Data.wszDisplayName); - if(pDLCInfo!=NULL) + if(pDLCInfo!=nullptr) { app.DebugPrintf("Updating product id for %ls\n",Data.wszDisplayName); swprintf_s(Data.wszProductID, 64,L"%ls",pDLCInfo->wsProductId.c_str()); @@ -557,7 +557,7 @@ int CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList(void *pParam,int iPad, { CConsoleMinecraftApp* pClass = static_cast(pParam); app.DebugPrintf("CConsoleMinecraftApp::Callback_TMSPPRetrieveFileList\n"); - if(lpvData!=NULL) + if(lpvData!=nullptr) { vector *pvTmsFileDetails=static_cast *>(lpvData); @@ -635,7 +635,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i // hack for now to upload the file // open the local file - file = CreateFile(L"DLCXbox1.cmp", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile(L"DLCXbox1.cmp", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -653,12 +653,12 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i PBYTE pbData= new BYTE [dwFileSize]; - ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); + ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); if(bytesRead==dwFileSize) { - //StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"DLCXbox1.cmp",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.cmp",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); + //StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"DLCXbox1.cmp",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.cmp",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); } Sleep(5000); } @@ -667,7 +667,7 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i /* // now the icon - file = CreateFile(L"TP06.png", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile(L"TP06.png", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -684,11 +684,11 @@ int CConsoleMinecraftApp::Callback_TMSPPReadDLCFile(void *pParam,int iPad, int i PBYTE pbData= new BYTE [dwFileSize]; - ReadFile(file,pbData,dwFileSize,&bytesRead,NULL); + ReadFile(file,pbData,dwFileSize,&bytesRead,nullptr); if(bytesRead==dwFileSize) { - StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",(PBYTE) pbData, dwFileSize,NULL,NULL, 0); + StorageManager.TMSPP_WriteFile(iPad,C4JStorage::eGlobalStorage_TitleUser,C4JStorage::TMS_FILETYPE_BINARY,L"TP06.png",(PBYTE) pbData, dwFileSize,nullptr,nullptr, 0); } Sleep(5000); } @@ -757,7 +757,7 @@ int CConsoleMinecraftApp::Callback_SaveGameIncompleteMessageBoxReturned(void *pP StorageManager.CancelIncompleteOperation(); break; case C4JStorage::EMessage_ResultThirdOption: - ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, NULL, eUILayer_Error, eUIGroup_Fullscreen); + ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, nullptr, eUILayer_Error, eUIGroup_Fullscreen); break; } return 0; diff --git a/Minecraft.Client/Durango/Durango_App.h b/Minecraft.Client/Durango/Durango_App.h index 4ae2a020c..ba4b26fb9 100644 --- a/Minecraft.Client/Durango/Durango_App.h +++ b/Minecraft.Client/Durango/Durango_App.h @@ -58,7 +58,7 @@ public: static void Callback_SaveGameIncomplete(void *pParam, C4JStorage::ESaveIncompleteType saveIncompleteType); static int Callback_SaveGameIncompleteMessageBoxReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - C4JStringTable *GetStringTable() { return NULL;} + C4JStringTable *GetStringTable() { return nullptr;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/Durango/Durango_Minecraft.cpp b/Minecraft.Client/Durango/Durango_Minecraft.cpp index b8487aec9..6e8b06cb4 100644 --- a/Minecraft.Client/Durango/Durango_Minecraft.cpp +++ b/Minecraft.Client/Durango/Durango_Minecraft.cpp @@ -271,7 +271,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice, return pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, - NULL, + nullptr, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES, pd3dPP, ppDevice ); @@ -290,7 +290,7 @@ void MemSect(int sect) #endif -HINSTANCE g_hInst = NULL; +HINSTANCE g_hInst = nullptr; Platform::Agile g_window; Windows::Foundation::Rect g_windowBounds; @@ -473,7 +473,7 @@ void oldWinMainInit() MSG msg = {0}; while( WM_QUIT != msg.message ) { - if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) + if( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -545,7 +545,7 @@ void oldWinMainInit() } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -784,7 +784,7 @@ void oldWinMainTick() else { MemSect(28); - pMinecraft->soundEngine->tick(NULL, 0.0f); + pMinecraft->soundEngine->tick(nullptr, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); diff --git a/Minecraft.Client/Durango/Durango_UIController.cpp b/Minecraft.Client/Durango/Durango_UIController.cpp index 7c9313e61..e27d91d23 100644 --- a/Minecraft.Client/Durango/Durango_UIController.cpp +++ b/Minecraft.Client/Durango/Durango_UIController.cpp @@ -75,7 +75,7 @@ void ConsoleUIController::render() example, no resolve targets are required. */ gdraw_D3D11_SetTileOrigin( m_pRenderTargetView.Get(), m_pDepthStencilView.Get(), - NULL, + nullptr, 0, 0 ); @@ -153,7 +153,7 @@ void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) { gdraw_D3D11_SetTileOrigin( m_pRenderTargetView.Get(), m_pDepthStencilView.Get(), - NULL, + nullptr, xPos, yPos ); } diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d10_shaders.inl b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d10_shaders.inl index d4d2bb229..6ea0d142f 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d10_shaders.inl +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d10_shaders.inl @@ -1364,7 +1364,7 @@ static DWORD pshader_exceptional_blend_12[276] = { }; static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { NULL, 0, }, + { nullptr, 0, }, { pshader_exceptional_blend_1, 1340, }, { pshader_exceptional_blend_2, 1444, }, { pshader_exceptional_blend_3, 1424, }, @@ -2672,10 +2672,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { { pshader_filter_9, 708, }, { pshader_filter_10, 1644, }, { pshader_filter_11, 1372, }, - { NULL, 0, }, - { NULL, 0, }, - { NULL, 0, }, - { NULL, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, { pshader_filter_16, 1740, }, { pshader_filter_17, 1732, }, { pshader_filter_18, 1820, }, @@ -2688,10 +2688,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { { pshader_filter_25, 1468, }, { pshader_filter_26, 1820, }, { pshader_filter_27, 1548, }, - { NULL, 0, }, - { NULL, 0, }, - { NULL, 0, }, - { NULL, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, }; static DWORD pshader_blur_2[320] = { @@ -3193,8 +3193,8 @@ static DWORD pshader_blur_9[621] = { }; static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { NULL, 0, }, - { NULL, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, { pshader_blur_2, 1280, }, { pshader_blur_3, 1452, }, { pshader_blur_4, 1624, }, diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.cpp b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.cpp index 0c106b3fd..b5bfe1f69 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.cpp +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.cpp @@ -64,7 +64,7 @@ static void *map_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf, bool discard) HRESULT hr = ctx->Map(buf, 0, discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, &msr); if (FAILED(hr)) { report_d3d_error(hr, "Map", "of buffer"); - return NULL; + return nullptr; } else return msr.pData; } @@ -76,12 +76,12 @@ static void unmap_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf) static RADINLINE void set_pixel_shader(ID3D11DeviceContext *ctx, ID3D11PixelShader *shader) { - ctx->PSSetShader(shader, NULL, 0); + ctx->PSSetShader(shader, nullptr, 0); } static RADINLINE void set_vertex_shader(ID3D11DeviceContext *ctx, ID3D11VertexShader *shader) { - ctx->VSSetShader(shader, NULL, 0); + ctx->VSSetShader(shader, nullptr, 0); } static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11_BLEND src, D3D11_BLEND dst) @@ -100,7 +100,7 @@ static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11 HRESULT hr = dev->CreateBlendState(&desc, &res); if (FAILED(hr)) { report_d3d_error(hr, "CreateBlendState", ""); - res = NULL; + res = nullptr; } return res; @@ -113,10 +113,10 @@ static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWi { *p = *src; if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, NULL, &p->pshader); + HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, nullptr, &p->pshader); if (FAILED(hr)) { report_d3d_error(hr, "CreatePixelShader", ""); - p->pshader = NULL; + p->pshader = nullptr; return; } } @@ -126,10 +126,10 @@ static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramW { *p = *src; if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, NULL, &p->vshader); + HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, nullptr, &p->vshader); if (FAILED(hr)) { report_d3d_error(hr, "CreateVertexShader", ""); - p->vshader = NULL; + p->vshader = nullptr; return; } } diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.h b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.h index c8db492a6..f8a5dc6d9 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.h +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d11.h @@ -41,7 +41,7 @@ IDOC extern GDrawFunctions * gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11 There can only be one D3D GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_D3D11_DestroyContext(void); /* Destroys the current GDraw context, if any. */ @@ -69,7 +69,7 @@ IDOC extern void gdraw_D3D11_SetTileOrigin(ID3D11RenderTargetView *main_rt, ID3D If your rendertarget uses multisampling, you also need to specify a shader resource view for a non-MSAA rendertarget texture (identically sized to main_rt) in non_msaa_rt. This is only used if the Flash content includes non-standard - blend modes which have to use a special blend shader, so you can leave it NULL + blend modes which have to use a special blend shader, so you can leave it nullptr if you forbid such content. You need to call this before Iggy calls any rendering functions. */ diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl index 1ab1f13f7..1cbac10fa 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_d3d1x_shared.inl @@ -196,16 +196,16 @@ static void safe_release(T *&p) { if (p) { p->Release(); - p = NULL; + p = nullptr; } } static void report_d3d_error(HRESULT hr, char *call, char *context) { if (hr == E_OUTOFMEMORY) - IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, context); + IggyGDrawSendWarning(nullptr, "GDraw D3D out of memory in %s%s", call, context); else - IggyGDrawSendWarning(NULL, "GDraw D3D error in %s%s: 0x%08x", call, context, hr); + IggyGDrawSendWarning(nullptr, "GDraw D3D error in %s%s: 0x%08x", call, context, hr); } static void unbind_resources(void) @@ -215,12 +215,12 @@ static void unbind_resources(void) // unset active textures and vertex/index buffers, // to make sure there are no dangling refs static ID3D1X(ShaderResourceView) *no_views[3] = { 0 }; - ID3D1X(Buffer) *no_vb = NULL; + ID3D1X(Buffer) *no_vb = nullptr; UINT no_offs = 0; d3d->PSSetShaderResources(0, 3, no_views); d3d->IASetVertexBuffers(0, 1, &no_vb, &no_offs, &no_offs); - d3d->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0); + d3d->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0); } static void api_free_resource(GDrawHandle *r) @@ -251,11 +251,11 @@ static void RADLINK gdraw_UnlockHandles(GDrawStats * /*stats*/) static void *start_write_dyn(DynBuffer *buf, U32 size) { - U8 *ptr = NULL; + U8 *ptr = nullptr; if (size > buf->size) { - IggyGDrawSendWarning(NULL, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size); - return NULL; + IggyGDrawSendWarning(nullptr, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size); + return nullptr; } // update statistics @@ -373,19 +373,19 @@ extern GDrawTexture *gdraw_D3D1X_(WrappedTextureCreate)(ID3D1X(ShaderResourceVie { GDrawStats stats={0}; GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle - p->handle.tex.d3d = NULL; + p->handle.tex.d3d = nullptr; p->handle.tex.d3d_view = tex_view; - p->handle.tex.d3d_rtview = NULL; + p->handle.tex.d3d_rtview = nullptr; p->handle.tex.w = 1; p->handle.tex.h = 1; - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); return (GDrawTexture *) p; } extern void gdraw_D3D1X_(WrappedTextureChange)(GDrawTexture *tex, ID3D1X(ShaderResourceView) *tex_view) { GDrawHandle *p = (GDrawHandle *) tex; - p->handle.tex.d3d = NULL; + p->handle.tex.d3d = nullptr; p->handle.tex.d3d_view = tex_view; } @@ -407,12 +407,12 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; DXGI_FORMAT dxgi_fmt; S32 bpp, size = 0, nmips = 0; if (width >= 16384 || height >= 16384) { - IggyGDrawSendWarning(NULL, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height); + IggyGDrawSendWarning(nullptr, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height); return false; } @@ -433,7 +433,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, // try to allocate memory for the client to write to p->texture_data = (U8 *) IggyGDrawMalloc(size); if (!p->texture_data) { - IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); return false; } @@ -446,9 +446,9 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, t->handle.tex.w = width; t->handle.tex.h = height; - t->handle.tex.d3d = NULL; - t->handle.tex.d3d_view = NULL; - t->handle.tex.d3d_rtview = NULL; + t->handle.tex.d3d = nullptr; + t->handle.tex.d3d_view = nullptr; + t->handle.tex.d3d_rtview = nullptr; p->texture_type = GDRAW_TEXTURE_TYPE_rgba; p->p0 = t; @@ -512,7 +512,7 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI // and create a corresponding shader resource view failed_call = "CreateShaderResourceView"; - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); + hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view); done: if (!FAILED(hr)) { @@ -525,7 +525,7 @@ done: safe_release(t->handle.tex.d3d_view); gdraw_HandleCacheAllocateFail(t); - t = NULL; + t = nullptr; report_d3d_error(hr, failed_call, " while creating texture"); } @@ -554,8 +554,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void * /*unique_id*/ static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != NULL); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == NULL) { + assert(t != nullptr); // @GDRAW_ASSERT + if (t->owner == unique_id || unique_id == nullptr) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -595,7 +595,7 @@ static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba) return; } - hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, NULL, &gdraw->aa_tex_view); + hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, nullptr, &gdraw->aa_tex_view); if (FAILED(hr)) { report_d3d_error(hr, "CreateShaderResourceView", " while creating texture"); safe_release(gdraw->aa_tex); @@ -616,8 +616,8 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat if (p->vertex_data && p->index_data) { GDrawHandle *vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, stats); if (vb) { - vb->handle.vbuf.verts = NULL; - vb->handle.vbuf.inds = NULL; + vb->handle.vbuf.verts = nullptr; + vb->handle.vbuf.inds = nullptr; p->vertex_data_length = vbuf_size; p->index_data_length = ibuf_size; @@ -661,7 +661,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf safe_release(vb->handle.vbuf.inds); gdraw_HandleCacheAllocateFail(vb); - vb = NULL; + vb = nullptr; report_d3d_error(hr, "CreateBuffer", " creating vertex buffer"); } else { @@ -682,7 +682,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != NULL); // @GDRAW_ASSERT + assert(h != nullptr); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_free(h, stats); } @@ -712,31 +712,31 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) // ran out of RTs, allocate a new one S32 size = gdraw->frametex_width * gdraw->frametex_height * 4; if (gdraw->rendertargets.bytes_free < size) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes); - return NULL; + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes); + return nullptr; } t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); return t; } D3D1X_(TEXTURE2D_DESC) desc = { gdraw->frametex_width, gdraw->frametex_height, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM, { 1, 0 }, D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_SHADER_RESOURCE) | D3D1X_(BIND_RENDER_TARGET), 0, 0 }; - t->handle.tex.d3d = NULL; - t->handle.tex.d3d_view = NULL; - t->handle.tex.d3d_rtview = NULL; + t->handle.tex.d3d = nullptr; + t->handle.tex.d3d_view = nullptr; + t->handle.tex.d3d_rtview = nullptr; - HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &t->handle.tex.d3d); + HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &t->handle.tex.d3d); failed_call = "CreateTexture2D"; if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); + hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view); failed_call = "CreateTexture2D"; } if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_rtview); + hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_rtview); failed_call = "CreateRenderTargetView"; } @@ -748,7 +748,7 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) report_d3d_error(hr, failed_call, " creating rendertarget"); - return NULL; + return nullptr; } gdraw_HandleCacheAllocateEnd(t, size, (void *) 1, GDRAW_HANDLE_STATE_locked); @@ -768,10 +768,10 @@ static ID3D1X(DepthStencilView) *get_rendertarget_depthbuffer(GDrawStats *stats) D3D1X_(TEXTURE2D_DESC) desc = { gdraw->frametex_width, gdraw->frametex_height, 1, 1, DXGI_FORMAT_D24_UNORM_S8_UINT, { 1, 0 }, D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_DEPTH_STENCIL), 0, 0 }; - HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &gdraw->rt_depth_buffer); + HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &gdraw->rt_depth_buffer); failed_call = "CreateTexture2D"; if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, NULL, &gdraw->depth_buffer[1]); + hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, nullptr, &gdraw->depth_buffer[1]); failed_call = "CreateDepthStencilView while creating rendertarget"; } @@ -1110,7 +1110,7 @@ static void set_render_target(GDrawStats *stats) gdraw->d3d_context->OMSetRenderTargets(1, &target, gdraw->depth_buffer[0]); gdraw->d3d_context->RSSetState(gdraw->raster_state[gdraw->main_msaa]); } else { - ID3D1X(DepthStencilView) *depth = NULL; + ID3D1X(DepthStencilView) *depth = nullptr; if (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil)) depth = get_rendertarget_depthbuffer(stats); @@ -1125,15 +1125,15 @@ static void set_render_target(GDrawStats *stats) static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format /*format*/, U32 flags, void *owner, GDrawStats *stats) { GDrawFramebufferState *n = gdraw->cur+1; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { assert(0); - IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } @@ -1147,10 +1147,10 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex n->flags = flags; n->color_buffer = t; - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT ++gdraw->cur; - gdraw->cur->cached = owner != NULL; + gdraw->cur->cached = owner != nullptr; if (owner) { gdraw->cur->base_x = region->x0; gdraw->cur->base_y = region->y0; @@ -1229,9 +1229,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != NULL); // @GDRAW_ASSERT + assert(m->color_buffer != nullptr); // @GDRAW_ASSERT } - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT // switch back to old render target set_render_target(stats); @@ -1288,8 +1288,8 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap { ID3D1XContext *d3d = gdraw->d3d_context; - if (tex == NULL) { - ID3D1X(ShaderResourceView) *notex = NULL; + if (tex == nullptr) { + ID3D1X(ShaderResourceView) *notex = nullptr; d3d->PSSetShaderResources(texunit, 1, ¬ex); } else { GDrawHandle *h = (GDrawHandle *) tex; @@ -1300,7 +1300,7 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap static void RADLINK gdraw_Set3DTransform(F32 *mat) { - if (mat == NULL) + if (mat == nullptr) gdraw->use_3d = 0; else { gdraw->use_3d = 1; @@ -1363,9 +1363,9 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta // in stencil set mode, prefer not doing any shading at all // but if alpha test is on, we need to make an exception -#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do NULL PS it seems +#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do nullptr PS it seems if (which != GDRAW_TEXTURE_alpha_test) - program = NULL; + program = nullptr; else #endif { @@ -1475,7 +1475,7 @@ static int vertsize[GDRAW_vformat__basic_count] = { // Draw triangles with a given renderstate // -static void tag_resources(void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) +static void tag_resources(void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) { U64 now = gdraw->frame_counter; if (r1) ((GDrawHandle *) r1)->fence.value = now; @@ -1687,7 +1687,7 @@ static void set_clamp_constant(F32 *constant, GDrawTexture *tex) static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *stats) { - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) return; set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); @@ -1775,7 +1775,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawHandle *blend_tex = NULL; + GDrawHandle *blend_tex = nullptr; // for crazy blend modes, we need to read back from the framebuffer // and do the blending in the pixel shader. we do this with copies @@ -1859,18 +1859,18 @@ static void destroy_shader(ProgramWithCachedVariableLocations *p) { if (p->pshader) { p->pshader->Release(); - p->pshader = NULL; + p->pshader = nullptr; } } static ID3D1X(Buffer) *create_dynamic_buffer(U32 size, U32 bind) { D3D1X_(BUFFER_DESC) desc = { size, D3D1X_(USAGE_DYNAMIC), bind, D3D1X_(CPU_ACCESS_WRITE), 0 }; - ID3D1X(Buffer) *buf = NULL; - HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, NULL, &buf); + ID3D1X(Buffer) *buf = nullptr; + HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, nullptr, &buf); if (FAILED(hr)) { report_d3d_error(hr, "CreateBuffer", " creating dynamic vertex buffer"); - buf = NULL; + buf = nullptr; } return buf; } @@ -1907,7 +1907,7 @@ static void create_all_shaders_and_state(void) HRESULT hr = d3d->CreateInputLayout(vformats[i].desc, vformats[i].nelem, vsh->bytecode, vsh->size, &gdraw->inlayout[i]); if (FAILED(hr)) { report_d3d_error(hr, "CreateInputLayout", ""); - gdraw->inlayout[i] = NULL; + gdraw->inlayout[i] = nullptr; } } @@ -2026,11 +2026,11 @@ static void create_all_shaders_and_state(void) hr = gdraw->d3d_device->CreateBuffer(&bufdesc, &data, &gdraw->quad_ib); if (FAILED(hr)) { report_d3d_error(hr, "CreateBuffer", " for constants"); - gdraw->quad_ib = NULL; + gdraw->quad_ib = nullptr; } IggyGDrawFree(inds); } else - gdraw->quad_ib = NULL; + gdraw->quad_ib = nullptr; } static void destroy_all_shaders_and_state() @@ -2103,7 +2103,7 @@ static void free_gdraw() if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = NULL; + gdraw = nullptr; } static bool alloc_dynbuffer(U32 size) @@ -2139,7 +2139,7 @@ static bool alloc_dynbuffer(U32 size) gdraw->max_quad_vert_count = RR_MIN(size / sizeof(gswf_vertex_xyst), QUAD_IB_COUNT * 4); gdraw->max_quad_vert_count &= ~3; // must be multiple of four - return gdraw->dyn_vb.buffer != NULL && gdraw->dyn_ib.buffer != NULL; + return gdraw->dyn_vb.buffer != nullptr && gdraw->dyn_ib.buffer != nullptr; } int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes) @@ -2178,7 +2178,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 IggyGDrawFree(gdraw->texturecache); } gdraw->texturecache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture)); - return gdraw->texturecache != NULL; + return gdraw->texturecache != nullptr; case GDRAW_D3D1X_(RESOURCE_vertexbuffer): if (gdraw->vbufcache) { @@ -2186,7 +2186,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 IggyGDrawFree(gdraw->vbufcache); } gdraw->vbufcache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != NULL; + return gdraw->vbufcache != nullptr; case GDRAW_D3D1X_(RESOURCE_dynbuffer): unbind_resources(); @@ -2202,7 +2202,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 w, S32 h) { gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return NULL; + if (!gdraw) return nullptr; memset(gdraw, 0, sizeof(*gdraw)); @@ -2217,7 +2217,7 @@ static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 if (!gdraw->texturecache || !gdraw->vbufcache || !alloc_dynbuffer(gdraw_limits[GDRAW_D3D1X_(RESOURCE_dynbuffer)].num_bytes)) { free_gdraw(); - return NULL; + return nullptr; } create_all_shaders_and_state(); @@ -2288,7 +2288,7 @@ void gdraw_D3D1X_(DestroyContext)(void) if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats); if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats); - gdraw->d3d_device = NULL; + gdraw->d3d_device = nullptr; } free_gdraw(); @@ -2351,7 +2351,7 @@ void RADLINK gdraw_D3D1X_(GetResourceUsageStats)(gdraw_resourcetype type, S32 *h case GDRAW_D3D1X_(RESOURCE_texture): cache = gdraw->texturecache; break; case GDRAW_D3D1X_(RESOURCE_vertexbuffer): cache = gdraw->vbufcache; break; case GDRAW_D3D1X_(RESOURCE_dynbuffer): *handles_used = 0; *bytes_used = gdraw->last_dyn_maxalloc; return; - default: cache = NULL; break; + default: cache = nullptr; break; } *handles_used = *bytes_used = 0; @@ -2408,7 +2408,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, case IFT_FORMAT_DXT3 : size=16; d3dfmt = DXGI_FORMAT_BC2_UNORM; blk = 4; break; case IFT_FORMAT_DXT5 : size=16; d3dfmt = DXGI_FORMAT_BC3_UNORM; blk = 4; break; default: { - IggyGDrawSendWarning(NULL, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); + IggyGDrawSendWarning(nullptr, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); goto done; } } @@ -2424,7 +2424,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, free_data = (U8 *) IggyGDrawMalloc(total_size); if (!free_data) { - IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); goto done; } @@ -2457,7 +2457,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, if (FAILED(hr)) goto done; failed_call = "CreateShaderResourceView for texture creation"; - hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view); + hr = gdraw->d3d_device->CreateShaderResourceView(tex, nullptr, &view); if (FAILED(hr)) goto done; t = gdraw_D3D1X_(WrappedTextureCreate)(view); diff --git a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl index 11a197e67..1790de77e 100644 --- a/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Durango/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != NULL) { + while (s != nullptr) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, NULL); + return gdraw_HandleCacheLockStats(t, owner, nullptr); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = NULL; - c->state[i].cache = NULL; // should never follow cache link from sentinels! + c->state[i].owner = nullptr; + c->state[i].cache = nullptr; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = NULL; + c->state[i].raw_ptr = nullptr; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = NULL; + c->handle[i].raw_ptr = nullptr; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = NULL; + c->alloc = nullptr; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = NULL; + c->alloc_other = nullptr; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = NULL; + t->raw_ptr = nullptr; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -558,7 +558,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : NULL; + return (sentinel->next != sentinel) ? sentinel->next : nullptr; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -1090,7 +1090,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = NULL; + *start = nullptr; *num_bytes = 0; return; } else { @@ -1127,7 +1127,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return NULL; + return nullptr; arena->current = ptr + size; return ptr; @@ -1152,7 +1152,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, NULL-terminated list of elements in each hash +// There's a single-linked, nullptr-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1161,7 +1161,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, NULL-terminated list of unused blocks. Every block is either +// single-linked, nullptr-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1379,7 +1379,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != NULL); + GFXALLOC_ASSERT(alloc->unused_list != nullptr); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1452,7 +1452,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return NULL; + return nullptr; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1460,7 +1460,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return NULL; + return nullptr; memset(a, 0, size); @@ -1501,16 +1501,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, NULL, 0,0); + debug_complete_check(a, nullptr, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = NULL; + gfx_block_info *cur, *best = nullptr; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, NULL, 0,0); +debug_complete_check(alloc, nullptr, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1560,7 +1560,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return NULL; // not enough space! + return nullptr; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1730,7 +1730,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = NULL; + b->prev = nullptr; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1743,7 +1743,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1905,7 +1905,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = NULL; + void *ptr = nullptr; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2295,7 +2295,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = NULL; + ring->cur = nullptr; ring->seg_size = 0; } @@ -2305,7 +2305,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return NULL; // nope, won't fit + return nullptr; // nope, won't fit assert(align <= ring->align); @@ -2410,7 +2410,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2430,8 +2430,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return NULL; + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return nullptr; } #ifndef GDRAW_MANAGE_MEM @@ -2440,7 +2440,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2448,7 +2448,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, NULL, "memory"); + gdraw_res_alloc_outofmem(c, nullptr, "memory"); break; } } @@ -2463,8 +2463,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == NULL) { - gdraw_res_alloc_outofmem(c, NULL, "handles"); + if (t == nullptr) { + gdraw_res_alloc_outofmem(c, nullptr, "handles"); } } } @@ -2508,7 +2508,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = NULL; + r->owner = nullptr; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2516,11 +2516,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = NULL; + void *ptr = nullptr; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2532,7 +2532,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, NULL, "handles"); + return gdraw_res_alloc_outofmem(c, nullptr, "handles"); } // try to allocate first diff --git a/Minecraft.Client/Durango/Iggy/include/gdraw.h b/Minecraft.Client/Durango/Iggy/include/gdraw.h index 404a2642b..7cc4ddd0e 100644 --- a/Minecraft.Client/Durango/Iggy/include/gdraw.h +++ b/Minecraft.Client/Durango/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is NULL, then the pointers in 'prim' are machine pointers, and + If buf is nullptr, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-NULL, then use the appropriate vertex buffer, and the + If buf is non-nullptr, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or NULL if an error occured + $:return Handle for the newly created texture, or nullptr if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/Durango/Iggy/include/iggyexpruntime.h b/Minecraft.Client/Durango/Iggy/include/iggyexpruntime.h index 1f1a90a1c..a42ccbfff 100644 --- a/Minecraft.Client/Durango/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/Durango/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP +Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp b/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp index e1d056a7d..cc19b7382 100644 --- a/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp +++ b/Minecraft.Client/Durango/Leaderboards/DurangoLeaderboardManager.cpp @@ -14,7 +14,7 @@ DurangoLeaderboardManager::DurangoLeaderboardManager() m_openSessions = 0; m_xboxLiveContext = nullptr; - m_scores = NULL; + m_scores = nullptr; m_readCount = 0; m_maxRank = 0; m_waitingForProfiles = false; @@ -160,7 +160,7 @@ void DurangoLeaderboardManager::Tick() m_displayNames.clear(); } - //assert(m_scores != NULL || m_readCount == 0); + //assert(m_scores != nullptr || m_readCount == 0); view.m_numQueries = m_readCount; view.m_queries = m_scores; @@ -170,7 +170,7 @@ void DurangoLeaderboardManager::Tick() eStatsReturn ret = view.m_numQueries > 0 ? eStatsReturn_Success : eStatsReturn_NoResults; - if (m_readListener != NULL) + if (m_readListener != nullptr) { app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _)\n", ret, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -178,7 +178,7 @@ void DurangoLeaderboardManager::Tick() app.DebugPrintf("[LeaderboardManager] Deleting scores\n"); delete [] m_scores; - m_scores = NULL; + m_scores = nullptr; setState(eStatsState_Idle); } @@ -186,9 +186,9 @@ void DurangoLeaderboardManager::Tick() case eStatsState_Failed: view.m_numQueries = 0; - view.m_queries = NULL; + view.m_queries = nullptr; - if ( m_readListener != NULL ) + if ( m_readListener != nullptr ) { m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); } @@ -371,7 +371,7 @@ void DurangoLeaderboardManager::FlushStats() //Cancel the current operation void DurangoLeaderboardManager::CancelOperation() { - m_readListener = NULL; + m_readListener = nullptr; setState(eStatsState_Canceled); if(m_leaderboardAsyncOp) m_leaderboardAsyncOp->Cancel(); @@ -458,7 +458,7 @@ void DurangoLeaderboardManager::runLeaderboardRequest(WF::IAsyncOperationTotalRowCount; m_readCount = lastResult->Rows->Size; - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_scores = new ReadScore[m_readCount]; ZeroMemory(m_scores, sizeof(ReadScore) * m_readCount); diff --git a/Minecraft.Client/Durango/Leaderboards/DurangoStatsDebugger.cpp b/Minecraft.Client/Durango/Leaderboards/DurangoStatsDebugger.cpp index caa5857e9..5ac711417 100644 --- a/Minecraft.Client/Durango/Leaderboards/DurangoStatsDebugger.cpp +++ b/Minecraft.Client/Durango/Leaderboards/DurangoStatsDebugger.cpp @@ -84,7 +84,7 @@ vector *StatParam::getStats() return out; } -DurangoStatsDebugger *DurangoStatsDebugger::instance = NULL; +DurangoStatsDebugger *DurangoStatsDebugger::instance = nullptr; DurangoStatsDebugger::DurangoStatsDebugger() { @@ -320,7 +320,7 @@ DurangoStatsDebugger *DurangoStatsDebugger::Initialize() void DurangoStatsDebugger::PrintStats(int iPad) { - if (instance == NULL) instance = Initialize(); + if (instance == nullptr) instance = Initialize(); vector *tmp = instance->getStats(); instance->m_printQueue.insert(instance->m_printQueue.end(), tmp->begin(), tmp->end()); diff --git a/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp b/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp index 18f4328c5..f97f9bb33 100644 --- a/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp +++ b/Minecraft.Client/Durango/Leaderboards/GameProgress.cpp @@ -10,11 +10,11 @@ namespace WFC = Windows::Foundation::Collections; namespace MXSA = Microsoft::Xbox::Services::Achievements; namespace CC = concurrency; -GameProgress *GameProgress::instance = NULL; +GameProgress *GameProgress::instance = nullptr; void GameProgress::Flush(int iPad) { - if (instance == NULL) + if (instance == nullptr) instance = new GameProgress(); instance->updatePlayer(iPad); @@ -22,7 +22,7 @@ void GameProgress::Flush(int iPad) void GameProgress::Tick() { - if (instance == NULL) + if (instance == nullptr) instance = new GameProgress(); long long currentTime = System::currentTimeMillis(); diff --git a/Minecraft.Client/Durango/Miles/include/mss.h b/Minecraft.Client/Durango/Miles/include/mss.h index 531dcbc92..a9fd231a9 100644 --- a/Minecraft.Client/Durango/Miles/include/mss.h +++ b/Minecraft.Client/Durango/Miles/include/mss.h @@ -584,7 +584,7 @@ typedef enum } MSS_SPEAKER; // -// Pass to AIL_midiOutOpen for NULL MIDI driver +// Pass to AIL_midiOutOpen for nullptr MIDI driver // #define MIDI_NULL_DRIVER ((U32)(S32)-2) @@ -833,7 +833,7 @@ the enumeration function until it returns 0. #define DEFAULT_DPWOD ((UINTa)-1) // Preferred WaveOut device == WAVE_MAPPER #define DIG_PREFERRED_DS_DEVICE 20 -#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default NULL GUID +#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default nullptr GUID #define MDI_SEQUENCES 21 @@ -1305,7 +1305,7 @@ typedef ASIRESULT (AILCALL *ASI_STARTUP)(void); typedef ASIRESULT (AILCALL * ASI_SHUTDOWN)(void); // -// Return codec error message, or NULL if no errors have occurred since +// Return codec error message, or nullptr if no errors have occurred since // last call // // The ASI error text state is global to all streams @@ -1878,7 +1878,7 @@ typedef struct _S3DSTATE // Portion of HSAMPLE that deals with 3D posi F32 spread; - HSAMPLE owner; // May be NULL if used for temporary/internal calculations + HSAMPLE owner; // May be nullptr if used for temporary/internal calculations AILFALLOFFCB falloff_function; // User function for min/max distance calculations, if desired MSSVECTOR3D position_graph[MILES_MAX_SEGMENT_COUNT]; @@ -2460,7 +2460,7 @@ typedef struct _DIG_DRIVER // Handle to digital audio driver S32 DS_initialized; - AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none) + AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or nullptr if none) AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim) S32 DS_buffer_size; // Size of entire output buffer @@ -4866,10 +4866,10 @@ typedef struct U8 *MP3_file_image; // Original MP3_file_image pointer passed to AIL_inspect_MP3() S32 MP3_image_size; // Original MP3_image_size passed to AIL_inspect_MP3() - U8 *ID3v2; // ID3v2 tag, if not NULL + U8 *ID3v2; // ID3v2 tag, if not nullptr S32 ID3v2_size; // Size of tag in bytes - U8 *ID3v1; // ID3v1 tag, if not NULL (always 128 bytes long if present) + U8 *ID3v1; // ID3v1 tag, if not nullptr (always 128 bytes long if present) U8 *start_MP3_data; // Pointer to start of data area in file (not necessarily first valid frame) U8 *end_MP3_data; // Pointer to last valid byte in MP3 data area (before ID3v1 tag, if any) diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp index a054a716d..cb39b5629 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager.cpp @@ -25,7 +25,7 @@ int DQRNetworkManager::m_bootUserIndex; wstring DQRNetworkManager::m_bootSessionName; wstring DQRNetworkManager::m_bootServiceConfig; wstring DQRNetworkManager::m_bootSessionTemplate; -DQRNetworkManager * DQRNetworkManager::s_pDQRManager = NULL; +DQRNetworkManager * DQRNetworkManager::s_pDQRManager = nullptr; //using namespace Windows::Xbox::Networking; @@ -87,16 +87,16 @@ DQRNetworkManager::DQRNetworkManager(IDQRNetworkManagerListener *listener) memset(&m_roomSyncData, 0, sizeof(m_roomSyncData)); memset(m_players, 0, sizeof(m_players)); - m_CreateSessionThread = NULL; - m_GetFriendPartyThread = NULL; - m_UpdateCustomSessionDataThread = NULL; + m_CreateSessionThread = nullptr; + m_GetFriendPartyThread = nullptr; + m_UpdateCustomSessionDataThread = nullptr; - m_CheckPartyInviteThread = NULL; + m_CheckPartyInviteThread = nullptr; m_notifyForFullParty = false; m_customDataDirtyUpdateTicks = 0; m_sessionResultCount = 0; - m_sessionSearchResults = NULL; + m_sessionSearchResults = nullptr; m_joinSessionUserMask = 0; m_cancelJoinFromSearchResult = false; @@ -274,7 +274,7 @@ void DQRNetworkManager::JoinSession(int playerMask) // If we found the session, then set the status of this member to be active (should be reserved). This will stop our slot timing out and us being dropped out of the session. if( session != nullptr ) { - if(!IsPlayerInSession(joiningUser->XboxUserId, session, NULL) ) + if(!IsPlayerInSession(joiningUser->XboxUserId, session, nullptr) ) { app.DebugPrintf("DNM_INT_STATE_JOINING_FAILED didn't find required player in session\n"); SetState(DNM_INT_STATE_JOINING_FAILED); @@ -600,7 +600,7 @@ bool DQRNetworkManager::AddLocalPlayerByUserIndex(int userIndex) m_joinSessionXUIDs[userIndex] = ProfileManager.GetUser(userIndex)->XboxUserId; m_partyController->AddLocalUsersToParty(1 << userIndex, ProfileManager.GetUser(0)); - m_addLocalPlayerSuccessPlayer = NULL; + m_addLocalPlayerSuccessPlayer = nullptr; m_addLocalPlayerState = DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS; } } @@ -763,7 +763,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerBySmallId(int idx) } } } - return NULL; + return nullptr; } DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid) @@ -778,7 +778,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetPlayerByXuid(PlayerUID xuid) } } } - return NULL; + return nullptr; } // Retrieve player display name by gamertag @@ -809,7 +809,7 @@ DQRNetworkPlayer *DQRNetworkManager::GetLocalPlayerByUserIndex(int idx) } } } - return NULL; + return nullptr; } DQRNetworkPlayer *DQRNetworkManager::GetHostPlayer() @@ -967,19 +967,19 @@ void DQRNetworkManager::Tick_Party() void DQRNetworkManager::Tick_CustomSessionData() { // If there was a thread updaing our custom session data, then clear it up if it is done - if( m_UpdateCustomSessionDataThread != NULL ) + if( m_UpdateCustomSessionDataThread != nullptr ) { if( !m_UpdateCustomSessionDataThread->isRunning() ) { delete m_UpdateCustomSessionDataThread; - m_UpdateCustomSessionDataThread = NULL; + m_UpdateCustomSessionDataThread = nullptr; } } // If our custom data is dirty, and we aren't currently updating, then kick off a thread to update it if( m_isHosting && ( !m_isOfflineGame ) ) { - if( m_UpdateCustomSessionDataThread == NULL ) + if( m_UpdateCustomSessionDataThread == nullptr ) { if( m_customDataDirtyUpdateTicks ) { @@ -1003,7 +1003,7 @@ void DQRNetworkManager::Tick_AddAndRemoveLocalPlayers() // A lot of handling adding local players is handled asynchronously. Trying to avoid having the callbacks that may result from this being called from the task threads, so handling this aspect of it here in the tick if( m_addLocalPlayerState == DNM_ADD_PLAYER_STATE_COMPLETE_SUCCESS ) { - // If we've completed, and we're the host, then we should have the new player to create stored here in m_localPlayerSuccessCreated. For clients, this will just be NULL as the actual + // If we've completed, and we're the host, then we should have the new player to create stored here in m_localPlayerSuccessCreated. For clients, this will just be nullptr as the actual // adding of the player happens as part of a longer process of the host creating us a reserved slot etc. etc. if( m_addLocalPlayerSuccessPlayer ) { @@ -1201,7 +1201,7 @@ void DQRNetworkManager::Tick_StateMachine() break; case DNM_INT_STATE_HOSTING_WAITING_TO_PLAY: delete m_CreateSessionThread; - m_CreateSessionThread = NULL; + m_CreateSessionThread = nullptr; // If the game is offline we can transition straight to playing if (m_isOfflineGame) StartGame(); break; @@ -1247,10 +1247,10 @@ void DQRNetworkManager::Tick_CheckInviteParty() if( !m_CheckPartyInviteThread->isRunning() ) { delete m_CheckPartyInviteThread; - m_CheckPartyInviteThread = NULL; + m_CheckPartyInviteThread = nullptr; } } - if( m_CheckPartyInviteThread == NULL ) + if( m_CheckPartyInviteThread == nullptr ) { m_inviteReceived = false; m_CheckPartyInviteThread = new C4JThread(&DQRNetworkManager::_CheckInviteThreadProc, this, "Check invite thread"); @@ -1449,7 +1449,7 @@ void DQRNetworkManager::UpdateRoomSyncPlayers(RoomSyncData *pNewSyncData) for( int j = 0; j < m_roomSyncData.playerCount; j++ ) { tempPlayers.push_back(m_players[j]); - m_players[j] = NULL; + m_players[j] = nullptr; } // For each new player, it's either: @@ -1597,7 +1597,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayersWithSessionAddress(unsigned int ses m_listener->HandlePlayerLeaving(removedPlayers[i]); delete removedPlayers[i]; memset(&m_roomSyncData.players[m_roomSyncData.playerCount + i], 0, sizeof(PlayerSyncData)); - m_players[m_roomSyncData.playerCount + i] = NULL; + m_players[m_roomSyncData.playerCount + i] = nullptr; } LeaveCriticalSection(&m_csRoomSyncData); } @@ -1628,7 +1628,7 @@ void DQRNetworkManager::RemoveRoomSyncPlayer(DQRNetworkPlayer *pPlayer) m_listener->HandlePlayerLeaving(removedPlayers[i]); delete removedPlayers[i]; memset(&m_roomSyncData.players[m_roomSyncData.playerCount + i], 0, sizeof(PlayerSyncData)); - m_players[m_roomSyncData.playerCount + i] = NULL; + m_players[m_roomSyncData.playerCount + i] = nullptr; } } @@ -1643,7 +1643,7 @@ void DQRNetworkManager::SendRoomSyncInfo() // (2) A single byte internal data tag // (3) An unsigned int encoding the size of the combined size of all the strings in stage (5) // (4) The RoomSyncData structure itself - // (5) A wchar NULL terminated string for every active player to encode the XUID + // (5) A wchar nullptr terminated string for every active player to encode the XUID unsigned int xuidBytes = 0; for( int i = 0 ; i < m_roomSyncData.playerCount; i++ ) { @@ -1689,7 +1689,7 @@ void DQRNetworkManager::SendAddPlayerFailed(Platform::String^ xuid) // (1) 2 byte general header // (2) A single byte internal data tag // (3) An unsigned int encoding the size size of the string - // (5) A wchar NULL terminated string storing the xuid of the player which has failed to join + // (5) A wchar nullptr terminated string storing the xuid of the player which has failed to join unsigned int xuidBytes = sizeof(wchar_t) * ( xuid->Length() + 1 ); @@ -2614,7 +2614,7 @@ void DQRNetworkManager::LeaveRoom() for( int i = 0; i < m_roomSyncData.playerCount; i++ ) { delete m_players[i]; - m_players[i] = NULL; + m_players[i] = nullptr; } memset(&m_roomSyncData, 0, sizeof(m_roomSyncData)); m_displayNames.clear(); diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager.h b/Minecraft.Client/Durango/Network/DQRNetworkManager.h index 5f7b8d908..e0d4d9c76 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager.h +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager.h @@ -221,7 +221,7 @@ public: class SessionSearchResult { public: - SessionSearchResult() { m_extData = NULL; } + SessionSearchResult() { m_extData = nullptr; } ~SessionSearchResult() { free(m_extData); } wstring m_partyId; wstring m_sessionName; diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp index 86d37a6e0..0822a93c6 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_FriendSessions.cpp @@ -49,7 +49,7 @@ bool DQRNetworkManager::FriendPartyManagerSearch() m_sessionResultCount = 0; delete [] m_sessionSearchResults; - m_sessionSearchResults = NULL; + m_sessionSearchResults = nullptr; m_GetFriendPartyThread = new C4JThread(&_GetFriendsThreadProc,this,"GetFriendsThreadProc"); m_GetFriendPartyThread->Run(); @@ -61,7 +61,7 @@ bool DQRNetworkManager::FriendPartyManagerSearch() void DQRNetworkManager::FriendPartyManagerGetSessionInfo(int idx, SessionSearchResult *searchResult) { assert( idx < m_sessionResultCount ); - assert( ( m_GetFriendPartyThread == NULL ) || ( !m_GetFriendPartyThread->isRunning()) ); + assert( ( m_GetFriendPartyThread == nullptr ) || ( !m_GetFriendPartyThread->isRunning()) ); // Need to make sure that copied data has independently allocated m_extData, so both copies can be freed *searchResult = m_sessionSearchResults[idx]; diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp index 9494683d4..eed3e8511 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_SendReceive.cpp @@ -24,7 +24,7 @@ void DQRNetworkManager::BytesReceived(int smallId, BYTE *bytes, int byteCount) DQRNetworkPlayer *host = GetPlayerBySmallId(m_hostSmallId); DQRNetworkPlayer *client = GetPlayerBySmallId(smallId); - if( ( host == NULL ) || ( client == NULL ) ) + if( ( host == nullptr ) || ( client == nullptr ) ) { return; } @@ -238,7 +238,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, UpdateRoomSyncPlayers((RoomSyncData *)connectionInfo->m_pucRoomSyncData); delete connectionInfo->m_pucRoomSyncData; - connectionInfo->m_pucRoomSyncData = NULL; + connectionInfo->m_pucRoomSyncData = nullptr; connectionInfo->m_internalDataState = DQRConnectionInfo::ConnectionState_InternalHeaderByte; // If we haven't actually established a connection yet for this channel, then this is the point where we can consider this active @@ -267,7 +267,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, { if( m_currentUserMask & ( 1 << i ) ) { - if( GetLocalPlayerByUserIndex(i) == NULL ) + if( GetLocalPlayerByUserIndex(i) == nullptr ) { allLocalPlayersHere = false; } @@ -307,7 +307,7 @@ void DQRNetworkManager::BytesReceivedInternal(DQRConnectionInfo *connectionInfo, // XUID fully read, can now handle what to do with it AddPlayerFailed(ref new Platform::String( (wchar_t *)connectionInfo->m_pucAddFailedPlayerData ) ); delete [] connectionInfo->m_pucAddFailedPlayerData; - connectionInfo->m_pucAddFailedPlayerData = NULL; + connectionInfo->m_pucAddFailedPlayerData = nullptr; connectionInfo->m_internalDataState = DQRConnectionInfo::ConnectionState_InternalHeaderByte; } diff --git a/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp b/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp index 29daa23e6..ae7094fb3 100644 --- a/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp +++ b/Minecraft.Client/Durango/Network/DQRNetworkManager_XRNSEvent.cpp @@ -603,7 +603,7 @@ void DQRNetworkManager::RTS_StartCient() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_START_CLIENT; - message.m_pucData = NULL; + message.m_pucData = nullptr; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); @@ -614,7 +614,7 @@ void DQRNetworkManager::RTS_StartHost() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_START_HOST; - message.m_pucData = NULL; + message.m_pucData = nullptr; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); @@ -625,7 +625,7 @@ void DQRNetworkManager::RTS_Terminate() EnterCriticalSection(&m_csRTSMessageQueueOutgoing); RTS_Message message; message.m_eType = eRTSMessageType::RTS_MESSAGE_TERMINATE; - message.m_pucData = NULL; + message.m_pucData = nullptr; message.m_dataSize = 0; m_RTSMessageQueueOutgoing.push(message); LeaveCriticalSection(&m_csRTSMessageQueueOutgoing); diff --git a/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp b/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp index bfb3c9a84..84a34a97e 100644 --- a/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp +++ b/Minecraft.Client/Durango/Network/NetworkPlayerDurango.cpp @@ -4,7 +4,7 @@ NetworkPlayerDurango::NetworkPlayerDurango(DQRNetworkPlayer *qnetPlayer) { m_dqrPlayer = qnetPlayer; - m_pSocket = NULL; + m_pSocket = nullptr; } unsigned char NetworkPlayerDurango::GetSmallId() diff --git a/Minecraft.Client/Durango/Network/PartyController.cpp b/Minecraft.Client/Durango/Network/PartyController.cpp index 4e1a7e611..1dfd5eb0a 100644 --- a/Minecraft.Client/Durango/Network/PartyController.cpp +++ b/Minecraft.Client/Durango/Network/PartyController.cpp @@ -181,7 +181,7 @@ bool PartyController::AddLocalUsersToParty(int userMask, Windows::Xbox::System:: bool alreadyInSession = false; if( session ) { - if( m_pDQRNet->IsPlayerInSession( ProfileManager.GetUser(i, true)->XboxUserId, session, NULL ) ) + if( m_pDQRNet->IsPlayerInSession( ProfileManager.GetUser(i, true)->XboxUserId, session, nullptr ) ) { alreadyInSession = true; } @@ -621,7 +621,7 @@ void PartyController::AddAvailableGamePlayers(IVectorView^ availabl } #endif - if( m_pDQRNet->IsPlayerInSession(player->XboxUserId, currentSession, NULL)) + if( m_pDQRNet->IsPlayerInSession(player->XboxUserId, currentSession, nullptr)) { DQRNetworkManager::LogComment( L"Player is already in session; skipping join request: " + player->XboxUserId->ToString() ); continue; @@ -639,7 +639,7 @@ void PartyController::AddAvailableGamePlayers(IVectorView^ availabl { bFoundLocal = true; // Check that they aren't in the game already (don't see how this could be the case anyway) - if( m_pDQRNet->GetPlayerByXuid( static_cast(player->XboxUserId->Data()) ) == NULL ) + if( m_pDQRNet->GetPlayerByXuid( static_cast(player->XboxUserId->Data()) ) == nullptr ) { // And check whether they are signed in yet or not int userIdx = -1; @@ -838,7 +838,7 @@ void PartyController::OnGameSessionReady( GameSessionReadyEventArgs^ eventArgs ) if( !isAJoiningXuid ) // Isn't someone we are actively trying to join { if( (!bInSession) || // If not in a game session at all - ( ( m_pDQRNet->GetState() == DQRNetworkManager::DNM_INT_STATE_PLAYING ) && ( m_pDQRNet->GetPlayerByXuid( static_cast(memberXUID->Data()) ) == NULL ) ) // Or we're fully in, and this player isn't in it + ( ( m_pDQRNet->GetState() == DQRNetworkManager::DNM_INT_STATE_PLAYING ) && ( m_pDQRNet->GetPlayerByXuid( static_cast(memberXUID->Data()) ) == nullptr ) ) // Or we're fully in, and this player isn't in it ) { for( int j = 4; j < 12; j++ ) // Final check that we have a gamepad for this xuid so that we might possibly be able to pair someone up diff --git a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp index 7171895a1..5e3a08245 100644 --- a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp +++ b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.cpp @@ -166,7 +166,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != NULL) + if(playerChangedCallback[idx] != nullptr) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -175,7 +175,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerJoined(DQRNetworkPlayer *pDQRPl int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; + if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -198,7 +198,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP { // Get our wrapper object associated with this player. Socket *socket = networkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { // If we are in game then remove this player from the game as well. // We may get here either from the player requesting to exit the game, @@ -214,14 +214,14 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP // We need this as long as the game server still needs to communicate with the player //delete socket; - networkPlayer->SetSocket( NULL ); + networkPlayer->SetSocket( nullptr ); } if( m_pDQRNet->IsHost() && !m_bHostChanged ) { if( isSystemPrimaryPlayer(pDQRPlayer) ) { - DQRNetworkPlayer *pNewDQRPrimaryPlayer = NULL; + DQRNetworkPlayer *pNewDQRPrimaryPlayer = nullptr; for(unsigned int i = 0; i < m_pDQRNet->GetPlayerCount(); ++i ) { DQRNetworkPlayer *pDQRPlayer2 = m_pDQRNet->GetPlayerByIndex( i ); @@ -238,7 +238,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP m_machineDQRPrimaryPlayers.erase( it ); } - if( pNewDQRPrimaryPlayer != NULL ) + if( pNewDQRPrimaryPlayer != nullptr ) m_machineDQRPrimaryPlayers.push_back( pNewDQRPrimaryPlayer ); } @@ -251,7 +251,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != NULL) + if(playerChangedCallback[idx] != nullptr) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); } @@ -260,7 +260,7 @@ void CPlatformNetworkManagerDurango::HandlePlayerLeaving(DQRNetworkPlayer *pDQRP int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; + if( m_pDQRNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -289,7 +289,7 @@ void CPlatformNetworkManagerDurango::HandleDataReceived(DQRNetworkPlayer *player INetworkPlayer *pPlayerFrom = getNetworkPlayer(playerFrom); Socket *socket = pPlayerFrom->GetSocket(); - if(socket != NULL) + if(socket != nullptr) socket->pushDataToQueue(data, dataSize, false); } else @@ -298,7 +298,7 @@ void CPlatformNetworkManagerDurango::HandleDataReceived(DQRNetworkPlayer *player INetworkPlayer *pPlayerTo = getNetworkPlayer(playerTo); Socket *socket = pPlayerTo->GetSocket(); //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != NULL) + if(socket != nullptr) socket->pushDataToQueue(data, dataSize); } } @@ -319,7 +319,7 @@ bool CPlatformNetworkManagerDurango::Initialise(CGameNetworkManager *pGameNetwor g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = NULL; + playerChangedCallback[ i ] = nullptr; } m_bLeavingGame = false; @@ -330,14 +330,14 @@ bool CPlatformNetworkManagerDurango::Initialise(CGameNetworkManager *pGameNetwor m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = NULL; - m_SessionsUpdatedCallback = NULL; + m_pSearchParam = nullptr; + m_SessionsUpdatedCallback = nullptr; m_searchResultsCount = 0; m_lastSearchStartTime = 0; // The results that will be filled in with the current search - m_pSearchResults = NULL; + m_pSearchResults = nullptr; Windows::Networking::Connectivity::NetworkInformation::NetworkStatusChanged += ref new Windows::Networking::Connectivity::NetworkStatusChangedEventHandler( []( Platform::Object^ pxObject ) { @@ -585,8 +585,8 @@ void CPlatformNetworkManagerDurango::UnRegisterPlayerChangedCallback(int iPad, v { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = NULL; - playerChangedCallbackParam[iPad] = NULL; + playerChangedCallback[iPad] = nullptr; + playerChangedCallbackParam[iPad] = nullptr; } } @@ -613,12 +613,12 @@ bool CPlatformNetworkManagerDurango::_RunNetworkGame() return true; } -void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) +void CPlatformNetworkManagerDurango::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) { if( this->m_bLeavingGame ) return; - if( GetHostPlayer() == NULL ) + if( GetHostPlayer() == nullptr ) return; m_hostGameSessionData.m_uiGameHostSettings = app.GetGameHostOption(eGameHostOption_All); @@ -632,14 +632,14 @@ int CPlatformNetworkManagerDurango::RemovePlayerOnSocketClosedThreadProc( void* Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( NULL ); + pNetworkPlayer->SetSocket( nullptr ); delete socket; } @@ -712,7 +712,7 @@ void CPlatformNetworkManagerDurango::SystemFlagReset() void CPlatformNetworkManagerDurango::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == NULL ) return; + if( pNetworkPlayer == nullptr ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -728,7 +728,7 @@ void CPlatformNetworkManagerDurango::SystemFlagSet(INetworkPlayer *pNetworkPlaye bool CPlatformNetworkManagerDurango::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == NULL ) + if( pNetworkPlayer == nullptr ) { return false; } @@ -769,7 +769,7 @@ void CPlatformNetworkManagerDurango::TickSearch() } m_bSearchPending = false; - if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); + if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam); } } else @@ -777,7 +777,7 @@ void CPlatformNetworkManagerDurango::TickSearch() if( !m_pDQRNet->FriendPartyManagerIsBusy() ) { // Don't start searches unless we have registered a callback - if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime + MINECRAFT_DURANGO_PARTY_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) + if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime + MINECRAFT_DURANGO_PARTY_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) { if( m_pDQRNet->FriendPartyManagerSearch() ); { @@ -800,7 +800,7 @@ vector *CPlatformNetworkManagerDurango::GetSessionList(int { FriendSessionInfo *session = new FriendSessionInfo(); session->searchResult = m_pSearchResults[i]; - session->searchResult.m_extData = NULL; // We have another copy of the GameSessionData, so don't need to make another copy of this here + session->searchResult.m_extData = nullptr; // We have another copy of the GameSessionData, so don't need to make another copy of this here session->displayLabelLength = session->searchResult.m_playerNames[0].size(); session->displayLabel = new wchar_t[ session->displayLabelLength + 1 ]; memcpy(&session->data, gameSessionData, sizeof(GameSessionData)); @@ -832,7 +832,7 @@ void CPlatformNetworkManagerDurango::ForceFriendsSessionRefresh() m_lastSearchStartTime = 0; m_searchResultsCount = 0; delete [] m_pSearchResults; - m_pSearchResults = NULL; + m_pSearchResults = nullptr; } INetworkPlayer *CPlatformNetworkManagerDurango::addNetworkPlayer(DQRNetworkPlayer *pDQRPlayer) @@ -858,7 +858,7 @@ void CPlatformNetworkManagerDurango::removeNetworkPlayer(DQRNetworkPlayer *pDQRP INetworkPlayer *CPlatformNetworkManagerDurango::getNetworkPlayer(DQRNetworkPlayer *pDQRPlayer) { - return pDQRPlayer ? (INetworkPlayer *)(pDQRPlayer->GetCustomDataValue()) : NULL; + return pDQRPlayer ? (INetworkPlayer *)(pDQRPlayer->GetCustomDataValue()) : nullptr; } diff --git a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h index 558072275..5626b0120 100644 --- a/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h +++ b/Minecraft.Client/Durango/Network/PlatformNetworkManagerDurango.h @@ -87,7 +87,7 @@ private: bool m_hostGameSessionIsJoinable; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp b/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp index 25ca46b28..31ab9d64b 100644 --- a/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp +++ b/Minecraft.Client/Durango/Sentient/DurangoTelemetry.cpp @@ -64,7 +64,7 @@ bool CDurangoTelemetryManager::RecordPlayerSessionExit(int iPad, int exitStatus) // 4J-JEV: Still needed to flush cached travel stats. DurangoStats::playerSessionEnd(iPad); - if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) + if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) { ULONG hr = EventWritePlayerSessionEnd( DurangoStats::getUserId(iPad), @@ -131,7 +131,7 @@ bool CDurangoTelemetryManager::RecordLevelStart(int iPad, ESen_FriendOrMatch fri ProfileManager.GetXUID(iPad, &puid, true); plr = Minecraft::GetInstance()->localplayers[iPad]; - if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) + if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) { hr = EventWritePlayerSessionStart( DurangoStats::getUserId(iPad), diff --git a/Minecraft.Client/Durango/ServiceConfig/Events-XBLA.8-149E11AEEvents.h b/Minecraft.Client/Durango/ServiceConfig/Events-XBLA.8-149E11AEEvents.h index 5fc804385..8bd113549 100644 --- a/Minecraft.Client/Durango/ServiceConfig/Events-XBLA.8-149E11AEEvents.h +++ b/Minecraft.Client/Durango/ServiceConfig/Events-XBLA.8-149E11AEEvents.h @@ -195,7 +195,7 @@ EventWriteAchievementGet(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, _ EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &AchievementId, sizeof(AchievementId)); @@ -216,7 +216,7 @@ EventWriteAchievemntUnlocked(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionI EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -246,7 +246,7 @@ EventWriteBanLevel(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in co EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -274,7 +274,7 @@ EventWriteBlockBroken(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &BlockId, sizeof(BlockId)); @@ -298,7 +298,7 @@ EventWriteBlockPlaced(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &BlockId, sizeof(BlockId)); @@ -322,7 +322,7 @@ EventWriteChestfulOfCobblestone(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessi EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &Cobblecount, sizeof(Cobblecount)); @@ -343,7 +343,7 @@ EventWriteEnteredNewBiome(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &BiomeId, sizeof(BiomeId)); @@ -364,7 +364,7 @@ EventWriteGameProgress(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __i EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &CompletionPercent, sizeof(CompletionPercent)); @@ -385,7 +385,7 @@ EventWriteIncDistanceTravelled(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessio EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &Distance, sizeof(Distance)); @@ -408,7 +408,7 @@ EventWriteIncTimePlayed(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __ EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &TimePlayed, sizeof(TimePlayed)); @@ -430,7 +430,7 @@ EventWriteLeaderboardTotals(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[4], &LeaderboardId, sizeof(LeaderboardId)); @@ -453,7 +453,7 @@ EventWriteLevelExit(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in c EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -482,7 +482,7 @@ EventWriteLevelResume(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -516,7 +516,7 @@ EventWriteLevelSaveOrCheckpoint(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessi EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -546,7 +546,7 @@ EventWriteLevelStart(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -579,10 +579,10 @@ EventWriteMcItemAcquired(__in_opt PCWSTR UserId, __in const signed int SectionId EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[3], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[5], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[6], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[7], &ItemId, sizeof(ItemId)); @@ -610,10 +610,10 @@ EventWriteMcItemUsed(__in_opt PCWSTR UserId, __in const signed int SectionId, __ EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[3], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[5], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[6], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[7], &ItemId, sizeof(ItemId)); @@ -641,7 +641,7 @@ EventWriteMenuShown(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in c EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -671,7 +671,7 @@ EventWriteMobInteract(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &MobId, sizeof(MobId)); EventDataDescCreate(&EventData[4], &InteractionId, sizeof(InteractionId)); @@ -693,10 +693,10 @@ EventWriteMobKilled(__in_opt PCWSTR UserId, __in const signed int SectionId, __i EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[3], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[4], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[5], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[6], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[7], RoundId, sizeof(GUID)); @@ -728,11 +728,11 @@ EventWriteMultiplayerRoundEnd(__in_opt PCWSTR UserId, __in LPCGUID RoundId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], RoundId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[4], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[5], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[5], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[6], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[7], &MatchTypeId, sizeof(MatchTypeId)); EventDataDescCreate(&EventData[8], &DifficultyLevelId, sizeof(DifficultyLevelId)); @@ -756,11 +756,11 @@ EventWriteMultiplayerRoundStart(__in_opt PCWSTR UserId, __in LPCGUID RoundId, __ EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], RoundId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SectionId, sizeof(SectionId)); EventDataDescCreate(&EventData[4], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[5], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[5], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[6], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[7], &MatchTypeId, sizeof(MatchTypeId)); EventDataDescCreate(&EventData[8], &DifficultyLevelId, sizeof(DifficultyLevelId)); @@ -782,7 +782,7 @@ EventWriteOnARail(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in con EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &Distance, sizeof(Distance)); @@ -803,7 +803,7 @@ EventWriteOverkill(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in co EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &Damage, sizeof(Damage)); @@ -824,7 +824,7 @@ EventWritePauseOrInactive(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -852,7 +852,7 @@ EventWritePlayedMusicDisc(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &DiscId, sizeof(DiscId)); @@ -873,7 +873,7 @@ EventWritePlayerDiedOrFailed(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionI EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -908,9 +908,9 @@ EventWritePlayerSessionEnd(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[4], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[5], &DifficultyLevelId, sizeof(DifficultyLevelId)); EventDataDescCreate(&EventData[6], &ExitStatusId, sizeof(ExitStatusId)); @@ -932,9 +932,9 @@ EventWritePlayerSessionPause(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionI EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); return EtxEventWrite(&XBLA_149E11AEEvents[28], &XBLA_149E11AEProvider, XBLA_149E11AEHandle, ARGUMENT_COUNT_XBLA_149E11AE_PlayerSessionPause, EventData); } @@ -953,9 +953,9 @@ EventWritePlayerSessionResume(__in_opt PCWSTR UserId, __in LPCGUID PlayerSession EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[4], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[5], &DifficultyLevelId, sizeof(DifficultyLevelId)); @@ -976,9 +976,9 @@ EventWritePlayerSessionStart(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionI EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); - EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != NULL) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != NULL) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[3], (MultiplayerCorrelationId != nullptr) ? MultiplayerCorrelationId : L"", (MultiplayerCorrelationId != nullptr) ? (ULONG)((wcslen(MultiplayerCorrelationId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[4], &GameplayModeId, sizeof(GameplayModeId)); EventDataDescCreate(&EventData[5], &DifficultyLevelId, sizeof(DifficultyLevelId)); @@ -999,7 +999,7 @@ EventWriteRecordMediaShareUpload(__in_opt PCWSTR UserId, __in LPCGUID PlayerSess EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1027,7 +1027,7 @@ EventWriteRichPresenceState(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &ContextID, sizeof(ContextID)); @@ -1048,7 +1048,7 @@ EventWriteSkinChanged(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1077,7 +1077,7 @@ EventWriteTexturePackLoaded(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1107,7 +1107,7 @@ EventWriteUnbanLevel(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, __in EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1135,7 +1135,7 @@ EventWriteUnpauseOrActive(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1163,7 +1163,7 @@ EventWriteUpsellPresented(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); @@ -1193,7 +1193,7 @@ EventWriteUpsellResponded(__in_opt PCWSTR UserId, __in LPCGUID PlayerSessionId, EtxFillCommonFields_v7(&EventData[0], scratch, 64); - EventDataDescCreate(&EventData[1], (UserId != NULL) ? UserId : L"", (UserId != NULL) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); + EventDataDescCreate(&EventData[1], (UserId != nullptr) ? UserId : L"", (UserId != nullptr) ? (ULONG)((wcslen(UserId) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); EventDataDescCreate(&EventData[2], PlayerSessionId, sizeof(GUID)); EventDataDescCreate(&EventData[3], &SecondsSinceInitialize, sizeof(SecondsSinceInitialize)); EventDataDescCreate(&EventData[4], &Mode, sizeof(Mode)); diff --git a/Minecraft.Client/Durango/XML/ATGXmlParser.cpp b/Minecraft.Client/Durango/XML/ATGXmlParser.cpp index dea8c1859..581ea27ec 100644 --- a/Minecraft.Client/Durango/XML/ATGXmlParser.cpp +++ b/Minecraft.Client/Durango/XML/ATGXmlParser.cpp @@ -27,7 +27,7 @@ XMLParser::XMLParser() { m_pWritePtr = m_pWriteBuf; m_pReadPtr = m_pReadBuf; - m_pISAXCallback = NULL; + m_pISAXCallback = nullptr; m_hFile = INVALID_HANDLE_VALUE; } @@ -49,7 +49,7 @@ VOID XMLParser::FillBuffer() m_pReadPtr = m_pReadBuf; - if( m_hFile == NULL ) + if( m_hFile == nullptr ) { if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE ) NChars = XML_READ_BUFFER_SIZE; @@ -62,7 +62,7 @@ VOID XMLParser::FillBuffer() } else { - if( !ReadFile( m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, NULL )) + if( !ReadFile( m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, nullptr )) { return; } @@ -359,7 +359,7 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail ) // Read more from the file FillBuffer(); - // We are at EOF if it is still NULL + // We are at EOF if it is still nullptr if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) ) { if( !bOkToFail ) @@ -861,7 +861,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) { HRESULT hr; - if( m_pISAXCallback == NULL ) + if( m_pISAXCallback == nullptr ) return E_NOINTERFACE; m_pISAXCallback->m_LineNum = 1; @@ -874,14 +874,14 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) m_pReadBuf[ 0 ] = '\0'; m_pReadBuf[ 1 ] = '\0'; - m_pInXMLBuffer = NULL; + m_pInXMLBuffer = nullptr; m_uInXMLBufferCharsLeft = 0; WCHAR wchFilename[ 64 ]; swprintf_s(wchFilename,64,L"%s",strFilename); - m_hFile = CreateFile( wchFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL ); + m_hFile = CreateFile( wchFilename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr ); if( m_hFile == INVALID_HANDLE_VALUE ) { @@ -904,7 +904,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) m_hFile = INVALID_HANDLE_VALUE; // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = NULL; + m_pISAXCallback->m_strFilename = nullptr; return hr; } @@ -917,7 +917,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) { HRESULT hr; - if( m_pISAXCallback == NULL ) + if( m_pISAXCallback == nullptr ) return E_NOINTERFACE; m_pISAXCallback->m_LineNum = 1; @@ -930,7 +930,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) m_pReadBuf[ 0 ] = '\0'; m_pReadBuf[ 1 ] = '\0'; - m_hFile = NULL; + m_hFile = nullptr; m_pInXMLBuffer = strBuffer; m_uInXMLBufferCharsLeft = uBufferSize; m_dwCharsTotal = uBufferSize; @@ -939,7 +939,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) hr = MainParseLoop(); // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = NULL; + m_pISAXCallback->m_strFilename = nullptr; return hr; } diff --git a/Minecraft.Client/Durango/XML/ATGXmlParser.h b/Minecraft.Client/Durango/XML/ATGXmlParser.h index 75142e3e3..12f597372 100644 --- a/Minecraft.Client/Durango/XML/ATGXmlParser.h +++ b/Minecraft.Client/Durango/XML/ATGXmlParser.h @@ -138,7 +138,7 @@ private: DWORD m_dwCharsTotal; DWORD m_dwCharsConsumed; - BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL + BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; BYTE* m_pReadPtr; diff --git a/Minecraft.Client/Durango/XML/xmlFilesCallback.h b/Minecraft.Client/Durango/XML/xmlFilesCallback.h index deba843d6..161493404 100644 --- a/Minecraft.Client/Durango/XML/xmlFilesCallback.h +++ b/Minecraft.Client/Durango/XML/xmlFilesCallback.h @@ -47,7 +47,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - xuid=_wcstoui64(wTemp,NULL,10); + xuid=_wcstoui64(wTemp,nullptr,10); } } else if (_wcsicmp(wAttName,L"cape")==0) @@ -138,7 +138,7 @@ public: #ifdef _XBOX iValue=_wtoi(wValue); #else - iValue=wcstol(wValue, NULL, 10); + iValue=wcstol(wValue, nullptr, 10); #endif } } @@ -220,7 +220,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - uiSortIndex=wcstoul(wTemp,NULL,10); + uiSortIndex=wcstoul(wTemp,nullptr,10); } } else if (_wcsicmp(wAttName,L"Banner")==0) @@ -269,7 +269,7 @@ public: #ifdef _XBOX iConfig=_wtoi(wConfig); #else - iConfig=wcstol(wConfig, NULL, 10); + iConfig=wcstol(wConfig, nullptr, 10); #endif } } diff --git a/Minecraft.Client/EnderDragonRenderer.cpp b/Minecraft.Client/EnderDragonRenderer.cpp index a0d66cb3e..8b5b248c2 100644 --- a/Minecraft.Client/EnderDragonRenderer.cpp +++ b/Minecraft.Client/EnderDragonRenderer.cpp @@ -90,7 +90,7 @@ void EnderDragonRenderer::render(shared_ptr _mob, double x, double y, do shared_ptr mob = dynamic_pointer_cast(_mob); BossMobGuiInfo::setBossHealth(mob, false); MobRenderer::render(mob, x, y, z, rot, a); - if (mob->nearestCrystal != NULL) + if (mob->nearestCrystal != nullptr) { float tt = mob->nearestCrystal->time + a; float hh = sin(tt * 0.2f) / 2 + 0.5f; diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index abfc2993e..cc14558f9 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -87,7 +87,7 @@ double EntityRenderDispatcher::xOff = 0.0; double EntityRenderDispatcher::yOff = 0.0; double EntityRenderDispatcher::zOff = 0.0; -EntityRenderDispatcher *EntityRenderDispatcher::instance = NULL; +EntityRenderDispatcher *EntityRenderDispatcher::instance = nullptr; void EntityRenderDispatcher::staticCtor() { @@ -280,7 +280,7 @@ void EntityRenderDispatcher::render(shared_ptr entity, float a) void EntityRenderDispatcher::render(shared_ptr entity, double x, double y, double z, float rot, float a, bool bItemFrame, bool bRenderPlayerShadow) { EntityRenderer *renderer = getRenderer(entity); - if (renderer != NULL) + if (renderer != nullptr) { renderer->SetItemFrame(bItemFrame); diff --git a/Minecraft.Client/EntityRenderer.cpp b/Minecraft.Client/EntityRenderer.cpp index 4ead9f4a9..fa41dfa60 100644 --- a/Minecraft.Client/EntityRenderer.cpp +++ b/Minecraft.Client/EntityRenderer.cpp @@ -18,7 +18,7 @@ ResourceLocation EntityRenderer::SHADOW_LOCATION = ResourceLocation(TN__CLAMP__M // 4J - added EntityRenderer::EntityRenderer() { - model = NULL; + model = nullptr; tileRenderer = new TileRenderer(); shadowRadius = 0; shadowStrength = 1.0f; @@ -113,7 +113,7 @@ void EntityRenderer::renderFlame(shared_ptr e, double x, double y, doubl t->begin(); while (h > 0) { - Icon *tex = NULL; + Icon *tex = nullptr; if (ss % 2 == 0) { tex = fire1; @@ -406,5 +406,5 @@ void EntityRenderer::registerTerrainTextures(IconRegister *iconRegister) ResourceLocation *EntityRenderer::getTextureLocation(shared_ptr mob) { - return NULL; + return nullptr; } \ No newline at end of file diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp index db175542e..8171e50d4 100644 --- a/Minecraft.Client/EntityTracker.cpp +++ b/Minecraft.Client/EntityTracker.cpp @@ -59,7 +59,7 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 1, true); else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 1, false); else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 1, false); - else if (dynamic_pointer_cast(e)!=NULL) addEntity(e, 16 * 5, 1, true); + else if (dynamic_pointer_cast(e)!=nullptr) addEntity(e, 16 * 5, 1, true); else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 1, true); else if (e->instanceof(eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true); else if (e->instanceof(eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true); @@ -145,9 +145,9 @@ void EntityTracker::tick() shared_ptr ep = server->getPlayers()->players[i]; if( ep->dimension != level->dimension->id ) continue; - if( ep->connection == NULL ) continue; + if( ep->connection == nullptr ) continue; INetworkPlayer *thisPlayer = ep->connection->getNetworkPlayer(); - if( thisPlayer == NULL ) continue; + if( thisPlayer == nullptr ) continue; bool addPlayer = false; for (unsigned int j = 0; j < movedPlayers.size(); j++) @@ -156,9 +156,9 @@ void EntityTracker::tick() if( sp == ep ) break; - if(sp->connection == NULL) continue; + if(sp->connection == nullptr) continue; INetworkPlayer *otherPlayer = sp->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { addPlayer = true; break; @@ -170,7 +170,7 @@ void EntityTracker::tick() for (unsigned int i = 0; i < movedPlayers.size(); i++) { shared_ptr player = movedPlayers[i]; - if(player->connection == NULL) continue; + if(player->connection == nullptr) continue; for( auto& te : entities ) { if ( te && te->e != player) diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 984397b8c..b03efe86c 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -58,7 +58,7 @@ bool CSocialManager::IsTitleAllowedToPostImages() { return false; } bool CSocialManager::PostLinkToSocialNetwork(ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect) { return false; } bool CSocialManager::PostImageToSocialNetwork(ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect) { return false; } -CSocialManager* CSocialManager::Instance() { return NULL; } +CSocialManager* CSocialManager::Instance() { return nullptr; } void CSocialManager::SetSocialPostText(LPCWSTR Title, LPCWSTR Caption, LPCWSTR Desc) {}; DWORD XShowPartyUI(DWORD dwUserIndex) { return 0; } @@ -159,7 +159,7 @@ void PIXSetMarkerDeprecated(int a, char* b, ...) {} //} #endif -// void *D3DXBUFFER::GetBufferPointer() { return NULL; } +// void *D3DXBUFFER::GetBufferPointer() { return nullptr; } // int D3DXBUFFER::GetBufferSize() { return 0; } // void D3DXBUFFER::Release() {} @@ -253,16 +253,16 @@ IQNetPlayer* IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex) !m_player[dwUserIndex].m_isRemote && Win64_IsActivePlayer(&m_player[dwUserIndex], dwUserIndex)) return &m_player[dwUserIndex]; - return NULL; + return nullptr; } if (dwUserIndex != 0) - return NULL; + return nullptr; for (DWORD i = 0; i < s_playerCount; i++) { if (!m_player[i].m_isRemote && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; } - return NULL; + return nullptr; } static bool Win64_IsActivePlayer(IQNetPlayer * p, DWORD index) { @@ -289,7 +289,7 @@ IQNetPlayer* IQNet::GetPlayerBySmallId(BYTE SmallId) { if (m_player[i].m_smallId == SmallId && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i]; } - return NULL; + return nullptr; } IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) { @@ -301,7 +301,7 @@ IQNetPlayer* IQNet::GetPlayerByXuid(PlayerUID xuid) if (m_player[i].GetXuid() == xuid) return &m_player[i]; } - // Keep existing stub behavior: return host slot instead of NULL on miss. + // Keep existing stub behavior: return host slot instead of nullptr on miss. return &m_player[0]; } DWORD IQNet::GetPlayerCount() @@ -453,11 +453,11 @@ HRESULT XMemCreateCompressionContext( ) { /* - COMPRESSOR_HANDLE Compressor = NULL; + COMPRESSOR_HANDLE Compressor = nullptr; HRESULT hr = CreateCompressor( COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm - NULL, // Optional allocation routine + nullptr, // Optional allocation routine &Compressor); // Handle pContext = (XMEMDECOMPRESSION_CONTEXT *)Compressor; @@ -474,11 +474,11 @@ HRESULT XMemCreateDecompressionContext( ) { /* - DECOMPRESSOR_HANDLE Decompressor = NULL; + DECOMPRESSOR_HANDLE Decompressor = nullptr; HRESULT hr = CreateDecompressor( COMPRESS_ALGORITHM_XPRESS_HUFF, // Compression Algorithm - NULL, // Optional allocation routine + nullptr, // Optional allocation routine &Decompressor); // Handle pContext = (XMEMDECOMPRESSION_CONTEXT *)Decompressor; @@ -645,8 +645,8 @@ bool C_4JProfile::LocaleIsUSorCanada(void) { return false; } HRESULT C_4JProfile::GetLiveConnectionStatus() { return S_OK; } bool C_4JProfile::IsSystemUIDisplayed() { return false; } void C_4JProfile::SetProfileReadErrorCallback(void (*Func)(LPVOID), LPVOID lpParam) {} -int(*defaultOptionsCallback)(LPVOID, C_4JProfile::PROFILESETTINGS*, const int iPad) = NULL; -LPVOID lpProfileParam = NULL; +int(*defaultOptionsCallback)(LPVOID, C_4JProfile::PROFILESETTINGS*, const int iPad) = nullptr; +LPVOID lpProfileParam = nullptr; int C_4JProfile::SetDefaultOptionsCallback(int(*Func)(LPVOID, PROFILESETTINGS*, const int iPad), LPVOID lpParam) { defaultOptionsCallback = Func; @@ -724,7 +724,7 @@ void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, XCONTENT_DATA & xCont void C4JStorage::GetSaveCacheFileInfo(DWORD dwFile, PBYTE * ppbImageData, DWORD * pdwImageBytes) {} C4JStorage::ESaveGameState C4JStorage::LoadSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool, const bool), LPVOID lpParam) { return C4JStorage::ESaveGame_Idle; } C4JStorage::EDeleteGameStatus C4JStorage::DeleteSaveData(PSAVE_INFO pSaveInfo, int(*Func)(LPVOID lpParam, const bool), LPVOID lpParam) { return C4JStorage::EDeleteGame_Idle; } -PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return NULL; } +PSAVE_DETAILS C4JStorage::ReturnSavesInfo() { return nullptr; } void C4JStorage::RegisterMarketplaceCountsCallback(int (*Func)(LPVOID lpParam, C4JStorage::DLC_TMS_DETAILS*, int), LPVOID lpParam) {} void C4JStorage::SetDLCPackageRoot(char* pszDLCRoot) {} @@ -746,7 +746,7 @@ void C4JStorage::StoreTMSPathName(WCHAR * pwchName) {} unsigned int C4JStorage::CRC(unsigned char* buf, int len) { return 0; } struct PTMSPP_FILEDATA; -C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR)/*=NULL*/, LPVOID lpParam/*=NULL*/, int iUserData/*=0*/) { return C4JStorage::ETMSStatus_Idle; } +C4JStorage::ETMSStatus C4JStorage::TMSPP_ReadFile(int iPad, C4JStorage::eGlobalStorage eStorageFacility, C4JStorage::eTMS_FILETYPEVAL eFileTypeVal, LPCSTR szFilename, int(*Func)(LPVOID, int, int, PTMSPP_FILEDATA, LPCSTR)/*=nullptr*/, LPVOID lpParam/*=nullptr*/, int iUserData/*=0*/) { return C4JStorage::ETMSStatus_Idle; } #endif // _WINDOWS64 #endif // __PS3__ diff --git a/Minecraft.Client/FallingTileRenderer.cpp b/Minecraft.Client/FallingTileRenderer.cpp index c46b83c5c..132f033a5 100644 --- a/Minecraft.Client/FallingTileRenderer.cpp +++ b/Minecraft.Client/FallingTileRenderer.cpp @@ -51,7 +51,7 @@ void FallingTileRenderer::render(shared_ptr _tile, double x, double y, d t->offset(0, 0, 0); t->end(); } - else if( tt != NULL ) + else if( tt != nullptr ) { tileRenderer->setShape(tt); tileRenderer->renderBlock(tt, level, Mth::floor(tile->x), Mth::floor(tile->y), Mth::floor(tile->z), tile->data); diff --git a/Minecraft.Client/FileTexturePack.cpp b/Minecraft.Client/FileTexturePack.cpp index af58dc1e1..711f67362 100644 --- a/Minecraft.Client/FileTexturePack.cpp +++ b/Minecraft.Client/FileTexturePack.cpp @@ -36,7 +36,7 @@ InputStream *FileTexturePack::getResourceImplementation(const wstring &name) //t return zipFile.getInputStream(entry); #endif - return NULL; + return nullptr; } bool FileTexturePack::hasFile(const wstring &name) diff --git a/Minecraft.Client/FireworksParticles.cpp b/Minecraft.Client/FireworksParticles.cpp index 9fdaebb92..c8a109c4b 100644 --- a/Minecraft.Client/FireworksParticles.cpp +++ b/Minecraft.Client/FireworksParticles.cpp @@ -15,12 +15,12 @@ FireworksParticles::FireworksStarter::FireworksStarter(Level *level, double x, d this->engine = engine; lifetime = 8; - if (infoTag != NULL) + if (infoTag != nullptr) { explosions = static_cast *>(infoTag->getList(FireworksItem::TAG_EXPLOSIONS)->copy()); if (explosions->size() == 0) { - explosions = NULL; + explosions = nullptr; } else { @@ -42,7 +42,7 @@ FireworksParticles::FireworksStarter::FireworksStarter(Level *level, double x, d else { // 4J: - explosions = NULL; + explosions = nullptr; } } @@ -53,7 +53,7 @@ void FireworksParticles::FireworksStarter::render(Tesselator *t, float a, float void FireworksParticles::FireworksStarter::tick() { - if (life == 0 && explosions != NULL) + if (life == 0 && explosions != nullptr) { bool farEffect = isFarAwayFromCamera(); @@ -97,7 +97,7 @@ void FireworksParticles::FireworksStarter::tick() level->playLocalSound(x, y, z, soundId, 20, .95f + random->nextFloat() * .1f, true, 100.0f); } - if ((life % 2) == 0 && explosions != NULL && (life / 2) < explosions->size()) + if ((life % 2) == 0 && explosions != nullptr && (life / 2) < explosions->size()) { int eIndex = life / 2; CompoundTag *compoundTag = explosions->get(eIndex); @@ -212,7 +212,7 @@ void FireworksParticles::FireworksStarter::tick() bool FireworksParticles::FireworksStarter::isFarAwayFromCamera() { Minecraft *instance = Minecraft::GetInstance(); - if (instance != NULL && instance->cameraTargetPlayer != NULL) + if (instance != nullptr && instance->cameraTargetPlayer != nullptr) { if (instance->cameraTargetPlayer->distanceToSqr(x, y, z) < 16 * 16) { @@ -231,7 +231,7 @@ void FireworksParticles::FireworksStarter::createParticle(double x, double y, do int color = random->nextInt(rgbColors.length); fireworksSparkParticle->setColor(rgbColors[color]); - if (/*fadeColors != NULL &&*/ fadeColors.length > 0) + if (/*fadeColors != nullptr &&*/ fadeColors.length > 0) { fireworksSparkParticle->setFadeColor(fadeColors[random->nextInt(fadeColors.length)]); } @@ -382,7 +382,7 @@ void FireworksParticles::FireworksSparkParticle::setFadeColor(int rgb) AABB *FireworksParticles::FireworksSparkParticle::getCollideBox() { - return NULL; + return nullptr; } bool FireworksParticles::FireworksSparkParticle::isPushable() diff --git a/Minecraft.Client/FishingHookRenderer.cpp b/Minecraft.Client/FishingHookRenderer.cpp index 6a55468db..d587ddb87 100644 --- a/Minecraft.Client/FishingHookRenderer.cpp +++ b/Minecraft.Client/FishingHookRenderer.cpp @@ -49,7 +49,7 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d glPopMatrix(); - if (hook->owner != NULL) + if (hook->owner != nullptr) { float swing = hook->owner->getAttackAnim(a); float swing2 = (float) Mth::sin(sqrt(swing) * PI); diff --git a/Minecraft.Client/FolderTexturePack.cpp b/Minecraft.Client/FolderTexturePack.cpp index 4b65dc7f0..05feca664 100644 --- a/Minecraft.Client/FolderTexturePack.cpp +++ b/Minecraft.Client/FolderTexturePack.cpp @@ -31,7 +31,7 @@ InputStream *FolderTexturePack::getResourceImplementation(const wstring &name) / #endif InputStream *resource = InputStream::getResourceAsStream(wDrive + name); //InputStream *stream = DefaultTexturePack::class->getResourceAsStream(name); - //if (stream == NULL) + //if (stream == nullptr) //{ // throw new FileNotFoundException(name); //} @@ -85,7 +85,7 @@ void FolderTexturePack::loadUI() swprintf(szResourceLocator, LOCATOR_SIZE,L"file://%lsTexturePack.xzp#skin_Minecraft.xur",getPath().c_str()); XuiFreeVisuals(L""); - app.LoadSkin(szResourceLocator,NULL);//L"TexturePack"); + app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack"); bUILoaded = true; //CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack"); } diff --git a/Minecraft.Client/FolderTexturePack.h b/Minecraft.Client/FolderTexturePack.h index 409210780..4327698d5 100644 --- a/Minecraft.Client/FolderTexturePack.h +++ b/Minecraft.Client/FolderTexturePack.h @@ -20,7 +20,7 @@ public: bool isTerrainUpdateCompatible(); // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=NULL); + virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=nullptr); virtual void loadUI(); virtual void unloadUI(); }; \ No newline at end of file diff --git a/Minecraft.Client/Font.cpp b/Minecraft.Client/Font.cpp index cb2f56324..37294f530 100644 --- a/Minecraft.Client/Font.cpp +++ b/Minecraft.Client/Font.cpp @@ -30,7 +30,7 @@ Font::Font(Options *options, const wstring& name, Textures* textures, bool enfor m_textureLocation = textureLocation; // Build character map - if (charMap != NULL) + if (charMap != nullptr) { for(int i = 0; i < charC; i++) { @@ -273,7 +273,7 @@ int Font::width(const wstring& str) { wstring cleanStr = sanitize(str); - if (cleanStr == L"") return 0; // 4J - was NULL comparison + if (cleanStr == L"") return 0; // 4J - was nullptr comparison int len = 0; for (int i = 0; i < cleanStr.length(); ++i) diff --git a/Minecraft.Client/Font.h b/Minecraft.Client/Font.h index 18d9bf91d..3c326f9af 100644 --- a/Minecraft.Client/Font.h +++ b/Minecraft.Client/Font.h @@ -32,7 +32,7 @@ private: std::map m_charMap; public: - Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, ResourceLocation *textureLocation, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = NULL); + Font(Options *options, const wstring& name, Textures* textures, bool enforceUnicode, ResourceLocation *textureLocation, int cols, int rows, int charWidth, int charHeight, unsigned short charMap[] = nullptr); #ifndef _XBOX // 4J Stu - This dtor clashes with one in xui! We never delete these anyway so take it out for now. Can go back when we have got rid of XUI ~Font(); diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index be2b5f0c1..3c11db1f6 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -106,8 +106,8 @@ GameRenderer::GameRenderer(Minecraft *mc) zoom = 1; zoom_x = 0; zoom_y = 0; - rainXa = NULL; - rainZa = NULL; + rainXa = nullptr; + rainZa = nullptr; lastActiveTime = Minecraft::currentTimeMillis(); lastNsTime = 0; random = new Random(); @@ -139,7 +139,7 @@ GameRenderer::GameRenderer(Minecraft *mc) } this->mc = mc; - itemInHandRenderer = NULL; + itemInHandRenderer = nullptr; // 4J-PB - set up the local players iteminhand renderers here - needs to be done with lighting enabled so that the render geometry gets compiled correctly glEnable(GL_LIGHTING); @@ -170,7 +170,7 @@ GameRenderer::GameRenderer(Minecraft *mc) m_updateEvents->Set(eUpdateEventIsFinished); InitializeCriticalSection(&m_csDeleteStack); - m_updateThread = new C4JThread(runUpdate, NULL, "Chunk update"); + m_updateThread = new C4JThread(runUpdate, nullptr, "Chunk update"); #ifdef __PS3__ m_updateThread->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL); #endif// __PS3__ @@ -182,8 +182,8 @@ GameRenderer::GameRenderer(Minecraft *mc) // 4J Stu Added to go with 1.8.2 change GameRenderer::~GameRenderer() { - if(rainXa != NULL) delete [] rainXa; - if(rainZa != NULL) delete [] rainZa; + if(rainXa != nullptr) delete [] rainXa; + if(rainZa != nullptr) delete [] rainZa; } void GameRenderer::tick(bool first) // 4J - add bFirst @@ -211,7 +211,7 @@ void GameRenderer::tick(bool first) // 4J - add bFirst accumulatedSmoothYO = 0; } - if (mc->cameraTargetPlayer == NULL) + if (mc->cameraTargetPlayer == nullptr) { mc->cameraTargetPlayer = dynamic_pointer_cast(mc->player); } @@ -249,8 +249,8 @@ void GameRenderer::tick(bool first) // 4J - add bFirst void GameRenderer::pick(float a) { - if (mc->cameraTargetPlayer == NULL) return; - if (mc->level == NULL) return; + if (mc->cameraTargetPlayer == nullptr) return; + if (mc->level == nullptr) return; mc->crosshairPickMob = nullptr; @@ -280,7 +280,7 @@ void GameRenderer::pick(float a) ( hitz < minxz ) || ( hitz > maxxz) ) { delete mc->hitResult; - mc->hitResult = NULL; + mc->hitResult = nullptr; } } @@ -297,7 +297,7 @@ void GameRenderer::pick(float a) range = dist; } - if (mc->hitResult != NULL) + if (mc->hitResult != nullptr) { dist = mc->hitResult->pos->distanceTo(from); } @@ -327,7 +327,7 @@ void GameRenderer::pick(float a) else if (p != nullptr) { double dd = from->distanceTo(p->pos); - if (e == mc->cameraTargetPlayer->riding != NULL) + if (e == mc->cameraTargetPlayer->riding != nullptr) { if (nearest == 0) { @@ -343,11 +343,11 @@ void GameRenderer::pick(float a) delete p; } - if (hovered != NULL) + if (hovered != nullptr) { - if (nearest < dist || (mc->hitResult == NULL)) + if (nearest < dist || (mc->hitResult == nullptr)) { - if( mc->hitResult != NULL ) + if( mc->hitResult != nullptr ) delete mc->hitResult; mc->hitResult = new HitResult(hovered); if (hovered->instanceof(eTYPE_LIVINGENTITY)) @@ -532,7 +532,7 @@ void GameRenderer::moveCameraToPlayer(float a) // 4J - corrected bug here where zo was also added to x component HitResult *hr = mc->level->clip(Vec3::newTemp(x + xo, y + yo, z + zo), Vec3::newTemp(x - xd + xo, y - yd + yo, z - zd + zo)); - if (hr != NULL) + if (hr != nullptr) { double dist = hr->pos->distanceTo(Vec3::newTemp(x, y, z)); if (dist < cameraDist) cameraDist = dist; @@ -692,7 +692,7 @@ void GameRenderer::renderItemInHand(float a, int eye) bool renderHand = true; // 4J-PB - to turn off the hand for screenshots, but not when the item held is a map - if ( localplayer!=NULL) + if ( localplayer!=nullptr) { shared_ptr item = localplayer->inventory->getSelected(); if(!(item && item->getItem()->id==Item::map_Id) && app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_DisplayHand)==0 ) renderHand = false; @@ -1156,7 +1156,7 @@ void GameRenderer::render(float a, bool bFirst) int maxFps = getFpsCap(mc->options->framerateLimit); - if (mc->level != NULL) + if (mc->level != nullptr) { if (mc->options->framerateLimit == 0) { @@ -1171,9 +1171,9 @@ void GameRenderer::render(float a, bool bFirst) ApplyGammaPostProcess(); - if (!mc->options->hideGui || mc->screen != NULL) + if (!mc->options->hideGui || mc->screen != nullptr) { - mc->gui->render(a, mc->screen != NULL, xMouse, yMouse); + mc->gui->render(a, mc->screen != nullptr, xMouse, yMouse); } } else @@ -1189,11 +1189,11 @@ void GameRenderer::render(float a, bool bFirst) } - if (mc->screen != NULL) + if (mc->screen != nullptr) { glClear(GL_DEPTH_BUFFER_BIT); mc->screen->render(xMouse, yMouse, a); - if (mc->screen != NULL && mc->screen->particles != NULL) mc->screen->particles->render(a); + if (mc->screen != nullptr && mc->screen->particles != nullptr) mc->screen->particles->render(a); } } @@ -1362,7 +1362,7 @@ void GameRenderer::renderLevel(float a, __int64 until) // going to do for the primary player, and the other players can just view whatever they have loaded in - we're sharing render data between players. bool updateChunks = ( mc->player == mc->localplayers[ProfileManager.GetPrimaryPad()] ); - // if (mc->cameraTargetPlayer == NULL) // 4J - removed condition as we want to update this is mc->player changes for different local players + // if (mc->cameraTargetPlayer == nullptr) // 4J - removed condition as we want to update this is mc->player changes for different local players { mc->cameraTargetPlayer = mc->player; } @@ -1490,7 +1490,7 @@ void GameRenderer::renderLevel(float a, __int64 until) PIXEndNamedEvent(); turnOffLightLayer(a); // 4J - brought forward from 1.8.2 - if ( (mc->hitResult != NULL) && cameraEntity->isUnderLiquid(Material::water) && cameraEntity->instanceof(eTYPE_PLAYER) ) //&& !mc->options.hideGui) + if ( (mc->hitResult != nullptr) && cameraEntity->isUnderLiquid(Material::water) && cameraEntity->instanceof(eTYPE_PLAYER) ) //&& !mc->options.hideGui) { shared_ptr player = dynamic_pointer_cast(cameraEntity); glDisable(GL_ALPHA_TEST); @@ -1559,7 +1559,7 @@ void GameRenderer::renderLevel(float a, __int64 until) if ( (zoom == 1) && cameraEntity->instanceof(eTYPE_PLAYER) ) //&& !mc->options.hideGui) { - if (mc->hitResult != NULL && !cameraEntity->isUnderLiquid(Material::water)) + if (mc->hitResult != nullptr && !cameraEntity->isUnderLiquid(Material::water)) { shared_ptr player = dynamic_pointer_cast(cameraEntity); glDisable(GL_ALPHA_TEST); @@ -1717,7 +1717,7 @@ void GameRenderer::renderSnowAndRain(float a) turnOnLightLayer(a); - if (rainXa == NULL) + if (rainXa == nullptr) { rainXa = new float[32 * 32]; rainZa = new float[32 * 32]; @@ -1942,7 +1942,7 @@ void GameRenderer::setupClearColor(float a) if (d > 0) { float *c = level->dimension->getSunriseColor(level->getTimeOfDay(a), a); - if (c != NULL) + if (c != nullptr) { d *= c[3]; fr = fr * (1 - d) + c[0] * d; diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index 44315340b..921472f20 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -240,8 +240,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) shared_ptr headGear = minecraft->player->inventory->getArmor(3); // 4J-PB - changing this to be per player - //if (!minecraft->options->thirdPersonView && headGear != NULL && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); - if ((minecraft->player->ThirdPersonView()==0) && headGear != NULL && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); + //if (!minecraft->options->thirdPersonView && headGear != nullptr && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); + if ((minecraft->player->ThirdPersonView()==0) && headGear != nullptr && headGear->id == Tile::pumpkin_Id) renderPumpkin(screenWidth, screenHeight); if (!minecraft->player->hasEffect(MobEffect::confusion)) { float pt = minecraft->player->oPortalTime + (minecraft->player->portalTime - minecraft->player->oPortalTime) * a; @@ -525,7 +525,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) std::shared_ptr riding = minecraft->localplayers[iPad].get()->riding; std::shared_ptr living = dynamic_pointer_cast(riding); - if (riding == NULL) + if (riding == nullptr) { // render food for (int i = 0; i < FoodConstants::MAX_FOOD / 2; i++) @@ -908,7 +908,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) int px = Mth::floor(minecraft->player->x); int py = Mth::floor(minecraft->player->y); int pz = Mth::floor(minecraft->player->z); - if (minecraft->level != NULL && minecraft->level->hasChunkAt(px, py, pz)) + if (minecraft->level != nullptr && minecraft->level->hasChunkAt(px, py, pz)) { LevelChunk *chunkAt = minecraft->level->getChunkAt(px, pz); Biome *biome = chunkAt->getBiome(px & 15, pz & 15, minecraft->level->getBiomeSource()); @@ -961,7 +961,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) unsigned int max = 10; bool isChatting = false; - if (dynamic_cast(minecraft->screen) != NULL) + if (dynamic_cast(minecraft->screen) != nullptr) { max = 20; isChatting = true; @@ -1090,10 +1090,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // Moved to the xui base scene // void Gui::renderBossHealth(void) // { -// if (EnderDragonRenderer::bossInstance == NULL) return; +// if (EnderDragonRenderer::bossInstance == nullptr) return; // // shared_ptr boss = EnderDragonRenderer::bossInstance; -// EnderDragonRenderer::bossInstance = NULL; +// EnderDragonRenderer::bossInstance = nullptr; // // Minecraft *pMinecraft=Minecraft::GetInstance(); // @@ -1214,7 +1214,7 @@ void Gui::renderTp(float br, int w, int h) void Gui::renderSlot(int slot, int x, int y, float a) { shared_ptr item = minecraft->player->inventory->items[slot]; - if (item == NULL) return; + if (item == nullptr) return; float pop = item->popTime - a; if (pop > 0) @@ -1460,7 +1460,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc int height = minecraft->height; // This causes us to cover xScale*dataLength pixels in the horizontal int xScale = 1; - if(dataA != NULL && dataB != NULL) xScale = 2; + if(dataA != nullptr && dataB != nullptr) xScale = 2; glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); @@ -1483,7 +1483,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc int cc2 = cc * cc / 255; cc2 = cc2 * cc2 / 255; - if( dataA != NULL ) + if( dataA != nullptr ) { if (dataA[i] > dataAWarning) { @@ -1500,7 +1500,7 @@ void Gui::renderGraph(int dataLength, int dataPos, __int64 *dataA, float dataASc t->vertex((float)(xScale*i + 0.5f), (float)( height + 0.5f), static_cast(0)); } - if( dataB != NULL ) + if( dataB != nullptr ) { if (dataB[i]>dataBWarning) { diff --git a/Minecraft.Client/HugeExplosionSeedParticle.cpp b/Minecraft.Client/HugeExplosionSeedParticle.cpp index 67d68d460..bb8c8f223 100644 --- a/Minecraft.Client/HugeExplosionSeedParticle.cpp +++ b/Minecraft.Client/HugeExplosionSeedParticle.cpp @@ -26,7 +26,7 @@ void HugeExplosionSeedParticle::tick() double zz = z + (random->nextDouble() - random->nextDouble()) * 4; level->addParticle(eParticleType_largeexplode, xx, yy, zz, life / static_cast(lifeTime), 0, 0); } - Minecraft::GetInstance()->animateTickLevel = NULL; + Minecraft::GetInstance()->animateTickLevel = nullptr; life++; if (life == lifeTime) remove(); } diff --git a/Minecraft.Client/HumanoidMobRenderer.cpp b/Minecraft.Client/HumanoidMobRenderer.cpp index 2d513875c..284b084d4 100644 --- a/Minecraft.Client/HumanoidMobRenderer.cpp +++ b/Minecraft.Client/HumanoidMobRenderer.cpp @@ -17,8 +17,8 @@ void HumanoidMobRenderer::_init(HumanoidModel *humanoidModel, float scale) { this->humanoidModel = humanoidModel; this->_scale = scale; - armorParts1 = NULL; - armorParts2 = NULL; + armorParts1 = nullptr; + armorParts2 = nullptr; createArmorParts(); } @@ -76,9 +76,9 @@ ResourceLocation *HumanoidMobRenderer::getArmorLocation(ArmorItem *armorItem, in void HumanoidMobRenderer::prepareSecondPassArmor(shared_ptr mob, int layer, float a) { shared_ptr itemInstance = mob->getArmor(3 - layer); - if (itemInstance != NULL) { + if (itemInstance != nullptr) { Item *item = itemInstance->getItem(); - if (dynamic_cast(item) != NULL) + if (dynamic_cast(item) != nullptr) { bindTexture(getArmorLocation(dynamic_cast(item), layer, true)); @@ -99,10 +99,10 @@ int HumanoidMobRenderer::prepareArmor(shared_ptr _mob, int layer, shared_ptr mob = dynamic_pointer_cast(_mob); shared_ptr itemInstance = mob->getArmor(3 - layer); - if (itemInstance != NULL) + if (itemInstance != nullptr) { Item *item = itemInstance->getItem(); - if (dynamic_cast(item) != NULL) + if (dynamic_cast(item) != nullptr) { ArmorItem *armorItem = dynamic_cast(item); bindTexture(getArmorLocation(armorItem, layer)); @@ -171,12 +171,12 @@ void HumanoidMobRenderer::render(shared_ptr _mob, double x, double y, do ResourceLocation *HumanoidMobRenderer::getTextureLocation(shared_ptr mob) { // TODO -- Figure out of we need some data in here - return NULL; + return nullptr; } void HumanoidMobRenderer::prepareCarriedItem(shared_ptr mob, shared_ptr item) { - armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != NULL ? 1 : 0; + armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != nullptr ? 1 : 0; armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = mob->isSneaking(); } @@ -187,7 +187,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, floa shared_ptr item = mob->getCarriedItem(); shared_ptr headGear = mob->getArmor(3); - if (headGear != NULL) + if (headGear != nullptr) { // don't render the pumpkin of skulls for the skins with that disabled // 4J-PB - need to disable rendering armour/skulls/pumpkins for some special skins (Daleks) @@ -199,7 +199,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, floa if (headGear->getItem()->id < 256) { - if (Tile::tiles[headGear->id] != NULL && TileRenderer::canRender(Tile::tiles[headGear->id]->getRenderShape())) + if (Tile::tiles[headGear->id] != nullptr && TileRenderer::canRender(Tile::tiles[headGear->id]->getRenderShape())) { float s = 10 / 16.0f; glTranslatef(-0 / 16.0f, -4 / 16.0f, 0 / 16.0f); @@ -226,7 +226,7 @@ void HumanoidMobRenderer::additionalRendering(shared_ptr mob, floa } } - if (item != NULL) + if (item != nullptr) { glPushMatrix(); diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index 1e76f45a6..c6c6b9f4f 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -8,7 +8,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) { - ModelPart *pAttachTo=NULL; + ModelPart *pAttachTo=nullptr; switch(pBox->ePart) { @@ -40,10 +40,10 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) if((pNewBox->getfU()!=static_cast(pBox->fU)) || (pNewBox->getfV()!=static_cast(pBox->fV))) { app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Box geometry was found, but with different uvs\n"); - pNewBox=NULL; + pNewBox=nullptr; } } - if(pNewBox==NULL) + if(pNewBox==nullptr) { //app.DebugPrintf("HumanoidModel::AddOrRetrievePart - Adding box to model part\n"); @@ -142,7 +142,7 @@ HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight void HumanoidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { - if(entity != NULL) + if(entity != nullptr) { m_uiAnimOverrideBitmask=entity->getAnimOverrideBitmask(); } diff --git a/Minecraft.Client/Input.cpp b/Minecraft.Client/Input.cpp index cbcd317f6..c9b04e78f 100644 --- a/Minecraft.Client/Input.cpp +++ b/Minecraft.Client/Input.cpp @@ -84,7 +84,7 @@ void Input::tick(LocalPlayer *player) } // 4J: In flying mode, don't actually toggle sneaking (unless we're riding in which case we need to sneak to dismount) - if(!player->abilities.flying || player->riding != NULL) + if(!player->abilities.flying || player->riding != nullptr) { if((player->ullButtonsPressed&(1LL<localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_SNEAK_TOGGLE)) { diff --git a/Minecraft.Client/ItemFrameRenderer.cpp b/Minecraft.Client/ItemFrameRenderer.cpp index 54633deb3..33c4cd8ac 100644 --- a/Minecraft.Client/ItemFrameRenderer.cpp +++ b/Minecraft.Client/ItemFrameRenderer.cpp @@ -110,7 +110,7 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) Minecraft *pMinecraft=Minecraft::GetInstance(); shared_ptr instance = entity->getItem(); - if (instance == NULL) return; + if (instance == nullptr) return; shared_ptr itemEntity = shared_ptr(new ItemEntity(entity->level, 0, 0, 0, instance)); itemEntity->getItem()->count = 1; @@ -154,7 +154,7 @@ void ItemFrameRenderer::drawItem(shared_ptr entity) t->end(); shared_ptr data = Item::map->getSavedData(itemEntity->getItem(), entity->level); - if (data != NULL) + if (data != nullptr) { entityRenderDispatcher->itemInHandRenderer->minimap->render(nullptr, entityRenderDispatcher->textures, data, entity->entityId); } diff --git a/Minecraft.Client/ItemInHandRenderer.cpp b/Minecraft.Client/ItemInHandRenderer.cpp index b7aa4f8b5..4cebda2fd 100644 --- a/Minecraft.Client/ItemInHandRenderer.cpp +++ b/Minecraft.Client/ItemInHandRenderer.cpp @@ -226,7 +226,7 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrid]->getColor(item,0); float red = ((col >> 16) & 0xff) / 255.0f; @@ -238,7 +238,7 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrid]; - if (item->getIconType() == Icon::TYPE_TERRAIN && tile != NULL && TileRenderer::canRender(tile->getRenderShape())) + if (item->getIconType() == Icon::TYPE_TERRAIN && tile != nullptr && TileRenderer::canRender(tile->getRenderShape())) { MemSect(31); minecraft->textures->bindTexture(minecraft->textures->getTextureLocation(Icon::TYPE_TERRAIN)); @@ -249,7 +249,7 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrgetItemInHandIcon(item, layer); - if (icon == NULL) + if (icon == nullptr) { glPopMatrix(); MemSect(0); @@ -299,7 +299,7 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrgetSourceWidth(), icon->getSourceHeight(), 1 / 16.0f, false, bIsTerrain); - if (item != NULL && item->isFoil() && layer == 0) + if (item != nullptr && item->isFoil() && layer == 0) { glDepthFunc(GL_EQUAL); glDisable(GL_LIGHTING); @@ -425,7 +425,7 @@ void ItemInHandRenderer::render(float a) glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); glColor4f(1, 1, 1, 1); } - if (item != NULL) + if (item != nullptr) { int col = Item::items[item->id]->getColor(item,0); float red = ((col >> 16) & 0xff) / 255.0f; @@ -439,7 +439,7 @@ void ItemInHandRenderer::render(float a) glColor4f(br, br, br, 1); } - if (item != NULL && item->id == Item::map->id) + if (item != nullptr && item->id == Item::map->id) { glPushMatrix(); float d = 0.8f; @@ -538,12 +538,12 @@ void ItemInHandRenderer::render(float a) shared_ptr data = Item::map->getSavedData(item, minecraft->level); PIXBeginNamedEvent(0,"Minimap render"); - if(data != NULL) minimap->render(minecraft->player, minecraft->textures, data, minecraft->player->entityId); + if(data != nullptr) minimap->render(minecraft->player, minecraft->textures, data, minecraft->player->entityId); PIXEndNamedEvent(); glPopMatrix(); } - else if (item != NULL) + else if (item != nullptr) { glPushMatrix(); float d = 0.8f; @@ -762,7 +762,7 @@ void ItemInHandRenderer::renderScreenEffect(float a) } } - if (Tile::tiles[tile] != NULL) renderTex(a, Tile::tiles[tile]->getTexture(2)); + if (Tile::tiles[tile] != nullptr) renderTex(a, Tile::tiles[tile]->getTexture(2)); } if (minecraft->player->isUnderLiquid(Material::water)) @@ -905,11 +905,11 @@ void ItemInHandRenderer::tick() shared_ptr nextTile = player->inventory->getSelected(); bool matches = lastSlot == player->inventory->selected && nextTile == selectedItem; - if (selectedItem == NULL && nextTile == NULL) + if (selectedItem == nullptr && nextTile == nullptr) { matches = true; } - if (nextTile != NULL && selectedItem != NULL && nextTile != selectedItem && nextTile->id == selectedItem->id && nextTile->getAuxValue() == selectedItem->getAuxValue()) + if (nextTile != nullptr && selectedItem != nullptr && nextTile != selectedItem && nextTile->id == selectedItem->id && nextTile->getAuxValue() == selectedItem->getAuxValue()) { selectedItem = nextTile; matches = true; diff --git a/Minecraft.Client/ItemRenderer.cpp b/Minecraft.Client/ItemRenderer.cpp index 849195a65..a7a3a1bf6 100644 --- a/Minecraft.Client/ItemRenderer.cpp +++ b/Minecraft.Client/ItemRenderer.cpp @@ -65,7 +65,7 @@ void ItemRenderer::render(shared_ptr _itemEntity, double x, double y, do random->setSeed(187); shared_ptr item = itemEntity->getItem(); - if (item->getItem() == NULL) return; + if (item->getItem() == nullptr) return; glPushMatrix(); float bob = Mth::sin((itemEntity->age + a) / 10.0f + itemEntity->bobOffs) * 0.1f + 0.1f; @@ -82,7 +82,7 @@ void ItemRenderer::render(shared_ptr _itemEntity, double x, double y, do Tile *tile = Tile::tiles[item->id]; - if (item->getIconType() == Icon::TYPE_TERRAIN && tile != NULL && TileRenderer::canRender(tile->getRenderShape())) + if (item->getIconType() == Icon::TYPE_TERRAIN && tile != nullptr && TileRenderer::canRender(tile->getRenderShape())) { glRotatef(spin, 0, 1, 0); @@ -200,7 +200,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon { Tesselator *t = Tesselator::getInstance(); - if (icon == NULL) icon = entityRenderDispatcher->textures->getMissingIcon(entity->getItem()->getIconType()); + if (icon == nullptr) icon = entityRenderDispatcher->textures->getMissingIcon(entity->getItem()->getIconType()); float u0 = icon->getU0(); float u1 = icon->getU1(); float v0 = icon->getV0(); @@ -264,7 +264,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon glTranslatef(0, 0, width + margin); bool bIsTerrain = false; - if (item->getIconType() == Icon::TYPE_TERRAIN && Tile::tiles[item->id] != NULL) + if (item->getIconType() == Icon::TYPE_TERRAIN && Tile::tiles[item->id] != nullptr) { bIsTerrain = true; bindTexture(&TextureAtlas::LOCATION_BLOCKS); // TODO: Do this sanely by Icon @@ -279,7 +279,7 @@ void ItemRenderer::renderItemBillboard(shared_ptr entity, Icon *icon //ItemInHandRenderer::renderItem3D(t, u1, v0, u0, v1, icon->getSourceWidth(), icon->getSourceHeight(), width, false); ItemInHandRenderer::renderItem3D(t, u0, v0, u1, v1, icon->getSourceWidth(), icon->getSourceHeight(), width, false, bIsTerrain); - if (item != NULL && item->isFoil()) + if (item != nullptr && item->isFoil()) { glDepthFunc(GL_EQUAL); glDisable(GL_LIGHTING); @@ -443,7 +443,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptrgetMissingIcon(item->getIconType()); } @@ -481,7 +481,7 @@ void ItemRenderer::renderGuiItem(Font *font, Textures *textures, shared_ptr item, float x, float y,float fScale,float fAlpha, bool isFoil) { - if(item==NULL) return; + if(item==nullptr) return; renderAndDecorateItem(font, textures, item, x, y,fScale, fScale, fAlpha, isFoil, true); } @@ -489,7 +489,7 @@ void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const s // (ie from the gui rather than xui). In this case we dno't want to enable/disable blending, and do need to restore the blend state when we are done. void ItemRenderer::renderAndDecorateItem(Font *font, Textures *textures, const shared_ptr item, float x, float y,float fScaleX, float fScaleY,float fAlpha, bool isFoil, bool isConstantBlended, bool useCompiled) { - if (item == NULL) + if (item == nullptr) { return; } @@ -593,7 +593,7 @@ void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shar void ItemRenderer::renderGuiItemDecorations(Font *font, Textures *textures, shared_ptr item, int x, int y, const wstring &countText, float fAlpha) { - if (item == NULL) + if (item == nullptr) { return; } diff --git a/Minecraft.Client/ItemSpriteRenderer.cpp b/Minecraft.Client/ItemSpriteRenderer.cpp index b8a4a3770..afe8023ee 100644 --- a/Minecraft.Client/ItemSpriteRenderer.cpp +++ b/Minecraft.Client/ItemSpriteRenderer.cpp @@ -22,7 +22,7 @@ void ItemSpriteRenderer::render(shared_ptr e, double x, double y, double { // the icon is already cached in the item object, so there should not be any performance impact by not caching it here Icon *icon = sourceItem->getIcon(sourceItemAuxValue); - if (icon == NULL) + if (icon == nullptr) { return; } diff --git a/Minecraft.Client/JoinMultiplayerScreen.cpp b/Minecraft.Client/JoinMultiplayerScreen.cpp index 7ef19663c..2e0c64d9e 100644 --- a/Minecraft.Client/JoinMultiplayerScreen.cpp +++ b/Minecraft.Client/JoinMultiplayerScreen.cpp @@ -7,7 +7,7 @@ JoinMultiplayerScreen::JoinMultiplayerScreen(Screen *lastScreen) { - ipEdit = NULL; + ipEdit = nullptr; this->lastScreen = lastScreen; } diff --git a/Minecraft.Client/LevelRenderer.cpp b/Minecraft.Client/LevelRenderer.cpp index 109fab3f5..dc7b8987d 100644 --- a/Minecraft.Client/LevelRenderer.cpp +++ b/Minecraft.Client/LevelRenderer.cpp @@ -111,12 +111,12 @@ const int LevelRenderer::DIMENSION_OFFSETS[3] = { 0, (80 * 80 * CHUNK_Y_COUNT) , LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures) { - breakingTextures = NULL; + breakingTextures = nullptr; for( int i = 0; i < 4; i++ ) { - level[i] = NULL; - tileRenderer[i] = NULL; + level[i] = nullptr; + tileRenderer[i] = nullptr; xOld[i] = -9999; yOld[i] = -9999; zOld[i] = -9999; @@ -142,7 +142,7 @@ LevelRenderer::LevelRenderer(Minecraft *mc, Textures *textures) totalChunks= offscreenChunks= occludedChunks= renderedChunks= emptyChunks = 0; for( int i = 0; i < 4; i++ ) { - // sortedChunks[i] = NULL; // 4J - removed - not sorting our chunks anymore + // sortedChunks[i] = nullptr; // 4J - removed - not sorting our chunks anymore chunks[i] = ClipChunkArray(); lastPlayerCount[i] = 0; } @@ -323,7 +323,7 @@ void LevelRenderer::renderStars() void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level) { - if (this->level[playerIndex] != NULL) + if (this->level[playerIndex] != nullptr) { // Remove listener for this level if this is the last player referencing it Level *prevLevel = this->level[playerIndex]; @@ -343,12 +343,12 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level) zOld[playerIndex] = -9999; this->level[playerIndex] = level; - if( tileRenderer[playerIndex] != NULL ) + if( tileRenderer[playerIndex] != nullptr ) { delete tileRenderer[playerIndex]; } tileRenderer[playerIndex] = new TileRenderer(level); - if (level != NULL) + if (level != nullptr) { // If we're the only player referencing this level, add a new listener for it int refCount = 0; @@ -366,7 +366,7 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level) else { // printf("NULLing player %d, chunks @ 0x%x\n",playerIndex,chunks[playerIndex]); - if( chunks[playerIndex].data != NULL ) + if( chunks[playerIndex].data != nullptr ) { for (unsigned int i = 0; i < chunks[playerIndex].length; i++) { @@ -374,14 +374,14 @@ void LevelRenderer::setLevel(int playerIndex, MultiPlayerLevel *level) delete chunks[playerIndex][i].chunk; } delete chunks[playerIndex].data; - chunks[playerIndex].data = NULL; + chunks[playerIndex].data = nullptr; chunks[playerIndex].length = 0; // delete sortedChunks[playerIndex]; // 4J - removed - not sorting our chunks anymore - // sortedChunks[playerIndex] = NULL; // 4J - removed - not sorting our chunks anymore + // sortedChunks[playerIndex] = nullptr; // 4J - removed - not sorting our chunks anymore } // 4J Stu - If we do this for splitscreen players leaving, then all the tile entities in the world dissappear - // We should only do this when actually exiting the game, so only when the primary player sets there level to NULL + // We should only do this when actually exiting the game, so only when the primary player sets there level to nullptr if(playerIndex == ProfileManager.GetPrimaryPad()) renderableTileEntities.clear(); } } @@ -416,7 +416,7 @@ void LevelRenderer::allChanged(int playerIndex) // If this CS is entered before DisableUpdateThread is called then (on 360 at least) we can get a // deadlock when starting a game in splitscreen. //EnterCriticalSection(&m_csDirtyChunks); - if( level == NULL ) + if( level == nullptr ) { return; } @@ -440,7 +440,7 @@ void LevelRenderer::allChanged(int playerIndex) yChunks = Level::maxBuildHeight / CHUNK_SIZE; zChunks = dist; - if( chunks[playerIndex].data != NULL ) + if( chunks[playerIndex].data != nullptr ) { for (unsigned int i = 0; i < chunks[playerIndex].length; i++) { @@ -463,7 +463,7 @@ void LevelRenderer::allChanged(int playerIndex) yMaxChunk = yChunks; zMaxChunk = zChunks; - // 4J removed - we now only fully clear this on exiting the game (setting level to NULL). Apart from that, the chunk rebuilding is responsible for maintaining this + // 4J removed - we now only fully clear this on exiting the game (setting level to nullptr). Apart from that, the chunk rebuilding is responsible for maintaining this // renderableTileEntities.clear(); for (int x = 0; x < xChunks; x++) @@ -483,10 +483,10 @@ void LevelRenderer::allChanged(int playerIndex) } nonStackDirtyChunksAdded(); - if (level != NULL) + if (level != nullptr) { shared_ptr player = mc->cameraTargetPlayer; - if (player != NULL) + if (player != nullptr) { this->resortChunks(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); // sort(sortedChunks[playerIndex]->begin(),sortedChunks[playerIndex]->end(), DistanceChunkSorter(player)); // 4J - removed - not sorting our chunks anymore @@ -547,7 +547,7 @@ void LevelRenderer::renderEntities(Vec3 *cam, Culler *culler, float a) if ( !shouldRender && entity->instanceof(eTYPE_MOB) ) { shared_ptr mob = dynamic_pointer_cast(entity); - if ( mob->isLeashed() && (mob->getLeashHolder() != NULL) ) + if ( mob->isLeashed() && (mob->getLeashHolder() != nullptr) ) { shared_ptr leashHolder = mob->getLeashHolder(); shouldRender = culler->isVisible(leashHolder->bb); @@ -1027,7 +1027,7 @@ void LevelRenderer::renderSky(float alpha) Lighting::turnOff(); float *c = level[playerIndex]->dimension->getSunriseColor(level[playerIndex]->getTimeOfDay(alpha), alpha); - if (c != NULL) + if (c != nullptr) { glDisable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); @@ -1813,7 +1813,7 @@ bool LevelRenderer::updateDirtyChunks() std::list< std::pair > nearestClipChunks; #endif - ClipChunk *nearChunk = NULL; // Nearest chunk that is dirty + ClipChunk *nearChunk = nullptr; // Nearest chunk that is dirty int veryNearCount = 0; int minDistSq = 0x7fffffff; // Distances to this chunk @@ -1891,15 +1891,15 @@ bool LevelRenderer::updateDirtyChunks() g_findNearestChunkDataIn.chunks[i] = (LevelRenderer_FindNearestChunk_DataIn::ClipChunk*)chunks[i].data; g_findNearestChunkDataIn.chunkLengths[i] = chunks[i].length; g_findNearestChunkDataIn.level[i] = level[i]; - g_findNearestChunkDataIn.playerData[i].bValid = mc->localplayers[i] != NULL; - if(mc->localplayers[i] != NULL) + g_findNearestChunkDataIn.playerData[i].bValid = mc->localplayers[i] != nullptr; + if(mc->localplayers[i] != nullptr) { g_findNearestChunkDataIn.playerData[i].x = mc->localplayers[i]->x; g_findNearestChunkDataIn.playerData[i].y = mc->localplayers[i]->y; g_findNearestChunkDataIn.playerData[i].z = mc->localplayers[i]->z; } - if(level[i] != NULL) + if(level[i] != nullptr) { g_findNearestChunkDataIn.multiplayerChunkCache[i].XZOFFSET = ((MultiPlayerChunkCache*)(level[i]->chunkSource))->XZOFFSET; g_findNearestChunkDataIn.multiplayerChunkCache[i].XZSIZE = ((MultiPlayerChunkCache*)(level[i]->chunkSource))->XZSIZE; @@ -1923,12 +1923,12 @@ bool LevelRenderer::updateDirtyChunks() // Find nearest chunk that is dirty for( int p = 0; p < XUSER_MAX_COUNT; p++ ) { - // It's possible that the localplayers member can be set to NULL on the main thread when a player chooses to exit the game + // It's possible that the localplayers member can be set to nullptr on the main thread when a player chooses to exit the game // So take a reference to the player object now. As it is a shared_ptr it should live as long as we need it shared_ptr player = mc->localplayers[p]; - if( player == NULL ) continue; - if( chunks[p].data == NULL ) continue; - if( level[p] == NULL ) continue; + if( player == nullptr ) continue; + if( chunks[p].data == nullptr ) continue; + if( level[p] == nullptr ) continue; if( chunks[p].length != xChunks * zChunks * CHUNK_Y_COUNT ) continue; int px = static_cast(player->x); int py = static_cast(player->y); @@ -2031,7 +2031,7 @@ bool LevelRenderer::updateDirtyChunks() - Chunk *chunk = NULL; + Chunk *chunk = nullptr; #ifdef _LARGE_WORLDS if(!nearestClipChunks.empty()) { @@ -2182,7 +2182,7 @@ void LevelRenderer::renderHit(shared_ptr player, HitResult *h, int mode, glEnable(GL_ALPHA_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glColor4f(1, 1, 1, ((float) (Mth::sin(Minecraft::currentTimeMillis() / 100.0f)) * 0.2f + 0.4f) * 0.5f); - if (mode != 0 && inventoryItem != NULL) + if (mode != 0 && inventoryItem != nullptr) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); float br = (Mth::sin(Minecraft::currentTimeMillis() / 100.0f) * 0.2f + 0.8f); @@ -2237,8 +2237,8 @@ void LevelRenderer::renderDestroyAnimation(Tesselator *t, shared_ptr pla { int iPad = mc->player->GetXboxPad(); // 4J added int tileId = level[iPad]->getTile(block->getX(), block->getY(), block->getZ()); - Tile *tile = tileId > 0 ? Tile::tiles[tileId] : NULL; - if (tile == NULL) tile = Tile::stone; + Tile *tile = tileId > 0 ? Tile::tiles[tileId] : nullptr; + if (tile == nullptr) tile = Tile::stone; tileRenderer[iPad]->tesselateInWorldFixedTexture(tile, block->getX(), block->getY(), block->getZ(), breakingTextures[block->getProgress()]); // 4J renamed to differentiate from tesselateInWorld } ++it; @@ -2329,7 +2329,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev { // 4J - level is passed if this is coming from setTilesDirty, which could come from when connection is being ticked outside of normal level tick, and player won't // be set up - if( level == NULL ) level = this->level[mc->player->GetXboxPad()]; + if( level == nullptr ) level = this->level[mc->player->GetXboxPad()]; // EnterCriticalSection(&m_csDirtyChunks); int _x0 = Mth::intFloorDiv(x0, CHUNK_XZSIZE); int _y0 = Mth::intFloorDiv(y0, CHUNK_SIZE); @@ -2350,7 +2350,7 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev // These chunks are then added to the global flags in the render update thread. // An XLockFreeQueue actually implements a queue of pointers to its templated type, and I don't want to have to go allocating ints here just to store the // pointer to them in a queue. Hence actually pretending that the int Is a pointer here. Our Index has a a valid range from 0 to something quite big, - // but including zero. The lock free queue, since it thinks it is dealing with pointers, uses a NULL pointer to signify that a Pop hasn't succeeded. + // but including zero. The lock free queue, since it thinks it is dealing with pointers, uses a nullptr pointer to signify that a Pop hasn't succeeded. // We also want to reserve one special value (of 1 ) for use when multiple chunks not individually listed are made dirty. Therefore adding 2 to our // index value here to move our valid range from 1 to something quite big + 2 if( index > -1 ) @@ -2408,12 +2408,12 @@ void LevelRenderer::setDirty(int x0, int y0, int z0, int x1, int y1, int z1, Lev void LevelRenderer::tileChanged(int x, int y, int z) { - setDirty(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, NULL); + setDirty(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, nullptr); } void LevelRenderer::tileLightChanged(int x, int y, int z) { - setDirty(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, NULL); + setDirty(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, nullptr); } void LevelRenderer::setTilesDirty(int x0, int y0, int z0, int x1, int y1, int z1, Level *level) // 4J - added level param @@ -2620,7 +2620,7 @@ void LevelRenderer::playSoundExceptPlayer(shared_ptr player, int iSound, /* void LevelRenderer::addParticle(const wstring& name, double x, double y, double z, double xa, double ya, double za) { -if (mc == NULL || mc->cameraTargetPlayer == NULL || mc->particleEngine == NULL) return; +if (mc == nullptr || mc->cameraTargetPlayer == nullptr || mc->particleEngine == nullptr) return; double xd = mc->cameraTargetPlayer->x - x; double yd = mc->cameraTargetPlayer->y - y; @@ -2656,7 +2656,7 @@ void LevelRenderer::addParticle(ePARTICLE_TYPE eParticleType, double x, double y shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticleType, double x, double y, double z, double xa, double ya, double za) { - if (mc == NULL || mc->cameraTargetPlayer == NULL || mc->particleEngine == NULL) + if (mc == nullptr || mc->cameraTargetPlayer == nullptr || mc->particleEngine == nullptr) { return nullptr; } @@ -2691,12 +2691,12 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle distCull = false; } - // 4J - this is a bit of hack to get communication through from the level itself, but if Minecraft::animateTickLevel is NULL then + // 4J - this is a bit of hack to get communication through from the level itself, but if Minecraft::animateTickLevel is nullptr then // we are to behave as normal, and if it is set, then we should use that as a pointer to the level the particle is to be created with // rather than try to work it out from the current player. This is because in this state we are calling from a loop that is trying // to amalgamate particle creation between all players for a particular level. Also don't do distance clipping as it isn't for a particular // player, and distance is already taken into account before we get here anyway by the code in Level::animateTickDoWork - if( mc->animateTickLevel == NULL ) + if( mc->animateTickLevel == nullptr ) { double particleDistanceSquared = 16 * 16; double xd = 0.0f; @@ -2709,7 +2709,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { shared_ptr thisPlayer = mc->localplayers[i]; - if(thisPlayer != NULL && level[i] == lev) + if(thisPlayer != nullptr && level[i] == lev) { xd = thisPlayer->x - x; yd = thisPlayer->y - y; @@ -2909,7 +2909,7 @@ shared_ptr LevelRenderer::addParticleInternal(ePARTICLE_TYPE eParticle } } - if (particle != NULL) + if (particle != nullptr) { mc->particleEngine->add(particle); } @@ -2985,7 +2985,7 @@ void LevelRenderer::globalLevelEvent(int type, int sourceX, int sourceY, int sou { case LevelEvent::SOUND_WITHER_BOSS_SPAWN: case LevelEvent::SOUND_DRAGON_DEATH: - if (mc->cameraTargetPlayer != NULL) + if (mc->cameraTargetPlayer != nullptr) { // play the sound at an offset from the player double dx = sourceX - mc->cameraTargetPlayer->x; @@ -3024,7 +3024,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y { //case LevelEvent::SOUND_WITHER_BOSS_SPAWN: case LevelEvent::SOUND_DRAGON_DEATH: - if (mc->cameraTargetPlayer != NULL) + if (mc->cameraTargetPlayer != nullptr) { // play the sound at an offset from the player double dx = x - mc->cameraTargetPlayer->x; @@ -3129,7 +3129,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y double zs = sin(angle) * dist; shared_ptr spellParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); - if (spellParticle != NULL) + if (spellParticle != nullptr) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; spellParticle->setColor(red * randBrightness, green * randBrightness, blue * randBrightness); @@ -3156,7 +3156,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y double zs = sin(angle) * dist; shared_ptr acidParticle = addParticleInternal(particleName, xp + xs * 0.1, yp + 0.3, zp + zs * 0.1, xs, ys, zs); - if (acidParticle != NULL) + if (acidParticle != nullptr) { float randBrightness = 0.75f + random->nextFloat() * 0.25f; acidParticle->setPower(static_cast(dist)); @@ -3217,7 +3217,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y case LevelEvent::SOUND_PLAY_RECORDING: { RecordingItem *rci = dynamic_cast(Item::items[data]); - if (rci != NULL) + if (rci != nullptr) { level[playerIndex]->playStreamingMusic(rci->recording, x, y, z); } @@ -3226,7 +3226,7 @@ void LevelRenderer::levelEvent(shared_ptr source, int type, int x, int y // 4J-PB - only play streaming music if there isn't already some playing - the CD playing may have finished, and game music started playing already if(!mc->soundEngine->GetIsPlayingStreamingGameMusic()) { - level[playerIndex]->playStreamingMusic(L"", x, y, z); // 4J - used to pass NULL, but using empty string here now instead + level[playerIndex]->playStreamingMusic(L"", x, y, z); // 4J - used to pass nullptr, but using empty string here now instead } } mc->localplayers[playerIndex]->updateRichPresence(); @@ -3286,12 +3286,12 @@ void LevelRenderer::destroyTileProgress(int id, int x, int y, int z, int progres } else { - BlockDestructionProgress *entry = NULL; + BlockDestructionProgress *entry = nullptr; auto it = destroyingBlocks.find(id); if(it != destroyingBlocks.end()) entry = it->second; - if (entry == NULL || entry->getX() != x || entry->getY() != y || entry->getZ() != z) + if (entry == nullptr || entry->getX() != x || entry->getY() != y || entry->getZ() != z) { entry = new BlockDestructionProgress(id, x, y, z); destroyingBlocks.insert( unordered_map::value_type(id, entry) ); @@ -3553,7 +3553,7 @@ void LevelRenderer::DestroyedTileManager::destroyingTileAt( Level *level, int x, AABB *box = AABB::newTemp(static_cast(x), static_cast(y), static_cast(z), static_cast(x + 1), static_cast(y + 1), static_cast(z + 1)); Tile *tile = Tile::tiles[level->getTile(x, y, z)]; - if (tile != NULL) + if (tile != nullptr) { tile->addAABBs(level, x, y, z, box, &recentTile->boxes, nullptr); } diff --git a/Minecraft.Client/LivingEntityRenderer.cpp b/Minecraft.Client/LivingEntityRenderer.cpp index f713c20e5..7e99f0ba6 100644 --- a/Minecraft.Client/LivingEntityRenderer.cpp +++ b/Minecraft.Client/LivingEntityRenderer.cpp @@ -17,7 +17,7 @@ LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow) { this->model = model; shadowRadius = shadow; - armor = NULL; + armor = nullptr; } void LivingEntityRenderer::setArmor(Model *armor) @@ -43,11 +43,11 @@ void LivingEntityRenderer::render(shared_ptr _mob, double x, double y, d glDisable(GL_CULL_FACE); model->attackTime = 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; model->young = mob->isBaby(); - if (armor != NULL) armor->young = model->young; + if (armor != nullptr) armor->young = model->young; /*try*/ { @@ -448,7 +448,7 @@ void LivingEntityRenderer::renderName(shared_ptr mob, double x, do bool LivingEntityRenderer::shouldShowName(shared_ptr mob) { - return Minecraft::renderNames() && mob != entityRenderDispatcher->cameraEntity && !mob->isInvisibleTo(Minecraft::GetInstance()->player) && mob->rider.lock() == NULL; + return Minecraft::renderNames() && mob != entityRenderDispatcher->cameraEntity && !mob->isInvisibleTo(Minecraft::GetInstance()->player) && mob->rider.lock() == nullptr; } void LivingEntityRenderer::renderNameTags(shared_ptr mob, double x, double y, double z, const wstring &msg, float scale, double dist) diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index 46d231d46..6e06f9ef6 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -79,11 +79,11 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim this->minecraft = minecraft; this->dimension = dimension; - if (user != NULL && user->name.length() > 0) + if (user != nullptr && user->name.length() > 0) { customTextureUrl = L"http://s3.amazonaws.com/MinecraftSkins/" + user->name + L".png"; } - if( user != NULL ) + if( user != nullptr ) { this->name = user->name; //wprintf(L"Created LocalPlayer with name %ls\n", name.c_str() ); @@ -95,7 +95,7 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim } } - input = NULL; + input = nullptr; m_iPad = -1; m_iScreenSection=C4JRender::VIEWPORT_TYPE_FULLSCREEN; // assume singleplayer default m_bPlayerRespawned=false; @@ -124,7 +124,7 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim LocalPlayer::~LocalPlayer() { - if( this->input != NULL ) + if( this->input != nullptr ) delete input; } @@ -188,9 +188,9 @@ void LocalPlayer::aiStep() { if (!level->isClientSide) { - if (riding != NULL) this->ride(nullptr); + if (riding != nullptr) this->ride(nullptr); } - if (minecraft->screen != NULL) minecraft->setScreen(NULL); + if (minecraft->screen != nullptr) minecraft->setScreen(nullptr); if (portalTime == 0) { @@ -574,7 +574,7 @@ void LocalPlayer::readAdditionalSaveData(CompoundTag *entityTag) void LocalPlayer::closeContainer() { Player::closeContainer(); - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); // 4J - Close any xui here // Fix for #9164 - CRASH: MP: Title crashes upon opening a chest and having another user destroy it. @@ -755,7 +755,7 @@ void LocalPlayer::hurtTo(float newHealth, ETelemetryChallenges damageSource) if( this->getHealth() <= 0) { int deathTime = static_cast(level->getGameTime() % Level::TICKS_PER_DAY)/1000; - int carriedId = inventory->getSelected() == NULL ? 0 : inventory->getSelected()->id; + int carriedId = inventory->getSelected() == nullptr ? 0 : inventory->getSelected()->id; TelemetryManager->RecordPlayerDiedOrFailed(GetXboxPad(), 0, y, 0, 0, carriedId, 0, damageSource); // if there are any xuiscenes up for this player, close them @@ -800,7 +800,7 @@ void LocalPlayer::awardStat(Stat *stat, byteArray param) delete [] param.data; if (!app.CanRecordStatsAndAchievements()) return; - if (stat == NULL) return; + if (stat == nullptr) return; if (stat->isAchievement()) { @@ -1196,7 +1196,7 @@ void LocalPlayer::playSound(int soundId, float volume, float pitch) bool LocalPlayer::isRidingJumpable() { - return riding != NULL && riding->GetType() == eTYPE_HORSE; + return riding != nullptr && riding->GetType() == eTYPE_HORSE; } float LocalPlayer::getJumpRidingScale() @@ -1215,7 +1215,7 @@ bool LocalPlayer::hasPermission(EGameCommand command) void LocalPlayer::onCrafted(shared_ptr item) { - if( minecraft->localgameModes[m_iPad] != NULL ) + if( minecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(minecraft->localgameModes[m_iPad]); gameMode->getTutorial()->onCrafted(item); @@ -1272,14 +1272,14 @@ void LocalPlayer::mapPlayerChunk(const unsigned int flagTileType) void LocalPlayer::handleMouseDown(int button, bool down) { // 4J Stu - We should not accept any input while asleep, except the above to wake up - if(isSleeping() && level != NULL && level->isClientSide) + if(isSleeping() && level != nullptr && level->isClientSide) { return; } if (!down) missTime = 0; if (button == 0 && missTime > 0) return; - if (down && minecraft->hitResult != NULL && minecraft->hitResult->type == HitResult::TILE && button == 0) + if (down && minecraft->hitResult != nullptr && minecraft->hitResult->type == HitResult::TILE && button == 0) { int x = minecraft->hitResult->x; int y = minecraft->hitResult->y; @@ -1486,7 +1486,7 @@ bool LocalPlayer::handleMouseClick(int button) // 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer game - we need to wake up, and we don't have the inbedchatscreen with a button - if(button==1 && (isSleeping() && level != NULL && level->isClientSide)) + if(button==1 && (isSleeping() && level != nullptr && level->isClientSide)) { if(lastClickState == lastClick_oldRepeat) return false; @@ -1497,14 +1497,14 @@ bool LocalPlayer::handleMouseClick(int button) } // 4J Stu - We should not accept any input while asleep, except the above to wake up - if(isSleeping() && level != NULL && level->isClientSide) + if(isSleeping() && level != nullptr && level->isClientSide) { return false; } shared_ptr oldItem = inventory->getSelected(); - if (minecraft->hitResult == NULL) + if (minecraft->hitResult == nullptr) { if (button == 0 && minecraft->localgameModes[GetXboxPad()]->hasMissTime()) missTime = 10; } @@ -1555,7 +1555,7 @@ bool LocalPlayer::handleMouseClick(int button) else { shared_ptr item = oldItem; - int oldCount = item != NULL ? item->count : 0; + int oldCount = item != nullptr ? item->count : 0; bool usedItem = false; if (minecraft->gameMode->useItemOn(minecraft->localplayers[GetXboxPad()], level, item, x, y, z, face, minecraft->hitResult->pos, false, &usedItem)) { @@ -1568,7 +1568,7 @@ bool LocalPlayer::handleMouseClick(int button) //app.DebugPrintf("Player %d is swinging\n",GetXboxPad()); swing(); } - if (item == NULL) + if (item == nullptr) { return false; } @@ -1587,7 +1587,7 @@ bool LocalPlayer::handleMouseClick(int button) if (mayUse && button == 1) { shared_ptr item = inventory->getSelected(); - if (item != NULL) + if (item != nullptr) { if (minecraft->gameMode->useItem(minecraft->localplayers[GetXboxPad()], level, item)) { @@ -1603,23 +1603,23 @@ void LocalPlayer::updateRichPresence() if((m_iPad!=-1)/* && !ui.GetMenuDisplayed(m_iPad)*/ ) { shared_ptr selectedItem = inventory->getSelected(); - if(selectedItem != NULL && selectedItem->id == Item::fishingRod_Id) + if(selectedItem != nullptr && selectedItem->id == Item::fishingRod_Id) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_FISHING); } - else if(selectedItem != NULL && selectedItem->id == Item::map_Id) + else if(selectedItem != nullptr && selectedItem->id == Item::map_Id) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_MAP); } - else if ( (riding != NULL) && riding->instanceof(eTYPE_MINECART) ) + else if ( (riding != nullptr) && riding->instanceof(eTYPE_MINECART) ) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_MINECART); } - else if ( (riding != NULL) && riding->instanceof(eTYPE_BOAT) ) + else if ( (riding != nullptr) && riding->instanceof(eTYPE_BOAT) ) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BOATING); } - else if ( (riding != NULL) && riding->instanceof(eTYPE_PIG) ) + else if ( (riding != nullptr) && riding->instanceof(eTYPE_PIG) ) { app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_RIDING_PIG); } @@ -1660,13 +1660,13 @@ float LocalPlayer::getAndResetChangeDimensionTimer() void LocalPlayer::handleCollectItem(shared_ptr item) { - if(item != NULL) + if(item != nullptr) { unsigned int itemCountAnyAux = 0; unsigned int itemCountThisAux = 0; for (unsigned int k = 0; k < inventory->items.length; ++k) { - if (inventory->items[k] != NULL) + if (inventory->items[k] != nullptr) { // do they have the item if(inventory->items[k]->id == item->id) diff --git a/Minecraft.Client/MemTexture.cpp b/Minecraft.Client/MemTexture.cpp index f587e82f1..ee3ba7981 100644 --- a/Minecraft.Client/MemTexture.cpp +++ b/Minecraft.Client/MemTexture.cpp @@ -15,7 +15,7 @@ MemTexture::MemTexture(const wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextu //loadedImage=Textures::getTexture() // 4J - remember to add deletes in here for any created BufferedImages when implemented loadedImage = new BufferedImage(pbData,dwBytes); - if(processor==NULL) + if(processor==nullptr) { } diff --git a/Minecraft.Client/MinecartRenderer.cpp b/Minecraft.Client/MinecartRenderer.cpp index 29b97b7ea..6bb8b26d3 100644 --- a/Minecraft.Client/MinecartRenderer.cpp +++ b/Minecraft.Client/MinecartRenderer.cpp @@ -42,12 +42,12 @@ void MinecartRenderer::render(shared_ptr _cart, double x, double y, doub float xRot = cart->xRotO + (cart->xRot - cart->xRotO) * a; - if (p != NULL) + if (p != nullptr) { Vec3 *p0 = cart->getPosOffs(xx, yy, zz, r); Vec3 *p1 = cart->getPosOffs(xx, yy, zz, -r); - if (p0 == NULL) p0 = p; - if (p1 == NULL) p1 = p; + if (p0 == nullptr) p0 = p; + if (p1 == nullptr) p1 = p; x += p->x - xx; y += (p0->y + p1->y) / 2 - yy; @@ -80,7 +80,7 @@ void MinecartRenderer::render(shared_ptr _cart, double x, double y, doub Tile *tile = cart->getDisplayTile(); int tileData = cart->getDisplayData(); - if (tile != NULL) + if (tile != nullptr) { glPushMatrix(); diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index 01e07a6c1..7048c8d01 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -84,7 +84,7 @@ // from the main thread, and have longer to run, since it's called at 20Hz instead of 60 #define DISABLE_LEVELTICK_THREAD -Minecraft *Minecraft::m_instance = NULL; +Minecraft *Minecraft::m_instance = nullptr; __int64 Minecraft::frameTimes[512]; __int64 Minecraft::tickTimes[512]; int Minecraft::frameTimePos = 0; @@ -119,33 +119,33 @@ ResourceLocation Minecraft::ALT_FONT_LOCATION = ResourceLocation(TN_ALT_FONT); Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet *minecraftApplet, int width, int height, bool fullscreen) { // 4J - added this block of initialisers - gameMode = NULL; + gameMode = nullptr; hasCrashed = false; timer = new Timer(SharedConstants::TICKS_PER_SECOND); - oldLevel = NULL; //4J Stu added - level = NULL; + oldLevel = nullptr; //4J Stu added + level = nullptr; levels = MultiPlayerLevelArray(3); // 4J Added - levelRenderer = NULL; + levelRenderer = nullptr; player = nullptr; cameraTargetPlayer = nullptr; - particleEngine = NULL; - user = NULL; - parent = NULL; + particleEngine = nullptr; + user = nullptr; + parent = nullptr; pause = false; - textures = NULL; - font = NULL; - screen = NULL; + textures = nullptr; + font = nullptr; + screen = nullptr; localPlayerIdx = 0; rightClickDelay = 0; // 4J Stu Added InitializeCriticalSection( &ProgressRenderer::s_progress ); InitializeCriticalSection(&m_setLevelCS); - //m_hPlayerRespawned = CreateEvent(NULL, FALSE, FALSE, NULL); + //m_hPlayerRespawned = CreateEvent(nullptr, FALSE, FALSE, nullptr); - progressRenderer = NULL; - gameRenderer = NULL; - bgLoader = NULL; + progressRenderer = nullptr; + gameRenderer = nullptr; + bgLoader = nullptr; ticks = 0; // 4J-PB - moved into the local player @@ -156,20 +156,20 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet orgWidth = orgHeight = 0; achievementPopup = new AchievementPopup(this); - gui = NULL; + gui = nullptr; noRender = false; humanoidModel = new HumanoidModel(0); hitResult = 0; - options = NULL; + options = nullptr; soundEngine = new SoundEngine(); - mouseHandler = NULL; - skins = NULL; + mouseHandler = nullptr; + skins = nullptr; workingDirectory = File(L""); - levelSource = NULL; - stats[0] = NULL; - stats[1] = NULL; - stats[2] = NULL; - stats[3] = NULL; + levelSource = nullptr; + stats[0] = nullptr; + stats[1] = nullptr; + stats[2] = nullptr; + stats[3] = nullptr; connectToPort = 0; workDir = File(L""); // 4J removed @@ -186,7 +186,7 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet orgHeight = height; this->fullscreen = fullscreen; - this->minecraftApplet = NULL; + this->minecraftApplet = nullptr; this->parent = parent; // 4J - Our actual physical frame buffer is always 1280x720 ie in a 16:9 ratio. If we want to do a 4:3 mode, we are telling the original minecraft code @@ -213,12 +213,12 @@ Minecraft::Minecraft(Component *mouseComponent, Canvas *parent, MinecraftApplet for(int i=0;isoundEngine->init(NULL); + this->soundEngine->init(nullptr); #endif #ifndef DISABLE_LEVELTICK_THREAD @@ -353,7 +353,7 @@ void Minecraft::init() stats[i] = new StatsCounter(); /* 4J - TODO, 4J-JEV: Unnecessary. - Achievements::openInventory->setDescFormatter(NULL); + Achievements::openInventory->setDescFormatter(nullptr); Achievements.openInventory.setDescFormatter(new DescFormatter(){ public String format(String i18nValue) { return String.format(i18nValue, Keyboard.getKeyName(options.keyBuild.key)); @@ -414,7 +414,7 @@ void Minecraft::init() MemSect(0); gui = new Gui(this); - if (connectToIp != L"") // 4J - was NULL comparison + if (connectToIp != L"") // 4J - was nullptr comparison { // setScreen(new ConnectScreen(this, connectToIp, connectToPort)); // 4J TODO - put back in } @@ -498,30 +498,30 @@ LevelStorageSource *Minecraft::getLevelSource() void Minecraft::setScreen(Screen *screen) { - if (this->screen != NULL) + if (this->screen != nullptr) { this->screen->removed(); } #ifdef _WINDOWS64 - if (screen != NULL && g_KBMInput.IsMouseGrabbed()) + if (screen != nullptr && g_KBMInput.IsMouseGrabbed()) { g_KBMInput.SetMouseGrabbed(false); } #endif //4J Gordon: Do not force a stats save here - /*if (dynamic_cast(screen)!=NULL) + /*if (dynamic_cast(screen)!=nullptr) { stats->forceSend(); } stats->forceSave();*/ - if (screen == NULL && level == NULL) + if (screen == nullptr && level == nullptr) { screen = new TitleScreen(); } - else if (player != NULL && !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0) + else if (player != nullptr && !ui.GetMenuDisplayed(player->GetXboxPad()) && player->getHealth() <= 0) { //screen = new DeathScreen(); @@ -534,18 +534,18 @@ void Minecraft::setScreen(Screen *screen) } else { - ui.NavigateToScene(player->GetXboxPad(),eUIScene_DeathMenu,NULL); + ui.NavigateToScene(player->GetXboxPad(),eUIScene_DeathMenu,nullptr); } } - if (dynamic_cast(screen)!=NULL) + if (dynamic_cast(screen)!=nullptr) { options->renderDebug = false; gui->clearMessages(); } this->screen = screen; - if (screen != NULL) + if (screen != nullptr) { // releaseMouse(); // 4J - removed ScreenSizeCalculator ssc(options, width, height); @@ -561,7 +561,7 @@ void Minecraft::setScreen(Screen *screen) // 4J-PB - if a screen has been set, go into menu mode // it's possible that player doesn't exist here yet - /*if(screen!=NULL) + /*if(screen!=nullptr) { if(player && player->GetXboxPad()!=-1) { @@ -598,7 +598,7 @@ void Minecraft::destroy() stats->forceSave();*/ // try { - setLevel(NULL); + setLevel(nullptr); // } catch (Throwable e) { // } @@ -645,11 +645,11 @@ void Minecraft::run() AABB::resetPool(); Vec3::resetPool(); - // if (parent == NULL && Display.isCloseRequested()) { // 4J - removed + // if (parent == nullptr && Display.isCloseRequested()) { // 4J - removed // stop(); // } - if (pause && level != NULL) + if (pause && level != nullptr) { float lastA = timer->a; timer->advanceTime(); @@ -682,14 +682,14 @@ void Minecraft::run() soundEngine->update(player, timer->a); glEnable(GL_TEXTURE_2D); - if (level != NULL) level->updateLights(); + if (level != nullptr) level->updateLights(); // if (!Keyboard::isKeyDown(Keyboard.KEY_F7)) Display.update(); // 4J - removed - if (player != NULL && player->isInWall()) options->thirdPersonView = false; + if (player != nullptr && player->isInWall()) options->thirdPersonView = false; if (!noRender) { - if (gameMode != NULL) gameMode->render(timer->a); + if (gameMode != nullptr) gameMode->render(timer->a); gameRenderer->render(timer->a); } @@ -723,7 +723,7 @@ void Minecraft::run() // checkScreenshot(); // 4J - removed /* 4J - removed - if (parent != NULL && !fullscreen) + if (parent != nullptr && !fullscreen) { if (parent.getWidth() != width || parent.getHeight() != height) { @@ -738,7 +738,7 @@ void Minecraft::run() */ checkGlError(L"Post render"); frames++; - pause = !isClientSide() && screen != NULL && screen->isPauseScreen(); + pause = !isClientSide() && screen != nullptr && screen->isPauseScreen(); while (System::currentTimeMillis() >= lastTime + 1000) { @@ -792,7 +792,7 @@ bool Minecraft::setLocalPlayerIdx(int idx) localPlayerIdx = idx; // If the player is not null, but the game mode is then this is just a temp player // whose only real purpose is to hold the viewport position - if( localplayers[idx] == NULL || localgameModes[idx] == NULL ) return false; + if( localplayers[idx] == nullptr || localgameModes[idx] == nullptr ) return false; gameMode = localgameModes[idx]; player = localplayers[idx]; @@ -816,7 +816,7 @@ void Minecraft::updatePlayerViewportAssignments() int viewportsRequired = 0; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != NULL ) viewportsRequired++; + if( localplayers[i] != nullptr ) viewportsRequired++; } if( viewportsRequired == 3 ) viewportsRequired = 4; @@ -826,7 +826,7 @@ void Minecraft::updatePlayerViewportAssignments() // Single viewport for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != NULL ) localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN; + if( localplayers[i] != nullptr ) localplayers[i]->m_iScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN; } } else if( viewportsRequired == 2 ) @@ -835,7 +835,7 @@ void Minecraft::updatePlayerViewportAssignments() int found = 0; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != NULL ) + if( localplayers[i] != nullptr ) { // Primary player settings decide what the mode is if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_SplitScreenVertical)) @@ -858,7 +858,7 @@ void Minecraft::updatePlayerViewportAssignments() for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != NULL ) + if( localplayers[i] != nullptr ) { // 4J Stu - If the game hasn't started, ignore current allocations (as the players won't have seen them) @@ -882,7 +882,7 @@ void Minecraft::updatePlayerViewportAssignments() // Found which quadrants are currently in use, now allocate out any spares that are required for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if( localplayers[i] != NULL ) + if( localplayers[i] != nullptr ) { if( ( localplayers[i]->m_iScreenSection < C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT ) || ( localplayers[i]->m_iScreenSection > C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT ) ) @@ -918,22 +918,22 @@ void Minecraft::updatePlayerViewportAssignments() bool Minecraft::addLocalPlayer(int idx) { //int iLocalPlayerC=app.GetLocalPlayerCount(); - if( m_pendingLocalConnections[idx] != NULL ) + if( m_pendingLocalConnections[idx] != nullptr ) { // 4J Stu - Should we ever be in a state where this happens? assert(false); m_pendingLocalConnections[idx]->close(); } m_connectionFailed[idx] = false; - m_pendingLocalConnections[idx] = NULL; + m_pendingLocalConnections[idx] = nullptr; bool success=g_NetworkManager.AddLocalPlayerByUserIndex(idx); if(success) { app.DebugPrintf("Adding temp local player on pad %d\n", idx); - localplayers[idx] = shared_ptr( new MultiplayerLocalPlayer(this, level, user, NULL ) ); - localgameModes[idx] = NULL; + localplayers[idx] = shared_ptr( new MultiplayerLocalPlayer(this, level, user, nullptr ) ); + localgameModes[idx] = nullptr; updatePlayerViewportAssignments(); @@ -946,7 +946,7 @@ bool Minecraft::addLocalPlayer(int idx) // send the message for(int i=0;i Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= NULL*/,MultiPlayerLevel *levelpassedin) +shared_ptr Minecraft::createExtraLocalPlayer(int idx, const wstring& name, int iPad, int iDimension, ClientConnection *clientConnection /*= nullptr*/,MultiPlayerLevel *levelpassedin) { - if( clientConnection == NULL) return nullptr; + if( clientConnection == nullptr) return nullptr; if( clientConnection == m_pendingLocalConnections[idx] ) { int tempScreenSection = C4JRender::VIEWPORT_TYPE_FULLSCREEN; - if( localplayers[idx] != NULL && localgameModes[idx] == NULL ) + if( localplayers[idx] != nullptr && localgameModes[idx] == nullptr ) { // A temp player displaying a connecting screen tempScreenSection = localplayers[idx]->m_iScreenSection; @@ -996,7 +996,7 @@ shared_ptr Minecraft::createExtraLocalPlayer(int idx, co user->name = name; // Don't need this any more - m_pendingLocalConnections[idx] = NULL; + m_pendingLocalConnections[idx] = nullptr; // Add the connection to the level which will now take responsibility for ticking it // 4J-PB - can't use the dimension from localplayers[idx], since there may be no localplayers at this point @@ -1043,7 +1043,7 @@ shared_ptr Minecraft::createExtraLocalPlayer(int idx, co // Compatibility rule for Win64 id migration // host keeps legacy host XUID, non-host uses persistent uid.dat XUID. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); - if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost()) + if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost()) { playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid(); } @@ -1060,11 +1060,11 @@ shared_ptr Minecraft::createExtraLocalPlayer(int idx, co localplayers[idx]->m_iScreenSection = tempScreenSection; - if( levelpassedin == NULL) level->addEntity(localplayers[idx]); // Don't add if we're passing the level in, we only do this from the client connection & we'll be handling adding it ourselves + if( levelpassedin == nullptr) level->addEntity(localplayers[idx]); // Don't add if we're passing the level in, we only do this from the client connection & we'll be handling adding it ourselves localplayers[idx]->SetXboxPad(iPad); - if( localplayers[idx]->input != NULL ) delete localplayers[idx]->input; + if( localplayers[idx]->input != nullptr ) delete localplayers[idx]->input; localplayers[idx]->input = new Input(); localplayers[idx]->resetPos(); @@ -1093,7 +1093,7 @@ void Minecraft::storeExtraLocalPlayer(int idx) { localplayers[idx] = player; - if( localplayers[idx]->input != NULL ) delete localplayers[idx]->input; + if( localplayers[idx]->input != nullptr ) delete localplayers[idx]->input; localplayers[idx]->input = new Input(); if(ProfileManager.IsSignedIn(idx)) @@ -1105,14 +1105,14 @@ void Minecraft::storeExtraLocalPlayer(int idx) void Minecraft::removeLocalPlayerIdx(int idx) { bool updateXui = true; - if(localgameModes[idx] != NULL) + if(localgameModes[idx] != nullptr) { if( getLevel( localplayers[idx]->dimension )->isClientSide ) { shared_ptr mplp = localplayers[idx]; ( (MultiPlayerLevel *)getLevel( localplayers[idx]->dimension ) )->removeClientConnection(mplp->connection, true); delete mplp->connection; - mplp->connection = NULL; + mplp->connection = nullptr; g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); } getLevel( localplayers[idx]->dimension )->removeEntity(localplayers[idx]); @@ -1127,13 +1127,13 @@ void Minecraft::removeLocalPlayerIdx(int idx) playerLeftTutorial( idx ); delete localgameModes[idx]; - localgameModes[idx] = NULL; + localgameModes[idx] = nullptr; } - else if( m_pendingLocalConnections[idx] != NULL ) + else if( m_pendingLocalConnections[idx] != nullptr ) { m_pendingLocalConnections[idx]->sendAndDisconnect( shared_ptr( new DisconnectPacket(DisconnectPacket::eDisconnect_Quitting) ) );; delete m_pendingLocalConnections[idx]; - m_pendingLocalConnections[idx] = NULL; + m_pendingLocalConnections[idx] = nullptr; g_NetworkManager.RemoveLocalPlayerByUserIndex(idx); } else @@ -1158,18 +1158,18 @@ void Minecraft::removeLocalPlayerIdx(int idx) /* // If we are removing the primary player then there can't be a valid gamemode left anymore, this // pointer will be referring to the one we've just deleted - gameMode = NULL; + gameMode = nullptr; // Remove references to player - player = NULL; - cameraTargetPlayer = NULL; - EntityRenderDispatcher::instance->cameraEntity = NULL; - TileEntityRenderDispatcher::instance->cameraEntity = NULL; + player = nullptr; + cameraTargetPlayer = nullptr; + EntityRenderDispatcher::instance->cameraEntity = nullptr; + TileEntityRenderDispatcher::instance->cameraEntity = nullptr; */ } else if( updateXui ) { gameRenderer->DisableUpdateThread(); - levelRenderer->setLevel(idx, NULL); + levelRenderer->setLevel(idx, nullptr); gameRenderer->EnableUpdateThread(); ui.CloseUIScenes(idx,true); updatePlayerViewportAssignments(); @@ -1197,16 +1197,16 @@ void Minecraft::applyFrameMouseLook() // Per-frame mouse look: consume mouse deltas every frame instead of waiting // for the 20Hz game tick. Apply the same delta to both xRot/yRot AND xRotO/yRotO // so the render interpolation instantly reflects the change without waiting for a tick. - if (level == NULL) return; + if (level == nullptr) return; for (int i = 0; i < XUSER_MAX_COUNT; i++) { - if (localplayers[i] == NULL) continue; + if (localplayers[i] == nullptr) continue; int iPad = localplayers[i]->GetXboxPad(); if (iPad != 0) continue; // Mouse only applies to pad 0 if (!g_KBMInput.IsMouseGrabbed()) continue; - if (localgameModes[iPad] == NULL) continue; + if (localgameModes[iPad] == nullptr) continue; float rawDx, rawDy; g_KBMInput.ConsumeMouseDelta(rawDx, rawDy); @@ -1265,12 +1265,12 @@ void Minecraft::run_middle() AABB::resetPool(); Vec3::resetPool(); - // if (parent == NULL && Display.isCloseRequested()) { // 4J - removed + // if (parent == nullptr && Display.isCloseRequested()) { // 4J - removed // stop(); // } // 4J-PB - AUTOSAVE TIMER - only in the full game and if the player is the host - if(level!=NULL && ProfileManager.IsFullVersion() && g_NetworkManager.IsHost()) + if(level!=nullptr && ProfileManager.IsFullVersion() && g_NetworkManager.IsHost()) { /*if(!bAutosaveTimerSet) { @@ -1390,7 +1390,7 @@ void Minecraft::run_middle() } // When we go into the first loaded level, check if the console has active joypads that are not in the game, and bring up the quadrant display to remind them to press start (if the session has space) - if(level!=NULL && bFirstTimeIntoGame && g_NetworkManager.SessionHasSpace()) + if(level!=nullptr && bFirstTimeIntoGame && g_NetworkManager.SessionHasSpace()) { // have a short delay before the display if(iFirstTimeCountdown==0) @@ -1401,7 +1401,7 @@ void Minecraft::run_middle() { for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if((localplayers[i] == NULL) && InputManager.IsPadConnected(i)) + if((localplayers[i] == nullptr) && InputManager.IsPadConnected(i)) { if(!ui.PressStartPlaying(i)) { @@ -1418,10 +1418,10 @@ void Minecraft::run_middle() for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { #ifdef __ORBIS__ - if ( m_pPsPlusUpsell != NULL && m_pPsPlusUpsell->hasResponse() && m_pPsPlusUpsell->m_userIndex == i ) + if ( m_pPsPlusUpsell != nullptr && m_pPsPlusUpsell->hasResponse() && m_pPsPlusUpsell->m_userIndex == i ) { delete m_pPsPlusUpsell; - m_pPsPlusUpsell = NULL; + m_pPsPlusUpsell = nullptr; if ( ProfileManager.HasPlayStationPlus(i) ) { @@ -1604,7 +1604,7 @@ void Minecraft::run_middle() // 4J Stu - Check that content restriction information has been received if( !g_NetworkManager.IsLocalGame() ) { - tryJoin = tryJoin && ProfileManager.GetChatAndContentRestrictions(i,true,NULL,NULL,NULL); + tryJoin = tryJoin && ProfileManager.GetChatAndContentRestrictions(i,true,nullptr,nullptr,nullptr); } #endif if(tryJoin) @@ -1644,7 +1644,7 @@ void Minecraft::run_middle() { #ifdef __ORBIS__ bool contentRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,false,NULL,&contentRestricted,NULL); // TODO! + ProfileManager.GetChatAndContentRestrictions(i,false,nullptr,&contentRestricted,nullptr); // TODO! if (!g_NetworkManager.IsLocalGame() && contentRestricted) { @@ -1672,7 +1672,7 @@ void Minecraft::run_middle() if(g_NetworkManager.IsLocalGame() == false) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(i,false,&chatRestricted,nullptr,nullptr); if(chatRestricted) { ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, i ); @@ -1685,7 +1685,7 @@ void Minecraft::run_middle() { // create the localplayer shared_ptr player = localplayers[i]; - if( player == NULL) + if( player == nullptr) { player = createExtraLocalPlayer(i, (convStringToWstring( ProfileManager.GetGamertag(i) )).c_str(), i, level->dimension->id); } @@ -1759,7 +1759,7 @@ void Minecraft::run_middle() int firstEmptyUser = 0; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - if(localplayers[i] == NULL) + if(localplayers[i] == nullptr) { firstEmptyUser = i; break; @@ -1793,7 +1793,7 @@ void Minecraft::run_middle() } #endif - if (pause && level != NULL) + if (pause && level != nullptr) { float lastA = timer->a; timer->advanceTime(); @@ -1822,13 +1822,13 @@ void Minecraft::run_middle() { // 4J - If we are waiting for this connection to do something, then tick it here. // This replaces many of the original Java scenes which would tick the connection while showing that scene - if( m_pendingLocalConnections[idx] != NULL ) + if( m_pendingLocalConnections[idx] != nullptr ) { m_pendingLocalConnections[idx]->tick(); } // reset the player inactive tick - if(localplayers[idx]!=NULL) + if(localplayers[idx]!=nullptr) { // any input received? if((localplayers[idx]->ullButtonsPressed!=0) || InputManager.GetJoypadStick_LX(idx,false)!=0.0f || @@ -1912,8 +1912,8 @@ void Minecraft::run_middle() // if (!Keyboard::isKeyDown(Keyboard.KEY_F7)) Display.update(); // 4J - removed // 4J-PB - changing this to be per player - //if (player != NULL && player->isInWall()) options->thirdPersonView = false; - if (player != NULL && player->isInWall()) player->SetThirdPersonView(0); + //if (player != nullptr && player->isInWall()) options->thirdPersonView = false; + if (player != nullptr && player->isInWall()) player->SetThirdPersonView(0); if (!noRender) { @@ -2023,7 +2023,7 @@ void Minecraft::run_middle() // checkScreenshot(); // 4J - removed /* 4J - removed - if (parent != NULL && !fullscreen) + if (parent != nullptr && !fullscreen) { if (parent.getWidth() != width || parent.getHeight() != height) { @@ -2040,7 +2040,7 @@ void Minecraft::run_middle() checkGlError(L"Post render"); MemSect(0); frames++; - //pause = !isClientSide() && screen != NULL && screen->isPauseScreen(); + //pause = !isClientSide() && screen != nullptr && screen->isPauseScreen(); //pause = g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 && app.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()); pause = app.IsAppPaused(); @@ -2092,7 +2092,7 @@ void Minecraft::emergencySave() levelRenderer->clear(); AABB::clearPool(); Vec3::clearPool(); - setLevel(NULL); + setLevel(nullptr); } void Minecraft::renderFpsMeter(__int64 tickTime) @@ -2191,7 +2191,7 @@ void Minecraft::stop() void Minecraft::pauseGame() { - if (screen != NULL) return; + if (screen != nullptr) return; // setScreen(new PauseScreen()); // 4J - TODO put back in } @@ -2203,7 +2203,7 @@ void Minecraft::resize(int width, int height) this->width = width; this->height = height; - if (screen != NULL) + if (screen != nullptr) { ScreenSizeCalculator ssc(options, width, height); int screenWidth = ssc.getWidth(); @@ -2270,10 +2270,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) gameRenderer->pick(1); #if 0 // 4J - removed - we don't use ChunkCache anymore - if (player != NULL) + if (player != nullptr) { ChunkSource *cs = level->getChunkSource(); - if (dynamic_cast(cs) != NULL) + if (dynamic_cast(cs) != nullptr) { ChunkCache *spcc = (ChunkCache *)cs; @@ -2287,7 +2287,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // soundEngine.playMusicTick(); - if (!pause && level != NULL) gameMode->tick(); + if (!pause && level != nullptr) gameMode->tick(); MemSect(31); glBindTexture(GL_TEXTURE_2D, textures->loadTexture(TN_TERRAIN)); //L"/terrain.png")); MemSect(0); @@ -2305,33 +2305,33 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) * progressRenderer.progressStagePercentage(0); } else { * serverConnection.tick(); serverConnection.sendPosition(player); } } */ - if (screen == NULL && player != NULL ) + if (screen == nullptr && player != nullptr ) { if (player->getHealth() <= 0 && !ui.GetMenuDisplayed(iPad) ) { - setScreen(NULL); + setScreen(nullptr); } - else if (player->isSleeping() && level != NULL && level->isClientSide) + else if (player->isSleeping() && level != nullptr && level->isClientSide) { // setScreen(new InBedChatScreen()); // 4J - TODO put back in } } - else if (screen != NULL && (dynamic_cast(screen)!=NULL) && !player->isSleeping()) + else if (screen != nullptr && (dynamic_cast(screen)!=nullptr) && !player->isSleeping()) { - setScreen(NULL); + setScreen(nullptr); } - if (screen != NULL) + if (screen != nullptr) { player->missTime = 10000; player->lastClickTick[0] = ticks + 10000; player->lastClickTick[1] = ticks + 10000; } - if (screen != NULL) + if (screen != nullptr) { screen->updateEvents(); - if (screen != NULL) + if (screen != nullptr) { screen->particles->tick(); screen->tick(); @@ -2339,13 +2339,13 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } #ifdef _WINDOWS64 - if ((screen != NULL || ui.GetMenuDisplayed(iPad)) && g_KBMInput.IsMouseGrabbed()) + if ((screen != nullptr || ui.GetMenuDisplayed(iPad)) && g_KBMInput.IsMouseGrabbed()) { g_KBMInput.SetMouseGrabbed(false); } #endif - if (screen == NULL && !ui.GetMenuDisplayed(iPad) ) + if (screen == nullptr && !ui.GetMenuDisplayed(iPad) ) { #ifdef _WINDOWS64 if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsWindowFocused()) @@ -2457,7 +2457,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) *piAlt=-1; // 4J-PB another special case for when the player is sleeping in a bed - if (player->isSleeping() && (level != NULL) && level->isClientSide) + if (player->isSleeping() && (level != nullptr) && level->isClientSide) { *piUse=IDS_TOOLTIPS_WAKEUP; } @@ -2514,7 +2514,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // Check that we are actually hungry so will eat this item { FoodItem *food = static_cast(itemInstance->getItem()); - if (food != NULL && food->canEat(player)) + if (food != nullptr && food->canEat(player)) { *piUse=IDS_TOOLTIPS_EAT; } @@ -2592,7 +2592,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } } - if (hitResult!=NULL) + if (hitResult!=nullptr) { switch(hitResult->type) { @@ -2607,7 +2607,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) int iTileID=level->getTile(x,y ,z ); int iData = level->getData(x, y, z); - if( gameMode != NULL && gameMode->getTutorial() != NULL ) + if( gameMode != nullptr && gameMode->getTutorial() != nullptr ) { // 4J Stu - For the tutorial we want to be able to record what items we look at so that we can give hints gameMode->getTutorial()->onLookAt(iTileID,iData); @@ -2621,7 +2621,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) * for noteblocks, enderportals and flowerpots in case of non-standard items. * (ie. ignite behaviour) */ - if (bUseItemOn && itemInstance!=NULL) + if (bUseItemOn && itemInstance!=nullptr) { switch (itemInstance->getItem()->id) { @@ -2716,7 +2716,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case Tile::chest_Id: *piAction = IDS_TOOLTIPS_MINE; - *piUse = (Tile::chest->getContainer(level,x,y,z) != NULL) ? IDS_TOOLTIPS_OPEN : -1; + *piUse = (Tile::chest->getContainer(level,x,y,z) != nullptr) ? IDS_TOOLTIPS_OPEN : -1; break; case Tile::enderChest_Id: @@ -2785,7 +2785,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case Tile::jukebox_Id: - if (!bUseItemOn && itemInstance!=NULL) + if (!bUseItemOn && itemInstance!=nullptr) { int iID=itemInstance->getItem()->id; if ( (iID>=Item::record_01_Id) && (iID<=Item::record_12_Id) ) @@ -2805,7 +2805,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) break; case Tile::flowerPot_Id: - if ( !bUseItemOn && (itemInstance != NULL) && (iData == 0) ) + if ( !bUseItemOn && (itemInstance != nullptr) && (iData == 0) ) { int iID = itemInstance->getItem()->id; if (iID<256) // is it a tile? @@ -2866,7 +2866,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case HitResult::ENTITY: eINSTANCEOF entityType = hitResult->entity->GetType(); - if ( (gameMode != NULL) && (gameMode->getTutorial() != NULL) ) + if ( (gameMode != nullptr) && (gameMode->getTutorial() != nullptr) ) { // 4J Stu - For the tutorial we want to be able to record what items we look at so that we can give hints gameMode->getTutorial()->onLookAtEntity(hitResult->entity); @@ -2877,7 +2877,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { heldItem = player->inventory->getSelected(); } - int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1; + int heldItemId = heldItem != nullptr ? heldItem->getItem()->id : -1; switch(entityType) { @@ -3312,7 +3312,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) shared_ptr itemFrame = dynamic_pointer_cast(hitResult->entity); // is the frame occupied? - if(itemFrame->getItem()!=NULL) + if(itemFrame->getItem()!=nullptr) { // rotate the item *piUse=IDS_TOOLTIPS_ROTATE; @@ -3515,7 +3515,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { player->inventory->swapPaint(wheel); - if( gameMode != NULL && gameMode->getTutorial() != NULL ) + if( gameMode != nullptr && gameMode->getTutorial() != nullptr ) { // 4J Stu - For the tutorial we want to be able to record what items we are using so that we can give hints gameMode->getTutorial()->onSelectedItemChanged(player->inventory->getSelected()); @@ -3665,7 +3665,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) app.EnableDebugOverlay(options->renderDebug,iPad); #else // 4J Stu - The xbox uses a completely different way of navigating to this scene - ui.NavigateToScene(0, eUIScene_DebugOverlay, NULL, eUILayer_Debug); + ui.NavigateToScene(0, eUIScene_DebugOverlay, nullptr, eUILayer_Debug); #endif #endif } @@ -3729,7 +3729,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) app.LoadCreativeMenu(iPad,player); } // 4J-PB - Microsoft request that we use the 3x3 crafting if someone presses X while at the workbench - else if ((hitResult!=NULL) && (hitResult->type == HitResult::TILE) && (level->getTile(hitResult->x, hitResult->y, hitResult->z) == Tile::workBench_Id)) + else if ((hitResult!=nullptr) && (hitResult->type == HitResult::TILE) && (level->getTile(hitResult->x, hitResult->y, hitResult->z) == Tile::workBench_Id)) { //ui.PlayUISFX(eSFX_Press); //app.LoadXuiCrafting3x3Menu(iPad,player,hitResult->x, hitResult->y, hitResult->z); @@ -3751,7 +3751,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) { app.DebugPrintf("PAUSE PRESS PROCESSING - ipad = %d, NavigateToScene\n",player->GetXboxPad()); ui.PlayUISFX(eSFX_Press); - ui.NavigateToScene(iPad, eUIScene_PauseMenu, NULL, eUILayer_Scene); + ui.NavigateToScene(iPad, eUIScene_PauseMenu, nullptr, eUILayer_Scene); } if((player->ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_DROP)) @@ -3786,12 +3786,12 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item int iCount=0; - if(selectedItem != NULL) iCount=selectedItem->GetCount(); - if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<GetCount() == 1)) + if(selectedItem != nullptr) iCount=selectedItem->GetCount(); + if(selectedItem != nullptr && !( (player->ullButtonsPressed&(1LL<GetCount() == 1)) { itemName = selectedItem->getHoverName(); } - if( !(player->ullButtonsPressed&(1LL<GetCount() <= 1) ) ui.SetSelectedItem( iPad, itemName ); + if( !(player->ullButtonsPressed&(1LL<GetCount() <= 1) ) ui.SetSelectedItem( iPad, itemName ); } } else @@ -3799,7 +3799,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // 4J-PB if (InputManager.GetValue(iPad, ACTION_MENU_CANCEL) > 0 && gameMode->isInputAllowed(ACTION_MENU_CANCEL)) { - setScreen(NULL); + setScreen(nullptr); } } @@ -3823,7 +3823,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) #if 0 // 4J - TODO - some replacement for input handling... - if (screen == NULL || screen.passEvents) + if (screen == nullptr || screen.passEvents) { while (Mouse.next()) { @@ -3966,9 +3966,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) } #endif - if (level != NULL) + if (level != nullptr) { - if (player != NULL) + if (player != nullptr) { recheckPlayerIn++; if (recheckPlayerIn == 30) @@ -4014,7 +4014,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // 4J - this doesn't fully tick the animateTick here, but does register this player's position. The actual // work is now done in Level::animateTickDoWork() so we can take into account multiple players in the one level. - if (!pause && levels[i] != NULL) levels[i]->animateTick(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); + if (!pause && levels[i] != nullptr) levels[i]->animateTick(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z)); if( levelsTickedFlags & ( 1 << i ) ) continue; // Don't tick further if we've already ticked this level this frame levelsTickedFlags |= (1 << i); @@ -4027,7 +4027,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) // level.addEntity(player); // } // } - if( levels[i] != NULL ) + if( levels[i] != nullptr ) { if (!pause) { @@ -4043,7 +4043,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) int currPlayerIdx = getLocalPlayerIdx(); for( int idx = 0; idx < XUSER_MAX_COUNT; idx++ ) { - if(localplayers[idx]!=NULL) + if(localplayers[idx]!=nullptr) { if( localplayers[idx]->level == levels[i] ) { @@ -4121,7 +4121,7 @@ void Minecraft::reloadSound() bool Minecraft::isClientSide() { - return level != NULL && level->isClientSide; + return level != nullptr && level->isClientSide; } void Minecraft::selectLevel(ConsoleSaveFile *saveFile, const wstring& levelId, const wstring& levelName, LevelSettings *levelSettings) @@ -4140,8 +4140,8 @@ bool Minecraft::loadSlot(const wstring& userName, int slot) void Minecraft::releaseLevel(int message) { - //this->level = NULL; - setLevel(NULL, message); + //this->level = nullptr; + setLevel(nullptr, message); } // 4J Stu - This code was within setLevel, but I moved it out so that I can call it at a better @@ -4172,14 +4172,14 @@ MultiPlayerLevel *Minecraft::getLevel(int dimension) // 4J Stu - Removed as redundant with default values in params. //void Minecraft::setLevel(Level *level, bool doForceStatsSave /*= true*/) //{ -// setLevel(level, -1, NULL, doForceStatsSave); +// setLevel(level, -1, nullptr, doForceStatsSave); //} // Also causing ambiguous call for some reason // as it is matching shared_ptr from the func below with bool from this one //void Minecraft::setLevel(Level *level, const wstring& message, bool doForceStatsSave /*= true*/) //{ -// setLevel(level, message, NULL, doForceStatsSave); +// setLevel(level, message, nullptr, doForceStatsSave); //} void Minecraft::forceaddLevel(MultiPlayerLevel *level) @@ -4190,13 +4190,13 @@ void Minecraft::forceaddLevel(MultiPlayerLevel *level) else levels[0] = level; } -void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_ptr forceInsertPlayer /*=NULL*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/) +void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_ptr forceInsertPlayer /*=nullptr*/, bool doForceStatsSave /*=true*/, bool bPrimaryPlayerSignedOut /*=false*/) { EnterCriticalSection(&m_setLevelCS); bool playerAdded = false; this->cameraTargetPlayer = nullptr; - if(progressRenderer != NULL) + if(progressRenderer != nullptr) { this->progressRenderer->progressStart(message); this->progressRenderer->progressStage(-1); @@ -4205,80 +4205,80 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // 4J-PB - since we now play music in the menu, just let it keep playing //soundEngine->playStreaming(L"", 0, 0, 0, 0, 0); - // 4J - stop update thread from processing this level, which blocks until it is safe to move on - will be re-enabled if we set the level to be non-NULL + // 4J - stop update thread from processing this level, which blocks until it is safe to move on - will be re-enabled if we set the level to be non-nullptr gameRenderer->DisableUpdateThread(); for(unsigned int i = 0; i < levels.length; ++i) { - // 4J We only need to save out in multiplayer is we are setting the level to NULL + // 4J We only need to save out in multiplayer is we are setting the level to nullptr // If we ever go back to making single player only then this will not work properly! - if (levels[i] != NULL && level == NULL) + if (levels[i] != nullptr && level == nullptr) { // 4J Stu - This is really only relevant for single player (ie not what we do at the moment) - if((doForceStatsSave==true) && player!=NULL) + if((doForceStatsSave==true) && player!=nullptr) forceStatsSave(player->GetXboxPad() ); - // 4J Stu - Added these for the case when we exit a level so we are setting the level to NULL - // The level renderer needs to have it's stored level set to NULL so that it doesn't break next time we set one - if (levelRenderer != NULL) + // 4J Stu - Added these for the case when we exit a level so we are setting the level to nullptr + // The level renderer needs to have it's stored level set to nullptr so that it doesn't break next time we set one + if (levelRenderer != nullptr) { for(DWORD p = 0; p < XUSER_MAX_COUNT; ++p) { - levelRenderer->setLevel(p, NULL); + levelRenderer->setLevel(p, nullptr); } } - if (particleEngine != NULL) particleEngine->setLevel(NULL); + if (particleEngine != nullptr) particleEngine->setLevel(nullptr); } } - // 4J If we are setting the level to NULL then we are exiting, so delete the levels - if( level == NULL ) + // 4J If we are setting the level to nullptr then we are exiting, so delete the levels + if( level == nullptr ) { - if(levels[0]!=NULL) + if(levels[0]!=nullptr) { delete levels[0]; - levels[0] = NULL; + levels[0] = nullptr; // Both level share the same savedDataStorage - if(levels[1]!=NULL) levels[1]->savedDataStorage = NULL; + if(levels[1]!=nullptr) levels[1]->savedDataStorage = nullptr; } - if(levels[1]!=NULL) + if(levels[1]!=nullptr) { delete levels[1]; - levels[1] = NULL; + levels[1] = nullptr; } - if(levels[2]!=NULL) + if(levels[2]!=nullptr) { delete levels[2]; - levels[2] = NULL; + levels[2] = nullptr; } // Delete all the player objects for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { shared_ptr mplp = localplayers[idx]; - if(mplp != NULL && mplp->connection != NULL ) + if(mplp != nullptr && mplp->connection != nullptr ) { delete mplp->connection; - mplp->connection = NULL; + mplp->connection = nullptr; } - if( localgameModes[idx] != NULL ) + if( localgameModes[idx] != nullptr ) { delete localgameModes[idx]; - localgameModes[idx] = NULL; + localgameModes[idx] = nullptr; } - if( m_pendingLocalConnections[idx] != NULL ) + if( m_pendingLocalConnections[idx] != nullptr ) { delete m_pendingLocalConnections[idx]; - m_pendingLocalConnections[idx] = NULL; + m_pendingLocalConnections[idx] = nullptr; } localplayers[idx] = nullptr; } // If we are removing the primary player then there can't be a valid gamemode left anymore, this // pointer will be referring to the one we've just deleted - gameMode = NULL; + gameMode = nullptr; // Remove references to player player = nullptr; cameraTargetPlayer = nullptr; @@ -4287,7 +4287,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt } this->level = level; - if (level != NULL) + if (level != nullptr) { int dimId = level->dimension->id; if (dimId == -1) levels[1] = level; @@ -4296,7 +4296,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // If no player has been set, then this is the first level to be set this game, so set up // a primary player & initialise some other things - if (player == NULL) + if (player == nullptr) { int iPrimaryPlayer = ProfileManager.GetPrimaryPad(); @@ -4317,7 +4317,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt // On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`. // To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPrimaryPlayer); - if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost()) + if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost()) { playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid(); } @@ -4340,32 +4340,32 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt for(int i=0;iresetPos(); // gameMode.initPlayer(player); - if (level != NULL) + if (level != nullptr) { level->addEntity(player); playerAdded = true; } } - if(player->input != NULL) delete player->input; + if(player->input != nullptr) delete player->input; player->input = new Input(); - if (levelRenderer != NULL) levelRenderer->setLevel(player->GetXboxPad(), level); - if (particleEngine != NULL) particleEngine->setLevel(level); + if (levelRenderer != nullptr) levelRenderer->setLevel(player->GetXboxPad(), level); + if (particleEngine != nullptr) particleEngine->setLevel(level); #if 0 // 4J - removed - we don't use ChunkCache anymore ChunkSource *cs = level->getChunkSource(); - if (dynamic_cast(cs) != NULL) + if (dynamic_cast(cs) != nullptr) { ChunkCache *spcc = (ChunkCache *)cs; @@ -4380,7 +4380,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt for(int i=0;iclearAll(); player = nullptr; - // Clear all players if the new level is NULL + // Clear all players if the new level is nullptr for(int i=0;iclose(); - m_pendingLocalConnections[i] = NULL; + if( m_pendingLocalConnections[i] != nullptr ) m_pendingLocalConnections[i]->close(); + m_pendingLocalConnections[i] = nullptr; localplayers[i] = nullptr; - localgameModes[i] = NULL; + localgameModes[i] = nullptr; } } @@ -4412,7 +4412,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt void Minecraft::prepareLevel(int title) { - if(progressRenderer != NULL) + if(progressRenderer != nullptr) { this->progressRenderer->progressStart(title); this->progressRenderer->progressStage(IDS_PROGRESS_BUILDING_TERRAIN); @@ -4425,7 +4425,7 @@ void Minecraft::prepareLevel(int title) ChunkSource *cs = level->getChunkSource(); Pos *spawnPos = level->getSharedSpawnPos(); - if (player != NULL) + if (player != nullptr) { spawnPos->x = static_cast(player->x); spawnPos->z = static_cast(player->z); @@ -4433,7 +4433,7 @@ void Minecraft::prepareLevel(int title) #if 0 // 4J - removed - we don't use ChunkCache anymore - if (dynamic_cast(cs)!=NULL) + if (dynamic_cast(cs)!=nullptr) { ChunkCache *spcc = (ChunkCache *) cs; @@ -4445,7 +4445,7 @@ void Minecraft::prepareLevel(int title) { for (int z = -r; z <= r; z += 16) { - if(progressRenderer != NULL) this->progressRenderer->progressStagePercentage((pp++) * 100 / max); + if(progressRenderer != nullptr) this->progressRenderer->progressStagePercentage((pp++) * 100 / max); level->getTile(spawnPos->x + x, 64, spawnPos->z + z); if (!gameMode->isCutScene()) { } @@ -4454,7 +4454,7 @@ void Minecraft::prepareLevel(int title) delete spawnPos; if (!gameMode->isCutScene()) { - if(progressRenderer != NULL) this->progressRenderer->progressStage(IDS_PROGRESS_SIMULATING_WORLD); + if(progressRenderer != nullptr) this->progressRenderer->progressStage(IDS_PROGRESS_SIMULATING_WORLD); max = 2000; } } @@ -4490,7 +4490,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) level->validateSpawn(); level->removeAllPendingEntityRemovals(); - if (localPlayer != NULL) + if (localPlayer != nullptr) { level->removeEntity(localPlayer); } @@ -4511,7 +4511,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) #ifdef _WINDOWS64 // Same compatibility rule as create/init paths. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iTempPad); - if(localNetworkPlayer != NULL && localNetworkPlayer->IsHost()) + if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost()) { playerXUIDOffline = Win64Xuid::GetLegacyEmbeddedHostXuid(); } @@ -4575,7 +4575,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) level->addEntity(player); gameMode->initPlayer(player); - if(player->input != NULL) delete player->input; + if(player->input != nullptr) delete player->input; player->input = new Input(); player->entityId = newEntityId; player->animateRespawn(); @@ -4591,7 +4591,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) //SetEvent(m_hPlayerRespawned); player->SetPlayerRespawned(true); - if (dynamic_cast(screen) != NULL) setScreen(NULL); + if (dynamic_cast(screen) != nullptr) setScreen(nullptr); gameRenderer->EnableUpdateThread(); } @@ -4623,9 +4623,9 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const */ Minecraft *minecraft; - // 4J - was new Minecraft(frame, canvas, NULL, 854, 480, fullScreen); + // 4J - was new Minecraft(frame, canvas, nullptr, 854, 480, fullScreen); - minecraft = new Minecraft(NULL, NULL, NULL, 1280, 720, fullScreen); + minecraft = new Minecraft(nullptr, nullptr, nullptr, 1280, 720, fullScreen); /* - 4J - removed { @@ -4646,7 +4646,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const // 4J Stu - We never want the player to be DemoUser, we always want them to have their gamertag displayed //if (ProfileManager.IsFullVersion()) { - if (userName != L"" && sid != L"") // 4J - username & side were compared with NULL rather than empty strings + if (userName != L"" && sid != L"") // 4J - username & side were compared with nullptr rather than empty strings { minecraft->user = new User(userName, sid); } @@ -4661,7 +4661,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const //} /* 4J - TODO - if (url != NULL) + if (url != nullptr) { String[] tokens = url.split(":"); minecraft.connectTo(tokens[0], Integer.parseInt(tokens[1])); @@ -4726,7 +4726,7 @@ void Minecraft::main() #if 0 for(unsigned int i = 0; i < Item::items.length; ++i) { - if(Item::items[i] != NULL) + if(Item::items[i] != nullptr) { app.DebugPrintf("%ls\n", i, app.GetString( Item::items[i]->getDescriptionId() )); } @@ -4736,7 +4736,7 @@ void Minecraft::main() for(unsigned int i = 0; i < 256; ++i) { - if(Tile::tiles[i] != NULL) + if(Tile::tiles[i] != nullptr) { app.DebugPrintf("%ls\n", i, app.GetString( Tile::tiles[i]->getDescriptionId() )); } @@ -4768,7 +4768,7 @@ void Minecraft::main() bool Minecraft::renderNames() { - if (m_instance == NULL || !m_instance->options->hideGui) + if (m_instance == nullptr || !m_instance->options->hideGui) { return true; } @@ -4777,17 +4777,17 @@ bool Minecraft::renderNames() bool Minecraft::useFancyGraphics() { - return (m_instance != NULL && m_instance->options->fancyGraphics); + return (m_instance != nullptr && m_instance->options->fancyGraphics); } bool Minecraft::useAmbientOcclusion() { - return (m_instance != NULL && m_instance->options->ambientOcclusion != Options::AO_OFF); + return (m_instance != nullptr && m_instance->options->ambientOcclusion != Options::AO_OFF); } bool Minecraft::renderDebug() { - return (m_instance != NULL && m_instance->options->renderDebug); + return (m_instance != nullptr && m_instance->options->renderDebug); } bool Minecraft::handleClientSideCommand(const wstring& chatMessage) @@ -4826,7 +4826,7 @@ if (gameMode->instaBuild) return; if (!down) missTime = 0; if (button == 0 && missTime > 0) return; -if (down && hitResult != NULL && hitResult->type == HitResult::TILE && button == 0) +if (down && hitResult != nullptr && hitResult->type == HitResult::TILE && button == 0) { int x = hitResult->x; int y = hitResult->y; @@ -4858,7 +4858,7 @@ bool mayUse = true; // 4J-PB - Adding a special case in here for sleeping in a bed in a multiplayer game - we need to wake up, and we don't have the inbedchatscreen with a button -if(button==1 && (player->isSleeping() && level != NULL && level->isClientSide)) +if(button==1 && (player->isSleeping() && level != nullptr && level->isClientSide)) { shared_ptr mplp = dynamic_pointer_cast( player ); @@ -4872,9 +4872,9 @@ if(mplp) mplp->StopSleeping(); //} } -if (hitResult == NULL) +if (hitResult == nullptr) { -if (button == 0 && !(dynamic_cast(gameMode) != NULL)) missTime = 10; +if (button == 0 && !(dynamic_cast(gameMode) != nullptr)) missTime = 10; } else if (hitResult->type == HitResult::ENTITY) { @@ -4910,21 +4910,21 @@ gameMode->startDestroyBlock(x, y, z, hitResult->f); else { shared_ptr item = player->inventory->getSelected(); -int oldCount = item != NULL ? item->count : 0; +int oldCount = item != nullptr ? item->count : 0; if (gameMode->useItemOn(player, level, item, x, y, z, face)) { mayUse = false; app.DebugPrintf("Player %d is swinging\n",player->GetXboxPad()); player->swing(); } -if (item == NULL) +if (item == nullptr) { return; } if (item->count == 0) { -player->inventory->items[player->inventory->selected] = NULL; +player->inventory->items[player->inventory->selected] = nullptr; } else if (item->count != oldCount) { @@ -4936,7 +4936,7 @@ gameRenderer->itemInHandRenderer->itemPlaced(); if (mayUse && button == 1) { shared_ptr item = player->inventory->getSelected(); -if (item != NULL) +if (item != nullptr) { if (gameMode->useItem(player, level, item)) { @@ -4957,7 +4957,7 @@ bool Minecraft::isTutorial() { return m_inFullTutorialBits > 0; - /*if( gameMode != NULL && gameMode->isTutorial() ) + /*if( gameMode != nullptr && gameMode->isTutorial() ) { return true; } @@ -4992,7 +4992,7 @@ void Minecraft::playerLeftTutorial(int iPad) #ifndef _XBOX_ONE for(DWORD idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(localplayers[idx] != NULL) + if(localplayers[idx] != nullptr) { TelemetryManager->RecordLevelStart(idx, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, level->difficulty, app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount()); } @@ -5023,7 +5023,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP { // create the local player for the iPad shared_ptr player = pClass->localplayers[iPad]; - if( player == NULL) + if( player == nullptr) { if( pClass->level->isClientSide ) { @@ -5033,7 +5033,7 @@ void Minecraft::inGameSignInCheckAllPrivilegesCallback(LPVOID lpParam, bool hasP { // create the local player for the iPad shared_ptr player = pClass->localplayers[iPad]; - if( player == NULL) + if( player == nullptr) { player = pClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pClass->level->dimension->id); } @@ -5061,7 +5061,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) } // If sign in succeded, we're in game and this player isn't already playing, continue - if(bContinue==true && g_NetworkManager.IsInSession() && pMinecraftClass->localplayers[iPad] == NULL) + if(bContinue==true && g_NetworkManager.IsInSession() && pMinecraftClass->localplayers[iPad] == nullptr) { // It's possible that the player has not signed in - they can back out or choose no for the converttoguest if(ProfileManager.IsSignedIn(iPad)) @@ -5087,7 +5087,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) { #ifdef __ORBIS__ bool contentRestricted = false; - ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&contentRestricted,NULL); // TODO! + ProfileManager.GetChatAndContentRestrictions(iPad,false,nullptr,&contentRestricted,nullptr); // TODO! if (!g_NetworkManager.IsLocalGame() && contentRestricted) { @@ -5108,7 +5108,7 @@ int Minecraft::InGame_SignInReturned(void *pParam,bool bContinue, int iPad) { // create the local player for the iPad shared_ptr player = pMinecraftClass->localplayers[iPad]; - if( player == NULL) + if( player == nullptr) { player = pMinecraftClass->createExtraLocalPlayer(iPad, (convStringToWstring( ProfileManager.GetGamertag(iPad) )).c_str(), iPad, pMinecraftClass->level->dimension->id); } @@ -5177,7 +5177,7 @@ ColourTable *Minecraft::getColourTable() ColourTable *colours = selected->getColourTable(); - if(colours == NULL) + if(colours == nullptr) { colours = skins->getDefault()->getColourTable(); } diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index cc1e5d18a..ef138d0af 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -114,7 +114,7 @@ public: void addPendingLocalConnection(int idx, ClientConnection *connection); void connectionDisconnected(int idx, DisconnectPacket::eDisconnectReason reason) { m_connectionFailed[idx] = true; m_connectionFailedReason[idx] = reason; } - shared_ptr createExtraLocalPlayer(int idx, const wstring& name, int pad, int iDimension, ClientConnection *clientConnection = NULL,MultiPlayerLevel *levelpassedin=NULL); + shared_ptr createExtraLocalPlayer(int idx, const wstring& name, int pad, int iDimension, ClientConnection *clientConnection = nullptr,MultiPlayerLevel *levelpassedin=nullptr); void createPrimaryLocalPlayer(int iPad); bool setLocalPlayerIdx(int idx); int getLocalPlayerIdx(); diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index f469c8b11..ad68b47fd 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -66,7 +66,7 @@ #define DEBUG_SERVER_DONT_SPAWN_MOBS 0 //4J Added -MinecraftServer *MinecraftServer::server = NULL; +MinecraftServer *MinecraftServer::server = nullptr; bool MinecraftServer::setTimeAtEndOfTick = false; __int64 MinecraftServer::setTime = 0; bool MinecraftServer::setTimeOfDayAtEndOfTick = false; @@ -97,17 +97,17 @@ static bool ShouldUseDedicatedServerProperties() static int GetDedicatedServerInt(Settings *settings, const wchar_t *key, int defaultValue) { - return (ShouldUseDedicatedServerProperties() && settings != NULL) ? settings->getInt(key, defaultValue) : defaultValue; + return (ShouldUseDedicatedServerProperties() && settings != nullptr) ? settings->getInt(key, defaultValue) : defaultValue; } static bool GetDedicatedServerBool(Settings *settings, const wchar_t *key, bool defaultValue) { - return (ShouldUseDedicatedServerProperties() && settings != NULL) ? settings->getBoolean(key, defaultValue) : defaultValue; + return (ShouldUseDedicatedServerProperties() && settings != nullptr) ? settings->getBoolean(key, defaultValue) : defaultValue; } static wstring GetDedicatedServerString(Settings *settings, const wchar_t *key, const wstring &defaultValue) { - return (ShouldUseDedicatedServerProperties() && settings != NULL) ? settings->getString(key, defaultValue) : defaultValue; + return (ShouldUseDedicatedServerProperties() && settings != nullptr) ? settings->getString(key, defaultValue) : defaultValue; } static void PrintConsoleLine(const wchar_t *prefix, const wstring &message) @@ -148,12 +148,12 @@ static wstring JoinConsoleCommandTokens(const vector &tokens, size_t st static shared_ptr FindPlayerByName(PlayerList *playerList, const wstring &name) { - if (playerList == NULL) return nullptr; + if (playerList == nullptr) return nullptr; for (size_t i = 0; i < playerList->players.size(); ++i) { shared_ptr player = playerList->players[i]; - if (player != NULL && equalsIgnoreCase(player->getName(), name)) + if (player != nullptr && equalsIgnoreCase(player->getName(), name)) { return player; } @@ -166,7 +166,7 @@ static void SetAllLevelTimes(MinecraftServer *server, int value) { for (unsigned int i = 0; i < server->levels.length; ++i) { - if (server->levels[i] != NULL) + if (server->levels[i] != nullptr) { server->levels[i]->setDayTime(value); } @@ -175,7 +175,7 @@ static void SetAllLevelTimes(MinecraftServer *server, int value) static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCommand) { - if (server == NULL) + if (server == nullptr) return false; wstring command = trimString(rawCommand); @@ -209,9 +209,9 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom if (action == L"list") { - wstring playerNames = (playerList != NULL) ? playerList->getPlayerNames() : L""; + wstring playerNames = (playerList != nullptr) ? playerList->getPlayerNames() : L""; if (playerNames.empty()) playerNames = L"(none)"; - server->info(L"Players (" + std::to_wstring((playerList != NULL) ? playerList->getPlayerCount() : 0) + L"): " + playerNames); + server->info(L"Players (" + std::to_wstring((playerList != nullptr) ? playerList->getPlayerCount() : 0) + L"): " + playerNames); return true; } @@ -224,7 +224,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } wstring message = L"[Server] " + JoinConsoleCommandTokens(tokens, 1); - if (playerList != NULL) + if (playerList != nullptr) { playerList->broadcastAll(shared_ptr(new ChatPacket(message))); } @@ -234,9 +234,9 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom if (action == L"save-all") { - if (playerList != NULL) + if (playerList != nullptr) { - playerList->saveAll(NULL, false); + playerList->saveAll(nullptr, false); } server->info(L"World saved."); return true; @@ -267,7 +267,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom for (unsigned int i = 0; i < server->levels.length; ++i) { - if (server->levels[i] != NULL) + if (server->levels[i] != nullptr) { server->levels[i]->setDayTime(server->levels[i]->getDayTime() + delta); } @@ -323,7 +323,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom return false; } - if (server->levels[0] == NULL) + if (server->levels[0] == nullptr) { server->warn(L"The overworld is not loaded."); return false; @@ -370,12 +370,12 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom shared_ptr subject = FindPlayerByName(playerList, tokens[1]); shared_ptr destination = FindPlayerByName(playerList, tokens[2]); - if (subject == NULL) + if (subject == nullptr) { server->warn(L"Unknown player: " + tokens[1]); return false; } - if (destination == NULL) + if (destination == nullptr) { server->warn(L"Unknown player: " + tokens[2]); return false; @@ -401,7 +401,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } shared_ptr player = FindPlayerByName(playerList, tokens[1]); - if (player == NULL) + if (player == nullptr) { server->warn(L"Unknown player: " + tokens[1]); return false; @@ -425,7 +425,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom server->warn(L"Invalid aux value: " + tokens[4]); return false; } - if (itemId <= 0 || Item::items[itemId] == NULL) + if (itemId <= 0 || Item::items[itemId] == nullptr) { server->warn(L"Unknown item id: " + std::to_wstring(itemId)); return false; @@ -438,7 +438,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom shared_ptr itemInstance(new ItemInstance(itemId, amount, aux)); shared_ptr drop = player->drop(itemInstance); - if (drop != NULL) + if (drop != nullptr) { drop->throwTime = 0; } @@ -455,7 +455,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } shared_ptr player = FindPlayerByName(playerList, tokens[1]); - if (player == NULL) + if (player == nullptr) { server->warn(L"Unknown player: " + tokens[1]); return false; @@ -475,14 +475,14 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } shared_ptr selectedItem = player->getSelectedItem(); - if (selectedItem == NULL) + if (selectedItem == nullptr) { server->warn(L"The player is not holding an item."); return false; } Enchantment *enchantment = Enchantment::enchantments[enchantmentId]; - if (enchantment == NULL) + if (enchantment == nullptr) { server->warn(L"Unknown enchantment id: " + std::to_wstring(enchantmentId)); return false; @@ -499,12 +499,12 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom if (selectedItem->hasTag()) { ListTag *enchantmentTags = selectedItem->getEnchantmentTags(); - if (enchantmentTags != NULL) + if (enchantmentTags != nullptr) { for (int i = 0; i < enchantmentTags->size(); i++) { int type = enchantmentTags->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); - if (Enchantment::enchantments[type] != NULL && !Enchantment::enchantments[type]->isCompatibleWith(enchantment)) + if (Enchantment::enchantments[type] != nullptr && !Enchantment::enchantments[type]->isCompatibleWith(enchantment)) { server->warn(L"That enchantment conflicts with an existing enchantment on the selected item."); return false; @@ -527,7 +527,7 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom } shared_ptr player = FindPlayerByName(playerList, tokens[1]); - if (player == NULL) + if (player == nullptr) { server->warn(L"Unknown player: " + tokens[1]); return false; @@ -545,10 +545,10 @@ static bool ExecuteConsoleCommand(MinecraftServer *server, const wstring &rawCom MinecraftServer::MinecraftServer() { // 4J - added initialisers - connection = NULL; - settings = NULL; - players = NULL; - commands = NULL; + connection = nullptr; + settings = nullptr; + players = nullptr; + commands = nullptr; running = true; m_bLoaded = false; stopped = false; @@ -567,7 +567,7 @@ MinecraftServer::MinecraftServer() m_texturePackId = 0; maxBuildHeight = Level::maxBuildHeight; playerIdleTimeout = 0; - m_postUpdateThread = NULL; + m_postUpdateThread = nullptr; forceGameType = false; commandDispatcher = new ServerCommandDispatcher(); @@ -684,10 +684,10 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW setPlayers(new PlayerList(this)); // 4J-JEV: Need to wait for levelGenerationOptions to load. - while ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->hasLoadedData() ) + while ( app.getLevelGenerationOptions() != nullptr && !app.getLevelGenerationOptions()->hasLoadedData() ) Sleep(1); - if ( app.getLevelGenerationOptions() != NULL && !app.getLevelGenerationOptions()->ready() ) + if ( app.getLevelGenerationOptions() != nullptr && !app.getLevelGenerationOptions()->ready() ) { // TODO: Stop loading, add error message. } @@ -698,7 +698,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW wstring levelTypeString; bool gameRuleUseFlatWorld = false; - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { gameRuleUseFlatWorld = app.getLevelGenerationOptions()->getuseFlatWorld(); } @@ -712,7 +712,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW } LevelType *pLevelType = LevelType::getLevelType(levelTypeString); - if (pLevelType == NULL) + if (pLevelType == nullptr) { pLevelType = LevelType::lvl_normal; } @@ -862,7 +862,7 @@ void MinecraftServer::postProcessTerminate(ProgressRenderer *mcprogress) } } while ( status == WAIT_TIMEOUT ); delete m_postUpdateThread; - m_postUpdateThread = NULL; + m_postUpdateThread = nullptr; DeleteCriticalSection(&m_postProcessCS); } @@ -888,7 +888,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring // 4J - temp - load existing level shared_ptr storage = nullptr; bool levelChunksNeedConverted = false; - if( initData->saveData != NULL ) + if( initData->saveData != nullptr ) { // We are loading a file from disk with the data passed in @@ -912,13 +912,13 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring #ifdef SPLIT_SAVES bool bLevelGenBaseSave = false; LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); - if( levelGen != NULL && levelGen->requiresBaseSave()) + if( levelGen != nullptr && levelGen->requiresBaseSave()) { DWORD fileSize = 0; LPVOID pvSaveData = levelGen->getBaseSaveData(fileSize); if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true; } - ConsoleSaveFileSplit *newFormatSave = NULL; + ConsoleSaveFileSplit *newFormatSave = nullptr; if(bLevelGenBaseSave) { ConsoleSaveFileOriginal oldFormatSave( L"" ); @@ -952,11 +952,11 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring if (i == 0) { levels[i] = new ServerLevel(this, storage, name, dimension, levelSettings); - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *mapOptions = app.getLevelGenerationOptions(); Pos *spawnPos = mapOptions->getSpawnPos(); - if( spawnPos != NULL ) + if( spawnPos != nullptr ) { levels[i]->setSpawnPos( spawnPos ); } @@ -981,7 +981,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring #endif levels[i]->getLevelData()->setGameType(gameType); - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *mapOptions = app.getLevelGenerationOptions(); levels[i]->getLevelData()->setHasBeenInCreative(mapOptions->getLevelHasBeenInCreative() ); @@ -1038,7 +1038,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring ba_gameRules.length = fe->getFileSize(); ba_gameRules.data = new BYTE[ ba_gameRules.length ]; - csf->setFilePointer(fe,0,NULL,FILE_BEGIN); + csf->setFilePointer(fe,0,nullptr,FILE_BEGIN); csf->readFile(fe, ba_gameRules.data, ba_gameRules.length, &numberOfBytesRead); assert(numberOfBytesRead == ba_gameRules.length); @@ -1349,7 +1349,7 @@ void MinecraftServer::saveAllChunks() // with the data from the nethers leveldata. // Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting. ServerLevel *level = levels[levels.length - 1 - i]; - if( level ) // 4J - added check as level can be NULL if we end up in stopServer really early on due to network failure + if( level ) // 4J - added check as level can be nullptr if we end up in stopServer really early on due to network failure { level->save(true, Minecraft::GetInstance()->progressRenderer); @@ -1375,14 +1375,14 @@ void MinecraftServer::saveGameRules() #endif { byteArray ba; - ba.data = NULL; + ba.data = nullptr; app.m_gameRules.saveGameRules( &ba.data, &ba.length ); - if (ba.data != NULL) + if (ba.data != nullptr) { ConsoleSaveFile *csf = getLevel(0)->getLevelStorage()->getSaveFile(); FileEntry *fe = csf->createFile(ConsoleSavePath(GAME_RULE_SAVENAME)); - csf->setFilePointer(fe, 0, NULL, FILE_BEGIN); + csf->setFilePointer(fe, 0, nullptr, FILE_BEGIN); DWORD length; csf->writeFile(fe, ba.data, ba.length, &length ); @@ -1406,9 +1406,9 @@ void MinecraftServer::Suspend() QueryPerformanceCounter( &qwTime ); if(m_bLoaded && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled())) { - if (players != NULL) + if (players != nullptr) { - players->saveAll(NULL); + players->saveAll(nullptr); } for (unsigned int j = 0; j < levels.length; j++) { @@ -1422,7 +1422,7 @@ void MinecraftServer::Suspend() if( !s_bServerHalted ) { saveGameRules(); - levels[0]->saveToDisc(NULL, true); + levels[0]->saveToDisc(nullptr, true); } } QueryPerformanceCounter( &qwNewTime ); @@ -1481,7 +1481,7 @@ void MinecraftServer::stopServer(bool didInit) // if trial version or saving is disabled, then don't save anything. Also don't save anything if we didn't actually get through the server initialisation. if(m_saveOnExit && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled()) && didInit) { - if (players != NULL) + if (players != nullptr) { players->saveAll(Minecraft::GetInstance()->progressRenderer, true); } @@ -1491,7 +1491,7 @@ void MinecraftServer::stopServer(bool didInit) //for (unsigned int i = levels.length - 1; i >= 0; i--) //{ // ServerLevel *level = levels[i]; - // if (level != NULL) + // if (level != nullptr) // { saveAllChunks(); // } @@ -1499,7 +1499,7 @@ void MinecraftServer::stopServer(bool didInit) saveGameRules(); app.m_gameRules.unloadCurrentGameRules(); - if( levels[0] != NULL ) // This can be null if stopServer happens very quickly due to network error + if( levels[0] != nullptr ) // This can be null if stopServer happens very quickly due to network error { levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, false); } @@ -1522,10 +1522,10 @@ void MinecraftServer::stopServer(bool didInit) unsigned int iServerLevelC=levels.length; for (unsigned int i = 0; i < iServerLevelC; i++) { - if(levels[i]!=NULL) + if(levels[i]!=nullptr) { delete levels[i]; - levels[i] = NULL; + levels[i] = nullptr; } } @@ -1535,11 +1535,11 @@ void MinecraftServer::stopServer(bool didInit) #endif delete connection; - connection = NULL; + connection = nullptr; delete players; - players = NULL; + players = nullptr; delete settings; - settings = NULL; + settings = nullptr; g_NetworkManager.ServerStopped(); } @@ -1697,10 +1697,10 @@ void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout) extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b; void MinecraftServer::run(__int64 seed, void *lpParameter) { - NetworkGameInitData *initData = NULL; + NetworkGameInitData *initData = nullptr; DWORD initSettings = 0; bool findSeed = false; - if(lpParameter != NULL) + if(lpParameter != nullptr) { initData = static_cast(lpParameter); initSettings = app.GetGameHostOption(eGameHostOption_All); @@ -1843,9 +1843,9 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) // Save the start time QueryPerformanceCounter( &qwTime ); - if (players != NULL) + if (players != nullptr) { - players->saveAll(NULL); + players->saveAll(nullptr); } for (unsigned int j = 0; j < levels.length; j++) @@ -1856,7 +1856,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) // Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting. ServerLevel *level = levels[levels.length - 1 - j]; PIXBeginNamedEvent(0, "Saving level %d",levels.length - 1 - j); - level->save(false, NULL, true); + level->save(false, nullptr, true); PIXEndNamedEvent(); } if( !s_bServerHalted ) @@ -1880,7 +1880,7 @@ void MinecraftServer::run(__int64 seed, void *lpParameter) #endif case eXuiServerAction_SaveGame: app.EnterSaveNotificationSection(); - if (players != NULL) + if (players != nullptr) { players->saveAll(Minecraft::GetInstance()->progressRenderer); } @@ -2214,14 +2214,14 @@ void MinecraftServer::main(__int64 seed, void *lpParameter) server = new MinecraftServer(); server->run(seed, lpParameter); delete server; - server = NULL; + server = nullptr; ShutdownManager::HasFinished(ShutdownManager::eServerThread ); } void MinecraftServer::HaltServer(bool bPrimaryPlayerSignedOut) { s_bServerHalted = true; - if( server != NULL ) + if( server != nullptr ) { m_bPrimaryPlayerSignedOut=bPrimaryPlayerSignedOut; server->halt(); @@ -2267,7 +2267,7 @@ void MinecraftServer::setLevel(int dimension, ServerLevel *level) bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player) { if( s_hasSentEnoughPackets ) return false; - if( player == NULL ) return false; + if( player == nullptr ) return false; for( int i = 0; i < s_sentTo.size(); i++ ) { @@ -2350,7 +2350,7 @@ void MinecraftServer::chunkPacketManagement_PostTick() // 4J Added bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player) { - if( player == NULL ) return false; + if( player == nullptr ) return false; int time = GetTickCount(); if( player->GetSessionIndex() == s_slowQueuePlayerIndex && (time - s_slowQueueLastTime) > MINECRAFT_SERVER_SLOW_QUEUE_DELAY ) @@ -2393,7 +2393,7 @@ void MinecraftServer::cycleSlowQueueIndex() if( !g_NetworkManager.IsInSession() ) return; int startingIndex = s_slowQueuePlayerIndex; - INetworkPlayer *currentPlayer = NULL; + INetworkPlayer *currentPlayer = nullptr; DWORD currentPlayerCount = 0; do { @@ -2415,7 +2415,7 @@ void MinecraftServer::cycleSlowQueueIndex() } while ( g_NetworkManager.IsInSession() && currentPlayerCount > 0 && s_slowQueuePlayerIndex != startingIndex && - currentPlayer != NULL && + currentPlayer != nullptr && currentPlayer->IsLocal() ); // app.DebugPrintf("Cycled slow queue index to %d\n", s_slowQueuePlayerIndex); diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 7fa8c7522..3332c6ae8 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -48,9 +48,9 @@ typedef struct _NetworkGameInitData _NetworkGameInitData() { seed = 0; - saveData = NULL; + saveData = nullptr; settings = 0; - levelGen = NULL; + levelGen = nullptr; texturePackId = 0; findSeed = false; xzSize = LEVEL_LEGACY_WIDTH; @@ -233,7 +233,7 @@ public: void addPostProcessRequest(ChunkSource *chunkSource, int x, int z); public: - static PlayerList *getPlayerList() { if( server != NULL ) return server->players; else return NULL; } + static PlayerList *getPlayerList() { if( server != nullptr ) return server->players; else return nullptr; } static void SetTimeOfDay(__int64 time) { setTimeOfDayAtEndOfTick = true; setTimeOfDay = time; } static void SetTime(__int64 time) { setTimeAtEndOfTick = true; setTime = time; } diff --git a/Minecraft.Client/Minimap.cpp b/Minecraft.Client/Minimap.cpp index 9e07dbdf2..4f6ccd6b6 100644 --- a/Minecraft.Client/Minimap.cpp +++ b/Minecraft.Client/Minimap.cpp @@ -165,9 +165,9 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrentityId != entityId) continue; glPushMatrix(); @@ -201,9 +201,9 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptrimg; imgIndex -= 16; - // 4J Stu - For item frame renders, the player is NULL. We do not want to show player icons on the frames. - if(player == NULL && (imgIndex != 12)) continue; - else if (player != NULL && imgIndex == 12) continue; + // 4J Stu - For item frame renders, the player is nullptr. We do not want to show player icons on the frames. + if(player == nullptr && (imgIndex != 12)) continue; + else if (player != nullptr && imgIndex == 12) continue; else if( imgIndex == 12 && dec->entityId != entityId) continue; glPushMatrix(); @@ -239,7 +239,7 @@ void Minimap::render(shared_ptr player, Textures *textures, shared_ptr entity, double x, double y, double { shared_ptr roper = entity->getLeashHolder(); // roper = entityRenderDispatcher.cameraEntity; - if (roper != NULL) + if (roper != nullptr) { glColor4f(1.0f, 1.0f, 1.0f, 1.0f); diff --git a/Minecraft.Client/MobSkinMemTextureProcessor.cpp b/Minecraft.Client/MobSkinMemTextureProcessor.cpp index a6fdf5270..c841c3f5a 100644 --- a/Minecraft.Client/MobSkinMemTextureProcessor.cpp +++ b/Minecraft.Client/MobSkinMemTextureProcessor.cpp @@ -3,14 +3,14 @@ BufferedImage *MobSkinMemTextureProcessor::process(BufferedImage *in) { - if (in == NULL) return NULL; + if (in == nullptr) return nullptr; width = 64; height = 32; BufferedImage *out = new BufferedImage(width, height, BufferedImage::TYPE_INT_ARGB); Graphics *g = out->getGraphics(); - g->drawImage(in, 0, 0, NULL); + g->drawImage(in, 0, 0, nullptr); g->dispose(); pixels = out->getData(); diff --git a/Minecraft.Client/MobSkinTextureProcessor.cpp b/Minecraft.Client/MobSkinTextureProcessor.cpp index dffb467a8..37d2ab46c 100644 --- a/Minecraft.Client/MobSkinTextureProcessor.cpp +++ b/Minecraft.Client/MobSkinTextureProcessor.cpp @@ -3,14 +3,14 @@ BufferedImage *MobSkinTextureProcessor::process(BufferedImage *in) { - if (in == NULL) return NULL; + if (in == nullptr) return nullptr; width = 64; height = 32; BufferedImage *out = new BufferedImage(width, height, BufferedImage::TYPE_INT_ARGB); Graphics *g = out->getGraphics(); - g->drawImage(in, 0, 0, NULL); + g->drawImage(in, 0, 0, nullptr); g->dispose(); pixels = out->getData(); diff --git a/Minecraft.Client/MobSpawnerRenderer.cpp b/Minecraft.Client/MobSpawnerRenderer.cpp index 9b6e6a0e2..1a083fabd 100644 --- a/Minecraft.Client/MobSpawnerRenderer.cpp +++ b/Minecraft.Client/MobSpawnerRenderer.cpp @@ -19,7 +19,7 @@ void MobSpawnerRenderer::render(BaseMobSpawner *spawner, double x, double y, dou glTranslatef(static_cast(x) + 0.5f, static_cast(y), static_cast(z) + 0.5f); shared_ptr e = spawner->getDisplayEntity(); - if (e != NULL) + if (e != nullptr) { e->setLevel(spawner->getLevel()); float s = 7 / 16.0f; diff --git a/Minecraft.Client/Model.h b/Minecraft.Client/Model.h index 305c5a0a1..6a797a258 100644 --- a/Minecraft.Client/Model.h +++ b/Minecraft.Client/Model.h @@ -24,7 +24,7 @@ public: virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr entity, unsigned int uiBitmaskOverrideAnim=0) {} virtual void prepareMobModel(shared_ptr mob, float time, float r, float a) {} virtual ModelPart *getRandomModelPart(Random random) {return cubes.at(random.nextInt(static_cast(cubes.size())));} - virtual ModelPart * AddOrRetrievePart(SKIN_BOX *pBox) { return NULL;} + virtual ModelPart * AddOrRetrievePart(SKIN_BOX *pBox) { return nullptr;} void setMapTex(wstring id, int x, int y); TexOffs *getMapTex(wstring id); diff --git a/Minecraft.Client/ModelHorse.cpp b/Minecraft.Client/ModelHorse.cpp index 7a13d0adc..81ff7ea61 100644 --- a/Minecraft.Client/ModelHorse.cpp +++ b/Minecraft.Client/ModelHorse.cpp @@ -252,7 +252,7 @@ void ModelHorse::render(shared_ptr entity, float time, float r, float bo bool largeEars = type == EntityHorse::TYPE_DONKEY || type == EntityHorse::TYPE_MULE; float sizeFactor = entityhorse->getFoalScale(); - bool rider = (entityhorse->rider.lock() != NULL); + bool rider = (entityhorse->rider.lock() != nullptr); if (saddled) { @@ -401,7 +401,7 @@ void ModelHorse::prepareMobModel(shared_ptr mob, float wp, float w float openMouth = entityhorse->getMouthAnim(a); bool tail = entityhorse->tailCounter != 0; bool saddled = entityhorse->isSaddled(); - bool rider = entityhorse->rider.lock() != NULL; + bool rider = entityhorse->rider.lock() != nullptr; float bob = mob->tickCount + a; float legAnim1 = cos((wp * 0.6662f) + 3.141593f); diff --git a/Minecraft.Client/ModelPart.cpp b/Minecraft.Client/ModelPart.cpp index 57424bc66..e423a4ae2 100644 --- a/Minecraft.Client/ModelPart.cpp +++ b/Minecraft.Client/ModelPart.cpp @@ -65,7 +65,7 @@ void ModelPart::construct(Model *model, int xTexOffs, int yTexOffs) void ModelPart::addChild(ModelPart *child) { - //if (children == NULL) children = new ModelPartArray; + //if (children == nullptr) children = new ModelPartArray; children.push_back(child); } @@ -89,7 +89,7 @@ ModelPart * ModelPart::retrieveChild(SKIN_BOX *pBox) } } - return NULL; + return nullptr; } ModelPart *ModelPart::mirror() @@ -180,7 +180,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart) } } } - //if (children != NULL) + //if (children != nullptr) { for (unsigned int i = 0; i < children.size(); i++) { @@ -208,7 +208,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart) } } } - //if (children != NULL) + //if (children != nullptr) { for (unsigned int i = 0; i < children.size(); i++) { @@ -234,7 +234,7 @@ void ModelPart::render(float scale, bool usecompiled, bool bHideParentBodyPart) } } } - //if (children != NULL) + //if (children != nullptr) { for (unsigned int i = 0; i < children.size(); i++) { diff --git a/Minecraft.Client/MultiPlayerChunkCache.cpp b/Minecraft.Client/MultiPlayerChunkCache.cpp index 4a9ca59ae..62361ce36 100644 --- a/Minecraft.Client/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/MultiPlayerChunkCache.cpp @@ -88,7 +88,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level) } else { - waterChunk = NULL; + waterChunk = nullptr; } this->level = level; @@ -132,7 +132,7 @@ bool MultiPlayerChunkCache::reallyHasChunk(int x, int z) int idx = ix * XZSIZE + iz; LevelChunk *chunk = cache[idx]; - if( chunk == NULL ) + if( chunk == nullptr ) { return false; } @@ -166,7 +166,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z) LevelChunk *chunk = cache[idx]; LevelChunk *lastChunk = chunk; - if( chunk == NULL ) + if( chunk == nullptr ) { EnterCriticalSection(&m_csLoadCreate); @@ -174,7 +174,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z) if( g_NetworkManager.IsHost() ) // force here to disable sharing of data { // 4J-JEV: We are about to use shared data, abort if the server is stopped and the data is deleted. - if (MinecraftServer::getInstance()->serverHalted()) return NULL; + if (MinecraftServer::getInstance()->serverHalted()) return nullptr; // If we're the host, then don't create the chunk, share data from the server's copy #ifdef _LARGE_WORLDS @@ -248,7 +248,7 @@ LevelChunk *MultiPlayerChunkCache::getChunk(int x, int z) int idx = ix * XZSIZE + iz; LevelChunk *chunk = cache[idx]; - if( chunk == NULL ) + if( chunk == nullptr ) { return emptyChunk; } @@ -279,12 +279,12 @@ void MultiPlayerChunkCache::postProcess(ChunkSource *parent, int x, int z) vector *MultiPlayerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { - return NULL; + return nullptr; } TilePos *MultiPlayerChunkCache::findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z) { - return NULL; + return nullptr; } void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chunkZ) diff --git a/Minecraft.Client/MultiPlayerGameMode.cpp b/Minecraft.Client/MultiPlayerGameMode.cpp index bf3550956..50e3080d7 100644 --- a/Minecraft.Client/MultiPlayerGameMode.cpp +++ b/Minecraft.Client/MultiPlayerGameMode.cpp @@ -75,7 +75,7 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face) if (localPlayerMode->isCreative()) { - if (minecraft->player->getCarriedItem() != NULL && dynamic_cast(minecraft->player->getCarriedItem()->getItem()) != NULL) + if (minecraft->player->getCarriedItem() != nullptr && dynamic_cast(minecraft->player->getCarriedItem()->getItem()) != nullptr) { return false; } @@ -84,7 +84,7 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face) Level *level = minecraft->level; Tile *oldTile = Tile::tiles[level->getTile(x, y, z)]; - if (oldTile == NULL) return false; + if (oldTile == nullptr) return false; level->levelEvent(LevelEvent::PARTICLES_DESTROY_BLOCK, x, y, z, oldTile->id + (level->getData(x, y, z) << Tile::TILE_NUM_SHIFT)); @@ -99,7 +99,7 @@ bool MultiPlayerGameMode::destroyBlock(int x, int y, int z, int face) if (!localPlayerMode->isCreative()) { shared_ptr item = minecraft->player->getSelectedItem(); - if (item != NULL) + if (item != nullptr) { item->mineBlock(level, oldTile->id, x, y, z, minecraft->player); if (item->count == 0) @@ -212,7 +212,7 @@ void MultiPlayerGameMode::continueDestroyBlock(int x, int y, int z, int face) if (destroyTicks % 4 == 0) { - if (tile != NULL) + if (tile != nullptr) { int iStepSound=tile->soundType->getStepSound(); @@ -259,8 +259,8 @@ void MultiPlayerGameMode::tick() bool MultiPlayerGameMode::sameDestroyTarget(int x, int y, int z) { shared_ptr selected = minecraft->player->getCarriedItem(); - bool sameItems = destroyingItem == NULL && selected == NULL; - if (destroyingItem != NULL && selected != NULL) + bool sameItems = destroyingItem == nullptr && selected == nullptr; + if (destroyingItem != nullptr && selected != nullptr) { sameItems = selected->id == destroyingItem->id && @@ -294,7 +294,7 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, sha float clickZ = static_cast(hit->z) - z; bool didSomething = false; - if (!player->isSneaking() || player->getCarriedItem() == NULL) + if (!player->isSneaking() || player->getCarriedItem() == nullptr) { int t = level->getTile(x, y, z); if (t > 0 && player->isAllowedToUse(Tile::tiles[t])) @@ -327,15 +327,15 @@ bool MultiPlayerGameMode::useItemOn(shared_ptr player, Level *level, sha } } - if (!didSomething && item != NULL && dynamic_cast(item->getItem())) + if (!didSomething && item != nullptr && dynamic_cast(item->getItem())) { TileItem *tile = dynamic_cast(item->getItem()); if (!tile->mayPlace(level, x, y, z, face, player, item)) return false; } - // 4J Stu - In Java we send the use packet before the above check for item being NULL + // 4J Stu - In Java we send the use packet before the above check for item being nullptr // so the following never gets executed but the packet still gets sent (for opening chests etc) - if(item != NULL) + if(item != nullptr) { if(!didSomething && player->isAllowedToUse(item)) { @@ -408,7 +408,7 @@ bool MultiPlayerGameMode::useItem(shared_ptr player, Level *level, share { int oldCount = item->count; shared_ptr itemInstance = item->use(level, player); - if ((itemInstance != NULL && itemInstance != item) || (itemInstance != NULL && itemInstance->count != oldCount)) + if ((itemInstance != nullptr && itemInstance != item) || (itemInstance != nullptr && itemInstance->count != oldCount)) { player->inventory->items[player->inventory->selected] = itemInstance; if (itemInstance->count == 0) @@ -470,7 +470,7 @@ void MultiPlayerGameMode::handleCreativeModeItemAdd(shared_ptr cli void MultiPlayerGameMode::handleCreativeModeItemDrop(shared_ptr clicked) { - if (localPlayerMode->isCreative() && clicked != NULL) + if (localPlayerMode->isCreative() && clicked != nullptr) { connection->send(shared_ptr( new SetCreativeModeSlotPacket(-1, clicked) ) ); } diff --git a/Minecraft.Client/MultiPlayerGameMode.h b/Minecraft.Client/MultiPlayerGameMode.h index 76aa8fc84..fb21bb67c 100644 --- a/Minecraft.Client/MultiPlayerGameMode.h +++ b/Minecraft.Client/MultiPlayerGameMode.h @@ -42,7 +42,7 @@ private: bool sameDestroyTarget(int x, int y, int z); void ensureHasSentCarriedItem(); public: - virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); + virtual bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=nullptr); virtual bool useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly=false); virtual shared_ptr createPlayer(Level *level); virtual void attack(shared_ptr player, shared_ptr entity); @@ -65,5 +65,5 @@ public: // 4J Stu - Added for tutorial checks virtual bool isInputAllowed(int mapping) { return true; } virtual bool isTutorial() { return false; } - virtual Tutorial *getTutorial() { return NULL; } + virtual Tutorial *getTutorial() { return nullptr; } }; \ No newline at end of file diff --git a/Minecraft.Client/MultiPlayerLevel.cpp b/Minecraft.Client/MultiPlayerLevel.cpp index 4b74bbf17..d91a1affc 100644 --- a/Minecraft.Client/MultiPlayerLevel.cpp +++ b/Minecraft.Client/MultiPlayerLevel.cpp @@ -43,7 +43,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings * levelData->setInitialized(true); } - if(connection !=NULL) + if(connection !=nullptr) { this->connections.push_back( connection ); } @@ -54,7 +54,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings * //setSpawnPos(new Pos(8, 64, 8)); // The base ctor already has made some storage, so need to delete that if( this->savedDataStorage ) delete savedDataStorage; - if(connection !=NULL) + if(connection !=nullptr) { savedDataStorage = connection->savedDataStorage; } @@ -70,7 +70,7 @@ MultiPlayerLevel::MultiPlayerLevel(ClientConnection *connection, LevelSettings * MultiPlayerLevel::~MultiPlayerLevel() { // Don't let the base class delete this, it comes from the connection for multiplayerlevels, and we'll delete there - this->savedDataStorage = NULL; + this->savedDataStorage = nullptr; } void MultiPlayerLevel::unshareChunkAt(int x, int z) @@ -465,7 +465,7 @@ void MultiPlayerLevel::entityRemoved(shared_ptr e) void MultiPlayerLevel::putEntity(int id, shared_ptr e) { shared_ptr old = getEntity(id); - if (old != NULL) + if (old != nullptr) { removeEntity(old); } @@ -633,7 +633,7 @@ void MultiPlayerLevel::disconnect(bool sendDisconnect /*= true*/) Tickable *MultiPlayerLevel::makeSoundUpdater(shared_ptr minecart) { - return NULL; //new MinecartSoundUpdater(minecraft->soundEngine, minecart, minecraft->player); + return nullptr; //new MinecartSoundUpdater(minecraft->soundEngine, minecart, minecraft->player); } void MultiPlayerLevel::tickWeather() @@ -732,7 +732,7 @@ void MultiPlayerLevel::animateTickDoWork() } } - Minecraft::GetInstance()->animateTickLevel = NULL; + Minecraft::GetInstance()->animateTickLevel = nullptr; delete animateRandom; chunksToAnimate.clear(); @@ -860,7 +860,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() { shared_ptr e = *it;//entities.at(i); - if (e->riding != NULL) + if (e->riding != nullptr) { if (e->riding->removed || e->riding->rider.lock() != e) { @@ -937,11 +937,11 @@ void MultiPlayerLevel::removeUnusedTileEntitiesInRegion(int x0, int y0, int z0, if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) { LevelChunk *lc = getChunk(te->x >> 4, te->z >> 4); - if (lc != NULL) + if (lc != nullptr) { // Only remove tile entities where this is no longer a tile entity int tileId = lc->getTile(te->x & 15, te->y, te->z & 15 ); - if( Tile::tiles[tileId] == NULL || !Tile::tiles[tileId]->isEntityTile()) + if( Tile::tiles[tileId] == nullptr || !Tile::tiles[tileId]->isEntityTile()) { tileEntityList[i] = tileEntityList.back(); tileEntityList.pop_back(); diff --git a/Minecraft.Client/MultiPlayerLocalPlayer.cpp b/Minecraft.Client/MultiPlayerLocalPlayer.cpp index 3c3c34310..57ffb2906 100644 --- a/Minecraft.Client/MultiPlayerLocalPlayer.cpp +++ b/Minecraft.Client/MultiPlayerLocalPlayer.cpp @@ -129,7 +129,7 @@ void MultiplayerLocalPlayer::sendPosition() bool move = (xdd * xdd + ydd1 * ydd1 + zdd * zdd) > 0.03 * 0.03 || positionReminder >= POSITION_REMINDER_INTERVAL; bool rot = rydd != 0 || rxdd != 0; - if (riding != NULL) + if (riding != nullptr) { connection->send( shared_ptr( new MovePlayerPacket::PosRot(xd, -999, -999, zd, yRot, xRot, onGround, abilities.flying) ) ); move = false; @@ -211,7 +211,7 @@ void MultiplayerLocalPlayer::actuallyHurt(DamageSource *source, float dmg) void MultiplayerLocalPlayer::completeUsingItem() { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(useItem != NULL && pMinecraft->localgameModes[m_iPad] != NULL ) + if(useItem != nullptr && pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); Tutorial *tutorial = gameMode->getTutorial(); @@ -223,7 +223,7 @@ void MultiplayerLocalPlayer::completeUsingItem() void MultiplayerLocalPlayer::onEffectAdded(MobEffectInstance *effect) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localgameModes[m_iPad] != NULL ) + if(pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); Tutorial *tutorial = gameMode->getTutorial(); @@ -236,7 +236,7 @@ void MultiplayerLocalPlayer::onEffectAdded(MobEffectInstance *effect) void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance *effect, bool doRefreshAttributes) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localgameModes[m_iPad] != NULL ) + if(pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); Tutorial *tutorial = gameMode->getTutorial(); @@ -249,7 +249,7 @@ void MultiplayerLocalPlayer::onEffectUpdated(MobEffectInstance *effect, bool doR void MultiplayerLocalPlayer::onEffectRemoved(MobEffectInstance *effect) { Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localgameModes[m_iPad] != NULL ) + if(pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); Tutorial *tutorial = gameMode->getTutorial(); @@ -286,7 +286,7 @@ void MultiplayerLocalPlayer::hurtTo(float newHealth, ETelemetryChallenges damage void MultiplayerLocalPlayer::awardStat(Stat *stat, byteArray param) { - if (stat == NULL) + if (stat == nullptr) { delete [] param.data; return; @@ -305,7 +305,7 @@ void MultiplayerLocalPlayer::awardStat(Stat *stat, byteArray param) void MultiplayerLocalPlayer::awardStatFromServer(Stat *stat, byteArray param) { - if ( stat != NULL && !stat->awardLocallyOnly ) + if ( stat != nullptr && !stat->awardLocallyOnly ) { LocalPlayer::awardStat(stat, param); } @@ -334,9 +334,9 @@ void MultiplayerLocalPlayer::sendOpenInventory() void MultiplayerLocalPlayer::ride(shared_ptr e) { - bool wasRiding = riding != NULL; + bool wasRiding = riding != nullptr; LocalPlayer::ride(e); - bool isRiding = riding != NULL; + bool isRiding = riding != nullptr; // 4J Added if(wasRiding && !isRiding) @@ -348,7 +348,7 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) if( isRiding ) { ETelemetryChallenges eventType = eTelemetryChallenges_Unknown; - if( this->riding != NULL ) + if( this->riding != nullptr ) { switch(riding->GetType()) { @@ -370,7 +370,7 @@ void MultiplayerLocalPlayer::ride(shared_ptr e) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != NULL ) + if( pMinecraft->localgameModes[m_iPad] != nullptr ) { TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); if(wasRiding && !isRiding) diff --git a/Minecraft.Client/NameEntryScreen.cpp b/Minecraft.Client/NameEntryScreen.cpp index c9df70245..f498d4ea3 100644 --- a/Minecraft.Client/NameEntryScreen.cpp +++ b/Minecraft.Client/NameEntryScreen.cpp @@ -41,7 +41,7 @@ void NameEntryScreen::buttonClicked(Button button) if (button.id == 0 && trimString(name).length() > 1) { minecraft->saveSlot(slot, trimString(name)); - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J - removed } if (button.id == 1) diff --git a/Minecraft.Client/Options.cpp b/Minecraft.Client/Options.cpp index d7e032fc6..9c0156322 100644 --- a/Minecraft.Client/Options.cpp +++ b/Minecraft.Client/Options.cpp @@ -152,8 +152,8 @@ void Options::init() keyMappings[12] = keyPickItem; keyMappings[13] = keyToggleFog; - minecraft = NULL; - //optionsFile = NULL; + minecraft = nullptr; + //optionsFile = nullptr; difficulty = 2; hideGui = false; @@ -412,7 +412,7 @@ void Options::load() BufferedReader *br = new BufferedReader(new InputStreamReader( new FileInputStream( optionsFile ) ) ); wstring line = L""; - while ((line = br->readLine()) != L"") // 4J - was check against NULL - do we need to distinguish between empty lines and a fail here? + while ((line = br->readLine()) != L"") // 4J - was check against nullptr - do we need to distinguish between empty lines and a fail here? { // 4J - removed try/catch // try { diff --git a/Minecraft.Client/OptionsScreen.cpp b/Minecraft.Client/OptionsScreen.cpp index 197d74763..507640066 100644 --- a/Minecraft.Client/OptionsScreen.cpp +++ b/Minecraft.Client/OptionsScreen.cpp @@ -47,7 +47,7 @@ void OptionsScreen::init() void OptionsScreen::buttonClicked(Button *button) { if (!button->active) return; - if (button->id < 100 && (dynamic_cast(button) != NULL)) + if (button->id < 100 && (dynamic_cast(button) != nullptr)) { options->toggle(static_cast(button)->getOption(), 1); button->msg = options->getMessage(Options::Option::getItem(button->id)); diff --git a/Minecraft.Client/Orbis/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Orbis/4JLibs/inc/4J_Profile.h index 03651b8fe..d988adbfe 100644 --- a/Minecraft.Client/Orbis/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Orbis/4JLibs/inc/4J_Profile.h @@ -120,7 +120,7 @@ public: // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h b/Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h index 6083654d2..00210f609 100644 --- a/Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/Orbis/4JLibs/inc/4J_Render.h @@ -19,8 +19,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { free(m_pBuffer); m_pBuffer = NULL; } - bool Allocated() { return m_pBuffer != NULL; } + void Release() { free(m_pBuffer); m_pBuffer = nullptr; } + bool Allocated() { return m_pBuffer != nullptr; } }; typedef struct @@ -62,7 +62,7 @@ public: void InitialiseContext(); void StartFrame(bool actualFrameStart = true); void Present(); - void Clear(int flags);//, D3D11_RECT *pRect = NULL); + void Clear(int flags);//, D3D11_RECT *pRect = nullptr); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/Orbis/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Orbis/4JLibs/inc/4J_Storage.h index d4d845dfa..467c7a116 100644 --- a/Minecraft.Client/Orbis/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Orbis/4JLibs/inc/4J_Storage.h @@ -28,7 +28,7 @@ typedef struct int newSaveBlocksUsed; int iSaveC; PSAVE_INFO SaveInfoA; - PSAVE_INFO pCurrentSaveInfo; // Pointer to SAVE_INFO for the save that has just been loaded, or NULL if no save has been loaded (ie this is a newly created game) + PSAVE_INFO pCurrentSaveInfo; // Pointer to SAVE_INFO for the save that has just been loaded, or nullptr if no save has been loaded (ie this is a newly created game) } SAVE_DETAILS,*PSAVE_DETAILS; @@ -315,7 +315,7 @@ public: // Get details of existing savedata C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName); // Start search - PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or NULL if not yet received) + PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or nullptr if not yet received) void ClearSavesInfo(); // Clears results C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo @@ -398,8 +398,8 @@ public: EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); CONTENT_DATA& GetDLC(DWORD dw); DWORD GetAvailableDLCCount( int iPad ); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = NULL); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = nullptr); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); void SetDLCProductCode(const char* szProductCode); diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.cpp b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.cpp index 122333607..33fd6b4a7 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.cpp +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.cpp @@ -353,7 +353,7 @@ static void gdraw_defragment_cache(GDrawHandleCache *c, GDrawStats *stats) // synchronize compute_to_graphics_sync(); - gdraw->gfxc->setCsShader(NULL); + gdraw->gfxc->setCsShader(nullptr); gdraw->gfxc->setShaderType(Gnm::kShaderTypeGraphics); // don't need to wait till GPU is done since we never access GPU memory from the @@ -365,7 +365,7 @@ static void api_free_resource(GDrawHandle *r) if (!r->cache->is_vertex) { for (S32 i=0; i < MAX_SAMPLERS; i++) if (gdraw->active_tex[i] == (GDrawTexture *) r) - gdraw->active_tex[i] = NULL; + gdraw->active_tex[i] = nullptr; } } @@ -410,7 +410,7 @@ static void track_staging_alloc_attempt(U32 size, U32 align) static void track_staging_alloc_failed() { if (gdraw->staging_stats.allocs_attempted == gdraw->staging_stats.allocs_succeeded + 1) { // warn the first time we run out of mem - IggyGDrawSendWarning(NULL, "GDraw out of staging memory"); + IggyGDrawSendWarning(nullptr, "GDraw out of staging memory"); } } @@ -537,7 +537,7 @@ static void gpu_compute_memset(void *ptr, U32 value, U32 size_in_bytes) // through the regular caches. gfxc->flushShaderCachesAndWait(Gnm::kCacheActionWriteBackL2Volatile, 0, Gnm::kStallCommandBufferParserDisable); gfxc->setShaderType(Gnm::kShaderTypeGraphics); - gfxc->setCsShader(NULL); + gfxc->setCsShader(nullptr); } //////////////////////////////////////////////////////////////////////// @@ -549,8 +549,8 @@ GDrawTexture * RADLINK gdraw_orbis_WrappedTextureCreate(Gnm::Texture *tex) { GDrawStats stats = {}; GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); - p->handle.tex.gnm_ptr = NULL; - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); + p->handle.tex.gnm_ptr = nullptr; + gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); gdraw_orbis_WrappedTextureChange((GDrawTexture *) p, tex); return (GDrawTexture *) p; } @@ -583,13 +583,13 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format gformat, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { S32 bytes_pixel = 4; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; Gnm::Texture gt; Gnm::SizeAlign sa; Gnm::DataFormat format = Gnm::kDataFormatR8G8B8A8Unorm; if (width > MAX_TEXTURE2D_DIM || height > MAX_TEXTURE2D_DIM) { - IggyGDrawSendWarning(NULL, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM); + IggyGDrawSendWarning(nullptr, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM); return false; } @@ -742,8 +742,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void *unique_id, GDr static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != NULL); - if (t->owner == unique_id || unique_id == NULL) { + assert(t != nullptr); + if (t->owner == unique_id || unique_id == nullptr) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -863,7 +863,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != NULL); // @GDRAW_ASSERT + assert(h != nullptr); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_kill(h, stats); } @@ -891,19 +891,19 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); return t; } U8 *ptr = (U8 *)gdraw_arena_alloc(&gdraw->rt_arena, gdraw->rt_colorbuffer_sa.m_size, gdraw->rt_colorbuffer_sa.m_align); if (!ptr) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); gdraw_HandleCacheAllocateFail(t); - return NULL; + return nullptr; } t->fence = get_next_fence(); - t->raw_ptr = NULL; + t->raw_ptr = nullptr; t->handle.tex.gnm_ptr = ptr; t->handle.tex.gnm->initFromRenderTarget(&gdraw->rt_colorbuffer, false); @@ -1065,7 +1065,7 @@ static void set_common_renderstate() // clear our state caching memset(gdraw->active_tex, 0, sizeof(gdraw->active_tex)); - gdraw->cur_ps = NULL; + gdraw->cur_ps = nullptr; gdraw->scissor_state = ~0u; gdraw->blend_mode = -1; @@ -1230,7 +1230,7 @@ static void eliminate_fast_clear() } gfxc->setCbControl(Gnm::kCbModeEliminateFastClear, Gnm::kRasterOpSrcCopy); - gfxc->setPsShader(NULL); + gfxc->setPsShader(nullptr); set_viewport_raw(r.x0, r.y0, r.x1 - r.x0, r.y1 - r.y0); set_projection_raw(r.x0, r.x1, r.y1, r.y0); GDrawStats stats = {}; // we already counted these clears once, so don't add to main stats @@ -1245,7 +1245,7 @@ static void eliminate_fast_clear() set_viewport(); set_projection(); - gdraw->cur_ps = NULL; + gdraw->cur_ps = nullptr; gdraw->cur->needs_clear_eliminate = false; } @@ -1276,7 +1276,7 @@ static inline U32 pack_color_8888(F32 x, F32 y, F32 z, F32 w) void gdraw_orbis_ClearWholeRenderTarget(const F32 clear_color_rgba[4]) { - assert(gdraw->gfxc != NULL); // call after gdraw_orbis_Begin + assert(gdraw->gfxc != nullptr); // call after gdraw_orbis_Begin gdraw->cur = gdraw->frame; set_common_renderstate(); @@ -1336,16 +1336,16 @@ static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, F32 // must include anything necessary for texture creation/update static void RADLINK gdraw_RenderingBegin(void) { - assert(gdraw->gfxc != NULL); // call after gdraw_orbis_Begin + assert(gdraw->gfxc != nullptr); // call after gdraw_orbis_Begin // unbind all shaders Gnmx::GfxContext *gfxc = gdraw->gfxc; - gfxc->setVsShader(NULL, 0, (void*)0); - gfxc->setPsShader(NULL); - gfxc->setCsShader(NULL); - gfxc->setLsHsShaders(NULL, 0, (void*)0, NULL, 0); - gfxc->setEsShader(NULL, 0, (void *) 0); - gfxc->setGsVsShaders(NULL); + gfxc->setVsShader(nullptr, 0, (void*)0); + gfxc->setPsShader(nullptr); + gfxc->setCsShader(nullptr); + gfxc->setLsHsShaders(nullptr, 0, (void*)0, nullptr, 0); + gfxc->setEsShader(nullptr, 0, (void *) 0); + gfxc->setGsVsShaders(nullptr); set_common_renderstate(); } @@ -1406,7 +1406,7 @@ GDRAW_MAYBE_UNUSED static bool mem_is_direct_and_write_combined_or_cached(const void gdraw_orbis_Begin(sce::Gnmx::GfxContext *context, void *staging_buffer, U32 staging_buf_bytes) { - assert(gdraw->gfxc == NULL); // may not nest Begin calls + assert(gdraw->gfxc == nullptr); // may not nest Begin calls // make sure that the memory setup is sensible. // if any of these asserts fire, please relocate your command buffers @@ -1426,13 +1426,13 @@ void gdraw_orbis_Begin(sce::Gnmx::GfxContext *context, void *staging_buffer, U32 void gdraw_orbis_End(gdraw_orbis_staging_stats *stats) { - assert(gdraw->gfxc != NULL); // please keep Begin / End pairs properly matched + assert(gdraw->gfxc != nullptr); // please keep Begin / End pairs properly matched gdraw_HandleCacheTick(gdraw->texturecache, gdraw->tile_end_fence); gdraw_HandleCacheTick(gdraw->vbufcache, gdraw->tile_end_fence); - gdraw_arena_init(&gdraw->staging, NULL, 0); - gdraw->gfxc = NULL; + gdraw_arena_init(&gdraw->staging, nullptr, 0); + gdraw->gfxc = nullptr; if (stats) *stats = gdraw->staging_stats; @@ -1440,7 +1440,7 @@ void gdraw_orbis_End(gdraw_orbis_staging_stats *stats) void gdraw_orbis_EliminateFastClears(void) { - assert(gdraw->gfxc != NULL); // call between gdraw_orbis_Begin and gdraw_orbis_End + assert(gdraw->gfxc != nullptr); // call between gdraw_orbis_Begin and gdraw_orbis_End eliminate_fast_clear(); } @@ -1469,18 +1469,18 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex GDrawFramebufferState *n = gdraw->cur+1; GDrawHandle *t; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } if (owner) { // @TODO implement - t = NULL; + t = nullptr; assert(0); // nyi } else { t = get_color_rendertarget(stats); @@ -1489,9 +1489,9 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex } n->color_buffer = t; - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT - n->cached = owner != NULL; + n->cached = owner != nullptr; if (owner) { n->base_x = region->x0; n->base_y = region->y0; @@ -1571,9 +1571,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != NULL); // @GDRAW_ASSERT + assert(m->color_buffer != nullptr); // @GDRAW_ASSERT } - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT // sync on draw completion for this render target rtt_sync(n->color_buffer->handle.tex.gnm_ptr, gdraw->rt_colorbuffer_sa.m_size >> 8); @@ -1615,7 +1615,7 @@ static void RADLINK gdraw_ClearID(void) static RADINLINE void set_texture(U32 texunit, GDrawTexture *tex) { assert(texunit < MAX_SAMPLERS); - assert(tex != NULL); + assert(tex != nullptr); if (gdraw->active_tex[texunit] != tex) { gdraw->active_tex[texunit] = tex; @@ -1791,7 +1791,7 @@ static void set_vertex_buffer(const GDraw::VFormatDesc *fmtdesc, void *ptr, U32 gdraw->gfxc->setBuffers(Gnm::kShaderStageVs, 0, fmtdesc->num_attribs, bufs); } -static RADINLINE void fence_resources(void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) +static RADINLINE void fence_resources(void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) { GDrawFence fence = get_next_fence(); if (r1) ((GDrawHandle *) r1)->fence = fence; @@ -1937,7 +1937,7 @@ static void set_clamp_constant(F32 *constant, GDrawTexture *tex) static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *stats) { - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) return; set_texture(0, r->tex[0]); @@ -2236,7 +2236,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_orbis_resourcetype type, U32 al cache->alloc = gfxalloc_create(gdraw_limits[type].ptr, num_bytes, align, num_handles); if (!cache->alloc) { IggyGDrawFree(cache); - cache = NULL; + cache = nullptr; } } @@ -2302,12 +2302,12 @@ int gdraw_orbis_SetResourceMemory(gdraw_orbis_resourcetype type, S32 num_handles case GDRAW_ORBIS_RESOURCE_texture: free_handle_cache(gdraw->texturecache); gdraw->texturecache = make_handle_cache(GDRAW_ORBIS_RESOURCE_texture, GDRAW_ORBIS_TEXTURE_ALIGNMENT); - return gdraw->texturecache != NULL; + return gdraw->texturecache != nullptr; case GDRAW_ORBIS_RESOURCE_vertexbuffer: free_handle_cache(gdraw->vbufcache); gdraw->vbufcache = make_handle_cache(GDRAW_ORBIS_RESOURCE_vertexbuffer, GDRAW_ORBIS_VERTEXBUFFER_ALIGNMENT); - return gdraw->vbufcache != NULL; + return gdraw->vbufcache != nullptr; default: return 0; @@ -2316,9 +2316,9 @@ int gdraw_orbis_SetResourceMemory(gdraw_orbis_resourcetype type, S32 num_handles void gdraw_orbis_ResetAllResourceMemory() { - gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_rendertarget, 0, NULL, 0); - gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_texture, 0, NULL, 0); - gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_vertexbuffer, 0, NULL, 0); + gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_rendertarget, 0, nullptr, 0); + gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_texture, 0, nullptr, 0); + gdraw_orbis_SetResourceMemory(GDRAW_ORBIS_RESOURCE_vertexbuffer, 0, nullptr, 0); } GDrawFunctions *gdraw_orbis_CreateContext(S32 w, S32 h, void *context_shared_mem) @@ -2326,7 +2326,7 @@ GDrawFunctions *gdraw_orbis_CreateContext(S32 w, S32 h, void *context_shared_mem U32 cpram_shadow_size = Gnmx::ConstantUpdateEngine::computeCpRamShadowSize(); gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw) + cpram_shadow_size); - if (!gdraw) return NULL; + if (!gdraw) return nullptr; memset(gdraw, 0, sizeof(*gdraw)); @@ -2349,7 +2349,7 @@ GDrawFunctions *gdraw_orbis_CreateContext(S32 w, S32 h, void *context_shared_mem Gnm::DataFormat rtFormat = Gnm::kDataFormatR8G8B8A8Unorm; Gnm::TileMode tileMode; GpuAddress::computeSurfaceTileMode(&tileMode, GpuAddress::kSurfaceTypeRwTextureFlat, rtFormat, 1); - gdraw->rt_colorbuffer_sa = gdraw->rt_colorbuffer.init(gdraw->frametex_width, gdraw->frametex_height, 1, rtFormat, tileMode, Gnm::kNumSamples1, Gnm::kNumFragments1, NULL, NULL); + gdraw->rt_colorbuffer_sa = gdraw->rt_colorbuffer.init(gdraw->frametex_width, gdraw->frametex_height, 1, rtFormat, tileMode, Gnm::kNumSamples1, Gnm::kNumFragments1, nullptr, nullptr); gdraw->rt_colorbuffer.setCmaskFastClearEnable(false); // shaders and state @@ -2418,7 +2418,7 @@ void gdraw_orbis_DestroyContext(void) free_handle_cache(gdraw->texturecache); free_handle_cache(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = NULL; + gdraw = nullptr; } } diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.h b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.h index 9fecfb085..13964e078 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.h +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis.h @@ -50,7 +50,7 @@ IDOC extern int gdraw_orbis_SetResourceMemory(gdraw_orbis_resourcetype type, S32 currently hold. SetResourceMemory takes a void* argument for the address of the resource pool. - Pass in NULL and zero bytes to reset a specific pool. + Pass in nullptr and zero bytes to reset a specific pool. Resource pool memory has certain alignment requirements - see the #defines above. If you pass in an unaligned pointer, GDraw will automatically clip off @@ -86,7 +86,7 @@ IDOC extern GDrawFunctions * gdraw_orbis_CreateContext(S32 w, S32 h, void *conte There can only be one GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_orbis_DestroyContext(void); /* Destroys the current GDraw context, if any. @@ -126,7 +126,7 @@ IDOC extern void gdraw_orbis_End(gdraw_orbis_staging_stats *staging_stats); staging_stats will be filled with stats for the staging buffer, denoting how much memory was actually used and which allocations were attempted. If you're not interested, just - pass NULL. */ + pass nullptr. */ IDOC extern void gdraw_orbis_SetTileOrigin(sce::Gnm::RenderTarget *color, sce::Gnm::DepthRenderTarget *depth, S32 x, S32 y); /* This sets the main color and depth buffers that GDraw should render to and the diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl index fc3e31a38..00010f809 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_orbis_shaders.inl @@ -517,24 +517,24 @@ static unsigned char pshader_basic_17[412] = { }; static ShaderCode pshader_basic_arr[18] = { - { pshader_basic_0, { NULL } }, - { pshader_basic_1, { NULL } }, - { pshader_basic_2, { NULL } }, - { pshader_basic_3, { NULL } }, - { pshader_basic_4, { NULL } }, - { pshader_basic_5, { NULL } }, - { pshader_basic_6, { NULL } }, - { pshader_basic_7, { NULL } }, - { pshader_basic_8, { NULL } }, - { pshader_basic_9, { NULL } }, - { pshader_basic_10, { NULL } }, - { pshader_basic_11, { NULL } }, - { pshader_basic_12, { NULL } }, - { pshader_basic_13, { NULL } }, - { pshader_basic_14, { NULL } }, - { pshader_basic_15, { NULL } }, - { pshader_basic_16, { NULL } }, - { pshader_basic_17, { NULL } }, + { pshader_basic_0, { nullptr } }, + { pshader_basic_1, { nullptr } }, + { pshader_basic_2, { nullptr } }, + { pshader_basic_3, { nullptr } }, + { pshader_basic_4, { nullptr } }, + { pshader_basic_5, { nullptr } }, + { pshader_basic_6, { nullptr } }, + { pshader_basic_7, { nullptr } }, + { pshader_basic_8, { nullptr } }, + { pshader_basic_9, { nullptr } }, + { pshader_basic_10, { nullptr } }, + { pshader_basic_11, { nullptr } }, + { pshader_basic_12, { nullptr } }, + { pshader_basic_13, { nullptr } }, + { pshader_basic_14, { nullptr } }, + { pshader_basic_15, { nullptr } }, + { pshader_basic_16, { nullptr } }, + { pshader_basic_17, { nullptr } }, }; static unsigned char pshader_exceptional_blend_1[440] = { @@ -917,19 +917,19 @@ static unsigned char pshader_exceptional_blend_12[336] = { }; static ShaderCode pshader_exceptional_blend_arr[13] = { - { NULL, { NULL } }, - { pshader_exceptional_blend_1, { NULL } }, - { pshader_exceptional_blend_2, { NULL } }, - { pshader_exceptional_blend_3, { NULL } }, - { pshader_exceptional_blend_4, { NULL } }, - { pshader_exceptional_blend_5, { NULL } }, - { pshader_exceptional_blend_6, { NULL } }, - { pshader_exceptional_blend_7, { NULL } }, - { pshader_exceptional_blend_8, { NULL } }, - { pshader_exceptional_blend_9, { NULL } }, - { pshader_exceptional_blend_10, { NULL } }, - { pshader_exceptional_blend_11, { NULL } }, - { pshader_exceptional_blend_12, { NULL } }, + { nullptr, { nullptr } }, + { pshader_exceptional_blend_1, { nullptr } }, + { pshader_exceptional_blend_2, { nullptr } }, + { pshader_exceptional_blend_3, { nullptr } }, + { pshader_exceptional_blend_4, { nullptr } }, + { pshader_exceptional_blend_5, { nullptr } }, + { pshader_exceptional_blend_6, { nullptr } }, + { pshader_exceptional_blend_7, { nullptr } }, + { pshader_exceptional_blend_8, { nullptr } }, + { pshader_exceptional_blend_9, { nullptr } }, + { pshader_exceptional_blend_10, { nullptr } }, + { pshader_exceptional_blend_11, { nullptr } }, + { pshader_exceptional_blend_12, { nullptr } }, }; static unsigned char pshader_filter_0[420] = { @@ -1685,38 +1685,38 @@ static unsigned char pshader_filter_27[412] = { }; static ShaderCode pshader_filter_arr[32] = { - { pshader_filter_0, { NULL } }, - { pshader_filter_1, { NULL } }, - { pshader_filter_2, { NULL } }, - { pshader_filter_3, { NULL } }, - { pshader_filter_4, { NULL } }, - { pshader_filter_5, { NULL } }, - { pshader_filter_6, { NULL } }, - { pshader_filter_7, { NULL } }, - { pshader_filter_8, { NULL } }, - { pshader_filter_9, { NULL } }, - { pshader_filter_10, { NULL } }, - { pshader_filter_11, { NULL } }, - { NULL, { NULL } }, - { NULL, { NULL } }, - { NULL, { NULL } }, - { NULL, { NULL } }, - { pshader_filter_16, { NULL } }, - { pshader_filter_17, { NULL } }, - { pshader_filter_18, { NULL } }, - { pshader_filter_19, { NULL } }, - { pshader_filter_20, { NULL } }, - { pshader_filter_21, { NULL } }, - { pshader_filter_22, { NULL } }, - { pshader_filter_23, { NULL } }, - { pshader_filter_24, { NULL } }, - { pshader_filter_25, { NULL } }, - { pshader_filter_26, { NULL } }, - { pshader_filter_27, { NULL } }, - { NULL, { NULL } }, - { NULL, { NULL } }, - { NULL, { NULL } }, - { NULL, { NULL } }, + { pshader_filter_0, { nullptr } }, + { pshader_filter_1, { nullptr } }, + { pshader_filter_2, { nullptr } }, + { pshader_filter_3, { nullptr } }, + { pshader_filter_4, { nullptr } }, + { pshader_filter_5, { nullptr } }, + { pshader_filter_6, { nullptr } }, + { pshader_filter_7, { nullptr } }, + { pshader_filter_8, { nullptr } }, + { pshader_filter_9, { nullptr } }, + { pshader_filter_10, { nullptr } }, + { pshader_filter_11, { nullptr } }, + { nullptr, { nullptr } }, + { nullptr, { nullptr } }, + { nullptr, { nullptr } }, + { nullptr, { nullptr } }, + { pshader_filter_16, { nullptr } }, + { pshader_filter_17, { nullptr } }, + { pshader_filter_18, { nullptr } }, + { pshader_filter_19, { nullptr } }, + { pshader_filter_20, { nullptr } }, + { pshader_filter_21, { nullptr } }, + { pshader_filter_22, { nullptr } }, + { pshader_filter_23, { nullptr } }, + { pshader_filter_24, { nullptr } }, + { pshader_filter_25, { nullptr } }, + { pshader_filter_26, { nullptr } }, + { pshader_filter_27, { nullptr } }, + { nullptr, { nullptr } }, + { nullptr, { nullptr } }, + { nullptr, { nullptr } }, + { nullptr, { nullptr } }, }; static unsigned char pshader_blur_2[356] = { @@ -2024,16 +2024,16 @@ static unsigned char pshader_blur_9[748] = { }; static ShaderCode pshader_blur_arr[10] = { - { NULL, { NULL } }, - { NULL, { NULL } }, - { pshader_blur_2, { NULL } }, - { pshader_blur_3, { NULL } }, - { pshader_blur_4, { NULL } }, - { pshader_blur_5, { NULL } }, - { pshader_blur_6, { NULL } }, - { pshader_blur_7, { NULL } }, - { pshader_blur_8, { NULL } }, - { pshader_blur_9, { NULL } }, + { nullptr, { nullptr } }, + { nullptr, { nullptr } }, + { pshader_blur_2, { nullptr } }, + { pshader_blur_3, { nullptr } }, + { pshader_blur_4, { nullptr } }, + { pshader_blur_5, { nullptr } }, + { pshader_blur_6, { nullptr } }, + { pshader_blur_7, { nullptr } }, + { pshader_blur_8, { nullptr } }, + { pshader_blur_9, { nullptr } }, }; static unsigned char pshader_color_matrix_0[348] = { @@ -2062,7 +2062,7 @@ static unsigned char pshader_color_matrix_0[348] = { }; static ShaderCode pshader_color_matrix_arr[1] = { - { pshader_color_matrix_0, { NULL } }, + { pshader_color_matrix_0, { nullptr } }, }; static unsigned char pshader_manual_clear_0[164] = { @@ -2080,7 +2080,7 @@ static unsigned char pshader_manual_clear_0[164] = { }; static ShaderCode pshader_manual_clear_arr[1] = { - { pshader_manual_clear_0, { NULL } }, + { pshader_manual_clear_0, { nullptr } }, }; static unsigned char vshader_vsps4_0[580] = { @@ -2124,7 +2124,7 @@ static unsigned char vshader_vsps4_0[580] = { }; static ShaderCode vshader_vsps4_arr[1] = { - { vshader_vsps4_0, { NULL } }, + { vshader_vsps4_0, { nullptr } }, }; static unsigned char cshader_tex_upload_0[212] = { @@ -2145,7 +2145,7 @@ static unsigned char cshader_tex_upload_0[212] = { }; static ShaderCode cshader_tex_upload_arr[1] = { - { cshader_tex_upload_0, { NULL } }, + { cshader_tex_upload_0, { nullptr } }, }; static unsigned char cshader_memset_0[196] = { @@ -2165,7 +2165,7 @@ static unsigned char cshader_memset_0[196] = { }; static ShaderCode cshader_memset_arr[1] = { - { cshader_memset_0, { NULL } }, + { cshader_memset_0, { nullptr } }, }; static unsigned char cshader_defragment_0[204] = { @@ -2185,7 +2185,7 @@ static unsigned char cshader_defragment_0[204] = { }; static ShaderCode cshader_defragment_arr[1] = { - { cshader_defragment_0, { NULL } }, + { cshader_defragment_0, { nullptr } }, }; static unsigned char cshader_mipgen_0[340] = { @@ -2214,6 +2214,6 @@ static unsigned char cshader_mipgen_0[340] = { }; static ShaderCode cshader_mipgen_arr[1] = { - { cshader_mipgen_0, { NULL } }, + { cshader_mipgen_0, { nullptr } }, }; diff --git a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl index b0bf146dc..1b7c1cc1e 100644 --- a/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Orbis/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != NULL) { + while (s != nullptr) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, NULL); + return gdraw_HandleCacheLockStats(t, owner, nullptr); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = NULL; - c->state[i].cache = NULL; // should never follow cache link from sentinels! + c->state[i].owner = nullptr; + c->state[i].cache = nullptr; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = NULL; + c->state[i].raw_ptr = nullptr; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = NULL; + c->handle[i].raw_ptr = nullptr; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = NULL; + c->alloc = nullptr; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = NULL; + c->alloc_other = nullptr; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = NULL; + t->raw_ptr = nullptr; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -563,7 +563,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : NULL; + return (sentinel->next != sentinel) ? sentinel->next : nullptr; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -1095,7 +1095,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = NULL; + *start = nullptr; *num_bytes = 0; return; } else { @@ -1132,7 +1132,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return NULL; + return nullptr; arena->current = ptr + size; return ptr; @@ -1157,7 +1157,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, NULL-terminated list of elements in each hash +// There's a single-linked, nullptr-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1166,7 +1166,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, NULL-terminated list of unused blocks. Every block is either +// single-linked, nullptr-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1384,7 +1384,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != NULL); + GFXALLOC_ASSERT(alloc->unused_list != nullptr); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1457,7 +1457,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return NULL; + return nullptr; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1465,7 +1465,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return NULL; + return nullptr; memset(a, 0, size); @@ -1506,16 +1506,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, NULL, 0,0); + debug_complete_check(a, nullptr, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = NULL; + gfx_block_info *cur, *best = nullptr; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, NULL, 0,0); +debug_complete_check(alloc, nullptr, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1565,7 +1565,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return NULL; // not enough space! + return nullptr; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1735,7 +1735,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = NULL; + b->prev = nullptr; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1748,7 +1748,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1910,7 +1910,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = NULL; + void *ptr = nullptr; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2300,7 +2300,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = NULL; + ring->cur = nullptr; ring->seg_size = 0; } @@ -2310,7 +2310,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return NULL; // nope, won't fit + return nullptr; // nope, won't fit assert(align <= ring->align); @@ -2415,7 +2415,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2435,8 +2435,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return NULL; + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return nullptr; } #ifndef GDRAW_MANAGE_MEM @@ -2445,7 +2445,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2453,7 +2453,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, NULL, "memory"); + gdraw_res_alloc_outofmem(c, nullptr, "memory"); break; } } @@ -2468,8 +2468,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == NULL) { - gdraw_res_alloc_outofmem(c, NULL, "handles"); + if (t == nullptr) { + gdraw_res_alloc_outofmem(c, nullptr, "handles"); } } } @@ -2513,7 +2513,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = NULL; + r->owner = nullptr; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2521,11 +2521,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = NULL; + void *ptr = nullptr; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2537,7 +2537,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, NULL, "handles"); + return gdraw_res_alloc_outofmem(c, nullptr, "handles"); } // try to allocate first diff --git a/Minecraft.Client/Orbis/Iggy/include/gdraw.h b/Minecraft.Client/Orbis/Iggy/include/gdraw.h index 404a2642b..7cc4ddd0e 100644 --- a/Minecraft.Client/Orbis/Iggy/include/gdraw.h +++ b/Minecraft.Client/Orbis/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is NULL, then the pointers in 'prim' are machine pointers, and + If buf is nullptr, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-NULL, then use the appropriate vertex buffer, and the + If buf is non-nullptr, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or NULL if an error occured + $:return Handle for the newly created texture, or nullptr if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/Orbis/Iggy/include/iggyexpruntime.h b/Minecraft.Client/Orbis/Iggy/include/iggyexpruntime.h index 1f1a90a1c..a42ccbfff 100644 --- a/Minecraft.Client/Orbis/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/Orbis/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP +Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/Orbis/Leaderboards/OrbisLeaderboardManager.cpp b/Minecraft.Client/Orbis/Leaderboards/OrbisLeaderboardManager.cpp index b76621970..b2492381b 100644 --- a/Minecraft.Client/Orbis/Leaderboards/OrbisLeaderboardManager.cpp +++ b/Minecraft.Client/Orbis/Leaderboards/OrbisLeaderboardManager.cpp @@ -29,7 +29,7 @@ OrbisLeaderboardManager::OrbisLeaderboardManager() m_myXUID = INVALID_XUID; - m_scores = NULL; //m_stats = NULL; + m_scores = nullptr; //m_stats = nullptr; m_statsType = eStatsType_Kills; m_difficulty = 0; @@ -41,7 +41,7 @@ OrbisLeaderboardManager::OrbisLeaderboardManager() InitializeCriticalSection(&m_csViewsLock); m_running = false; - m_threadScoreboard = NULL; + m_threadScoreboard = nullptr; } OrbisLeaderboardManager::~OrbisLeaderboardManager() @@ -181,7 +181,7 @@ bool OrbisLeaderboardManager::getScoreByIds() SceRtcTick last_sort_date; SceNpScoreRankNumber mTotalRecord; - SceNpId *npIds = NULL; + SceNpId *npIds = nullptr; int ret; @@ -267,7 +267,7 @@ bool OrbisLeaderboardManager::getScoreByIds() ZeroMemory(comments, sizeof(SceNpScoreComment) * num); /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\ - rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n", + rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount ); */ @@ -284,9 +284,9 @@ bool OrbisLeaderboardManager::getScoreByIds() sceNpScoreDestroyTransactionCtx(ret); - if (npIds != NULL) delete [] npIds; - if (ptr != NULL) delete [] ptr; - if (comments != NULL) delete [] comments; + if (npIds != nullptr) delete [] npIds; + if (ptr != nullptr) delete [] ptr; + if (comments != nullptr) delete [] comments; return false; } @@ -297,9 +297,9 @@ bool OrbisLeaderboardManager::getScoreByIds() m_eStatsState = eStatsState_Failed; - if (npIds != NULL) delete [] npIds; - if (ptr != NULL) delete [] ptr; - if (comments != NULL) delete [] comments; + if (npIds != nullptr) delete [] npIds; + if (ptr != nullptr) delete [] ptr; + if (comments != nullptr) delete [] comments; return false; } @@ -322,14 +322,14 @@ bool OrbisLeaderboardManager::getScoreByIds() batch + comments, sizeof(SceNpScoreComment) * tmpNum, //OUT: Comments - NULL, 0, // GameData. (unused) + nullptr, 0, // GameData. (unused) tmpNum, &last_sort_date, &mTotalRecord, - NULL // Reserved, specify null. + nullptr // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -357,7 +357,7 @@ bool OrbisLeaderboardManager::getScoreByIds() m_readCount = num; // Filter scorers and construct output structure. - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_scores = new ReadScore[m_readCount]; convertToOutput(m_readCount, m_scores, ptr, comments); m_maxRank = m_readCount; @@ -390,7 +390,7 @@ error3: delete [] ptr; delete [] comments; error2: - if (npIds != NULL) delete [] npIds; + if (npIds != nullptr) delete [] npIds; error1: if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed; app.DebugPrintf("[LeaderboardManger] getScoreByIds() FAILED, ret=0x%X\n", ret); @@ -443,14 +443,14 @@ bool OrbisLeaderboardManager::getScoreByRange() comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data - NULL, 0, // GameData. + nullptr, 0, // GameData. num, &last_sort_date, &m_maxRank, // 'Total number of players registered in the target scoreboard.' - NULL // Reserved, specify null. + nullptr // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -471,7 +471,7 @@ bool OrbisLeaderboardManager::getScoreByRange() delete [] ptr; delete [] comments; - m_scores = NULL; + m_scores = nullptr; m_readCount = 0; m_eStatsState = eStatsState_Ready; @@ -489,7 +489,7 @@ bool OrbisLeaderboardManager::getScoreByRange() //m_stats = ptr; //Maybe: addPadding(num,ptr); - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_readCount = ret; m_scores = new ReadScore[m_readCount]; for (int i=0; i 0) ret = eStatsReturn_Success; - if (m_readListener != NULL) + if (m_readListener != nullptr) { app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -636,16 +636,16 @@ void OrbisLeaderboardManager::Tick() m_eStatsState = eStatsState_Idle; delete [] m_scores; - m_scores = NULL; + m_scores = nullptr; } break; case eStatsState_Failed: { view.m_numQueries = 0; - view.m_queries = NULL; + view.m_queries = nullptr; - if ( m_readListener != NULL ) + if ( m_readListener != nullptr ) m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); m_eStatsState = eStatsState_Idle; @@ -667,7 +667,7 @@ bool OrbisLeaderboardManager::OpenSession() { if (m_openSessions == 0) { - if (m_threadScoreboard == NULL) + if (m_threadScoreboard == nullptr) { m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard"); m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS); @@ -762,7 +762,7 @@ void OrbisLeaderboardManager::FlushStats() {} void OrbisLeaderboardManager::CancelOperation() { - m_readListener = NULL; + m_readListener = nullptr; m_eStatsState = eStatsState_Canceled; if (m_requestId != 0) @@ -912,7 +912,7 @@ void OrbisLeaderboardManager::fromBase32(void *out, SceNpScoreComment *in) for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) { ch[0] = in->utf8Comment[i]; - unsigned char fivebits = strtol(ch, NULL, 32) << 3; + unsigned char fivebits = strtol(ch, nullptr, 32) << 3; int sByte = (i*5) / 8; int eByte = (5+(i*5)) / 8; @@ -973,7 +973,7 @@ bool OrbisLeaderboardManager::test_string(string testing) int ctx = sceNpScoreCreateTransactionCtx(m_titleContext); if (ctx<0) return false; - int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, NULL); + int ret = sceNpScoreCensorComment(ctx, (const char *) &comment, nullptr); if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) { diff --git a/Minecraft.Client/Orbis/Miles/include/mss.h b/Minecraft.Client/Orbis/Miles/include/mss.h index 531dcbc92..a9fd231a9 100644 --- a/Minecraft.Client/Orbis/Miles/include/mss.h +++ b/Minecraft.Client/Orbis/Miles/include/mss.h @@ -584,7 +584,7 @@ typedef enum } MSS_SPEAKER; // -// Pass to AIL_midiOutOpen for NULL MIDI driver +// Pass to AIL_midiOutOpen for nullptr MIDI driver // #define MIDI_NULL_DRIVER ((U32)(S32)-2) @@ -833,7 +833,7 @@ the enumeration function until it returns 0. #define DEFAULT_DPWOD ((UINTa)-1) // Preferred WaveOut device == WAVE_MAPPER #define DIG_PREFERRED_DS_DEVICE 20 -#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default NULL GUID +#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default nullptr GUID #define MDI_SEQUENCES 21 @@ -1305,7 +1305,7 @@ typedef ASIRESULT (AILCALL *ASI_STARTUP)(void); typedef ASIRESULT (AILCALL * ASI_SHUTDOWN)(void); // -// Return codec error message, or NULL if no errors have occurred since +// Return codec error message, or nullptr if no errors have occurred since // last call // // The ASI error text state is global to all streams @@ -1878,7 +1878,7 @@ typedef struct _S3DSTATE // Portion of HSAMPLE that deals with 3D posi F32 spread; - HSAMPLE owner; // May be NULL if used for temporary/internal calculations + HSAMPLE owner; // May be nullptr if used for temporary/internal calculations AILFALLOFFCB falloff_function; // User function for min/max distance calculations, if desired MSSVECTOR3D position_graph[MILES_MAX_SEGMENT_COUNT]; @@ -2460,7 +2460,7 @@ typedef struct _DIG_DRIVER // Handle to digital audio driver S32 DS_initialized; - AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none) + AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or nullptr if none) AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim) S32 DS_buffer_size; // Size of entire output buffer @@ -4866,10 +4866,10 @@ typedef struct U8 *MP3_file_image; // Original MP3_file_image pointer passed to AIL_inspect_MP3() S32 MP3_image_size; // Original MP3_image_size passed to AIL_inspect_MP3() - U8 *ID3v2; // ID3v2 tag, if not NULL + U8 *ID3v2; // ID3v2 tag, if not nullptr S32 ID3v2_size; // Size of tag in bytes - U8 *ID3v1; // ID3v1 tag, if not NULL (always 128 bytes long if present) + U8 *ID3v1; // ID3v1 tag, if not nullptr (always 128 bytes long if present) U8 *start_MP3_data; // Pointer to start of data area in file (not necessarily first valid frame) U8 *end_MP3_data; // Pointer to last valid byte in MP3 data area (before ID3v1 tag, if any) diff --git a/Minecraft.Client/Orbis/Network/Orbis_NPToolkit.cpp b/Minecraft.Client/Orbis/Network/Orbis_NPToolkit.cpp index d1c9cf15f..5db367d4c 100644 --- a/Minecraft.Client/Orbis/Network/Orbis_NPToolkit.cpp +++ b/Minecraft.Client/Orbis/Network/Orbis_NPToolkit.cpp @@ -309,7 +309,7 @@ void hexStrToBin( val <<= 4; } else { - if (pBinBuf != NULL && binOffset < binBufSize) { + if (pBinBuf != nullptr && binOffset < binBufSize) { memcpy(pBinBuf + binOffset, &val, 1); val = 0; } @@ -317,7 +317,7 @@ void hexStrToBin( } } - if (val != 0 && pBinBuf != NULL && binOffset < binBufSize) { + if (val != 0 && pBinBuf != nullptr && binOffset < binBufSize) { memcpy(pBinBuf + binOffset, &val, 1); } diff --git a/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.cpp b/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.cpp index 650683b0a..13b3c32bd 100644 --- a/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.cpp @@ -17,8 +17,8 @@ // #include "..\PS3Extras\PS3Strings.h" -int (* SQRNetworkManager_Orbis::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = NULL; -void * SQRNetworkManager_Orbis::s_SignInCompleteParam = NULL; +int (* SQRNetworkManager_Orbis::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = nullptr; +void * SQRNetworkManager_Orbis::s_SignInCompleteParam = nullptr; sce::Toolkit::NP::PresenceDetails SQRNetworkManager_Orbis::s_lastPresenceInfo; __int64 SQRNetworkManager_Orbis::s_lastPresenceTime = 0; @@ -109,8 +109,8 @@ SQRNetworkManager_Orbis::SQRNetworkManager_Orbis(ISQRNetworkManagerListener *lis m_isInSession = false; m_offlineGame = false; m_offlineSQR = false; - m_aServerId = NULL; - m_gameBootInvite = NULL; + m_aServerId = nullptr; + m_gameBootInvite = nullptr; m_onlineStatus = false; m_bLinkDisconnected = false; m_bRefreshingRestrictionsForInvite = false; @@ -137,7 +137,7 @@ void SQRNetworkManager_Orbis::Initialise() int32_t ret = 0; int32_t libCtxId = 0; - ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, NULL); + ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, nullptr); assert (ret >= 0); libCtxId = ret; @@ -251,7 +251,7 @@ void SQRNetworkManager_Orbis::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,s_SignInCompleteCallbackPad); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; s_SignInCompleteCallbackPad = -1; } return; @@ -334,7 +334,7 @@ void SQRNetworkManager_Orbis::RefreshChatAndContentRestrictionsReturned_HandleIn SQRNetworkManager_Orbis *netMan = (SQRNetworkManager_Orbis *)pParam; netMan->m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), netMan->m_gameBootInvite ); - netMan->m_gameBootInvite = NULL; + netMan->m_gameBootInvite = nullptr; netMan->m_bRefreshingRestrictionsForInvite = false; } @@ -357,7 +357,7 @@ void SQRNetworkManager_Orbis::Tick() m_bRefreshingRestrictionsForInvite = true; ProfileManager.RefreshChatAndContentRestrictions(RefreshChatAndContentRestrictionsReturned_HandleInvite, this); //m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); - //m_gameBootInvite = NULL; + //m_gameBootInvite = nullptr; } ErrorHandlingTick(); @@ -431,14 +431,14 @@ void SQRNetworkManager_Orbis::Tick() if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,s_SignInCompleteCallbackPad); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } s_SignInCompleteCallbackPad = -1; } else if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, s_SignInCompleteCallbackPad); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; s_SignInCompleteCallbackPad = -1; } } @@ -539,7 +539,7 @@ void SQRNetworkManager_Orbis::ErrorHandlingTick() m_bCallPSNSignInCallback=true; //s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,s_SignInCompleteCallbackPad); } - //s_SignInCompleteCallbackFn = NULL; + //s_SignInCompleteCallbackFn = nullptr; //s_SignInCompleteCallbackPad = -1; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); @@ -655,7 +655,7 @@ void SQRNetworkManager_Orbis::UpdateExternalRoomData() reqParam.roomBinAttrExternalNum = 1; reqParam.roomBinAttrExternal = &roomBinAttr; - int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); + int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SetRoomDataExternal returns 0x%x, number of players %d\n",ret,((char *)m_joinExtData)[174]); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA ) ) { @@ -689,7 +689,7 @@ bool SQRNetworkManager_Orbis::FriendRoomManagerSearch() { if(m_aFriendSearchResults[i].m_RoomExtDataReceived) free(m_aFriendSearchResults[i].m_RoomExtDataReceived); - m_aFriendSearchResults[i].m_RoomExtDataReceived = NULL; + m_aFriendSearchResults[i].m_RoomExtDataReceived = nullptr; } m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT; @@ -755,7 +755,7 @@ void SQRNetworkManager_Orbis::FriendSearchTick() { m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; delete m_getFriendCountThread; - m_getFriendCountThread = NULL; + m_getFriendCountThread = nullptr; FriendRoomManagerSearch2(); } } @@ -773,7 +773,7 @@ int SQRNetworkManager_Orbis::BasicEventThreadProc( void *lpParameter ) do { - ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL); + ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, nullptr); // If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread if( event.udata == 0 ) @@ -979,7 +979,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerByIndex(int idx) } else { - return NULL; + return nullptr; } } @@ -996,7 +996,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerByXuid(PlayerUID xuid) @@ -1012,7 +1012,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerByXuid(PlayerUID xuid) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_Orbis::GetLocalPlayerByUserIndex(int idx) @@ -1028,7 +1028,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetLocalPlayerByUserIndex(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_Orbis::GetHostPlayer() @@ -1041,11 +1041,11 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == NULL ) return NULL; + if( player == nullptr ) return nullptr; if( player->IsReady() ) return player; - return NULL; + return nullptr; } // Update state internally @@ -1099,7 +1099,7 @@ bool SQRNetworkManager_Orbis::JoinRoom(SQRNetworkManager_Orbis::SessionSearchRes { // Set up the presence info we would like to synchronise out when we have fully joined the game CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(&s_lastPresenceSyncInfo, searchResult->m_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, NULL); + return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, nullptr); } // Join room with a specified roomId. This is used when joining from an invite, as well as by the previous method @@ -1165,7 +1165,7 @@ void SQRNetworkManager_Orbis::LeaveRoom(bool bActuallyLeaveRoom) reqParam.roomId = m_room; SetState(SNM_INT_STATE_LEAVING); - int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, NULL, &m_leaveRoomRequestId ); + int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, nullptr, &m_leaveRoomRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_LEAVE_ROOM) ) { SetState(SNM_INT_STATE_LEAVING_FAILED); @@ -1274,7 +1274,7 @@ bool SQRNetworkManager_Orbis::AddLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL) ) { @@ -1326,7 +1326,7 @@ bool SQRNetworkManager_Orbis::RemoveLocalPlayerByUserIndex(int idx) // And do any adjusting necessary to the mappings from this room data, to the SQRNetworkPlayers. // This will also delete the SQRNetworkPlayer and do all the callbacks that requires etc. MapRoomSlotPlayers(roomSlotPlayerCount); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; // Sync this back out to our networked clients... SyncRoomData(); @@ -1367,7 +1367,7 @@ bool SQRNetworkManager_Orbis::RemoveLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2) ) { @@ -1388,7 +1388,7 @@ void SQRNetworkManager_Orbis::UpdateRemotePlay() int localPlayerCount = 0; for(int i = 0; i < XUSER_MAX_COUNT; i++) { - if(GetLocalPlayerByUserIndex(i) != NULL) localPlayerCount++; + if(GetLocalPlayerByUserIndex(i) != nullptr) localPlayerCount++; } InputManager.SetLocalMultiplayer(localPlayerCount > 1); } @@ -1427,7 +1427,7 @@ void SQRNetworkManager_Orbis::SendInviteGUI() messData.body.assign(body); messData.dialogFlag = SCE_TOOLKIT_NP_DIALOG_TYPE_USER_EDITABLE; messData.npIdsCount = 2; // TODO: Set this to the number of available slots - messData.npIds = NULL; + messData.npIds = nullptr; messData.userInfo.userId = userId; // Set expire to maximum @@ -1602,7 +1602,7 @@ void SQRNetworkManager_Orbis::FindOrCreateNonNetworkPlayer(int slot, int playerT } } // Create the player - non-network players can be considered complete as soon as we create them as we aren't waiting on their network connections becoming complete, so can flag them as such and notify via callback - PlayerUID *pUID = NULL; + PlayerUID *pUID = nullptr; PlayerUID localUID; if( ( playerType == SQRNetworkPlayer::SNP_TYPE_LOCAL ) || (m_isHosting && ( playerType == SQRNetworkPlayer::SNP_TYPE_HOST )) ) @@ -1669,7 +1669,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1725,7 +1725,7 @@ void SQRNetworkManager_Orbis::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1817,7 +1817,7 @@ void SQRNetworkManager_Orbis::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_Orbis::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) +bool SQRNetworkManager_Orbis::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) { assert( m_isHosting ); @@ -1939,7 +1939,7 @@ void SQRNetworkManager_Orbis::RemoveRemotePlayersAndSync( SceNpMatching2RoomMemb } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; } else { @@ -1984,7 +1984,7 @@ void SQRNetworkManager_Orbis::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } // And delete the reference from the ctx->player map @@ -2037,7 +2037,7 @@ void SQRNetworkManager_Orbis::SyncRoomData() roomBinAttr.size = sizeof( m_roomSyncData ); reqParam.roomBinAttrInternalNum = 1; reqParam.roomBinAttrInternal = &roomBinAttr; - sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); + sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); } // Check if the matching context is valid, and if not attempt to create one. If to do this requires starting an asynchronous process, then sets the internal state to the state passed in @@ -2159,7 +2159,7 @@ bool SQRNetworkManager_Orbis::GetServerContext(SceNpMatching2ServerId serverId) // { // // Get list of server IDs of servers allocated to the application. We don't actually need to do this, but it is as good a way as any to try a matching2 service and check that // // the context *really* is valid. -// int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); +// int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); // // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again // if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment // ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -2253,7 +2253,7 @@ void SQRNetworkManager_Orbis::RoomCreateTick() SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_CREATING_ROOM); app.DebugPrintf(CMinecraftApp::USER_RR,">> Creating room start\n"); s_roomStartTime = System::currentTimeMillis(); - int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, NULL, &m_createRoomRequestId ); + int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, nullptr, &m_createRoomRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_JOIN_ROOM) ) { SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED); @@ -2493,7 +2493,7 @@ bool SQRNetworkManager_Orbis::CreateVoiceRudpConnections(SceNpMatching2RoomId ro // create this connection if we don't have it already SQRVoiceConnection* pConnection = SonyVoiceChat_Orbis::getVoiceConnectionFromRoomMemberID(peerMemberId); - if(pConnection == NULL) + if(pConnection == nullptr) { // Create an Rudp context for the voice connection, this will happen regardless of whether the peer is client or host @@ -2573,7 +2573,7 @@ bool SQRNetworkManager_Orbis::CreateRudpConnections(SceNpMatching2RoomId roomId, if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, NULL ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, nullptr ); } else { @@ -2611,7 +2611,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRudpCtx(int rudpCtx) { return it->second; } - return NULL; + return nullptr; } @@ -2625,7 +2625,7 @@ SQRNetworkPlayer *SQRNetworkManager_Orbis::GetPlayerFromRoomMemberAndLocalIdx(in return it->second; } } - return NULL; + return nullptr; } @@ -2720,7 +2720,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp if( manager->m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { manager->SetState( SNM_INT_STATE_IDLE ); - manager->GetExtDataForRoom(0, NULL, NULL, NULL); + manager->GetExtDataForRoom(0, nullptr, nullptr, nullptr); break; } @@ -2759,7 +2759,7 @@ void SQRNetworkManager_Orbis::ContextCallback(SceNpMatching2ContextId id, SceNp // if(s_SignInCompleteCallbackFn) // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - // s_SignInCompleteCallbackFn = NULL; + // s_SignInCompleteCallbackFn = nullptr; // } @@ -2966,12 +2966,12 @@ void SQRNetworkManager_Orbis::DefaultRequestCallback(SceNpMatching2ContextId id, // Set flag to indicate whether we were kicked for being out of room or not reqParam.optData.data[0] = isFull ? 1 : 0; reqParam.optData.len = 1; - int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, NULL, &manager->m_kickRequestId); + int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, nullptr, &manager->m_kickRequestId); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2KickoutRoomMember returns error 0x%x\n",ret); } else { - if(pRoomMemberData->roomMemberDataInternal->roomMemberBinAttrInternal->data.ptr == NULL) + if(pRoomMemberData->roomMemberDataInternal->roomMemberBinAttrInternal->data.ptr == nullptr) { // the host doesn't send out data, so this must be the host we're connecting to @@ -3213,7 +3213,7 @@ void SQRNetworkManager_Orbis::RoomEventCallback(SceNpMatching2ContextId id, SceN reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_setRoomMemberInternalDataRequestId ); } else { @@ -3349,7 +3349,7 @@ void SQRNetworkManager_Orbis::ProcessSignallingEvent(SceNpMatching2ContextId ctx reqParam.attrId = attrs; reqParam.attrIdNum = 1; - sceNpMatching2GetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_roomMemberDataRequestId); + sceNpMatching2GetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_roomMemberDataRequestId); } break; } @@ -3376,7 +3376,7 @@ int SQRNetworkManager_Orbis::BasicEventCallback(int event, int retCode, uint32_t ORBIS_STUBBED; // SQRNetworkManager_Orbis *manager = (SQRNetworkManager_Orbis *)arg; // // We aren't allowed to actually get the event directly from this callback, so send our own internal event to a thread dedicated to doing this -// sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, NULL); +// sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, nullptr); return 0; } @@ -3422,7 +3422,7 @@ void SQRNetworkManager_Orbis::SysUtilCallback(uint64_t status, uint64_t param, v // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } -// s_SignInCompleteCallbackFn = NULL; +// s_SignInCompleteCallbackFn = nullptr; // } // return; // } @@ -3437,7 +3437,7 @@ void SQRNetworkManager_Orbis::SysUtilCallback(uint64_t status, uint64_t param, v // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } -// s_SignInCompleteCallbackFn = NULL; +// s_SignInCompleteCallbackFn = nullptr; // } // } // @@ -3534,7 +3534,7 @@ void SQRNetworkManager_Orbis::RudpContextCallback(int ctx_id, int event_id, int if( dataSize >= sizeof(SQRNetworkPlayer::InitSendData) ) { SQRNetworkPlayer::InitSendData ISD; - int bytesRead = sceRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, NULL ); + int bytesRead = sceRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, nullptr ); if( bytesRead == sizeof(SQRNetworkPlayer::InitSendData) ) { manager->NetworkPlayerInitialDataReceived(playerFrom, &ISD); @@ -3555,7 +3555,7 @@ void SQRNetworkManager_Orbis::RudpContextCallback(int ctx_id, int event_id, int if( dataSize > 0 ) { unsigned char *data = new unsigned char [ dataSize ]; - int bytesRead = sceRudpRead( ctx_id, data, dataSize, 0, NULL ); + int bytesRead = sceRudpRead( ctx_id, data, dataSize, 0, nullptr ); if( bytesRead > 0 ) { SQRNetworkPlayer *playerFrom, *playerTo; @@ -3571,7 +3571,7 @@ void SQRNetworkManager_Orbis::RudpContextCallback(int ctx_id, int event_id, int playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) + if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -3632,7 +3632,7 @@ void SQRNetworkManager_Orbis::ServerContextValid_CreateRoom() int ret = -1; if( !ForceErrorPoint(SNM_FORCE_ERROR_GET_WORLD_INFO_LIST) ) { - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); } if (ret < 0) { @@ -3661,7 +3661,7 @@ void SQRNetworkManager_Orbis::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -3722,9 +3722,9 @@ void SQRNetworkManager_Orbis::GetExtDataForRoom( SceNpMatching2RoomId roomId, vo static SceNpMatching2RoomId aRoomId[1]; static SceNpMatching2AttributeId attr[1]; - // All parameters will be NULL if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). - // NULL parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList - if( extData != NULL ) + // All parameters will be nullptr if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). + // nullptr parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList + if( extData != nullptr ) { aRoomId[0] = roomId; attr[0] = SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_1_ID; @@ -3748,14 +3748,14 @@ void SQRNetworkManager_Orbis::GetExtDataForRoom( SceNpMatching2RoomId roomId, vo return; } - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { app.DebugPrintf("Having to recreate matching context, setting state to SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT\n"); return; } - int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, NULL, &m_roomDataExternalListRequestId ); + int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, nullptr, &m_roomDataExternalListRequestId ); // If we hadn't properly detected that a matching context was unvailable, we might still get an error indicating that it is from the previous call. Handle similarly, but we need // to destroy the context first. @@ -3769,7 +3769,7 @@ void SQRNetworkManager_Orbis::GetExtDataForRoom( SceNpMatching2RoomId roomId, vo m_FriendSessionUpdatedFn(false, m_pParamFriendSessionUpdated); return; }; - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { return; @@ -3907,7 +3907,7 @@ void SQRNetworkManager_Orbis::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(v //s_signInCompleteCallbackIfFailed=false; //s_SignInCompleteCallbackFn(s_SignInCompleteParam, false, iPad); } - //s_SignInCompleteCallbackFn = NULL; + //s_SignInCompleteCallbackFn = nullptr; } } } @@ -4145,11 +4145,11 @@ void SQRNetworkManager_Orbis::NotifyRealtimePlusFeature(int iQuadrant) // bool isSignedIn = ProfileManager.IsSignedInLive(s_SignInCompleteCallbackPad); // // s_SignInCompleteCallbackFn(s_SignInCompleteParam, isSignedIn, s_SignInCompleteCallbackPad); -// s_SignInCompleteCallbackFn = NULL; +// s_SignInCompleteCallbackFn = nullptr; // s_SignInCompleteCallbackPad = -1; // } // else // { -// app.DebugPrintf("============ Calling CallSignInCompleteCallback but s_SignInCompleteCallbackFn is NULL\n"); +// app.DebugPrintf("============ Calling CallSignInCompleteCallback but s_SignInCompleteCallbackFn is nullptr\n"); // } //} \ No newline at end of file diff --git a/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.h b/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.h index 5b19f63ec..d2ff09d96 100644 --- a/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.h +++ b/Minecraft.Client/Orbis/Network/SQRNetworkManager_Orbis.h @@ -139,7 +139,7 @@ private: void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize); int GetSessionIndex(SQRNetworkPlayer *player); - bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = NULL ); + bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = nullptr ); void RemoveRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int mask ); void RemoveNetworkPlayers( int mask ); void SetLocalPlayersAndSync(); diff --git a/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.cpp index 34ab67e40..67ae639bc 100644 --- a/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.cpp @@ -9,22 +9,22 @@ bool SonyCommerce_Orbis::m_bCommerceInitialised = false; // SceNpCommerce2SessionInfo SonyCommerce_Orbis::m_sessionInfo; SonyCommerce_Orbis::State SonyCommerce_Orbis::m_state = e_state_noSession; int SonyCommerce_Orbis::m_errorCode = 0; -LPVOID SonyCommerce_Orbis::m_callbackParam = NULL; +LPVOID SonyCommerce_Orbis::m_callbackParam = nullptr; -void* SonyCommerce_Orbis::m_receiveBuffer = NULL; +void* SonyCommerce_Orbis::m_receiveBuffer = nullptr; SonyCommerce_Orbis::Event SonyCommerce_Orbis::m_event; std::queue SonyCommerce_Orbis::m_messageQueue; -std::vector* SonyCommerce_Orbis::m_pProductInfoList = NULL; -SonyCommerce_Orbis::ProductInfoDetailed* SonyCommerce_Orbis::m_pProductInfoDetailed = NULL; -SonyCommerce_Orbis::ProductInfo* SonyCommerce_Orbis::m_pProductInfo = NULL; +std::vector* SonyCommerce_Orbis::m_pProductInfoList = nullptr; +SonyCommerce_Orbis::ProductInfoDetailed* SonyCommerce_Orbis::m_pProductInfoDetailed = nullptr; +SonyCommerce_Orbis::ProductInfo* SonyCommerce_Orbis::m_pProductInfo = nullptr; -SonyCommerce_Orbis::CategoryInfo* SonyCommerce_Orbis::m_pCategoryInfo = NULL; -const char* SonyCommerce_Orbis::m_pProductID = NULL; -char* SonyCommerce_Orbis::m_pCategoryID = NULL; +SonyCommerce_Orbis::CategoryInfo* SonyCommerce_Orbis::m_pCategoryInfo = nullptr; +const char* SonyCommerce_Orbis::m_pProductID = nullptr; +char* SonyCommerce_Orbis::m_pCategoryID = nullptr; SonyCommerce_Orbis::CheckoutInputParams SonyCommerce_Orbis::m_checkoutInputParams; SonyCommerce_Orbis::DownloadListInputParams SonyCommerce_Orbis::m_downloadInputParams; -SonyCommerce_Orbis::CallbackFunc SonyCommerce_Orbis::m_callbackFunc = NULL; +SonyCommerce_Orbis::CallbackFunc SonyCommerce_Orbis::m_callbackFunc = nullptr; // sys_memory_container_t SonyCommerce_Orbis::m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; bool SonyCommerce_Orbis::m_bUpgradingTrial = false; @@ -38,7 +38,7 @@ bool SonyCommerce_Orbis::m_contextCreated=false; ///< npcommerce2 cont SonyCommerce_Orbis::Phase SonyCommerce_Orbis::m_currentPhase = e_phase_stopped; ///< Current commerce2 util // char SonyCommerce_Orbis::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; -C4JThread* SonyCommerce_Orbis::m_tickThread = NULL; +C4JThread* SonyCommerce_Orbis::m_tickThread = nullptr; bool SonyCommerce_Orbis::m_bLicenseChecked=false; // Check the trial/full license for the game @@ -52,12 +52,12 @@ sce::Toolkit::NP::Utilities::Future g_d SonyCommerce_Orbis::ProductInfoDetailed s_trialUpgradeProductInfoDetailed; void SonyCommerce_Orbis::Delete() { - m_pProductInfoList=NULL; - m_pProductInfoDetailed=NULL; - m_pProductInfo=NULL; - m_pCategoryInfo = NULL; - m_pProductID = NULL; - m_pCategoryID = NULL; + m_pProductInfoList=nullptr; + m_pProductInfoDetailed=nullptr; + m_pProductInfo=nullptr; + m_pCategoryInfo = nullptr; + m_pProductID = nullptr; + m_pCategoryID = nullptr; } void SonyCommerce_Orbis::Init() @@ -95,7 +95,7 @@ bool SonyCommerce_Orbis::LicenseChecked() void SonyCommerce_Orbis::CheckForTrialUpgradeKey() { - StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, NULL); + StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, nullptr); } int SonyCommerce_Orbis::Shutdown() @@ -112,7 +112,7 @@ int SonyCommerce_Orbis::Shutdown() DeleteCriticalSection(&m_queueLock); // clear any possible callback function - m_callbackFunc = NULL; + m_callbackFunc = nullptr; return ret; } @@ -582,7 +582,7 @@ int SonyCommerce_Orbis::createContext() // } // // // Create commerce2 context -// ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, NULL, &m_contextId); +// ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, nullptr, &m_contextId); // if (ret < 0) // { // app.DebugPrintf(4,"createContext sceNpCommerce2CreateCtx problem\n"); @@ -657,7 +657,7 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event) case sce::Toolkit::NP::Event::UserEvent::commerceGotCategoryInfo: { copyCategoryInfo(m_pCategoryInfo, g_categoryInfo.get()); - m_pCategoryInfo = NULL; + m_pCategoryInfo = nullptr; m_event = e_event_commerceGotCategoryInfo; break; } @@ -665,7 +665,7 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event) case sce::Toolkit::NP::Event::UserEvent::commerceGotProductList: { copyProductList(m_pProductInfoList, g_productList.get()); - m_pProductInfoDetailed = NULL; + m_pProductInfoDetailed = nullptr; m_event = e_event_commerceGotProductList; break; } @@ -675,12 +675,12 @@ void SonyCommerce_Orbis::commerce2Handler( const sce::Toolkit::NP::Event& event) if(m_pProductInfoDetailed) { copyDetailedProductInfo(m_pProductInfoDetailed, g_detailedProductInfo.get()); - m_pProductInfoDetailed = NULL; + m_pProductInfoDetailed = nullptr; } else { copyAddDetailedProductInfo(m_pProductInfo, g_detailedProductInfo.get()); - m_pProductInfo = NULL; + m_pProductInfo = nullptr; } m_event = e_event_commerceGotDetailedProductInfo; break; @@ -1027,7 +1027,7 @@ void SonyCommerce_Orbis::processEvent() case e_event_commerceProductBrowseFinished: app.DebugPrintf(4,"e_event_commerceProductBrowseFinished succeeded: 0x%x\n", m_errorCode); - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1076,7 +1076,7 @@ void SonyCommerce_Orbis::processEvent() } // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1094,7 +1094,7 @@ void SonyCommerce_Orbis::processEvent() } // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1154,8 +1154,8 @@ void SonyCommerce_Orbis::CreateSession( CallbackFunc cb, LPVOID lpParam ) m_messageQueue.push(e_message_commerceEnd); m_event = e_event_commerceSessionCreated; - if(m_tickThread == NULL) - m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce_Orbis tick"); + if(m_tickThread == nullptr) + m_tickThread = new C4JThread(TickLoop, nullptr, "SonyCommerce_Orbis tick"); if(m_tickThread->isRunning() == false) { m_currentPhase = e_phase_idle; diff --git a/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.h b/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.h index a2a42d574..dc7671f46 100644 --- a/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.h +++ b/Minecraft.Client/Orbis/Network/SonyCommerce_Orbis.h @@ -107,14 +107,14 @@ class SonyCommerce_Orbis : public SonyCommerce { assert(m_callbackFunc); CallbackFunc func = m_callbackFunc; - m_callbackFunc = NULL; + m_callbackFunc = nullptr; if(func) func(m_callbackParam, m_errorCode); m_errorCode = SCE_OK; } static void setCallback(CallbackFunc cb,LPVOID lpParam) { - assert(m_callbackFunc == NULL); + assert(m_callbackFunc == nullptr); m_callbackFunc = cb; m_callbackParam = lpParam; } diff --git a/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp index b9c4a6ed1..3387839fd 100644 --- a/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyHttp_Orbis.cpp @@ -100,16 +100,16 @@ void SonyHttp_Orbis::printSslError(SceInt32 sslErr, SceUInt32 sslErrDetail) void SonyHttp_Orbis::printSslCertInfo(int libsslCtxId,SceSslCert *sslCert) { SceInt32 ret; - SceUChar8 *sboData = NULL ; + SceUChar8 *sboData = nullptr ; SceSize sboLen, counter; - ret = sceSslGetSerialNumber(libsslCtxId, sslCert, NULL, &sboLen); + ret = sceSslGetSerialNumber(libsslCtxId, sslCert, nullptr, &sboLen); if (ret < 0){ app.DebugPrintf("sceSslGetSerialNumber() returns 0x%x\n", ret); } else { sboData = static_cast(malloc(sboLen)); - if ( sboData != NULL ) { + if ( sboData != nullptr ) { ret = sceSslGetSerialNumber(libsslCtxId, sslCert, sboData, &sboLen); if (ret < 0){ app.DebugPrintf ("sceSslGetSerialNumber() returns 0x%x\n", ret); @@ -225,7 +225,7 @@ bool SonyHttp_Orbis::http_get(const char *targetUrl, void** ppOutData, int* pDat } reqId = ret; - ret = sceHttpSendRequest(reqId, NULL, 0); + ret = sceHttpSendRequest(reqId, nullptr, 0); if (ret < 0) { app.DebugPrintf("sceHttpSendRequest() error: 0x%08X\n", ret); diff --git a/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp index 0af059a90..008879cb3 100644 --- a/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyRemoteStorage_Orbis.cpp @@ -196,7 +196,7 @@ bool SonyRemoteStorage_Orbis::init(CallbackFunc cb, LPVOID lpParam) // memcpy(clientId.id, CLIENT_ID, strlen(CLIENT_ID)); // authParams.pClientId = &clientId; -// ret = sceNpAuthGetAuthorizationCode(reqId, &authParams, &authCode, NULL); +// ret = sceNpAuthGetAuthorizationCode(reqId, &authParams, &authCode, nullptr); // if (ret < 0) { // app.DebugPrintf("Failed to get auth code 0x%x\n", ret); // } @@ -223,7 +223,7 @@ bool SonyRemoteStorage_Orbis::init(CallbackFunc cb, LPVOID lpParam) params.timeout.sendMs = 120 * 1000; //120 seconds is the default params.pool.memPoolSize = 7 * 1024 * 1024; - if(m_memPoolBuffer == NULL) + if(m_memPoolBuffer == nullptr) m_memPoolBuffer = malloc(params.pool.memPoolSize); params.pool.memPoolBuffer = m_memPoolBuffer; diff --git a/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp b/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp index d869d38bf..c075badb6 100644 --- a/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp +++ b/Minecraft.Client/Orbis/Network/SonyVoiceChat_Orbis.cpp @@ -67,7 +67,7 @@ void LoadPCMVoiceData() { char filename[64]; sprintf(filename, "voice%d.pcm", i+1); - HANDLE file = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(filename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); DWORD dwHigh=0; g_loadedPCMVoiceDataSizes[i] = GetFileSize(file,&dwHigh); @@ -75,7 +75,7 @@ void LoadPCMVoiceData() { g_loadedPCMVoiceData[i] = new char[g_loadedPCMVoiceDataSizes[i]]; DWORD bytesRead; - BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, NULL); + BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, nullptr); assert(bSuccess); } g_loadedPCMVoiceDataPos[i] = 0; @@ -274,7 +274,7 @@ void SQRVoiceConnection::readRemoteData() if( dataSize > 0 ) { VoicePacket packet; - int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, NULL ); + int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, nullptr ); unsigned int writeSize; if( bytesRead > 0 ) { @@ -468,7 +468,7 @@ void SonyVoiceChat_Orbis::sendAllVoiceData() if(m_localVoiceDevices[i].isValid()) { bool bChatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,true,&bChatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(i,true,&bChatRestricted,nullptr,nullptr); if(bChatRestricted) { @@ -928,7 +928,7 @@ void SonyVoiceChat_Orbis::initLocalPlayer(int playerIndex) if(m_localVoiceDevices[playerIndex].isValid() == false) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); // create all device ports required m_localVoiceDevices[playerIndex].init(ProfileManager.getUserID(playerIndex), chatRestricted); @@ -965,7 +965,7 @@ SQRVoiceConnection* SonyVoiceChat_Orbis::GetVoiceConnectionFromRudpCtx( int Rudp if(m_remoteConnections[i]->m_rudpCtx == RudpCtx) return m_remoteConnections[i]; } - return NULL; + return nullptr; } void SonyVoiceChat_Orbis::connectPlayerToAll( int playerIndex ) @@ -990,7 +990,7 @@ SQRVoiceConnection* SonyVoiceChat_Orbis::getVoiceConnectionFromRoomMemberID( Sce } } - return NULL; + return nullptr; } void SonyVoiceChat_Orbis::disconnectLocalPlayer( int localIdx ) diff --git a/Minecraft.Client/Orbis/OrbisExtras/OrbisStubs.cpp b/Minecraft.Client/Orbis/OrbisExtras/OrbisStubs.cpp index d3a21ac4f..92718f7e1 100644 --- a/Minecraft.Client/Orbis/OrbisExtras/OrbisStubs.cpp +++ b/Minecraft.Client/Orbis/OrbisExtras/OrbisStubs.cpp @@ -35,8 +35,8 @@ int _wcsicmp( const wchar_t * dst, const wchar_t * src ) wchar_t f,l; // validation section - // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR); - // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR); + // _VALIDATE_RETURN(dst != nullptr, EINVAL, _NLSCMPERROR); + // _VALIDATE_RETURN(src != nullptr, EINVAL, _NLSCMPERROR); do { f = towlower(*dst); @@ -51,7 +51,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize) { size_t n; -// Note that we do not check if s == NULL, because we do not +// Note that we do not check if s == nullptr, because we do not // return errno_t... for (n = 0; n < maxsize && *wcs; n++, wcs++) @@ -94,7 +94,7 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) lpSystemTime->wMilliseconds = sceRtcGetMicrosecond(&dateTime)/1000; } -HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { ORBIS_STUBBED; return NULL; } +HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { ORBIS_STUBBED; return nullptr; } VOID Sleep(DWORD dwMilliseconds) { C4JThread::Sleep(dwMilliseconds); @@ -203,7 +203,7 @@ VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) CriticalSection->m_cLock = 0; assert(err == SCE_OK); #ifdef _DEBUG - CriticalSection->m_pOwnerThread = NULL; + CriticalSection->m_pOwnerThread = nullptr; #endif } @@ -247,7 +247,7 @@ VOID LeaveCriticalSection(PCRITICAL_SECTION CriticalSection) int err = scePthreadMutexUnlock(&CriticalSection->mutex); assert(err == SCE_OK ); #ifdef _DEBUG - CriticalSection->m_pOwnerThread = NULL; + CriticalSection->m_pOwnerThread = nullptr; #endif } @@ -268,7 +268,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, CONST HANDLE *lpHandles,BOOL bWaitAll BOOL CloseHandle(HANDLE hObject) { - sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)hObject)); + sceFiosFHCloseSync(nullptr,(SceFiosFH)((int64_t)hObject)); return true; // ORBIS_STUBBED; // return false; @@ -342,7 +342,7 @@ public: if(err != SCE_OK) { assert(0); - return NULL; + return nullptr; } // work out where the next page should be in virtual addr space, and pass that to the mapping function void* pageVirtualAddr = ((char*)m_virtualAddr) + m_allocatedSize; @@ -359,12 +359,12 @@ public: if(inAddr != pageVirtualAddr) // make sure we actually get the virtual address that we requested { assert(0); - return NULL; + return nullptr; } if(err != SCE_OK) { assert(0); - return NULL; + return nullptr; } m_pagesAllocated.push_back(PageInfo(physAddr, pageVirtualAddr, sizeToAdd)); m_allocatedSize += sizeToAdd; @@ -395,14 +395,14 @@ static std::vector s_orbisVAllocs; LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) { - if(lpAddress == NULL) + if(lpAddress == nullptr) { void *pAddr = (void*)SCE_KERNEL_APP_MAP_AREA_START_ADDR; int err = sceKernelReserveVirtualRange(&pAddr, dwSize, 0, 16*1024); if( err != SCE_OK ) { app.DebugPrintf("sceKernelReserveVirtualRange failed: 0x%08X\n", err); - return NULL; + return nullptr; } s_orbisVAllocs.push_back(new OrbisVAlloc(pAddr, dwSize)); return (LPVOID)pAddr; @@ -419,10 +419,10 @@ LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWO } } assert(0); // failed to find the virtual alloc in our table - return NULL; + return nullptr; } } - return NULL; + return nullptr; } BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) @@ -483,7 +483,7 @@ BOOL WriteFile( { SceFiosFH fh = (SceFiosFH)((int64_t)hFile); // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. - SceFiosSize bytesRead = sceFiosFHWriteSync(NULL, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToWrite); + SceFiosSize bytesRead = sceFiosFHWriteSync(nullptr, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToWrite); if(bytesRead < 0) { // error @@ -500,7 +500,7 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD { SceFiosFH fh = (SceFiosFH)((int64_t)hFile); // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. - SceFiosSize bytesRead = sceFiosFHReadSync(NULL, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToRead); + SceFiosSize bytesRead = sceFiosFHReadSync(nullptr, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToRead); *lpNumberOfBytesRead = (DWORD)bytesRead; if(bytesRead < 0) { @@ -520,7 +520,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi uint64_t bitsToMove = (int64_t) lDistanceToMove; SceFiosOffset pos = 0; - if (lpDistanceToMoveHigh != NULL) + if (lpDistanceToMoveHigh != nullptr) bitsToMove |= ((uint64_t) (*lpDistanceToMoveHigh)) << 32; SceFiosWhence whence = SCE_FIOS_SEEK_SET; @@ -581,7 +581,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, case TRUNCATE_EXISTING: break; } - int err = sceFiosFHOpenSync(NULL, &fh, filePath, &openParams); + int err = sceFiosFHOpenSync(nullptr, &fh, filePath, &openParams); if(err != SCE_FIOS_OK) { @@ -597,7 +597,7 @@ BOOL DeleteFileA(LPCSTR lpFileName) { ORBIS_STUBBED; return false; } // BOOL XCloseHandle(HANDLE a) // { -// sceFiosFHCloseSync(NULL,(SceFiosFH)((int64_t)a)); +// sceFiosFHCloseSync(nullptr,(SceFiosFH)((int64_t)a)); // return true; // } @@ -617,7 +617,7 @@ DWORD GetFileAttributesA(LPCSTR lpFileName) // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) { app.DebugPrintf("*** sceFiosStatSync Failed\n"); return -1; diff --git a/Minecraft.Client/Orbis/OrbisExtras/TLSStorage.cpp b/Minecraft.Client/Orbis/OrbisExtras/TLSStorage.cpp index 9f17e999d..4229b61d1 100644 --- a/Minecraft.Client/Orbis/OrbisExtras/TLSStorage.cpp +++ b/Minecraft.Client/Orbis/OrbisExtras/TLSStorage.cpp @@ -4,7 +4,7 @@ -TLSStorageOrbis* TLSStorageOrbis::m_pInstance = NULL; +TLSStorageOrbis* TLSStorageOrbis::m_pInstance = nullptr; BOOL TLSStorageOrbis::m_activeList[sc_maxSlots]; __thread LPVOID TLSStorageOrbis::m_values[sc_maxSlots]; @@ -16,7 +16,7 @@ TLSStorageOrbis::TLSStorageOrbis() for(int i=0;isecond; } @@ -124,7 +124,7 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfoFromKeyname(char *pchKeyName) } } - return NULL; + return nullptr; } #define WRAPPED_READFILE(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped) {if(ReadFile(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped)==FALSE) { return FALSE;}} @@ -133,8 +133,8 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() char chDLCTitle[64]; // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds - //HANDLE file = CreateFile("orbis/DLCImages/TP01_360x360.png", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - HANDLE file = CreateFile("orbis/PS4ProductCodes.bin", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + //HANDLE file = CreateFile("orbis/DLCImages/TP01_360x360.png", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + HANDLE file = CreateFile("orbis/PS4ProductCodes.bin", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -149,12 +149,12 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() { DWORD bytesRead; - WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,NULL); - WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,NULL); - WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,NULL); - WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,NULL); - WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,NULL); - WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,nullptr); app.DebugPrintf("ProductCodes.chProductCode %s\n",ProductCodes.chProductCode); app.DebugPrintf("ProductCodes.chSaveFolderPrefix %s\n",ProductCodes.chSaveFolderPrefix); @@ -165,7 +165,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // DLC unsigned int uiDLC; - WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,nullptr); for(unsigned int i=0;ichDLCKeyname,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,pDLCInfo->chDLCKeyname,sizeof(char)*uiVal,&bytesRead,nullptr); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,nullptr); app.DebugPrintf("DLC title %s\n",chDLCTitle); - WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,nullptr); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,pDLCInfo->chDLCPicname,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,pDLCInfo->chDLCPicname,sizeof(char)*uiVal,&bytesRead,nullptr); - WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,nullptr); // push this into a vector @@ -310,7 +310,7 @@ void CConsoleMinecraftApp::FreeLocalDLCImages() { free(pDLCInfo->pbImageData); pDLCInfo->dwImageBytes=0; - pDLCInfo->pbImageData=NULL; + pDLCInfo->pbImageData=nullptr; } } } @@ -323,7 +323,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(SONYDLC *pDLCInfo) sprintf(pchFilename,"orbis/DLCImages/%s_360x360.png",pDLCInfo->chDLCPicname); // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds - HANDLE hFile = CreateFile(pchFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(pchFilename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( hFile == INVALID_HANDLE_VALUE ) { @@ -339,7 +339,7 @@ int CConsoleMinecraftApp::LoadLocalDLCImage(SONYDLC *pDLCInfo) DWORD dwBytesRead; pDLCInfo->pbImageData=(PBYTE)malloc(pDLCInfo->dwImageBytes); - if(ReadFile(hFile,pDLCInfo->pbImageData,pDLCInfo->dwImageBytes,&dwBytesRead,NULL)==FALSE) + if(ReadFile(hFile,pDLCInfo->pbImageData,pDLCInfo->dwImageBytes,&dwBytesRead,nullptr)==FALSE) { // failed free(pDLCInfo->pbImageData); @@ -375,7 +375,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(NULL); + app.setLevelGenerationOptions(nullptr); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -404,7 +404,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = NULL; + param->saveData = nullptr; app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -620,7 +620,7 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo() { if(m_bCommerceCategoriesRetrieved==false) { - return NULL; + return nullptr; } return &m_CategoryInfo; @@ -636,10 +636,10 @@ void CConsoleMinecraftApp::ClearCommerceDetails() pProductList->clear(); } - if(m_ProductListA!=NULL) + if(m_ProductListA!=nullptr) { delete [] m_ProductListA; - m_ProductListA=NULL; + m_ProductListA=nullptr; } m_ProductListRetrievedC=0; @@ -727,7 +727,7 @@ std::vector* CConsoleMinecraftApp::GetProductList(int { if((m_bCommerceProductListRetrieved==false) || (m_bProductListAdditionalDetailsRetrieved==false) ) { - return NULL; + return nullptr; } return &m_ProductListA[iIndex]; @@ -1175,7 +1175,7 @@ int CConsoleMinecraftApp::Callback_SaveGameIncompleteMessageBoxReturned(void *pP StorageManager.CancelIncompleteOperation(); break; case C4JStorage::EMessage_ResultThirdOption: - ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, NULL, eUILayer_Error, eUIGroup_Fullscreen); + ui.NavigateToScene(iPad, eUIScene_InGameSaveManagementMenu, nullptr, eUILayer_Error, eUIGroup_Fullscreen); break; } return 0; @@ -1186,7 +1186,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); bool bEmptyStore=true; - if(pCategories!=NULL) + if(pCategories!=nullptr) { if(pCategories->countOfProducts>0) { @@ -1244,7 +1244,7 @@ void CConsoleMinecraftApp::PatchAvailableDialogTick() UINT uiIDA[1]; uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION_PATCH_AVAILABLE, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable()); + ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION_PATCH_AVAILABLE, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr, app.GetStringTable()); m_bPatchAvailableDialogRunning=false; } } diff --git a/Minecraft.Client/Orbis/Orbis_App.h b/Minecraft.Client/Orbis/Orbis_App.h index 1c09579f7..06b6e83a8 100644 --- a/Minecraft.Client/Orbis/Orbis_App.h +++ b/Minecraft.Client/Orbis/Orbis_App.h @@ -86,7 +86,7 @@ public: // BANNED LEVEL LIST virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} - C4JStringTable *GetStringTable() { return NULL;} + C4JStringTable *GetStringTable() { return nullptr;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/Orbis/Orbis_Minecraft.cpp b/Minecraft.Client/Orbis/Orbis_Minecraft.cpp index 646165652..01d24fe1d 100644 --- a/Minecraft.Client/Orbis/Orbis_Minecraft.cpp +++ b/Minecraft.Client/Orbis/Orbis_Minecraft.cpp @@ -362,7 +362,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice, return pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, - NULL, + nullptr, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES, pd3dPP, ppDevice ); @@ -381,16 +381,16 @@ void MemSect(int sect) #endif #ifndef __ORBIS__ -HINSTANCE g_hInst = NULL; -HWND g_hWnd = NULL; +HINSTANCE g_hInst = nullptr; +HWND g_hWnd = nullptr; D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL; D3D_FEATURE_LEVEL g_featureLevel = D3D_FEATURE_LEVEL_11_0; -ID3D11Device* g_pd3dDevice = NULL; -ID3D11DeviceContext* g_pImmediateContext = NULL; -IDXGISwapChain* g_pSwapChain = NULL; -ID3D11RenderTargetView* g_pRenderTargetView = NULL; -ID3D11DepthStencilView* g_pDepthStencilView = NULL; -ID3D11Texture2D* g_pDepthStencilBuffer = NULL; +ID3D11Device* g_pd3dDevice = nullptr; +ID3D11DeviceContext* g_pImmediateContext = nullptr; +IDXGISwapChain* g_pSwapChain = nullptr; +ID3D11RenderTargetView* g_pRenderTargetView = nullptr; +ID3D11DepthStencilView* g_pDepthStencilView = nullptr; +ID3D11Texture2D* g_pDepthStencilBuffer = nullptr; // // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) @@ -455,7 +455,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance) wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, "Minecraft"); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = "Minecraft"; wcex.lpszClassName = "MinecraftClass"; @@ -479,7 +479,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) g_hInst = hInstance; // Store instance handle in our global variable g_hWnd = CreateWindow("MinecraftClass", "Minecraft", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); if (!g_hWnd) { @@ -543,7 +543,7 @@ HRESULT InitDevice() for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ ) { g_driverType = driverTypes[driverTypeIndex]; - hr = D3D11CreateDeviceAndSwapChain( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels, + hr = D3D11CreateDeviceAndSwapChain( nullptr, g_driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext ); if( HRESULT_SUCCEEDED( hr ) ) break; @@ -552,7 +552,7 @@ HRESULT InitDevice() return hr; // Create a render target view - ID3D11Texture2D* pBackBuffer = NULL; + ID3D11Texture2D* pBackBuffer = nullptr; hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer ); if( FAILED( hr ) ) return hr; @@ -571,7 +571,7 @@ HRESULT InitDevice() descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; descDepth.CPUAccessFlags = 0; descDepth.MiscFlags = 0; - hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer); + hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, &g_pDepthStencilBuffer); D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; descDSView.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; @@ -580,7 +580,7 @@ HRESULT InitDevice() hr = g_pd3dDevice->CreateDepthStencilView(g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView); - hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView ); + hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, nullptr, &g_pRenderTargetView ); pBackBuffer->Release(); if( FAILED( hr ) ) return hr; @@ -773,7 +773,7 @@ int main(int argc, const char *argv[] ) MSG msg = {0}; while( WM_QUIT != msg.message ) { - if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) + if( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -919,7 +919,7 @@ int main(int argc, const char *argv[] ) StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app,""); StorageManager.SetSaveTitleExtraFileSuffix(app.GetString(IDS_SAVE_SUBTITLE_SUFFIX)); StorageManager.SetDLCInfoMap(app.GetSonyDLCMap()); - app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL + app.CommerceInit(); // MGH - moved this here so GetCommerce isn't nullptr // 4J-PB - Kick of the check for trial or full version - requires ui to be initialised app.GetCommerce()->CheckForTrialUpgradeKey(); @@ -939,7 +939,7 @@ int main(int argc, const char *argv[] ) } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -1089,7 +1089,7 @@ int main(int argc, const char *argv[] ) // Minecraft::main () used to call Minecraft::Start, but this takes ~2.5 seconds, so now running this in another thread // so we can do some basic renderer calls whilst it is happening. This is at attempt to stop getting TRC failure on SubmitDone taking > 5 seconds on boot - C4JThread *minecraftThread = new C4JThread(&StartMinecraftThreadProc, NULL, "Running minecraft start"); + C4JThread *minecraftThread = new C4JThread(&StartMinecraftThreadProc, nullptr, "Running minecraft start"); minecraftThread->Run(); do { @@ -1194,7 +1194,7 @@ int main(int argc, const char *argv[] ) // We should track down why though... app.DebugPrintf("---init sound engine()\n"); - pMinecraft->soundEngine->init(NULL); + pMinecraft->soundEngine->init(nullptr); while (TRUE) { @@ -1249,7 +1249,7 @@ int main(int argc, const char *argv[] ) else { MemSect(28); - pMinecraft->soundEngine->tick(NULL, 0.0f); + pMinecraft->soundEngine->tick(nullptr, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1487,7 +1487,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); - if( strUtf8 != NULL ) + if( strUtf8 != nullptr ) { vRichPresenceStrings.push_back(strUtf8); } diff --git a/Minecraft.Client/Orbis/Orbis_UIController.cpp b/Minecraft.Client/Orbis/Orbis_UIController.cpp index 38cc79e94..a6ed530e4 100644 --- a/Minecraft.Client/Orbis/Orbis_UIController.cpp +++ b/Minecraft.Client/Orbis/Orbis_UIController.cpp @@ -182,7 +182,7 @@ void ConsoleUIController::render() throttle++; #else - gdraw_orbis_End(NULL); + gdraw_orbis_End(nullptr); #endif #endif @@ -252,7 +252,7 @@ GDrawTexture *ConsoleUIController::getSubstitutionTexture(int textureId) GDrawTexture *gdrawTex = gdraw_orbis_WrappedTextureCreate(tex); return gdrawTex; - return NULL; + return nullptr; } void ConsoleUIController::destroySubstitutionTexture(void *destroyCallBackData, GDrawTexture *handle) diff --git a/Minecraft.Client/Orbis/XML/ATGXmlParser.h b/Minecraft.Client/Orbis/XML/ATGXmlParser.h index 75142e3e3..12f597372 100644 --- a/Minecraft.Client/Orbis/XML/ATGXmlParser.h +++ b/Minecraft.Client/Orbis/XML/ATGXmlParser.h @@ -138,7 +138,7 @@ private: DWORD m_dwCharsTotal; DWORD m_dwCharsConsumed; - BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL + BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; BYTE* m_pReadPtr; diff --git a/Minecraft.Client/Orbis/user_malloc.cpp b/Minecraft.Client/Orbis/user_malloc.cpp index 6a85e83b5..d7552b5ba 100644 --- a/Minecraft.Client/Orbis/user_malloc.cpp +++ b/Minecraft.Client/Orbis/user_malloc.cpp @@ -54,7 +54,7 @@ int user_malloc_init(void) return 1; } - addr = NULL; + addr = nullptr; //E Map direct memory to the process address space res = sceKernelMapDirectMemory(&addr, s_heapLength, SCE_KERNEL_PROT_CPU_READ | SCE_KERNEL_PROT_CPU_WRITE, 0, s_memStart, s_memAlign); if (res < 0) { @@ -64,7 +64,7 @@ int user_malloc_init(void) //E Generate mspace s_mspace = sceLibcMspaceCreate("User Malloc", addr, s_heapLength, 0); - if (s_mspace == NULL) { + if (s_mspace == nullptr) { //E Error handling return 1; } @@ -77,7 +77,7 @@ int user_malloc_finalize(void) { int res; - if (s_mspace != NULL) { + if (s_mspace != nullptr) { //E Free mspace //J mspace を解放する res = sceLibcMspaceDestroy(s_mspace); diff --git a/Minecraft.Client/Orbis/user_malloc_for_tls.cpp b/Minecraft.Client/Orbis/user_malloc_for_tls.cpp index d1a8d2555..d862b6b9f 100644 --- a/Minecraft.Client/Orbis/user_malloc_for_tls.cpp +++ b/Minecraft.Client/Orbis/user_malloc_for_tls.cpp @@ -39,7 +39,7 @@ int user_malloc_init_for_tls(void) return 1; } - addr = NULL; + addr = nullptr; //E Map direct memory to the process address space //J ダイレクトメモリをプロセスアドレス空間にマップする res = sceKernelMapDirectMemory(&addr, HEAP_SIZE, SCE_KERNEL_PROT_CPU_READ | SCE_KERNEL_PROT_CPU_WRITE, 0, s_memStart, s_memAlign); @@ -52,7 +52,7 @@ int user_malloc_init_for_tls(void) //E Generate mspace //J mspace を生成する s_mspace = sceLibcMspaceCreate("User Malloc For TLS", addr, HEAP_SIZE, 0); - if (s_mspace == NULL) { + if (s_mspace == nullptr) { //E Error handling //J エラー処理 return 1; @@ -67,7 +67,7 @@ int user_malloc_fini_for_tls(void) { int res; - if (s_mspace != NULL) { + if (s_mspace != nullptr) { //E Free mspace //J mspace を解放する res = sceLibcMspaceDestroy(s_mspace); diff --git a/Minecraft.Client/Orbis/user_new.cpp b/Minecraft.Client/Orbis/user_new.cpp index 83aa3f8ca..e31083544 100644 --- a/Minecraft.Client/Orbis/user_new.cpp +++ b/Minecraft.Client/Orbis/user_new.cpp @@ -26,13 +26,13 @@ void *user_new(std::size_t size) throw(std::bad_alloc) if (size == 0) size = 1; - while ((ptr = (void *)std::malloc(size)) == NULL) { + while ((ptr = (void *)std::malloc(size)) == nullptr) { //E Obtain new_handler //J new_handler を取得する std::new_handler handler = std::get_new_handler(); - //E When new_handler is a NULL pointer, bad_alloc is send. If not, new_handler is called. - //J new_handler が NULL ポインタの場合、bad_alloc を送出する、そうでない場合、new_handler を呼び出す + //E When new_handler is a nullptr pointer, bad_alloc is send. If not, new_handler is called. + //J new_handler が nullptr ポインタの場合、bad_alloc を送出する、そうでない場合、new_handler を呼び出す if (!handler) { assert(0);//throw std::bad_alloc(); @@ -54,27 +54,27 @@ void *user_new(std::size_t size, const std::nothrow_t& x) throw() // if (size == 0) // size = 1; // -// while ((ptr = (void *)std::malloc(size)) == NULL) { +// while ((ptr = (void *)std::malloc(size)) == nullptr) { // //E Obtain new_handler // //J new_handler を取得する // std::new_handler handler = std::get_new_handler(); // -// //E When new_handler is a NULL pointer, NULL is returned. -// //J new_handler が NULL ポインタの場合、NULL を返す +// //E When new_handler is a nullptr pointer, nullptr is returned. +// //J new_handler が nullptr ポインタの場合、nullptr を返す // if (!handler) -// return NULL; +// return nullptr; // -// //E Call new_handler. If new_handler sends bad_alloc, NULL is returned. -// //J new_handler を呼び出す、new_handler が bad_alloc を送出した場合、NULL を返す +// //E Call new_handler. If new_handler sends bad_alloc, nullptr is returned. +// //J new_handler を呼び出す、new_handler が bad_alloc を送出した場合、nullptr を返す // try { // (*handler)(); // } catch (std::bad_alloc) { -// return NULL; +// return nullptr; // } // } // return ptr; assert(0); - return NULL; + return nullptr; } //E Replace operator new[]. @@ -95,9 +95,9 @@ void *user_new_array(std::size_t size, const std::nothrow_t& x) throw() //J operator delete と置き換わる void user_delete(void *ptr) throw() { - //E In the case of the NULL pointer, no action will be taken. - //J NULL ポインタの場合、何も行わない - if (ptr != NULL) + //E In the case of the nullptr pointer, no action will be taken. + //J nullptr ポインタの場合、何も行わない + if (ptr != nullptr) std::free(ptr); } diff --git a/Minecraft.Client/PS3/4JLibs/STO_TitleSmallStorage.cpp b/Minecraft.Client/PS3/4JLibs/STO_TitleSmallStorage.cpp index f3d2729f0..bb7c88c7e 100644 --- a/Minecraft.Client/PS3/4JLibs/STO_TitleSmallStorage.cpp +++ b/Minecraft.Client/PS3/4JLibs/STO_TitleSmallStorage.cpp @@ -58,7 +58,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) { int32_t ret = 0; int32_t transId = 0; - void *data=NULL; + void *data=nullptr; size_t dataSize=0; SceNpId npId; @@ -100,7 +100,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) //memset(&npclient_info, 0x00, sizeof(npclient_info)); data = malloc(SCE_NET_NP_TSS_MAX_SIZE); - if (data == NULL) + if (data == nullptr) { printf("out of memory: can't allocate memory for titleSmallStorage\n"); ret = -1; @@ -121,7 +121,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) // data, // SCE_NET_NP_TSS_MAX_SIZE, // &dataSize, -// NULL); +// nullptr); // if (ret < 0) // { // printf("sceNpLookupTitleSmallStorage() failed. ret = 0x%x\n", ret); @@ -150,7 +150,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) size_t dataSize; SceNpTssSlotId slotId=SLOTID; SceNpTssDataStatus dataStatus; - const char *ptr =NULL; + const char *ptr =nullptr; size_t recvdSize=0; size_t totalSize=0; size_t recvSize=0; @@ -163,7 +163,7 @@ int32_t CTSS::doLookupTitleSmallStorage(void) sizeof(SceNpTssDataStatus), ptr, recvSize, - NULL); + nullptr); if (ret < 0) { // Error handling @@ -174,10 +174,10 @@ int32_t CTSS::doLookupTitleSmallStorage(void) // Processing when there is no data goto finish; } - if (ptr == NULL) + if (ptr == nullptr) { ptr = malloc(dataStatus.contentLength); - if (ptr == NULL){ + if (ptr == nullptr){ // Error handling goto error; } @@ -197,7 +197,7 @@ error: ret = sceNpLookupDestroyTransactionCtx(transId); printf("sceNpLookupDestroyTransactionCtx() done. ret = 0x%x\n", ret); } - if (data != NULL) + if (data != nullptr) { free(data); } diff --git a/Minecraft.Client/PS3/4JLibs/inc/4J_Input.h b/Minecraft.Client/PS3/4JLibs/inc/4J_Input.h index 6f51bba51..9d46e7413 100644 --- a/Minecraft.Client/PS3/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/PS3/4JLibs/inc/4J_Input.h @@ -130,8 +130,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); -// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); -// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); +// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); +// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); void DestroyKeyboard(); void GetText(uint16_t *UTF16String); diff --git a/Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h b/Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h index 888c38cc5..4a65dcb96 100644 --- a/Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/PS3/4JLibs/inc/4J_Profile.h @@ -109,7 +109,7 @@ public: // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/PS3/4JLibs/inc/4J_Render.h b/Minecraft.Client/PS3/4JLibs/inc/4J_Render.h index d55f440bf..1b68695f0 100644 --- a/Minecraft.Client/PS3/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/PS3/4JLibs/inc/4J_Render.h @@ -17,8 +17,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { delete m_pBuffer; m_pBuffer = NULL; } - bool Allocated() { return m_pBuffer != NULL; } + void Release() { delete m_pBuffer; m_pBuffer = nullptr; } + bool Allocated() { return m_pBuffer != nullptr; } }; typedef struct @@ -60,7 +60,7 @@ public: void InitialiseContext(); void StartFrame(); void Present(); - void Clear(int flags, D3D11_RECT *pRect = NULL); + void Clear(int flags, D3D11_RECT *pRect = nullptr); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h b/Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h index 3950bbad6..b95325b37 100644 --- a/Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/PS3/4JLibs/inc/4J_Storage.h @@ -293,7 +293,7 @@ typedef struct // Messages C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=USER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, StringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0); + int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, StringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0); C4JStorage::EMessageResult GetMessageBoxResult(); @@ -350,7 +350,7 @@ typedef struct void FreeSaveData(); void SetSaveDataSize(unsigned int uiBytes); // after a successful compression, update the size of the gamedata - //void SaveSaveData(unsigned int uiBytes,PBYTE pbThumbnail=NULL,DWORD cbThumbnail=0,PBYTE pbTextData=NULL, DWORD dwTextLen=0); + //void SaveSaveData(unsigned int uiBytes,PBYTE pbThumbnail=nullptr,DWORD cbThumbnail=0,PBYTE pbTextData=nullptr, DWORD dwTextLen=0); C4JStorage::ESaveGameState SaveSaveData(int( *Func)(LPVOID ,const bool),LPVOID lpParam, bool bDataFileOnly = false); void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam); void SetSaveDeviceSelected(unsigned int uiPad,bool bSelected); @@ -383,8 +383,8 @@ typedef struct DWORD GetAvailableDLCCount( int iPad); CONTENT_DATA& GetDLC(DWORD dw); C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = NULL); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = nullptr); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int),LPVOID lpParam, int iAction) { return C4JStorage::ETMSStatus_Idle; } @@ -400,7 +400,7 @@ typedef struct bool CheckForTrialUpgradeKey(void( *Func)(LPVOID, bool),LPVOID lpParam); - C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)/*=NULL*/,LPVOID lpParam/*=NULL*/, int iUserData/*=0*/) {return C4JStorage::ETMSStatus_Idle;} + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)/*=nullptr*/,LPVOID lpParam/*=nullptr*/, int iUserData/*=0*/) {return C4JStorage::ETMSStatus_Idle;} // PROFILE DATA int SetDefaultOptionsCallback(int( *Func)(LPVOID,PROFILESETTINGS *, const int iPad),LPVOID lpParam); diff --git a/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp b/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp index fcce5f05a..1c7edba30 100644 --- a/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp +++ b/Minecraft.Client/PS3/Audio/PS3_SoundEngine.cpp @@ -37,7 +37,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = ch_pcm; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE; /* No downmixer is used */ - cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ); + cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ); ret = ch_pcm; } @@ -51,7 +51,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = 6; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_TYPE_B; - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) != CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) != CELL_OK ) { return 0; // error - the downmixer didn't init } @@ -83,7 +83,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) ret = 8; } - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) == CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) == CELL_OK ) { break; } @@ -94,7 +94,7 @@ int SoundEngine::initAudioHardware( int minimum_chans ) a_config.channel = 2; a_config.encoder = CELL_AUDIO_OUT_CODING_TYPE_LPCM; a_config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_TYPE_A; - if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, NULL, 0 ) != CELL_OK ) + if ( cellAudioOutConfigure( CELL_AUDIO_OUT_PRIMARY, &a_config, nullptr, 0 ) != CELL_OK ) { return 0; // error - downmixer didn't work } diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp index 997e8d837..e8bd03679 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.cpp @@ -751,7 +751,7 @@ static void api_free_resource(GDrawHandle *r) S32 i; for (i=0; i < MAX_SAMPLERS; i++) if (gdraw->active_tex[i] == (GDrawTexture *) r) - gdraw->active_tex[i] = NULL; + gdraw->active_tex[i] = nullptr; } static void RADLINK gdraw_UnlockHandles(GDrawStats *stats) @@ -772,7 +772,7 @@ extern GDrawTexture *gdraw_GCM_WrappedTextureCreate(CellGcmTexture *gcm_tex) memset(&stats, 0, sizeof(stats)); GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle p->handle.tex.gcm_ptr = 0; - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); gdraw_GCM_WrappedTextureChange((GDrawTexture *) p, gcm_tex); return (GDrawTexture *) p; } @@ -816,11 +816,11 @@ static bool is_texture_swizzled(S32 w, S32 h) static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format gformat, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { S32 bytes_pixel = 4; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; bool swizzled = false; if (width > 4096 || height > 4096) { - IggyGDrawSendWarning(NULL, "GDraw %d x %d texture not supported by hardware (dimension size limit 4096)", width, height); + IggyGDrawSendWarning(nullptr, "GDraw %d x %d texture not supported by hardware (dimension size limit 4096)", width, height); return false; } @@ -893,7 +893,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, if (swizzled || (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap)) { rrbool ok; - assert(p->temp_buffer != NULL); + assert(p->temp_buffer != nullptr); ok = gdraw_MipmapBegin(&gdraw->mipmap, width, height, mipmaps, bytes_pixel, p->temp_buffer, p->temp_buffer_bytes); assert(ok); // this should never hit unless the temp_buffer is way too small @@ -1023,8 +1023,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void *unique_id, GDr static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != NULL); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == NULL) { + assert(t != nullptr); // @GDRAW_ASSERT + if (t->owner == unique_id || unique_id == nullptr) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -1121,7 +1121,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != NULL); // @GDRAW_ASSERT + assert(h != nullptr); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_kill(h, stats); } @@ -1152,19 +1152,19 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); return t; } void *ptr = gdraw_arena_alloc(&gdraw->rt_arena, size, 1); if (!ptr) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: out of rendertarget texture memory"); gdraw_HandleCacheAllocateFail(t); - return NULL; + return nullptr; } t->fence = get_next_fence(); // we're about to start using it immediately, so... - t->raw_ptr = NULL; + t->raw_ptr = nullptr; t->handle.tex.gcm_ptr = ptr; @@ -1329,14 +1329,14 @@ static void set_common_renderstate() // reset our state caching for (i=0; i < MAX_SAMPLERS; i++) { - gdraw->active_tex[i] = NULL; + gdraw->active_tex[i] = nullptr; cellGcmSetTextureControl(gcm, i, CELL_GCM_FALSE, 0, 0, 0); } assert(gdraw->aa_tex.offset != 0); // if you hit this, your initialization is screwed up. set_rsx_texture(gdraw->gcm, AATEX_SAMPLER, &gdraw->aa_tex, GDRAW_WRAP_clamp, 0); - gdraw->cur_fprog = NULL; + gdraw->cur_fprog = nullptr; gdraw->vert_format = -1; gdraw->scissor_state = ~0u; gdraw->blend_mode = -1; @@ -1363,7 +1363,7 @@ static void clear_renderstate(void) static void set_render_target() { - GcmTexture *tex = NULL; + GcmTexture *tex = nullptr; S32 i; CellGcmSurface surf = gdraw->main_surface; @@ -1384,7 +1384,7 @@ static void set_render_target() // invalidate current textures (need to reset them to force L1 texture cache flush) for (i=0; i < MAX_SAMPLERS; ++i) - gdraw->active_tex[i] = NULL; + gdraw->active_tex[i] = nullptr; } //////////////////////////////////////////////////////////////////////// @@ -1513,19 +1513,19 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex GDrawFramebufferState *n = gdraw->cur+1; GDrawHandle *t; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { assert(0); - IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } if (owner) { // @TODO implement - t = NULL; + t = nullptr; assert(0); // nyi } else { t = get_color_rendertarget(stats); @@ -1534,9 +1534,9 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex } n->color_buffer = t; - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT - n->cached = owner != NULL; + n->cached = owner != nullptr; if (owner) { n->base_x = region->x0; n->base_y = region->y0; @@ -1617,9 +1617,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != NULL); // @GDRAW_ASSERT + assert(m->color_buffer != nullptr); // @GDRAW_ASSERT } - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT // wait for render to texture operation to finish // can't put down a backend fence directly, there might still be @@ -1694,7 +1694,7 @@ static void set_fragment_para(GDraw * RADRESTRICT gd, U32 ucode_offs, int para, if (para == -1) return; - gd->cur_fprog = NULL; // need to re-set shader after patching + gd->cur_fprog = nullptr; // need to re-set shader after patching const U64 *inv = (const U64 *) values; const int *patch_offs = (const int *) para; @@ -1728,7 +1728,7 @@ static void set_fragment_para(GDraw * RADRESTRICT gd, U32 ucode_offs, int para, static RADINLINE void set_texture(S32 texunit, GDrawTexture *tex) { assert(texunit < MAX_SAMPLERS); - assert(tex != NULL); + assert(tex != nullptr); if (gdraw->active_tex[texunit] != tex) { gdraw->active_tex[texunit] = tex; @@ -1983,7 +1983,7 @@ static RADINLINE void set_vertex_decl(GDraw * RADRESTRICT gd, CellGcmContextData // Draw triangles with a given renderstate // -static RADINLINE void fence_resources(GDraw * RADRESTRICT gd, void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) +static RADINLINE void fence_resources(GDraw * RADRESTRICT gd, void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) { GDrawFence fence; fence.value = gd->next_fence_index; @@ -2046,7 +2046,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti while (pos < p->num_indices) { S32 vert_count = RR_MIN(p->num_indices - pos, verts_per_chunk); void *ring = gdraw_bufring_alloc(&gd->dyn_vb, vert_count * vsize, CELL_GCM_VERTEX_TEXTURE_CACHE_LINE_SIZE); - assert(ring != NULL); // we specifically chunked so this alloc succeeds! + assert(ring != nullptr); // we specifically chunked so this alloc succeeds! // prepare for painting... cellGcmSetInvalidateVertexCache(gcm); @@ -2083,7 +2083,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti S32 vert_count = RR_MIN(p->num_vertices - pos, verts_per_chunk); U32 chunk_bytes = vert_count * vsize; void *ring = gdraw_bufring_alloc(&gd->dyn_vb, chunk_bytes, CELL_GCM_VERTEX_TEXTURE_CACHE_LINE_SIZE); - assert(ring != NULL); // we picked the chunk size so this alloc succeeds! + assert(ring != nullptr); // we picked the chunk size so this alloc succeeds! memcpy(ring, (U8 *)p->vertices + pos * vsize, chunk_bytes); cellGcmSetInvalidateVertexCache(gcm); @@ -2203,7 +2203,7 @@ static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbe { ProgramWithCachedVariableLocations *prg = &gdraw->filter_prog[isbevel][r->filter_mode]; U32 ucode_offs = prg->cfg.offset; - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) return; set_texture(0, r->tex[0]); @@ -2287,14 +2287,14 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawHandle *blend_tex = NULL; + GDrawHandle *blend_tex = nullptr; GDraw *gd = gdraw; // for crazy blend modes, we need to read back from the framebuffer // and do the blending in the pixel shader. so we need to copy the // relevant pixels from our active render target into a texture. if (r->blend_mode == GDRAW_BLEND_special && - (blend_tex = get_color_rendertarget(stats)) != NULL) { + (blend_tex = get_color_rendertarget(stats)) != nullptr) { // slightly different logic depending on whether we were rendering // to the main color buffer or a render target, because the former // has tile origin-based coordinates while the latter don't. also, @@ -2344,7 +2344,7 @@ static void create_fragment_program(ProgramWithCachedVariableLocations *p, Progr cellGcmCgGetUCode(p->program, &ucode_main, &ucode_size); ucode_local = gdraw_arena_alloc(&gdraw->local_arena, ucode_size + 400, CELL_GCM_FRAGMENT_UCODE_LOCAL_ALIGN_OFFSET); // 400 for overfetch - assert(ucode_local != NULL); // if this triggers, it's a GDraw bug + assert(ucode_local != nullptr); // if this triggers, it's a GDraw bug memcpy(ucode_local, ucode_main, ucode_size); cellGcmCgGetCgbFragmentProgramConfiguration(p->program, &p->cfg, 0, 1, 0); @@ -2408,7 +2408,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_gcm_resourcetype type, U32 alig U32 header_size = is_vertex ? 0 : sizeof(GcmTexture) * num_handles; if (!num_handles) - return NULL; + return nullptr; GDrawHandleCache *cache = (GDrawHandleCache *) IggyGDrawMalloc(cache_size + header_size); if (cache) { @@ -2427,7 +2427,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_gcm_resourcetype type, U32 alig cache->alloc = gfxalloc_create(gdraw_mem[type].ptr, num_bytes, align, num_handles); if (!cache->alloc) { IggyGDrawFree(cache); - cache = NULL; + cache = nullptr; } } @@ -2496,14 +2496,14 @@ int gdraw_GCM_SetResourceMemory(gdraw_gcm_resourcetype type, S32 num_handles, vo free_handle_cache(gdraw->texturecache); gdraw->texturecache = make_handle_cache(GDRAW_GCM_RESOURCE_texture, CELL_GCM_TEXTURE_SWIZZLE_ALIGN_OFFSET); gdraw->tex_loc = get_location(ptr); - return gdraw->texturecache != NULL; + return gdraw->texturecache != nullptr; case GDRAW_GCM_RESOURCE_vertexbuffer: free_handle_cache(gdraw->vbufcache); gdraw->vbufcache = make_handle_cache(GDRAW_GCM_RESOURCE_vertexbuffer, CELL_GCM_SURFACE_LINEAR_ALIGN_OFFSET); gdraw->vbuf_base = ptr ? (U8 *) ptr - addr2offs(ptr) : 0; gdraw->vbuf_loc = get_location(ptr); - return gdraw->vbufcache != NULL; + return gdraw->vbufcache != nullptr; case GDRAW_GCM_RESOURCE_dyn_vertexbuffer: gdraw_bufring_shutdown(&gdraw->dyn_vb); @@ -2549,10 +2549,10 @@ int gdraw_GCM_SetRendertargetMemory(void *ptr, S32 num_bytes, S32 width, S32 hei void gdraw_GCM_ResetAllResourceMemory() { - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_texture, 0, NULL, 0); - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_vertexbuffer, 0, NULL, 0); - gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_dyn_vertexbuffer, 0, NULL, 0); - gdraw_GCM_SetRendertargetMemory(NULL, 0, 0, 0, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_texture, 0, nullptr, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_vertexbuffer, 0, nullptr, 0); + gdraw_GCM_SetResourceMemory(GDRAW_GCM_RESOURCE_dyn_vertexbuffer, 0, nullptr, 0); + gdraw_GCM_SetRendertargetMemory(nullptr, 0, 0, 0, 0); } GDrawFunctions *gdraw_GCM_CreateContext(CellGcmContextData *gcm, void *local_workmem, U8 rsx_label_index) @@ -2560,7 +2560,7 @@ GDrawFunctions *gdraw_GCM_CreateContext(CellGcmContextData *gcm, void *local_wor S32 i; gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); // make sure gdraw struct is PPU cache line aligned - if (!gdraw) return NULL; + if (!gdraw) return nullptr; memset(gdraw, 0, sizeof(*gdraw)); @@ -2648,7 +2648,7 @@ void gdraw_GCM_DestroyContext(void) free_handle_cache(gdraw->texturecache); free_handle_cache(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = NULL; + gdraw = nullptr; } } diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h index f8ec8705e..cf691d067 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm.h @@ -108,7 +108,7 @@ IDOC extern GDrawFunctions * gdraw_GCM_CreateContext(CellGcmContextData *gcm, vo There can only be one GCM GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_GCM_DestroyContext(void); /* Destroys the current GDraw context, if any. */ diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl index c8a3b42ea..4d3c91bb0 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_ps3gcm_shaders.inl @@ -273,24 +273,24 @@ static int pshader_basic_econst[28] = { }; static ProgramWithCachedVariableLocations pshader_basic_arr[18] = { - { { pshader_basic_0 }, { NULL }, { -1, 7, -1, -1, -1, } }, - { { pshader_basic_1 }, { NULL }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, - { { pshader_basic_2 }, { NULL }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, - { { pshader_basic_3 }, { NULL }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_4 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, - { { pshader_basic_5 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 4)), -1, } }, - { { pshader_basic_6 }, { NULL }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_7 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, - { { pshader_basic_8 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, - { { pshader_basic_9 }, { NULL }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_10 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 8)), -1, } }, - { { pshader_basic_11 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 10)), -1, } }, - { { pshader_basic_12 }, { NULL }, { 0, 7, -1, -1, static_cast((intptr_t)(pshader_basic_econst + 12)), } }, - { { pshader_basic_13 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 16)), static_cast((intptr_t)(pshader_basic_econst + 18)), } }, - { { pshader_basic_14 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 22)), static_cast((intptr_t)(pshader_basic_econst + 24)), } }, - { { pshader_basic_15 }, { NULL }, { 0, 7, -1, -1, -1, } }, - { { pshader_basic_16 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, - { { pshader_basic_17 }, { NULL }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, + { { pshader_basic_0 }, { nullptr }, { -1, 7, -1, -1, -1, } }, + { { pshader_basic_1 }, { nullptr }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, + { { pshader_basic_2 }, { nullptr }, { -1, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 0)), -1, } }, + { { pshader_basic_3 }, { nullptr }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_4 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, + { { pshader_basic_5 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 4)), -1, } }, + { { pshader_basic_6 }, { nullptr }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_7 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, + { { pshader_basic_8 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, + { { pshader_basic_9 }, { nullptr }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_10 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 8)), -1, } }, + { { pshader_basic_11 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 10)), -1, } }, + { { pshader_basic_12 }, { nullptr }, { 0, 7, -1, -1, static_cast((intptr_t)(pshader_basic_econst + 12)), } }, + { { pshader_basic_13 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 16)), static_cast((intptr_t)(pshader_basic_econst + 18)), } }, + { { pshader_basic_14 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 22)), static_cast((intptr_t)(pshader_basic_econst + 24)), } }, + { { pshader_basic_15 }, { nullptr }, { 0, 7, -1, -1, -1, } }, + { { pshader_basic_16 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 2)), -1, } }, + { { pshader_basic_17 }, { nullptr }, { 0, 7, -1, static_cast((intptr_t)(pshader_basic_econst + 6)), -1, } }, }; static unsigned char pshader_exceptional_blend_1[368] = { @@ -536,19 +536,19 @@ static int pshader_exceptional_blend_econst[4] = { }; static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { { NULL }, { NULL }, { -1, -1, -1, -1, } }, - { { pshader_exceptional_blend_1 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_2 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_3 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_4 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_5 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_6 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_7 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_8 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_9 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_10 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, - { { pshader_exceptional_blend_11 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, - { { pshader_exceptional_blend_12 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, } }, + { { pshader_exceptional_blend_1 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_2 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_3 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_4 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_5 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_6 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_7 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_8 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_9 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_10 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 0)), } }, + { { pshader_exceptional_blend_11 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, + { { pshader_exceptional_blend_12 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_exceptional_blend_econst + 2)), } }, }; static unsigned char pshader_filter_0[416] = { @@ -1121,38 +1121,38 @@ static int pshader_filter_econst[90] = { }; static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { - { { pshader_filter_0 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 0)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_1 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 11)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_2 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, - { { pshader_filter_3 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, - { { pshader_filter_4 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 19)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_5 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 11)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_6 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 2)), 2, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_7 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, - { { pshader_filter_8 }, { NULL }, { -1, 1, static_cast((intptr_t)(pshader_filter_econst + 21)), -1, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 24)), -1, } }, - { { pshader_filter_9 }, { NULL }, { -1, -1, static_cast((intptr_t)(pshader_filter_econst + 27)), -1, -1, -1, -1, -1, } }, - { { pshader_filter_10 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 2)), 2, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, - { { pshader_filter_11 }, { NULL }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 29)), 2, static_cast((intptr_t)(pshader_filter_econst + 32)), -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { pshader_filter_16 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, - { { pshader_filter_17 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 47)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 51)), static_cast((intptr_t)(pshader_filter_econst + 35)), } }, - { { pshader_filter_18 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((intptr_t)(pshader_filter_econst + 54)), static_cast((intptr_t)(pshader_filter_econst + 59)), -1, } }, - { { pshader_filter_19 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 62)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 66)), -1, } }, - { { pshader_filter_20 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, - { { pshader_filter_21 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 47)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 51)), static_cast((intptr_t)(pshader_filter_econst + 35)), } }, - { { pshader_filter_22 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 69)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 73)), -1, } }, - { { pshader_filter_23 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 62)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 66)), -1, } }, - { { pshader_filter_24 }, { NULL }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, - { { pshader_filter_25 }, { NULL }, { 0, -1, static_cast((intptr_t)(pshader_filter_econst + 76)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), -1, static_cast((intptr_t)(pshader_filter_econst + 67)), } }, - { { pshader_filter_26 }, { NULL }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 78)), 2, static_cast((intptr_t)(pshader_filter_econst + 82)), static_cast((intptr_t)(pshader_filter_econst + 87)), -1, } }, - { { pshader_filter_27 }, { NULL }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { pshader_filter_0 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 0)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_1 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 11)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_2 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, + { { pshader_filter_3 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, + { { pshader_filter_4 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 19)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_5 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 11)), static_cast((intptr_t)(pshader_filter_econst + 2)), -1, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_6 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 2)), 2, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_7 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 13)), 2, static_cast((intptr_t)(pshader_filter_econst + 16)), static_cast((intptr_t)(pshader_filter_econst + 5)), -1, } }, + { { pshader_filter_8 }, { nullptr }, { -1, 1, static_cast((intptr_t)(pshader_filter_econst + 21)), -1, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 24)), -1, } }, + { { pshader_filter_9 }, { nullptr }, { -1, -1, static_cast((intptr_t)(pshader_filter_econst + 27)), -1, -1, -1, -1, -1, } }, + { { pshader_filter_10 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 2)), 2, static_cast((intptr_t)(pshader_filter_econst + 5)), static_cast((intptr_t)(pshader_filter_econst + 8)), -1, } }, + { { pshader_filter_11 }, { nullptr }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 29)), 2, static_cast((intptr_t)(pshader_filter_econst + 32)), -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { pshader_filter_16 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, + { { pshader_filter_17 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 47)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 51)), static_cast((intptr_t)(pshader_filter_econst + 35)), } }, + { { pshader_filter_18 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((intptr_t)(pshader_filter_econst + 54)), static_cast((intptr_t)(pshader_filter_econst + 59)), -1, } }, + { { pshader_filter_19 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 62)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 66)), -1, } }, + { { pshader_filter_20 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, + { { pshader_filter_21 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 47)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 51)), static_cast((intptr_t)(pshader_filter_econst + 35)), } }, + { { pshader_filter_22 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 69)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 73)), -1, } }, + { { pshader_filter_23 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 62)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 66)), -1, } }, + { { pshader_filter_24 }, { nullptr }, { 0, 1, static_cast((intptr_t)(pshader_filter_econst + 35)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), static_cast((intptr_t)(pshader_filter_econst + 46)), static_cast((intptr_t)(pshader_filter_econst + 49)), } }, + { { pshader_filter_25 }, { nullptr }, { 0, -1, static_cast((intptr_t)(pshader_filter_econst + 76)), static_cast((intptr_t)(pshader_filter_econst + 37)), -1, static_cast((intptr_t)(pshader_filter_econst + 41)), -1, static_cast((intptr_t)(pshader_filter_econst + 67)), } }, + { { pshader_filter_26 }, { nullptr }, { 0, 1, -1, static_cast((intptr_t)(pshader_filter_econst + 78)), 2, static_cast((intptr_t)(pshader_filter_econst + 82)), static_cast((intptr_t)(pshader_filter_econst + 87)), -1, } }, + { { pshader_filter_27 }, { nullptr }, { 0, -1, -1, static_cast((intptr_t)(pshader_filter_econst + 37)), 2, static_cast((intptr_t)(pshader_filter_econst + 41)), -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, -1, -1, -1, -1, -1, } }, }; static unsigned char pshader_blur_2[368] = { @@ -1560,16 +1560,16 @@ static int pshader_blur_econst[256] = { }; static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { { NULL }, { NULL }, { -1, -1, -1, } }, - { { NULL }, { NULL }, { -1, -1, -1, } }, - { { pshader_blur_2 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 0)), static_cast((intptr_t)(pshader_blur_econst + 13)), } }, - { { pshader_blur_3 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 18)), static_cast((intptr_t)(pshader_blur_econst + 33)), } }, - { { pshader_blur_4 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 40)), static_cast((intptr_t)(pshader_blur_econst + 57)), } }, - { { pshader_blur_5 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 66)), static_cast((intptr_t)(pshader_blur_econst + 85)), } }, - { { pshader_blur_6 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 96)), static_cast((intptr_t)(pshader_blur_econst + 117)), } }, - { { pshader_blur_7 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 130)), static_cast((intptr_t)(pshader_blur_econst + 153)), } }, - { { pshader_blur_8 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 168)), static_cast((intptr_t)(pshader_blur_econst + 193)), } }, - { { pshader_blur_9 }, { NULL }, { 0, static_cast((intptr_t)(pshader_blur_econst + 210)), static_cast((intptr_t)(pshader_blur_econst + 237)), } }, + { { nullptr }, { nullptr }, { -1, -1, -1, } }, + { { nullptr }, { nullptr }, { -1, -1, -1, } }, + { { pshader_blur_2 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 0)), static_cast((intptr_t)(pshader_blur_econst + 13)), } }, + { { pshader_blur_3 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 18)), static_cast((intptr_t)(pshader_blur_econst + 33)), } }, + { { pshader_blur_4 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 40)), static_cast((intptr_t)(pshader_blur_econst + 57)), } }, + { { pshader_blur_5 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 66)), static_cast((intptr_t)(pshader_blur_econst + 85)), } }, + { { pshader_blur_6 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 96)), static_cast((intptr_t)(pshader_blur_econst + 117)), } }, + { { pshader_blur_7 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 130)), static_cast((intptr_t)(pshader_blur_econst + 153)), } }, + { { pshader_blur_8 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 168)), static_cast((intptr_t)(pshader_blur_econst + 193)), } }, + { { pshader_blur_9 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_blur_econst + 210)), static_cast((intptr_t)(pshader_blur_econst + 237)), } }, }; static unsigned char pshader_color_matrix_0[336] = { @@ -1598,7 +1598,7 @@ static int pshader_color_matrix_econst[12] = { }; static ProgramWithCachedVariableLocations pshader_color_matrix_arr[1] = { - { { pshader_color_matrix_0 }, { NULL }, { 0, static_cast((intptr_t)(pshader_color_matrix_econst + 0)), } }, + { { pshader_color_matrix_0 }, { nullptr }, { 0, static_cast((intptr_t)(pshader_color_matrix_econst + 0)), } }, }; static unsigned char vshader_vsps3_0[272] = { @@ -1655,8 +1655,8 @@ static unsigned char vshader_vsps3_2[240] = { }; static ProgramWithCachedVariableLocations vshader_vsps3_arr[3] = { - { { vshader_vsps3_0 }, { NULL }, { } }, - { { vshader_vsps3_1 }, { NULL }, { } }, - { { vshader_vsps3_2 }, { NULL }, { } }, + { { vshader_vsps3_0 }, { nullptr }, { } }, + { { vshader_vsps3_1 }, { nullptr }, { } }, + { { vshader_vsps3_2 }, { nullptr }, { } }, }; diff --git a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl index 639b4c921..6f8dd9c02 100644 --- a/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/PS3/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != NULL) { + while (s != nullptr) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, NULL); + return gdraw_HandleCacheLockStats(t, owner, nullptr); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = NULL; - c->state[i].cache = NULL; // should never follow cache link from sentinels! + c->state[i].owner = nullptr; + c->state[i].cache = nullptr; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = NULL; + c->state[i].raw_ptr = nullptr; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = NULL; + c->handle[i].raw_ptr = nullptr; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = NULL; + c->alloc = nullptr; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = NULL; + c->alloc_other = nullptr; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = NULL; + t->raw_ptr = nullptr; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -563,7 +563,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : NULL; + return (sentinel->next != sentinel) ? sentinel->next : nullptr; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -1095,7 +1095,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = NULL; + *start = nullptr; *num_bytes = 0; return; } else { @@ -1132,7 +1132,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return NULL; + return nullptr; arena->current = ptr + size; return ptr; @@ -1157,7 +1157,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, NULL-terminated list of elements in each hash +// There's a single-linked, nullptr-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1166,7 +1166,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, NULL-terminated list of unused blocks. Every block is either +// single-linked, nullptr-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1384,7 +1384,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != NULL); + GFXALLOC_ASSERT(alloc->unused_list != nullptr); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1457,7 +1457,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return NULL; + return nullptr; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1465,7 +1465,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return NULL; + return nullptr; memset(a, 0, size); @@ -1506,16 +1506,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, NULL, 0,0); + debug_complete_check(a, nullptr, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = NULL; + gfx_block_info *cur, *best = nullptr; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, NULL, 0,0); +debug_complete_check(alloc, nullptr, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1565,7 +1565,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return NULL; // not enough space! + return nullptr; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1735,7 +1735,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = NULL; + b->prev = nullptr; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1748,7 +1748,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1910,7 +1910,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = NULL; + void *ptr = nullptr; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2300,7 +2300,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = NULL; + ring->cur = nullptr; ring->seg_size = 0; } @@ -2310,7 +2310,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return NULL; // nope, won't fit + return nullptr; // nope, won't fit assert(align <= ring->align); @@ -2415,7 +2415,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2435,8 +2435,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return NULL; + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return nullptr; } #ifndef GDRAW_MANAGE_MEM @@ -2445,7 +2445,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2453,7 +2453,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, NULL, "memory"); + gdraw_res_alloc_outofmem(c, nullptr, "memory"); break; } } @@ -2468,8 +2468,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == NULL) { - gdraw_res_alloc_outofmem(c, NULL, "handles"); + if (t == nullptr) { + gdraw_res_alloc_outofmem(c, nullptr, "handles"); } } } @@ -2513,7 +2513,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = NULL; + r->owner = nullptr; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2521,11 +2521,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = NULL; + void *ptr = nullptr; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2537,7 +2537,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, NULL, "handles"); + return gdraw_res_alloc_outofmem(c, nullptr, "handles"); } // try to allocate first diff --git a/Minecraft.Client/PS3/Iggy/include/gdraw.h b/Minecraft.Client/PS3/Iggy/include/gdraw.h index 404a2642b..7cc4ddd0e 100644 --- a/Minecraft.Client/PS3/Iggy/include/gdraw.h +++ b/Minecraft.Client/PS3/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is NULL, then the pointers in 'prim' are machine pointers, and + If buf is nullptr, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-NULL, then use the appropriate vertex buffer, and the + If buf is non-nullptr, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or NULL if an error occured + $:return Handle for the newly created texture, or nullptr if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h b/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h index 1f1a90a1c..a42ccbfff 100644 --- a/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/PS3/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP +Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp b/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp index 38380bfb4..274061866 100644 --- a/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp +++ b/Minecraft.Client/PS3/Leaderboards/PS3LeaderboardManager.cpp @@ -30,7 +30,7 @@ PS3LeaderboardManager::PS3LeaderboardManager() m_myXUID = INVALID_XUID; - m_scores = NULL; //m_stats = NULL; + m_scores = nullptr; //m_stats = nullptr; m_statsType = eStatsType_Kills; m_difficulty = 0; @@ -42,7 +42,7 @@ PS3LeaderboardManager::PS3LeaderboardManager() InitializeCriticalSection(&m_csViewsLock); m_running = false; - m_threadScoreboard = NULL; + m_threadScoreboard = nullptr; } PS3LeaderboardManager::~PS3LeaderboardManager() @@ -196,7 +196,7 @@ bool PS3LeaderboardManager::getScoreByIds() CellRtcTick last_sort_date; SceNpScoreRankNumber mTotalRecord; - SceNpId *npIds = NULL; + SceNpId *npIds = nullptr; int ret; @@ -246,7 +246,7 @@ bool PS3LeaderboardManager::getScoreByIds() sceNpScoreDestroyTransactionCtx(ret); - if (npIds != NULL) delete [] npIds; + if (npIds != nullptr) delete [] npIds; return false; } else if (ret < 0) @@ -256,7 +256,7 @@ bool PS3LeaderboardManager::getScoreByIds() m_eStatsState = eStatsState_Failed; - if (npIds != NULL) delete [] npIds; + if (npIds != nullptr) delete [] npIds; return false; } else @@ -270,7 +270,7 @@ bool PS3LeaderboardManager::getScoreByIds() comments = new SceNpScoreComment[num]; /* app.DebugPrintf("sceNpScoreGetRankingByNpId(\n\t transaction=%i,\n\t boardID=0,\n\t npId=%i,\n\t friendCount*sizeof(SceNpId)=%i*%i=%i,\ - rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t NULL, 0, NULL, 0,\n\t friendCount=%i,\n...\n", + rankData=%i,\n\t friendCount*sizeof(SceNpScorePlayerRankData)=%i,\n\t nullptr, 0, nullptr, 0,\n\t friendCount=%i,\n...\n", transaction, npId, friendCount, sizeof(SceNpId), friendCount*sizeof(SceNpId), rankData, friendCount*sizeof(SceNpScorePlayerRankData), friendCount ); */ @@ -285,14 +285,14 @@ bool PS3LeaderboardManager::getScoreByIds() comments, sizeof(SceNpScoreComment) * num, //OUT: Comments - NULL, 0, // GameData. (unused) + nullptr, 0, // GameData. (unused) num, &last_sort_date, &mTotalRecord, - NULL // Reserved, specify null. + nullptr // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -319,7 +319,7 @@ bool PS3LeaderboardManager::getScoreByIds() delete [] comments; delete [] npIds; - m_scores = NULL; + m_scores = nullptr; m_readCount = 0; m_maxRank = num; @@ -335,7 +335,7 @@ bool PS3LeaderboardManager::getScoreByIds() m_readCount = num; // Filter scorers and construct output structure. - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_scores = new ReadScore[m_readCount]; convertToOutput(m_readCount, m_scores, ptr, comments); m_maxRank = m_readCount; @@ -368,7 +368,7 @@ error3: delete [] ptr; delete [] comments; error2: - if (npIds != NULL) delete [] npIds; + if (npIds != nullptr) delete [] npIds; error1: if (m_eStatsState != eStatsState_Canceled) m_eStatsState = eStatsState_Failed; app.DebugPrintf("[LeaderboardManger] getScoreByIds() FAILED, ret=0x%X\n", ret); @@ -422,14 +422,14 @@ bool PS3LeaderboardManager::getScoreByRange() comments, sizeof(SceNpScoreComment) * num, //OUT: Comment Data - NULL, 0, // GameData. + nullptr, 0, // GameData. num, &last_sort_date, &m_maxRank, // 'Total number of players registered in the target scoreboard.' - NULL // Reserved, specify null. + nullptr // Reserved, specify null. ); if (ret == SCE_NP_COMMUNITY_ERROR_ABORTED) @@ -454,7 +454,7 @@ bool PS3LeaderboardManager::getScoreByRange() delete [] ptr; delete [] comments; - m_scores = NULL; + m_scores = nullptr; m_readCount = 0; m_eStatsState = eStatsState_Ready; @@ -472,7 +472,7 @@ bool PS3LeaderboardManager::getScoreByRange() //m_stats = ptr; //Maybe: addPadding(num,ptr); - if (m_scores != NULL) delete [] m_scores; + if (m_scores != nullptr) delete [] m_scores; m_readCount = ret; m_scores = new ReadScore[m_readCount]; for (int i=0; i 0) ret = eStatsReturn_Success; - if (m_readListener != NULL) + if (m_readListener != nullptr) { app.DebugPrintf("[LeaderboardManager] OnStatsReadComplete(%i, %i, _), m_readCount=%i.\n", ret, m_maxRank, m_readCount); m_readListener->OnStatsReadComplete(ret, m_maxRank, view); @@ -621,16 +621,16 @@ void PS3LeaderboardManager::Tick() m_eStatsState = eStatsState_Idle; delete [] m_scores; - m_scores = NULL; + m_scores = nullptr; } break; case eStatsState_Failed: { view.m_numQueries = 0; - view.m_queries = NULL; + view.m_queries = nullptr; - if ( m_readListener != NULL ) + if ( m_readListener != nullptr ) m_readListener->OnStatsReadComplete(eStatsReturn_NetworkError, 0, view); m_eStatsState = eStatsState_Idle; @@ -652,7 +652,7 @@ bool PS3LeaderboardManager::OpenSession() { if (m_openSessions == 0) { - if (m_threadScoreboard == NULL) + if (m_threadScoreboard == nullptr) { m_threadScoreboard = new C4JThread(&scoreboardThreadEntry, this, "4JScoreboard"); m_threadScoreboard->SetProcessor(CPU_CORE_LEADERBOARDS); @@ -747,7 +747,7 @@ void PS3LeaderboardManager::FlushStats() {} void PS3LeaderboardManager::CancelOperation() { - m_readListener = NULL; + m_readListener = nullptr; m_eStatsState = eStatsState_Canceled; if (m_transactionCtx != 0) @@ -897,7 +897,7 @@ void PS3LeaderboardManager::fromBase32(void *out, SceNpScoreComment *in) for (int i = 0; i < SCE_NP_SCORE_COMMENT_MAXLEN; i++) { ch[0] = in->data[i]; - unsigned char fivebits = strtol(ch, NULL, 32) << 3; + unsigned char fivebits = strtol(ch, nullptr, 32) << 3; int sByte = (i*5) / 8; int eByte = (5+(i*5)) / 8; @@ -958,7 +958,7 @@ bool PS3LeaderboardManager::test_string(string testing) int ctx = sceNpScoreCreateTransactionCtx(m_titleContext); if (ctx<0) return false; - int ret = sceNpScoreCensorComment(ctx, (const void *) &comment, NULL); + int ret = sceNpScoreCensorComment(ctx, (const void *) &comment, nullptr); if (ret == SCE_NP_COMMUNITY_SERVER_ERROR_CENSORED) { diff --git a/Minecraft.Client/PS3/Miles/include/mss.h b/Minecraft.Client/PS3/Miles/include/mss.h index 531dcbc92..a9fd231a9 100644 --- a/Minecraft.Client/PS3/Miles/include/mss.h +++ b/Minecraft.Client/PS3/Miles/include/mss.h @@ -584,7 +584,7 @@ typedef enum } MSS_SPEAKER; // -// Pass to AIL_midiOutOpen for NULL MIDI driver +// Pass to AIL_midiOutOpen for nullptr MIDI driver // #define MIDI_NULL_DRIVER ((U32)(S32)-2) @@ -833,7 +833,7 @@ the enumeration function until it returns 0. #define DEFAULT_DPWOD ((UINTa)-1) // Preferred WaveOut device == WAVE_MAPPER #define DIG_PREFERRED_DS_DEVICE 20 -#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default NULL GUID +#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default nullptr GUID #define MDI_SEQUENCES 21 @@ -1305,7 +1305,7 @@ typedef ASIRESULT (AILCALL *ASI_STARTUP)(void); typedef ASIRESULT (AILCALL * ASI_SHUTDOWN)(void); // -// Return codec error message, or NULL if no errors have occurred since +// Return codec error message, or nullptr if no errors have occurred since // last call // // The ASI error text state is global to all streams @@ -1878,7 +1878,7 @@ typedef struct _S3DSTATE // Portion of HSAMPLE that deals with 3D posi F32 spread; - HSAMPLE owner; // May be NULL if used for temporary/internal calculations + HSAMPLE owner; // May be nullptr if used for temporary/internal calculations AILFALLOFFCB falloff_function; // User function for min/max distance calculations, if desired MSSVECTOR3D position_graph[MILES_MAX_SEGMENT_COUNT]; @@ -2460,7 +2460,7 @@ typedef struct _DIG_DRIVER // Handle to digital audio driver S32 DS_initialized; - AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none) + AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or nullptr if none) AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim) S32 DS_buffer_size; // Size of entire output buffer @@ -4866,10 +4866,10 @@ typedef struct U8 *MP3_file_image; // Original MP3_file_image pointer passed to AIL_inspect_MP3() S32 MP3_image_size; // Original MP3_image_size passed to AIL_inspect_MP3() - U8 *ID3v2; // ID3v2 tag, if not NULL + U8 *ID3v2; // ID3v2 tag, if not nullptr S32 ID3v2_size; // Size of tag in bytes - U8 *ID3v1; // ID3v1 tag, if not NULL (always 128 bytes long if present) + U8 *ID3v1; // ID3v1 tag, if not nullptr (always 128 bytes long if present) U8 *start_MP3_data; // Pointer to start of data area in file (not necessarily first valid frame) U8 *end_MP3_data; // Pointer to last valid byte in MP3 data area (before ID3v1 tag, if any) diff --git a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp index 8ab30bebd..a1a57443d 100644 --- a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.cpp @@ -19,8 +19,8 @@ #include "..\PS3Extras\PS3Strings.h" #include "PS3\Network\SonyRemoteStorage_PS3.h" -int (* SQRNetworkManager_PS3::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = NULL; -void * SQRNetworkManager_PS3::s_SignInCompleteParam = NULL; +int (* SQRNetworkManager_PS3::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = nullptr; +void * SQRNetworkManager_PS3::s_SignInCompleteParam = nullptr; SceNpBasicPresenceDetails2 SQRNetworkManager_PS3::s_lastPresenceInfo = { 0 }; int SQRNetworkManager_PS3::s_resendPresenceCountdown = 0; bool SQRNetworkManager_PS3::s_presenceStatusDirty = false; @@ -96,8 +96,8 @@ SQRNetworkManager_PS3::SQRNetworkManager_PS3(ISQRNetworkManagerListener *listene m_isInSession = false; m_offlineGame = false; m_offlineSQR = false; - m_aServerId = NULL; - m_gameBootInvite = NULL; + m_aServerId = nullptr; + m_gameBootInvite = nullptr; m_onlineStatus = false; m_bLinkDisconnected = false; @@ -151,7 +151,7 @@ void SQRNetworkManager_PS3::Initialise() // Initialise RUDP #ifdef __PS3__ - ret = cellRudpInit(NULL); + ret = cellRudpInit(nullptr); #else const int RUDP_POOL_SIZE = (500 * 1024); // TODO - find out what we need, this size is copied from library reference uint8_t *rudp_pool = (uint8_t *)malloc(RUDP_POOL_SIZE); @@ -258,7 +258,7 @@ void SQRNetworkManager_PS3::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } return; } @@ -268,7 +268,7 @@ void SQRNetworkManager_PS3::InitialiseAfterOnline() int ret = 0; if( !m_matching2initialised) { - ret = sceNpMatching2Init2(0, 0, NULL); + ret = sceNpMatching2Init2(0, 0, nullptr); } #else SceNpMatching2InitializeParameter initParam; @@ -339,7 +339,7 @@ void SQRNetworkManager_PS3::Tick() if( ( m_gameBootInvite ) && ( s_safeToRespondToGameBootInvite ) ) { m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); - m_gameBootInvite = NULL; + m_gameBootInvite = nullptr; } ErrorHandlingTick(); @@ -399,12 +399,12 @@ void SQRNetworkManager_PS3::Tick() if( s_signInCompleteCallbackIfFailed ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } else if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } @@ -421,7 +421,7 @@ void SQRNetworkManager_PS3::ErrorHandlingTick() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); if( m_isInSession && m_offlineGame) // m_offlineSQR ) // MGH - changed this to m_offlineGame, as m_offlineSQR can be true when running an online game but the init has failed because the servers are down @@ -531,7 +531,7 @@ void SQRNetworkManager_PS3::UpdateExternalRoomData() reqParam.roomBinAttrExternalNum = 1; reqParam.roomBinAttrExternal = &roomBinAttr; - int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); + int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SetRoomDataExternal returns 0x%x, number of players %d\n",ret,((char *)m_joinExtData)[174]); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA ) ) { @@ -564,7 +564,7 @@ bool SQRNetworkManager_PS3::FriendRoomManagerSearch() for( int i = 0; i < m_searchResultCount; i++ ) { free(m_aSearchResultRoomExtDataReceived[i]); - m_aSearchResultRoomExtDataReceived[i] = NULL; + m_aSearchResultRoomExtDataReceived[i] = nullptr; } m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT; @@ -639,7 +639,7 @@ void SQRNetworkManager_PS3::FriendSearchTick() { m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; delete m_getFriendCountThread; - m_getFriendCountThread = NULL; + m_getFriendCountThread = nullptr; FriendRoomManagerSearch2(); } } @@ -813,7 +813,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByIndex(int idx) } else { - return NULL; + return nullptr; } } @@ -830,7 +830,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByXuid(PlayerUID xuid) @@ -846,7 +846,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerByXuid(PlayerUID xuid) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetLocalPlayerByUserIndex(int idx) @@ -862,7 +862,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetLocalPlayerByUserIndex(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetHostPlayer() @@ -875,11 +875,11 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == NULL ) return NULL; + if( player == nullptr ) return nullptr; if( player->IsReady() ) return player; - return NULL; + return nullptr; } // Update state internally @@ -930,7 +930,7 @@ bool SQRNetworkManager_PS3::JoinRoom(SQRNetworkManager_PS3::SessionSearchResult { // Set up the presence info we would like to synchronise out when we have fully joined the game CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(&s_lastPresenceSyncInfo, searchResult->m_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, NULL); + return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, nullptr); } // Join room with a specified roomId. This is used when joining from an invite, as well as by the previous method @@ -996,7 +996,7 @@ void SQRNetworkManager_PS3::LeaveRoom(bool bActuallyLeaveRoom) reqParam.roomId = m_room; SetState(SNM_INT_STATE_LEAVING); - int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, NULL, &m_leaveRoomRequestId ); + int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, nullptr, &m_leaveRoomRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_LEAVE_ROOM) ) { SetState(SNM_INT_STATE_LEAVING_FAILED); @@ -1100,7 +1100,7 @@ bool SQRNetworkManager_PS3::AddLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL) ) { @@ -1148,7 +1148,7 @@ bool SQRNetworkManager_PS3::RemoveLocalPlayerByUserIndex(int idx) // And do any adjusting necessary to the mappings from this room data, to the SQRNetworkPlayers. // This will also delete the SQRNetworkPlayer and do all the callbacks that requires etc. MapRoomSlotPlayers(roomSlotPlayerCount); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; // Sync this back out to our networked clients... SyncRoomData(); @@ -1184,7 +1184,7 @@ bool SQRNetworkManager_PS3::RemoveLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2) ) { @@ -1216,7 +1216,7 @@ void SQRNetworkManager_PS3::SendInviteGUI() msg.mainType = SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE; msg.subType = SCE_NP_BASIC_MESSAGE_INVITE_SUBTYPE_ACTION_ACCEPT; msg.msgFeatures = SCE_NP_BASIC_MESSAGE_FEATURES_BOOTABLE; - msg.npids = NULL; + msg.npids = nullptr; msg.count = 0; uint8_t *subject = mallocAndCreateUTF8ArrayFromString(IDS_INVITATION_SUBJECT_MAX_18_CHARS); @@ -1284,7 +1284,7 @@ void SQRNetworkManager_PS3::FindOrCreateNonNetworkPlayer(int slot, int playerTyp } } // Create the player - non-network players can be considered complete as soon as we create them as we aren't waiting on their network connections becoming complete, so can flag them as such and notify via callback - PlayerUID *pUID = NULL; + PlayerUID *pUID = nullptr; PlayerUID localUID; if( ( playerType == SQRNetworkPlayer::SNP_TYPE_LOCAL ) || m_isHosting && ( playerType == SQRNetworkPlayer::SNP_TYPE_HOST ) ) @@ -1351,7 +1351,7 @@ void SQRNetworkManager_PS3::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1407,7 +1407,7 @@ void SQRNetworkManager_PS3::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1499,7 +1499,7 @@ void SQRNetworkManager_PS3::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_PS3::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) +bool SQRNetworkManager_PS3::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) { assert( m_isHosting ); @@ -1618,7 +1618,7 @@ void SQRNetworkManager_PS3::RemoveRemotePlayersAndSync( SceNpMatching2RoomMember } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; } else { @@ -1660,7 +1660,7 @@ void SQRNetworkManager_PS3::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } // And delete the reference from the ctx->player map @@ -1711,7 +1711,7 @@ void SQRNetworkManager_PS3::SyncRoomData() roomBinAttr.size = sizeof( m_roomSyncData ); reqParam.roomBinAttrInternalNum = 1; reqParam.roomBinAttrInternal = &roomBinAttr; - sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); + sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); } // Check if the matching context is valid, and if not attempt to create one. If to do this requires starting an asynchronous process, then sets the internal state to the state passed in @@ -1724,7 +1724,7 @@ bool SQRNetworkManager_PS3::GetMatchingContext(eSQRNetworkManagerInternalState a int ret = 0; if( !m_matching2initialised) { - ret = sceNpMatching2Init2(0, 0, NULL); + ret = sceNpMatching2Init2(0, 0, nullptr); } if( ret < 0 ) { @@ -1797,7 +1797,7 @@ bool SQRNetworkManager_PS3::GetServerContext() bool SQRNetworkManager_PS3::GetServerContext2() { // Get list of server IDs of servers allocated to the application - int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); + int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -1852,7 +1852,7 @@ bool SQRNetworkManager_PS3::GetServerContext(SceNpMatching2ServerId serverId) { // Get list of server IDs of servers allocated to the application. We don't actually need to do this, but it is as good a way as any to try a matching2 service and check that // the context *really* is valid. - int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); + int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -1906,7 +1906,7 @@ void SQRNetworkManager_PS3::ServerContextTick() reqParam.serverId = m_serverId; SetState((m_state==SNM_INT_STATE_HOSTING_SERVER_FOUND)?SNM_INT_STATE_HOSTING_SERVER_SEARCH_CREATING_CONTEXT:SNM_INT_STATE_JOINING_SERVER_SEARCH_CREATING_CONTEXT); // Found a server - now try and create a context for it - int ret = sceNpMatching2CreateServerContext( m_matchingContext, &reqParam, NULL, &m_serverContextRequestId ); + int ret = sceNpMatching2CreateServerContext( m_matchingContext, &reqParam, nullptr, &m_serverContextRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_SERVER_CONTEXT) ) { SetState((m_state==SNM_INT_STATE_HOSTING_SERVER_FOUND)?SNM_INT_STATE_HOSTING_SERVER_SEARCH_FAILED:SNM_INT_STATE_JOINING_SERVER_SEARCH_FAILED); @@ -1958,7 +1958,7 @@ void SQRNetworkManager_PS3::RoomCreateTick() SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_CREATING_ROOM); app.DebugPrintf(CMinecraftApp::USER_RR,">> Creating room start\n"); s_roomStartTime = System::currentTimeMillis(); - int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, NULL, &m_createRoomRequestId ); + int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, nullptr, &m_createRoomRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_JOIN_ROOM) ) { SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED); @@ -2105,7 +2105,7 @@ bool SQRNetworkManager_PS3::SelectRandomServer() // Kick off the search - we'll get a callback to DefaultRequestCallback with the result from this app.DebugPrintf(CMinecraftApp::USER_RR,"Kicking off sceNpMatching2GetServerInfo for server id %d\n",reqParam.serverId); - int ret = sceNpMatching2GetServerInfo( m_matchingContext, &reqParam, NULL, &m_serverSearchRequestId); + int ret = sceNpMatching2GetServerInfo( m_matchingContext, &reqParam, nullptr, &m_serverSearchRequestId); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_GET_SERVER_INFO) ) { // Jump straight to an error state for this server @@ -2125,7 +2125,7 @@ void SQRNetworkManager_PS3::DeleteServerContext() reqParam.serverId = m_serverId; m_serverContextValid = false; SetState(SNM_INT_STATE_SERVER_DELETING_CONTEXT); - int ret = sceNpMatching2DeleteServerContext( m_matchingContext, &reqParam, NULL, &m_serverContextRequestId ); + int ret = sceNpMatching2DeleteServerContext( m_matchingContext, &reqParam, nullptr, &m_serverContextRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_DELETE_SERVER_CONTEXT) ) { ResetToIdle(); @@ -2203,7 +2203,7 @@ bool SQRNetworkManager_PS3::CreateRudpConnections(SceNpMatching2RoomId roomId, S if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT) ) return false; if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, NULL ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, nullptr ); } else { @@ -2237,7 +2237,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRudpCtx(int rudpCtx) { return it->second; } - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRoomMemberAndLocalIdx(int roomMember, int localIdx) @@ -2249,7 +2249,7 @@ SQRNetworkPlayer *SQRNetworkManager_PS3::GetPlayerFromRoomMemberAndLocalIdx(int return it->second; } } - return NULL; + return nullptr; } @@ -2342,7 +2342,7 @@ void SQRNetworkManager_PS3::ContextCallback(SceNpMatching2ContextId id, SceNpMa { manager->SetState( SNM_INT_STATE_IDLE ); - manager->GetExtDataForRoom(0, NULL, NULL, NULL); + manager->GetExtDataForRoom(0, nullptr, nullptr, nullptr); break; } @@ -2373,7 +2373,7 @@ void SQRNetworkManager_PS3::ContextCallback(SceNpMatching2ContextId id, SceNpMa // if(s_SignInCompleteCallbackFn) // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); -// s_SignInCompleteCallbackFn = NULL; +// s_SignInCompleteCallbackFn = nullptr; // } @@ -2510,7 +2510,7 @@ void SQRNetworkManager_PS3::DefaultRequestCallback(SceNpMatching2ContextId id, S } } - // If there was some problem getting data, then silently ignore as we don't want to go any further with a NULL data pointer, and this will just be indicating that the networking context + // If there was some problem getting data, then silently ignore as we don't want to go any further with a nullptr data pointer, and this will just be indicating that the networking context // is invalid which will be picked up elsewhere to shut everything down properly if( dataError ) { @@ -2706,7 +2706,7 @@ void SQRNetworkManager_PS3::DefaultRequestCallback(SceNpMatching2ContextId id, S // Set flag to indicate whether we were kicked for being out of room or not reqParam.optData.data[0] = isFull ? 1 : 0; reqParam.optData.len = 1; - int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, NULL, &manager->m_kickRequestId); + int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, nullptr, &manager->m_kickRequestId); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2KickoutRoomMember returns error 0x%x\n",ret); break; } @@ -2814,7 +2814,7 @@ void SQRNetworkManager_PS3::RoomEventCallback(SceNpMatching2ContextId id, SceNpM case SCE_NP_MATCHING2_ROOM_EVENT_RoomDestroyed: { SonyVoiceChat::signalRoomDestroyed(); - SceNpMatching2RoomUpdateInfo *pUpdateInfo=NULL; + SceNpMatching2RoomUpdateInfo *pUpdateInfo=nullptr; if( dataSize <= SCE_NP_MATCHING2_EVENT_DATA_MAX_SIZE_RoomUpdateInfo ) { @@ -2937,7 +2937,7 @@ void SQRNetworkManager_PS3::RoomEventCallback(SceNpMatching2ContextId id, SceNpM reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_setRoomMemberInternalDataRequestId ); } } @@ -3037,7 +3037,7 @@ void SQRNetworkManager_PS3::SignallingCallback(SceNpMatching2ContextId ctxId, Sc reqParam.attrId = attrs; reqParam.attrIdNum = 1; - sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_roomMemberDataRequestId); + sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_roomMemberDataRequestId); } else { @@ -3118,7 +3118,7 @@ void SQRNetworkManager_PS3::SysUtilCallback(uint64_t status, uint64_t param, voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } return; } @@ -3133,7 +3133,7 @@ void SQRNetworkManager_PS3::SysUtilCallback(uint64_t status, uint64_t param, voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } @@ -3204,7 +3204,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er if( dataSize >= sizeof(SQRNetworkPlayer::InitSendData) ) { SQRNetworkPlayer::InitSendData ISD; - unsigned int bytesRead = cellRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, NULL ); + unsigned int bytesRead = cellRudpRead( ctx_id, &ISD, sizeof(SQRNetworkPlayer::InitSendData), 0, nullptr ); if( bytesRead == sizeof(SQRNetworkPlayer::InitSendData) ) { manager->NetworkPlayerInitialDataReceived(playerFrom, &ISD); @@ -3225,7 +3225,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er if( dataSize > 0 ) { unsigned char *data = new unsigned char [ dataSize ]; - unsigned int bytesRead = cellRudpRead( ctx_id, data, dataSize, 0, NULL ); + unsigned int bytesRead = cellRudpRead( ctx_id, data, dataSize, 0, nullptr ); if( bytesRead > 0 ) { SQRNetworkPlayer *playerFrom, *playerTo; @@ -3241,7 +3241,7 @@ void SQRNetworkManager_PS3::RudpContextCallback(int ctx_id, int event_id, int er playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) + if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -3306,7 +3306,7 @@ void SQRNetworkManager_PS3::ServerContextValid_CreateRoom() int ret = -1; if( !ForceErrorPoint(SNM_FORCE_ERROR_GET_WORLD_INFO_LIST) ) { - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); } if (ret < 0) { @@ -3335,7 +3335,7 @@ void SQRNetworkManager_PS3::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -3386,9 +3386,9 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void static SceNpMatching2RoomId aRoomId[1]; static SceNpMatching2AttributeId attr[1]; - // All parameters will be NULL if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). - // NULL parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList - if( extData != NULL ) + // All parameters will be nullptr if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). + // nullptr parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList + if( extData != nullptr ) { aRoomId[0] = roomId; attr[0] = SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_1_ID; @@ -3412,14 +3412,14 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void return; } - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { app.DebugPrintf("Having to recreate matching context, setting state to SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT\n"); return; } - int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, NULL, &m_roomDataExternalListRequestId ); + int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, nullptr, &m_roomDataExternalListRequestId ); // If we hadn't properly detected that a matching context was unvailable, we might still get an error indicating that it is from the previous call. Handle similarly, but we need // to destroy the context first. @@ -3434,7 +3434,7 @@ void SQRNetworkManager_PS3::GetExtDataForRoom( SceNpMatching2RoomId roomId, void m_FriendSessionUpdatedFn(false, m_pParamFriendSessionUpdated); return; }; - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { return; @@ -3530,7 +3530,7 @@ void SQRNetworkManager_PS3::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(voi { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } diff --git a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h index 6143bbb58..4953b08fa 100644 --- a/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h +++ b/Minecraft.Client/PS3/Network/SQRNetworkManager_PS3.h @@ -125,7 +125,7 @@ private: void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize); int GetSessionIndex(SQRNetworkPlayer *player); - bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = NULL ); + bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = nullptr ); void RemoveRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int mask ); void RemoveNetworkPlayers( int mask ); void SetLocalPlayersAndSync(); diff --git a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp index 230e03099..8ba847975 100644 --- a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.cpp @@ -9,22 +9,22 @@ bool SonyCommerce_PS3::m_bCommerceInitialised = false; SceNpCommerce2SessionInfo SonyCommerce_PS3::m_sessionInfo; SonyCommerce_PS3::State SonyCommerce_PS3::m_state = e_state_noSession; int SonyCommerce_PS3::m_errorCode = 0; -LPVOID SonyCommerce_PS3::m_callbackParam = NULL; +LPVOID SonyCommerce_PS3::m_callbackParam = nullptr; -void* SonyCommerce_PS3::m_receiveBuffer = NULL; +void* SonyCommerce_PS3::m_receiveBuffer = nullptr; SonyCommerce_PS3::Event SonyCommerce_PS3::m_event; std::queue SonyCommerce_PS3::m_messageQueue; -std::vector* SonyCommerce_PS3::m_pProductInfoList = NULL; -SonyCommerce_PS3::ProductInfoDetailed* SonyCommerce_PS3::m_pProductInfoDetailed = NULL; -SonyCommerce_PS3::ProductInfo* SonyCommerce_PS3::m_pProductInfo = NULL; +std::vector* SonyCommerce_PS3::m_pProductInfoList = nullptr; +SonyCommerce_PS3::ProductInfoDetailed* SonyCommerce_PS3::m_pProductInfoDetailed = nullptr; +SonyCommerce_PS3::ProductInfo* SonyCommerce_PS3::m_pProductInfo = nullptr; -SonyCommerce_PS3::CategoryInfo* SonyCommerce_PS3::m_pCategoryInfo = NULL; -const char* SonyCommerce_PS3::m_pProductID = NULL; -char* SonyCommerce_PS3::m_pCategoryID = NULL; +SonyCommerce_PS3::CategoryInfo* SonyCommerce_PS3::m_pCategoryInfo = nullptr; +const char* SonyCommerce_PS3::m_pProductID = nullptr; +char* SonyCommerce_PS3::m_pCategoryID = nullptr; SonyCommerce_PS3::CheckoutInputParams SonyCommerce_PS3::m_checkoutInputParams; SonyCommerce_PS3::DownloadListInputParams SonyCommerce_PS3::m_downloadInputParams; -SonyCommerce_PS3::CallbackFunc SonyCommerce_PS3::m_callbackFunc = NULL; +SonyCommerce_PS3::CallbackFunc SonyCommerce_PS3::m_callbackFunc = nullptr; sys_memory_container_t SonyCommerce_PS3::m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; bool SonyCommerce_PS3::m_bUpgradingTrial = false; @@ -40,19 +40,19 @@ bool SonyCommerce_PS3::m_contextCreated=false; ///< npcommerce2 context ID c SonyCommerce_PS3::Phase SonyCommerce_PS3::m_currentPhase = e_phase_stopped; ///< Current commerce2 util char SonyCommerce_PS3::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; -C4JThread* SonyCommerce_PS3::m_tickThread = NULL; +C4JThread* SonyCommerce_PS3::m_tickThread = nullptr; bool SonyCommerce_PS3::m_bLicenseChecked=false; // Check the trial/full license for the game SonyCommerce_PS3::ProductInfoDetailed s_trialUpgradeProductInfoDetailed; void SonyCommerce_PS3::Delete() { - m_pProductInfoList=NULL; - m_pProductInfoDetailed=NULL; - m_pProductInfo=NULL; - m_pCategoryInfo = NULL; - m_pProductID = NULL; - m_pCategoryID = NULL; + m_pProductInfoList=nullptr; + m_pProductInfoDetailed=nullptr; + m_pProductInfo=nullptr; + m_pCategoryInfo = nullptr; + m_pProductID = nullptr; + m_pCategoryID = nullptr; } void SonyCommerce_PS3::Init() { @@ -106,11 +106,11 @@ void SonyCommerce_PS3::CheckForTrialUpgradeKey() // 4J-PB - If we are the blu ray disc then we are the full version if(StorageManager.GetBootTypeDisc()) { - CheckForTrialUpgradeKey_Callback(NULL,true); + CheckForTrialUpgradeKey_Callback(nullptr,true); } else { - StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, NULL); + StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, nullptr); } } @@ -498,7 +498,7 @@ int SonyCommerce_PS3::getDetailedProductInfo(ProductInfoDetailed *pInfo, const c if (categoryId && categoryId[0] != 0) { ret = sceNpCommerce2GetProductInfoStart(requestId, categoryId, productId); } else { - ret = sceNpCommerce2GetProductInfoStart(requestId, NULL, productId); + ret = sceNpCommerce2GetProductInfoStart(requestId, nullptr, productId); } if (ret < 0) { sceNpCommerce2DestroyReq(requestId); @@ -887,7 +887,7 @@ int SonyCommerce_PS3::createContext() } // Create commerce2 context - ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, NULL, &m_contextId); + ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, nullptr, &m_contextId); if (ret < 0) { app.DebugPrintf(4,"createContext sceNpCommerce2CreateCtx problem\n"); @@ -1325,7 +1325,7 @@ void SonyCommerce_PS3::processEvent() m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1349,7 +1349,7 @@ void SonyCommerce_PS3::processEvent() m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1410,8 +1410,8 @@ void SonyCommerce_PS3::CreateSession( CallbackFunc cb, LPVOID lpParam ) EnterCriticalSection(&m_queueLock); setCallback(cb,lpParam); m_messageQueue.push(e_message_commerceCreateSession); - if(m_tickThread == NULL) - m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce_PS3 tick"); + if(m_tickThread == nullptr) + m_tickThread = new C4JThread(TickLoop, nullptr, "SonyCommerce_PS3 tick"); if(m_tickThread->isRunning() == false) { m_currentPhase = e_phase_idle; diff --git a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h index 1f43341a0..05b48cf85 100644 --- a/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h +++ b/Minecraft.Client/PS3/Network/SonyCommerce_PS3.h @@ -114,14 +114,14 @@ class SonyCommerce_PS3 : public SonyCommerce { assert(m_callbackFunc); CallbackFunc func = m_callbackFunc; - m_callbackFunc = NULL; + m_callbackFunc = nullptr; if(func) func(m_callbackParam, m_errorCode); m_errorCode = CELL_OK; } static void setCallback(CallbackFunc cb,LPVOID lpParam) { - assert(m_callbackFunc == NULL); + assert(m_callbackFunc == nullptr); m_callbackFunc = cb; m_callbackParam = lpParam; } diff --git a/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp b/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp index 5f804051e..4e681354f 100644 --- a/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyHttp_PS3.cpp @@ -10,10 +10,10 @@ static const int sc_SSLPoolSize = (512 * 1024U); static const int sc_CookiePoolSize = (256 * 1024U); -void* SonyHttp_PS3::uriPool = NULL; -void* SonyHttp_PS3::httpPool = NULL; -void* SonyHttp_PS3::sslPool = NULL; -void* SonyHttp_PS3::cookiePool = NULL; +void* SonyHttp_PS3::uriPool = nullptr; +void* SonyHttp_PS3::httpPool = nullptr; +void* SonyHttp_PS3::sslPool = nullptr; +void* SonyHttp_PS3::cookiePool = nullptr; CellHttpClientId SonyHttp_PS3::client; CellHttpTransId SonyHttp_PS3::trans; bool SonyHttp_PS3:: bInitialised = false; @@ -22,31 +22,31 @@ bool SonyHttp_PS3:: bInitialised = false; bool SonyHttp_PS3::loadCerts(size_t *numBufPtr, CellHttpsData **caListPtr) { - CellHttpsData *caList = NULL; + CellHttpsData *caList = nullptr; size_t size = 0; int ret = 0; - char *buf = NULL; + char *buf = nullptr; caList = static_cast(malloc(sizeof(CellHttpsData) * 2)); - if (NULL == caList) { + if (nullptr == caList) { app.DebugPrintf("failed to malloc cert data"); return false; } - ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, NULL, 0, &size); + ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, nullptr, 0, &size); if (ret < 0) { app.DebugPrintf("cellSslCertifacateLoader() failed(1): 0x%08x", ret); return ret; } buf = static_cast(malloc(size)); - if (NULL == buf) { + if (nullptr == buf) { app.DebugPrintf("failed to malloc cert buffer"); free(caList); return false; } - ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, buf, size, NULL); + ret = cellSslCertificateLoader(CELL_SSL_LOAD_CERT_ALL, buf, size, nullptr); if (ret < 0) { app.DebugPrintf("cellSslCertifacateLoader() failed(2): 0x%08x", ret); free(buf); @@ -72,7 +72,7 @@ bool SonyHttp_PS3::init() /*E startup procedures */ httpPool = malloc(sc_HTTPPoolSize); - if (httpPool == NULL) { + if (httpPool == nullptr) { app.DebugPrintf("failed to malloc libhttp memory pool\n"); return false; } @@ -84,7 +84,7 @@ bool SonyHttp_PS3::init() } cookiePool = malloc(sc_CookiePoolSize); - if (cookiePool == NULL) { + if (cookiePool == nullptr) { app.DebugPrintf("failed to malloc ssl memory pool\n"); return false; } @@ -97,7 +97,7 @@ bool SonyHttp_PS3::init() sslPool = malloc(sc_SSLPoolSize); - if (sslPool == NULL) { + if (sslPool == nullptr) { app.DebugPrintf("failed to malloc ssl memory pool\n"); return false; } @@ -109,7 +109,7 @@ bool SonyHttp_PS3::init() } size_t numBuf = 0; - CellHttpsData *caList = NULL; + CellHttpsData *caList = nullptr; if(!loadCerts(&numBuf, &caList)) return false; @@ -153,18 +153,18 @@ bool SonyHttp_PS3::parseUri(const char* szUri, CellHttpUri& parsedUri) { /*E the main part */ size_t poolSize = 0; - int ret = cellHttpUtilParseUri(NULL, szUri, NULL, 0, &poolSize); + int ret = cellHttpUtilParseUri(nullptr, szUri, nullptr, 0, &poolSize); if (0 > ret) { app.DebugPrintf("error parsing URI... (0x%x)\n\n", ret); return false; } - if (NULL == (uriPool = malloc(poolSize))) + if (nullptr == (uriPool = malloc(poolSize))) { app.DebugPrintf("error mallocing uriPool (%d)\n", poolSize); return false; } - ret = cellHttpUtilParseUri(&parsedUri, szUri, uriPool, poolSize, NULL); + ret = cellHttpUtilParseUri(&parsedUri, szUri, uriPool, poolSize, nullptr); if (0 > ret) { free(uriPool); @@ -185,7 +185,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) size_t localRecv = 0; if(!parseUri(url, uri)) - return NULL; + return nullptr; app.DebugPrintf(" scheme: %s\n", uri.scheme); app.DebugPrintf(" hostname: %s\n", uri.hostname); @@ -199,10 +199,10 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) if (0 > ret) { app.DebugPrintf("failed to create http transaction... (0x%x)\n\n", ret); - return NULL; + return nullptr; } - ret = cellHttpSendRequest(trans, NULL, 0, NULL); + ret = cellHttpSendRequest(trans, nullptr, 0, nullptr); if (0 > ret) { app.DebugPrintf("failed to complete http transaction... (0x%x)\n\n", ret); @@ -219,7 +219,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) app.DebugPrintf("failed to receive http response... (0x%x)\n\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return NULL; + return nullptr; } app.DebugPrintf("Status Code is %d\n", code); } @@ -232,14 +232,14 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) app.DebugPrintf("Only supporting data that has a content length : CELL_HTTP_ERROR_NO_CONTENT_LENGTH\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return NULL; + return nullptr; } else { app.DebugPrintf("error in receiving content length... (0x%x)\n\n", ret); cellHttpDestroyTransaction(trans); trans = 0; - return NULL; + return nullptr; } } @@ -261,7 +261,7 @@ void* SonyHttp_PS3::getData(const char* url, int* pDataSize) free(buffer); cellHttpDestroyTransaction(trans); trans = 0; - return NULL; + return nullptr; } else { diff --git a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp index a1f6c7fde..221e9f8fc 100644 --- a/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp +++ b/Minecraft.Client/PS3/Network/SonyRemoteStorage_PS3.cpp @@ -35,7 +35,7 @@ void SonyRemoteStorage_PS3::npauthhandler(int event, int result, void *arg) { psnTicketSize = result; psnTicket = malloc(psnTicketSize); - if (psnTicket == NULL) + if (psnTicket == nullptr) { app.DebugPrintf("Failed to allocate for ticket\n"); } @@ -67,7 +67,7 @@ int SonyRemoteStorage_PS3::initPreconditions() SceNpTicketVersion ticketVersion; ticketVersion.major = 3; ticketVersion.minor = 0; - ret = sceNpManagerRequestTicket2(&npId, &ticketVersion, TICKETING_SERVICE_ID, NULL, 0, NULL, 0); + ret = sceNpManagerRequestTicket2(&npId, &ticketVersion, TICKETING_SERVICE_ID, nullptr, 0, nullptr, 0); if(ret < 0) { return ret; @@ -78,7 +78,7 @@ int SonyRemoteStorage_PS3::initPreconditions() cellSysutilCheckCallback(); sys_timer_usleep(50000); //50 milliseconds. } - if(psnTicket == NULL) + if(psnTicket == nullptr) return -1; return 0; @@ -239,7 +239,7 @@ bool SonyRemoteStorage_PS3::init(CallbackFunc cb, LPVOID lpParam) params.timeout.receiveMs = 120 * 1000; //120 seconds is the default params.timeout.sendMs = 120 * 1000; //120 seconds is the default params.pool.memPoolSize = 7 * 1024 * 1024; - if(m_memPoolBuffer == NULL) + if(m_memPoolBuffer == nullptr) m_memPoolBuffer = malloc(params.pool.memPoolSize); params.pool.memPoolBuffer = m_memPoolBuffer; @@ -345,7 +345,7 @@ bool SonyRemoteStorage_PS3::setDataInternal() char seed[22]; app.GetImageTextData(m_thumbnailData, m_thumbnailDataSize,(unsigned char *)seed, uiHostOptions, bHostOptionsRead, uiTexturePack); - __int64 iSeed = strtoll(seed,NULL,10); + __int64 iSeed = strtoll(seed,nullptr,10); char seedHex[17]; sprintf(seedHex,"%016llx",iSeed); memcpy(descData.m_seed,seedHex,16); // Don't copy null diff --git a/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp b/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp index 41c52bed9..7a4d95aa2 100644 --- a/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp +++ b/Minecraft.Client/PS3/Network/SonyVoiceChat.cpp @@ -49,7 +49,7 @@ void SonyVoiceChat::init( SQRNetworkManager_PS3* pNetMan ) sm_pNetworkManager = pNetMan; setState(AVC_STATE_CHAT_INIT); - ProfileManager.GetChatAndContentRestrictions(0,false,&sm_isChatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(0,false,&sm_isChatRestricted,nullptr,nullptr); } void SonyVoiceChat::shutdown() @@ -225,11 +225,11 @@ void SonyVoiceChat::eventcb( CellSysutilAvc2EventId event_id, CellSysutilAvc2Eve { CELL_AVC2_EVENT_LEAVE_FAILED, eventcb_leave }, { CELL_AVC2_EVENT_UNLOAD_SUCCEEDED, eventcb_unload }, { CELL_AVC2_EVENT_UNLOAD_FAILED, eventcb_unload }, - { CELL_AVC2_EVENT_SYSTEM_NEW_MEMBER_JOINED, NULL }, - { CELL_AVC2_EVENT_SYSTEM_MEMBER_LEFT, NULL }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_ESTABLISHED, NULL }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_CANNOT_ESTABLISHED,NULL }, - { CELL_AVC2_EVENT_SYSTEM_SESSION_DISCONNECTED, NULL }, + { CELL_AVC2_EVENT_SYSTEM_NEW_MEMBER_JOINED, nullptr }, + { CELL_AVC2_EVENT_SYSTEM_MEMBER_LEFT, nullptr }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_ESTABLISHED, nullptr }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_CANNOT_ESTABLISHED,nullptr }, + { CELL_AVC2_EVENT_SYSTEM_SESSION_DISCONNECTED, nullptr }, { CELL_AVC2_EVENT_SYSTEM_VOICE_DETECTED, eventcb_voiceDetected }, }; @@ -258,7 +258,7 @@ int SonyVoiceChat::load() ret = cellSysutilAvc2LoadAsync( sm_pNetworkManager->m_matchingContext, SYS_MEMORY_CONTAINER_ID_INVALID, eventcb, - NULL, + nullptr, &g_chat_avc2param ); if( ret != CELL_OK ) { diff --git a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp index fd8ddd9ad..bce76078f 100644 --- a/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp +++ b/Minecraft.Client/PS3/PS3Extras/C4JSpursJob.cpp @@ -16,13 +16,13 @@ static const unsigned int NUM_SUBMIT_JOBS = 128; #define DMA_ALIGNMENT (128) #define JOBHEADER_SYMBOL(JobName) _binary_jqjob_##JobName##_jobbin2_jobheader -C4JSpursJobQueue* C4JSpursJobQueue::m_pMainJobQueue = NULL; +C4JSpursJobQueue* C4JSpursJobQueue::m_pMainJobQueue = nullptr; uint16_t C4JSpursJobQueue::Port::s_jobTagBitmask = 0; -C4JSpursJobQueue::Port* C4JSpursJobQueue::Port::s_allocatedPorts[16] = {NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL, - NULL,NULL,NULL,NULL }; +C4JSpursJobQueue::Port* C4JSpursJobQueue::Port::s_allocatedPorts[16] = {nullptr,nullptr,nullptr,nullptr, + nullptr,nullptr,nullptr,nullptr, + nullptr,nullptr,nullptr,nullptr, + nullptr,nullptr,nullptr,nullptr }; bool C4JSpursJobQueue::Port::s_initialised; CRITICAL_SECTION C4JSpursJobQueue::Port::s_lock; @@ -43,7 +43,7 @@ C4JSpursJobQueue::C4JSpursJobQueue() //E create jobQueue pJobQueue = (JobQueue*)memalign(CELL_SPURS_JOBQUEUE_ALIGN, sizeof(JobQueue)); - assert(pJobQueue != NULL); + assert(pJobQueue != nullptr); ret = JobQueue::create( pJobQueue, spurs, @@ -168,7 +168,7 @@ int C4JSpursJobQueue::Port::getFreeJobTag() void C4JSpursJobQueue::Port::releaseJobTag( int tag ) { s_jobTagBitmask &= ~(1< *pJobQueue; public: - static C4JSpursJobQueue& getMainJobQueue() {if(m_pMainJobQueue == NULL) m_pMainJobQueue = new C4JSpursJobQueue; return *m_pMainJobQueue;} + static C4JSpursJobQueue& getMainJobQueue() {if(m_pMainJobQueue == nullptr) m_pMainJobQueue = new C4JSpursJobQueue; return *m_pMainJobQueue;} C4JSpursJobQueue(); void shutdown(); diff --git a/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp b/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp index 94d7ef87d..56dd98783 100644 --- a/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp +++ b/Minecraft.Client/PS3/PS3Extras/C4JThread_SPU.cpp @@ -17,7 +17,7 @@ static const bool sc_verbose = true; -cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = NULL; +cell::Spurs::Spurs2* C4JThread_SPU::ms_spurs2Object = nullptr; void C4JThread_SPU::initSPURS() { diff --git a/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp b/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp index 2b0a523fe..53a8639d4 100644 --- a/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp +++ b/Minecraft.Client/PS3/PS3Extras/EdgeZLib.cpp @@ -3,7 +3,7 @@ #include "EdgeZLib.h" #include "edge/zlib/edgezlib_ppu.h" -static CellSpurs* s_pSpurs = NULL; +static CellSpurs* s_pSpurs = nullptr; //Set this to 5 if you want deflate/inflate to run in parallel on 5 SPUs. @@ -12,7 +12,7 @@ const uint32_t kMaxNumDeflateQueueEntries = 64; static CellSpursEventFlag s_eventFlagDeflate; //Cannot be on stack static CellSpursTaskset s_taskSetDeflate; //Cannot be on stack static EdgeZlibDeflateQHandle s_deflateQueue; -static void* s_pDeflateQueueBuffer = NULL; +static void* s_pDeflateQueueBuffer = nullptr; static void* s_pDeflateTaskContext[kNumDeflateTasks]; static uint32_t s_numElementsToCompress; //Cannot be on stack @@ -22,7 +22,7 @@ const uint32_t kMaxNumInflateQueueEntries = 64; static CellSpursEventFlag s_eventFlagInflate; //Cannot be on stack static CellSpursTaskset s_taskSetInflate; //Cannot be on stack static EdgeZlibInflateQHandle s_inflateQueue; -static void* s_pInflateQueueBuffer = NULL; +static void* s_pInflateQueueBuffer = nullptr; static void* s_pInflateTaskContext[kNumInflateTasks]; static uint32_t s_numElementsToDecompress; //Cannot be on stack @@ -195,9 +195,9 @@ bool EdgeZLib::Compress(void* pDestination, uint32_t* pDestSize, const void* pSo // The Deflate Task will wake up and process this work. // ////////////////////////////////////////////////////////////////////////// - uint32_t* pDst = NULL; + uint32_t* pDst = nullptr; bool findingSizeOnly = false; - if(pDestination == NULL && *pDestSize == 0) + if(pDestination == nullptr && *pDestSize == 0) { pDst = (uint32_t*)malloc(SrcSize); findingSizeOnly = true; diff --git a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp index a07646047..442aab06f 100644 --- a/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp +++ b/Minecraft.Client/PS3/PS3Extras/PS3Strings.cpp @@ -13,10 +13,10 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) if( (cd = l10n_get_converter( L10N_UTF16, L10N_UTF8 )) == -1 ) { app.DebugPrintf("l10n_get_converter: no such converter\n"); - return NULL; + return nullptr; } - l10n_convert_str( cd, wchString, &src_len, NULL, &dst_len ); + l10n_convert_str( cd, wchString, &src_len, nullptr, &dst_len ); uint8_t *strUtf8=static_cast(malloc(dst_len)); memset(strUtf8,0,dst_len); @@ -24,7 +24,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) if( result != ConversionOK ) { app.DebugPrintf("l10n_convert: conversion error : 0x%x\n", result); - return NULL; + return nullptr; } return strUtf8; diff --git a/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp b/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp index 2177739a6..9c462e728 100644 --- a/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp +++ b/Minecraft.Client/PS3/PS3Extras/Ps3Stubs.cpp @@ -74,8 +74,8 @@ int _wcsicmp( const wchar_t * dst, const wchar_t * src ) wchar_t f,l; // validation section - // _VALIDATE_RETURN(dst != NULL, EINVAL, _NLSCMPERROR); - // _VALIDATE_RETURN(src != NULL, EINVAL, _NLSCMPERROR); + // _VALIDATE_RETURN(dst != nullptr, EINVAL, _NLSCMPERROR); + // _VALIDATE_RETURN(src != nullptr, EINVAL, _NLSCMPERROR); do { f = towlower(*dst); @@ -90,7 +90,7 @@ size_t wcsnlen(const wchar_t *wcs, size_t maxsize) { size_t n; -// Note that we do not check if s == NULL, because we do not +// Note that we do not check if s == nullptr, because we do not // return errno_t... for (n = 0; n < maxsize && *wcs; n++, wcs++) @@ -134,7 +134,7 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime) lpSystemTime->wMilliseconds = cellRtcGetMicrosecond(&dateTime)/1000; } -HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PS3_STUBBED; return NULL; } +HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PS3_STUBBED; return nullptr; } VOID Sleep(DWORD dwMilliseconds) { C4JThread::Sleep(dwMilliseconds); @@ -267,8 +267,8 @@ BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { return TLSStoragePS3::In LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) { int err; - sys_addr_t newAddress = NULL; - if(lpAddress == NULL) + sys_addr_t newAddress = nullptr; + if(lpAddress == nullptr) { // reserve, and possibly commit also int commitSize = 0; @@ -382,7 +382,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi int fd = (int) hFile; uint64_t pos = 0, bitsToMove = (int64_t) lDistanceToMove; - if (lpDistanceToMoveHigh != NULL) + if (lpDistanceToMoveHigh != nullptr) bitsToMove |= ((uint64_t) (*lpDistanceToMoveHigh)) << 32; int whence = 0; @@ -490,7 +490,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, } else { - err = cellFsOpen(filePath, flags, &fd ,NULL, 0); + err = cellFsOpen(filePath, flags, &fd ,nullptr, 0); iFilesOpen++; //printf("\n\nFiles Open - %d\n\n",iFilesOpen); } @@ -675,7 +675,7 @@ errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_ int _wtoi(const wchar_t *_Str) { - return wcstol(_Str, NULL, 10); + return wcstol(_Str, nullptr, 10); } diff --git a/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp b/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp index e7eca53f4..a04e45d9f 100644 --- a/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp +++ b/Minecraft.Client/PS3/PS3Extras/ShutdownManager.cpp @@ -16,12 +16,12 @@ C4JThread::EventArray *ShutdownManager::s_eventArray[eThreadIdCount]; void ShutdownManager::Initialise() { #ifdef __PS3__ - cellSysutilRegisterCallback( 1, SysUtilCallback, NULL ); + cellSysutilRegisterCallback( 1, SysUtilCallback, nullptr ); for( int i = 0; i < eThreadIdCount; i++ ) { s_threadShouldRun[i] = true; s_threadRunning[i] = 0; - s_eventArray[i] = NULL; + s_eventArray[i] = nullptr; } // Special case for storage manager, which we will manually set now to be considered as running - this will be unset by StorageManager.ExitRequest if required s_threadRunning[eStorageManagerThreads] = true; diff --git a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp index 0906802df..a3b09d6d1 100644 --- a/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp +++ b/Minecraft.Client/PS3/PS3Extras/TLSStorage.cpp @@ -4,7 +4,7 @@ -TLSStoragePS3* TLSStoragePS3::m_pInstance = NULL; +TLSStoragePS3* TLSStoragePS3::m_pInstance = nullptr; BOOL TLSStoragePS3::m_activeList[sc_maxSlots]; __thread LPVOID TLSStoragePS3::m_values[sc_maxSlots]; @@ -16,7 +16,7 @@ TLSStoragePS3::TLSStoragePS3() for(int i=0;ichDLCKeyname,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,pDLCInfo->chDLCKeyname,sizeof(char)*uiVal,&bytesRead,nullptr); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,nullptr); app.DebugPrintf("DLC title %s\n",chDLCTitle); - WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,nullptr); // push this into a vector @@ -345,7 +345,7 @@ void CConsoleMinecraftApp::FatalLoadError() } app.DebugPrintf("Requesting Message Box for Fatal Error\n"); - EMsgBoxResult eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,NULL,this,(char *)u8Message,0); + EMsgBoxResult eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,nullptr,this,(char *)u8Message,0); while ((eResult==EMsgBox_Busy) || (eResult==EMsgBox_SysUtilBusy)) { @@ -359,7 +359,7 @@ void CConsoleMinecraftApp::FatalLoadError() _Exit(0); } app.DebugPrintf("Requesting Message Box for Fatal Error again due to BUSY\n"); - eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,NULL,this,(char *)u8Message,0); + eResult=InputManager.RequestMessageBox(EMSgBoxType_None,0,nullptr,this,(char *)u8Message,0); } while(1) @@ -483,7 +483,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(NULL); + app.setLevelGenerationOptions(nullptr); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -521,7 +521,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() #ifdef SAVE_GAME_TO_LOAD param->saveData = LoadSaveFromDisk(wstring(SAVE_GAME_TO_LOAD)); #else - param->saveData = NULL; + param->saveData = nullptr; #endif app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); @@ -728,7 +728,7 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo() { if(m_bCommerceCategoriesRetrieved==false) { - return NULL; + return nullptr; } return &m_CategoryInfo; @@ -742,10 +742,10 @@ void CConsoleMinecraftApp::ClearCommerceDetails() pProductList->clear(); } - if(m_ProductListA!=NULL) + if(m_ProductListA!=nullptr) { delete [] m_ProductListA; - m_ProductListA=NULL; + m_ProductListA=nullptr; } m_ProductListRetrievedC=0; @@ -831,7 +831,7 @@ std::vector* CConsoleMinecraftApp::GetProductList(int { if((m_bCommerceProductListRetrieved==false) || (m_bProductListAdditionalDetailsRetrieved==false) ) { - return NULL; + return nullptr; } return &m_ProductListA[iIndex]; @@ -1181,7 +1181,7 @@ char *PatchFilelist[] = - NULL + nullptr }; bool CConsoleMinecraftApp::IsFileInPatchList(LPCSTR lpFileName) @@ -1226,7 +1226,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); bool bEmptyStore=true; - if(pCategories!=NULL) + if(pCategories!=nullptr) { if(pCategories->countOfProducts>0) { diff --git a/Minecraft.Client/PS3/PS3_App.h b/Minecraft.Client/PS3/PS3_App.h index d1ecdb6f5..f9293b6fd 100644 --- a/Minecraft.Client/PS3/PS3_App.h +++ b/Minecraft.Client/PS3/PS3_App.h @@ -88,7 +88,7 @@ public: // void SetVoiceChatAndUGCRestricted(bool bRestricted); // bool GetVoiceChatAndUGCRestricted(void); - StringTable *GetStringTable() { return NULL;} + StringTable *GetStringTable() { return nullptr;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/PS3/PS3_Minecraft.cpp b/Minecraft.Client/PS3/PS3_Minecraft.cpp index 53b47d2d0..2210a5651 100644 --- a/Minecraft.Client/PS3/PS3_Minecraft.cpp +++ b/Minecraft.Client/PS3/PS3_Minecraft.cpp @@ -355,9 +355,9 @@ void MemSect(int sect) #endif -ID3D11Device* g_pd3dDevice = NULL; -ID3D11DeviceContext* g_pImmediateContext = NULL; -IDXGISwapChain* g_pSwapChain = NULL; +ID3D11Device* g_pd3dDevice = nullptr; +ID3D11DeviceContext* g_pImmediateContext = nullptr; +IDXGISwapChain* g_pSwapChain = nullptr; bool g_bBootedFromInvite = false; //-------------------------------------------------------------------------------------- @@ -419,7 +419,7 @@ static void * load_file( char const * name ) void debugSaveGameDirect() { - C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, NULL, "debugSaveGameDirect"); + C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, nullptr, "debugSaveGameDirect"); thread->Run(); thread->WaitForCompletion(1000); } @@ -446,7 +446,7 @@ int simpleMessageBoxCallback( UINT uiTitle, UINT uiText, ui.RequestMessageBox( uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, app.GetStringTable(), - NULL, 0 + nullptr, 0 ); return 0; @@ -632,7 +632,7 @@ int LoadSysModules() DEBUG_PRINTF("contentInfoPath - %s\n",contentInfoPath); DEBUG_PRINTF("usrdirPath - %s\n",usrdirPath); - ret=cellGamePatchCheck(&sizeBD,NULL); + ret=cellGamePatchCheck(&sizeBD,nullptr); if(ret < 0) { DEBUG_PRINTF("cellGamePatchCheck() Error: 0x%x\n", ret); @@ -838,7 +838,7 @@ int main() else ui.init(1280,480); - app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL + app.CommerceInit(); // MGH - moved this here so GetCommerce isn't nullptr // 4J-PB - Kick of the check for trial or full version - requires ui to be initialised app.GetCommerce()->CheckForTrialUpgradeKey(); @@ -861,7 +861,7 @@ int main() } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -976,24 +976,24 @@ int main() free(szTemp); StorageManager.SetDefaultImages((PBYTE)baOptionsIcon.data, baOptionsIcon.length,(PBYTE)baSaveImage.data, baSaveImage.length,(PBYTE)baSaveThumbnail.data, baSaveThumbnail.length); - if(baOptionsIcon.data!=NULL) + if(baOptionsIcon.data!=nullptr) { delete [] baOptionsIcon.data; } - if(baSaveThumbnail.data!=NULL) + if(baSaveThumbnail.data!=nullptr) { delete [] baSaveThumbnail.data; } - if(baSaveImage.data!=NULL) + if(baSaveImage.data!=nullptr) { delete [] baSaveImage.data; } wstring wsName=L"Graphics\\SaveChest.png"; byteArray baSaveLoadIcon = app.getArchiveFile(wsName); - if(baSaveLoadIcon.data!=NULL) + if(baSaveLoadIcon.data!=nullptr) { StorageManager.SetSaveLoadIcon((PBYTE)baSaveLoadIcon.data, baSaveLoadIcon.length); delete [] baSaveLoadIcon.data; @@ -1038,7 +1038,7 @@ int main() }*/ // set the achievement text for a trial achievement, now we have the string table loaded - ProfileManager.SetTrialTextStringTable(NULL, IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL); + ProfileManager.SetTrialTextStringTable(nullptr, IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL); ProfileManager.SetTrialAwardText(eAwardType_Achievement,IDS_UNLOCK_TITLE,IDS_UNLOCK_ACHIEVEMENT_TEXT); #ifndef __PS3__ ProfileManager.SetTrialAwardText(eAwardType_GamerPic,IDS_UNLOCK_TITLE,IDS_UNLOCK_GAMERPIC_TEXT); @@ -1108,7 +1108,7 @@ int main() // It's ok to do this for the primary PSN player here - it has this data locally. All other players need to do it on PSN sign in. // bool bChatRestricted=false; -// ProfileManager.GetChatAndContentRestrictions(0,&bChatRestricted,NULL,NULL); +// ProfileManager.GetChatAndContentRestrictions(0,&bChatRestricted,nullptr,nullptr); // 4J-PB - really want to wait until we've read the options, so we can set the right language if they've chosen one other than the default // bool bOptionsRead=false; @@ -1197,7 +1197,7 @@ int main() else { MemSect(28); - pMinecraft->soundEngine->tick(NULL, 0.0f); + pMinecraft->soundEngine->tick(nullptr, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1366,7 +1366,7 @@ vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); - if( strUtf8 != NULL ) + if( strUtf8 != nullptr ) { vRichPresenceStrings.push_back(strUtf8); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h index 8196032ec..929cc0d11 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/BedTile_SPU.h @@ -17,10 +17,10 @@ public: BedTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } virtual int getRenderShape() { return Tile_SPU::SHAPE_BED; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { setShape(); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h index f34a5ec94..1009396c0 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ButtonTile_SPU.h @@ -18,7 +18,7 @@ public: virtual bool blocksLight() { return false; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual bool isCubeShaped() { return false; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { int data = level->getData(x, y, z); int dir = data & 7; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h index 07eb3d86f..e617e84cf 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CakeTile_SPU.h @@ -5,7 +5,7 @@ class CakeTile_SPU : public Tile_SPU { public: CakeTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { int d = level->getData(x, y, z); float r = 1 / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h index 2854b48bb..199fceb6c 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/CauldronTile_SPU.h @@ -6,7 +6,7 @@ class CauldronTile_SPU : public Tile_SPU { public: CauldronTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } //@Override // virtual void updateDefaultShape(); virtual bool isSolidRender(bool isServerLevel = false) { return false; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp index 9aa7978a2..ac71c572a 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ChunkRebuildData.cpp @@ -696,7 +696,7 @@ bool ChunkRebuildData::isEmptyTile(int x, int y, int z) bool ChunkRebuildData::isSolidRenderTile(int x, int y, int z) { TileRef_SPU tile(getTile(x,y,z)); - if (tile.getPtr() == NULL) return false; + if (tile.getPtr() == nullptr) return false; // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so @@ -727,7 +727,7 @@ bool ChunkRebuildData::isSolidRenderTile(int x, int y, int z) bool ChunkRebuildData::isSolidBlockingTile(int x, int y, int z) { TileRef_SPU tile(getTile(x, y, z)); - if (tile.getPtr() == NULL) return false; + if (tile.getPtr() == nullptr) return false; bool ret = tile->getMaterial()->blocksMotion() && tile->isCubeShaped(); return ret; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h index f6671db49..2fcb15146 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/DoorTile_SPU.h @@ -24,7 +24,7 @@ public: virtual bool blocksLight() { return false; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual int getRenderShape() { return Tile_SPU::SHAPE_DOOR; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param int getDir(ChunkRebuildData *level, int x, int y, int z); bool isOpen(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h index 6e86d1f03..5e99cc320 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceGateTile_SPU.h @@ -12,7 +12,7 @@ public: Icon_SPU *getTexture(int face, int data) { return TileRef_SPU(wood_Id)->getTexture(face); } static int getDirection(int data) { return (data & DIRECTION_MASK); } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param // Brought forward from 1.2.3 + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param // Brought forward from 1.2.3 { int data = getDirection(level->getData(x, y, z)); if (data == Direction::NORTH || data == Direction::SOUTH) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp index fcb3baefb..63c206d1d 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.cpp @@ -59,7 +59,7 @@ bool FenceTile_SPU::connectsTo(ChunkRebuildData *level, int x, int y, int z) return true; } TileRef_SPU tileInstance(tile); - if (tileInstance.getPtr() != NULL) + if (tileInstance.getPtr() != nullptr) { if (tileInstance->getMaterial()->isSolidBlocking() && tileInstance->isCubeShaped()) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h index 50a775fb4..bed2e3b72 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/FenceTile_SPU.h @@ -5,7 +5,7 @@ class FenceTile_SPU : public Tile_SPU { public: FenceTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual bool blocksLight(); virtual bool isSolidRender(bool isServerLevel = false); virtual int getRenderShape(); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp index 1cf838219..1dba9757c 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.cpp @@ -3,7 +3,7 @@ #include "Facing_SPU.h" #include "ChunkRebuildData.h" -void HalfSlabTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData /* = -1 */, TileEntity* forceEntity /* = NULL */) +void HalfSlabTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData /* = -1 */, TileEntity* forceEntity /* = nullptr */) { if (fullSize()) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h index fd525e96b..c89581ad9 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/HalfSlabTile_SPU.h @@ -9,7 +9,7 @@ public: static const int TOP_SLOT_BIT = 8; HalfSlabTile_SPU(int id) : Tile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); virtual bool isSolidRender(bool isServerLevel); virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h index e8411c885..81ba68c19 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonBaseTile_SPU.h @@ -8,7 +8,7 @@ class PistonBaseTile_SPU : public Tile_SPU public: PistonBaseTile_SPU(int id) : Tile_SPU(id) {} // virtual void updateShape(float x0, float y0, float z0, float x1, float y1, float z1); - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } virtual int getRenderShape() { return SHAPE_PISTON_BASE; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h index d5460492e..ee559eff2 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonExtensionTile_SPU.h @@ -6,7 +6,7 @@ class PistonExtensionTile_SPU : public Tile_SPU public: PistonExtensionTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } virtual int getRenderShape() { return SHAPE_PISTON_EXTENSION; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } // virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h index 48fc52e91..6ea12648f 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PistonMovingPiece_SPU.h @@ -10,7 +10,7 @@ public: virtual int getRenderShape() { return SHAPE_INVISIBLE; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } - virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { // should never get here. } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h index f01313a11..a5a4652d8 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PortalTile_SPU.h @@ -5,7 +5,7 @@ class PortalTile_SPU : public HalfTransparentTile_SPU { public: PortalTile_SPU(int id): HalfTransparentTile_SPU(id) {} - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { if (level->getTile(x - 1, y, z) == id || level->getTile(x + 1, y, z) == id) { diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h index 133ec52e5..6742e6f6c 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/PressurePlateTile_SPU.h @@ -16,6 +16,6 @@ public: virtual bool isSolidRender(bool isServerLevel = false); virtual bool blocksLight(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); }; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h index 615ebec92..2f8639d4f 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RailTile_SPU.h @@ -10,7 +10,7 @@ public: RailTile_SPU(int id) : Tile_SPU(id) {} virtual bool isSolidRender(bool isServerLevel = false) { return false; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { int data = level->getData(x, y, z); if (data >= 2 && data <= 5) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h index 0e461118e..218cbd646 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/RedStoneDustTile_SPU.h @@ -26,7 +26,7 @@ public: case TEXTURE_CROSS_OVERLAY: return &ms_pTileData->redStoneDust_iconCrossOver; case TEXTURE_LINE_OVERLAY: return &ms_pTileData->redStoneDust_iconLineOver; } - return NULL; + return nullptr; } static bool shouldConnectTo(ChunkRebuildData *level, int x, int y, int z, int direction) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h index 7fe54d991..74bdb95d9 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/SignTile_SPU.h @@ -16,7 +16,7 @@ public: } Icon_SPU *getTexture(int face, int data){ return TileRef_SPU(wood_Id)->getTexture(face); } - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { if (onGround()) return; int face = level->getData(x, y, z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h index eefa36b2a..ca5ba279f 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StairTile_SPU.h @@ -15,7 +15,7 @@ public: public: StairTile_SPU(int id) : Tile_SPU(id) {} - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param bool isSolidRender(bool isServerLevel = false); int getRenderShape(); void setBaseShape(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h index 89cd3739c..4923e862d 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/StemTile_SPU.h @@ -35,7 +35,7 @@ public: this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss); } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { ms_pTileData->yy1[id] = (level->getData(x, y, z) * 2 + 2) / 16.0f; float ss = 0.125f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp index 7772aba9f..efcd44f01 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tesselator_SPU.cpp @@ -170,7 +170,7 @@ float convertHFloatToFloat(hfloat hf) // Tesselator_SPU *Tesselator_SPU::getInstance() { - return NULL; + return nullptr; // return (Tesselator_SPU *)TlsGetValue(tlsIdx); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h index 8aab31a35..87d87bcfa 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TheEndPortalFrameTile_SPU.h @@ -5,7 +5,7 @@ class TheEndPortalFrameTile_SPU : public Tile_SPU { public: TheEndPortalFrameTile_SPU(int id) : Tile_SPU(id) {} - virtual Icon_SPU *getTexture(int face, int data) { return NULL; } + virtual Icon_SPU *getTexture(int face, int data) { return nullptr; } virtual bool isSolidRender(bool isServerLevel = false) { return false; } virtual int getRenderShape() { return SHAPE_PORTAL_FRAME; } // virtual void updateDefaultShape(); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp index 20393f6ea..9e7d30de6 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.cpp @@ -74,7 +74,7 @@ Icon_SPU *ThinFenceTile_SPU::getEdgeTexture() #ifndef SN_TARGET_PS3_SPU assert(0); #endif - return NULL; + return nullptr; } bool ThinFenceTile_SPU::attachsTo(int tile) diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h index 61c392010..8f7b601b3 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/ThinFenceTile_SPU.h @@ -11,7 +11,7 @@ public: virtual int getRenderShape(); virtual bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face); virtual void updateDefaultShape(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual Icon_SPU *getEdgeTexture(); bool attachsTo(int tile); }; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp index fd9421af0..22c3a26d3 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp @@ -71,7 +71,7 @@ const float smallUV = ( 1.0f / 16.0f ); void TileRenderer_SPU::_init() { - fixedTexture = NULL; + fixedTexture = nullptr; xFlipTexture = false; noCulling = false; blsmooth = 1; @@ -103,7 +103,7 @@ TileRenderer_SPU::TileRenderer_SPU( ChunkRebuildData* level ) TileRenderer_SPU::TileRenderer_SPU() { - this->level = NULL; + this->level = nullptr; _init(); } @@ -122,12 +122,12 @@ void TileRenderer_SPU::setFixedTexture( Icon_SPU *fixedTexture ) void TileRenderer_SPU::clearFixedTexture() { - this->fixedTexture = NULL; + this->fixedTexture = nullptr; } bool TileRenderer_SPU::hasFixedTexture() { - return fixedTexture != NULL; + return fixedTexture != nullptr; } void TileRenderer_SPU::setShape(float x0, float y0, float z0, float x1, float y1, float z1) @@ -838,7 +838,7 @@ bool TileRenderer_SPU::tesselateFlowerPotInWorld(FlowerPotTile_SPU *tt, int x, i float xOff = 0; float yOff = 4; float zOff = 0; - Tile *plant = NULL; + Tile *plant = nullptr; switch (type) { @@ -858,7 +858,7 @@ bool TileRenderer_SPU::tesselateFlowerPotInWorld(FlowerPotTile_SPU *tt, int x, i t->addOffset(xOff / 16.0f, yOff / 16.0f, zOff / 16.0f); - if (plant != NULL) + if (plant != nullptr) { tesselateInWorld(plant, x, y, z); } @@ -1724,7 +1724,7 @@ bool TileRenderer_SPU::tesselateLeverInWorld( Tile_SPU* tt, int x, int y, int z } } - Vec3* c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; + Vec3* c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; for ( int i = 0; i < 6; i++ ) { if ( i == 0 ) @@ -1897,7 +1897,7 @@ bool TileRenderer_SPU::tesselateTripwireSourceInWorld(Tile_SPU *tt, int x, int y corners[i]->z += z + 0.5; } - Vec3 *c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; + Vec3 *c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; int stickX0 = 7; int stickX1 = 9; int stickY0 = 9; @@ -4586,7 +4586,7 @@ bool TileRenderer_SPU::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Ti else { /*#ifdef _DEBUG - if(dynamic_cast(tt)!=NULL) + if(dynamic_cast(tt)!=nullptr) { // stair tile faceFlags |= tt->shouldRenderFace( level, pX, pY - 1, pZ, 0 ) ? 0x01 : 0; @@ -7626,7 +7626,7 @@ Icon_SPU *TileRenderer_SPU::getTexture(Tile_SPU *tile) Icon_SPU *TileRenderer_SPU::getTextureOrMissing(Icon_SPU *Icon_SPU) { - if (Icon_SPU == NULL) + if (Icon_SPU == nullptr) { assert(0); // return minecraft->textures->getMissingIcon_SPU(Icon_SPU::TYPE_TERRAIN); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h index 2c484faaa..3f34a778a 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.h @@ -72,8 +72,8 @@ public: void tesselateInWorldFixedTexture( Tile_SPU* tile, int x, int y, int z, Icon_SPU *fixedTexture ); // 4J renamed to differentiate from tesselateInWorld void tesselateInWorldNoCulling( Tile_SPU* tile, int x, int y, int z, int forceData = -1, - TileEntity* forceEntity = NULL ); // 4J added forceData, forceEntity param - bool tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL ); // 4J added forceData, forceEntity param + TileEntity* forceEntity = nullptr ); // 4J added forceData, forceEntity param + bool tesselateInWorld( Tile_SPU* tt, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr ); // 4J added forceData, forceEntity param private: bool tesselateAirPortalFrameInWorld(TheEndPortalFrameTile *tt, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp index f2dfeaac7..c5a9be4d7 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp @@ -92,7 +92,7 @@ #include #include "AnvilTile_SPU.h" -TileData_SPU* Tile_SPU::ms_pTileData = NULL; +TileData_SPU* Tile_SPU::ms_pTileData = nullptr; Tile_SPU Tile_SPU::m_tiles[256]; @@ -181,7 +181,7 @@ Icon_SPU *Tile_SPU::getTexture(ChunkRebuildData *level, int x, int y, int z, int } - Icon_SPU *icon = NULL; + Icon_SPU *icon = nullptr; if(opaque) { LeafTile_SPU::setFancy(false); @@ -215,13 +215,13 @@ Icon_SPU *Tile_SPU::getTexture(int face) // void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, Entity *source) // { // AABB *aabb = getAABB(level, x, y, z); -// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); +// if (aabb != nullptr && box->intersects(aabb)) boxes->push_back(aabb); // } // // void Tile_SPU::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes) // { // AABB *aabb = getAABB(level, x, y, z); -// if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); +// if (aabb != nullptr && box->intersects(aabb)) boxes->push_back(aabb); // } // // AABB *Tile_SPU::getAABB(Level *level, int x, int y, int z) @@ -368,18 +368,18 @@ Icon_SPU *Tile_SPU::getTexture(int face) // Vec3 *zh0 = a->clipZ(b, zz0); // Vec3 *zh1 = a->clipZ(b, zz1); // -// Vec3 *closest = NULL; +// Vec3 *closest = nullptr; // -// if (containsX(xh0) && (closest == NULL || a->distanceTo(xh0) < a->distanceTo(closest))) closest = xh0; -// if (containsX(xh1) && (closest == NULL || a->distanceTo(xh1) < a->distanceTo(closest))) closest = xh1; -// if (containsY(yh0) && (closest == NULL || a->distanceTo(yh0) < a->distanceTo(closest))) closest = yh0; -// if (containsY(yh1) && (closest == NULL || a->distanceTo(yh1) < a->distanceTo(closest))) closest = yh1; -// if (containsZ(zh0) && (closest == NULL || a->distanceTo(zh0) < a->distanceTo(closest))) closest = zh0; -// if (containsZ(zh1) && (closest == NULL || a->distanceTo(zh1) < a->distanceTo(closest))) closest = zh1; +// if (containsX(xh0) && (closest == nullptr || a->distanceTo(xh0) < a->distanceTo(closest))) closest = xh0; +// if (containsX(xh1) && (closest == nullptr || a->distanceTo(xh1) < a->distanceTo(closest))) closest = xh1; +// if (containsY(yh0) && (closest == nullptr || a->distanceTo(yh0) < a->distanceTo(closest))) closest = yh0; +// if (containsY(yh1) && (closest == nullptr || a->distanceTo(yh1) < a->distanceTo(closest))) closest = yh1; +// if (containsZ(zh0) && (closest == nullptr || a->distanceTo(zh0) < a->distanceTo(closest))) closest = zh0; +// if (containsZ(zh1) && (closest == nullptr || a->distanceTo(zh1) < a->distanceTo(closest))) closest = zh1; // // LeaveCriticalSection(&m_csShape); // -// if (closest == NULL) return NULL; +// if (closest == nullptr) return nullptr; // // int face = -1; // @@ -395,19 +395,19 @@ Icon_SPU *Tile_SPU::getTexture(int face) // // bool Tile_SPU::containsX(Vec3 *v) // { -// if( v == NULL) return false; +// if( v == nullptr) return false; // return v->y >= yy0 && v->y <= yy1 && v->z >= zz0 && v->z <= zz1; // } // // bool Tile_SPU::containsY(Vec3 *v) // { -// if( v == NULL) return false; +// if( v == nullptr) return false; // return v->x >= xx0 && v->x <= xx1 && v->z >= zz0 && v->z <= zz1; // } // // bool Tile_SPU::containsZ(Vec3 *v) // { -// if( v == NULL) return false; +// if( v == nullptr) return false; // return v->x >= xx0 && v->x <= xx1 && v->y >= yy0 && v->y <= yy1; // } // @@ -516,7 +516,7 @@ void Tile_SPU::updateDefaultShape() // // 4J Stu - Special case - only record a crop destroy if is fully grown // if(id==Tile_SPU::crops_Id) // { -// if( Tile_SPU::crops->getResource(data, NULL, 0) > 0 ) +// if( Tile_SPU::crops->getResource(data, nullptr, 0) > 0 ) // player->awardStat(Stats::blocksMined[id], 1); // } // else @@ -533,7 +533,7 @@ void Tile_SPU::updateDefaultShape() // if (isCubeShaped() && !isEntityTile[id] && EnchantmentHelper::hasSilkTouch(player->inventory)) // { // shared_ptr item = getSilkTouchItemInstance(data); -// if (item != NULL) +// if (item != nullptr) // { // popResource(level, x, y, z, item); // } @@ -625,7 +625,7 @@ float Tile_SPU::getShadeBrightness(ChunkRebuildData *level, int x, int y, int z) Tile_SPU* Tile_SPU::createFromID( int tileID ) { if(tileID == 0) - return NULL; + return nullptr; if(m_tiles[tileID].id != -1) return &m_tiles[tileID]; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h index 484823efa..e3d11f044 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.h @@ -242,7 +242,7 @@ public: Icon_SPU *getTexture(int face, int data); Icon_SPU *getTexture(int face); public: - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param double getShapeX0(); double getShapeX1(); double getShapeY0(); @@ -465,7 +465,7 @@ public: double getShapeZ1() { return ms_pTileData->zz1[id]; } Material_SPU* getMaterial(); - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL); // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr); // 4J added forceData, forceEntity param virtual void updateDefaultShape(); virtual void setShape(float x0, float y0, float z0, float x1, float y1, float z1); virtual float getBrightness(ChunkRebuildData *level, int x, int y, int z); diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h index 2b5f86a58..43cffbf8e 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TopSnowTile_SPU.h @@ -14,7 +14,7 @@ public: bool blocksLight() { return false; } bool isSolidRender(bool isServerLevel = false) { return false; } bool isCubeShaped() { return false; } - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { int height = level->getData(x, y, z) & HEIGHT_MASK; float o = 2 * (1 + height) / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h index 6f096a17f..4f72c543f 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/TrapDoorTile_SPU.h @@ -21,7 +21,7 @@ public: bool isSolidRender(bool isServerLevel = false) { return false; } bool isCubeShaped() { return false; } int getRenderShape() { return Tile_SPU::SHAPE_BLOCK;} - void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { setShape(level->getData(x, y, z)); } diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h index e2f4a4ad4..7d94e750d 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/VineTile_SPU.h @@ -27,7 +27,7 @@ public: return false; } - virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param + virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = nullptr) // 4J added forceData, forceEntity param { const float thickness = 1.0f / 16.0f; diff --git a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h index e298ae2dc..7065210fe 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h +++ b/Minecraft.Client/PS3/SPU_Tasks/ChunkUpdate/stubs_SPU.h @@ -172,15 +172,15 @@ public: // { // public: // ZipFile(File *file) {} -// InputStream *getInputStream(ZipEntry *entry) { return NULL; } -// ZipEntry *getEntry(const wstring& name) {return NULL;} +// InputStream *getInputStream(ZipEntry *entry) { return nullptr; } +// ZipEntry *getEntry(const wstring& name) {return nullptr;} // void close() {} // }; // // class ImageIO // { // public: -// static BufferedImage *read(InputStream *in) { return NULL; } +// static BufferedImage *read(InputStream *in) { return nullptr; } // }; // // class Keyboard diff --git a/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp b/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp index dc134ecaf..16ea17bb5 100644 --- a/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp +++ b/Minecraft.Client/PS3/SPU_Tasks/CompressedTile/CompressedTileStorage_SPU.cpp @@ -315,7 +315,7 @@ void TileCompressData_SPU::loadAndUncompressLowerSection(int block, int x0, int // tile IDs first // --------------------------- - if(m_lowerBlocks[block] != NULL) + if(m_lowerBlocks[block] != nullptr) { int dmaSize = padTo16(m_lowerBlocksSize[block]); DmaData_SPU::getAndWait(m_pTileStorage->getDataPtr(), (uint32_t)m_lowerBlocks[block], dmaSize); @@ -366,7 +366,7 @@ void TileCompressData_SPU::loadAndUncompressLowerSection(int block, int x0, int void TileCompressData_SPU::loadAndUncompressUpperSection(int block, int x0, int z0, int x1, int z1) { - if(m_upperBlocks[block] != NULL) + if(m_upperBlocks[block] != nullptr) { int dmaSize = padTo16(m_upperBlocksSize[block]); DmaData_SPU::getAndWait(m_pTileStorage->getDataPtr(), (uint32_t)m_upperBlocks[block], dmaSize); @@ -507,7 +507,7 @@ void TileCompressData_SPU::setForChunk( Region* region, int x0, int y0, int z0 ) } else { - m_lowerBlocks[i*3+j] = NULL; + m_lowerBlocks[i*3+j] = nullptr; m_lowerBlocksSize[i*3+j] = 0; m_lowerSkyLight[i*3+j] = 0; m_lowerBlockLight[i*3+j] = 0; @@ -527,7 +527,7 @@ void TileCompressData_SPU::setForChunk( Region* region, int x0, int y0, int z0 ) } else { - m_upperBlocks[i*3+j] = NULL; + m_upperBlocks[i*3+j] = nullptr; m_upperBlocksSize[i*3+j] = 0; m_upperSkyLight[i*3+j] = 0; m_upperBlockLight[i*3+j] = 0; diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h index c0209eb66..644ab3e74 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Input.h @@ -145,8 +145,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); -// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); -// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); +// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); +// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); void GetText(uint16_t *UTF16String); diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h index ab6b6131f..4c1f4e013 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Profile.h @@ -191,7 +191,7 @@ public: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void InitialiseTrophies(); //CD - Don't use this, auto setup after login void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h index b08c9fba6..e5d19e20e 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Render.h @@ -20,8 +20,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { free(m_pBuffer); m_pBuffer = NULL; } - bool Allocated() { return m_pBuffer != NULL; } + void Release() { free(m_pBuffer); m_pBuffer = nullptr; } + bool Allocated() { return m_pBuffer != nullptr; } }; typedef struct @@ -63,7 +63,7 @@ public: void InitialiseContext(); void StartFrame(); void Present(); - void Clear(int flags, D3D11_RECT *pRect = NULL); + void Clear(int flags, D3D11_RECT *pRect = nullptr); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h b/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h index 552c247d4..4c9219a9f 100644 --- a/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/PSVita/4JLibs/inc/4J_Storage.h @@ -298,7 +298,7 @@ public: // Get details of existing savedata C4JStorage::ESaveGameState GetSavesInfo(int iPad,int ( *Func)(LPVOID lpParam,SAVE_DETAILS *pSaveDetails,const bool),LPVOID lpParam,char *pszSavePackName); // Start search - PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or NULL if not yet received) + PSAVE_DETAILS ReturnSavesInfo(); // Returns result of search (or nullptr if not yet received) void ClearSavesInfo(); // Clears results C4JStorage::ESaveGameState LoadSaveDataThumbnail(PSAVE_INFO pSaveInfo,int( *Func)(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes), LPVOID lpParam); // Get the thumbnail for an individual save referenced by pSaveInfo @@ -374,8 +374,8 @@ public: EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); CONTENT_DATA& GetDLC(DWORD dw); DWORD GetAvailableDLCCount( int iPad ); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = NULL); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive = nullptr); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); void SetDLCProductCode(const char* szProductCode); diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.cpp b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.cpp index fc5b190ad..7594f7ec9 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.cpp +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.cpp @@ -311,7 +311,7 @@ extern "C" void gdraw_psp2_wait(U64 fence_val) // // (once or several times) here // SceGxmNotification notify = gdraw_psp2_End(); // // --- again, may issue rendering calls here (but not draw Iggys) - // sceGxmEndScene(imm_ctx, NULL, ¬ify); + // sceGxmEndScene(imm_ctx, nullptr, ¬ify); // // That is, exactly one gdraw_psp2_Begin/_End pair for that scene, and // all IggyPlayerDraws must be inside that pair. That's it. @@ -360,7 +360,7 @@ static void gdraw_gpu_memcpy(GDrawHandleCache *c, void *dst, void *src, U32 num_ 0, 0, SCE_GXM_TRANSFER_COLORKEY_NONE, SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, srcp + offs, 0, 0, row_size, SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, dstp + offs, 0, 0, row_size, - NULL, 0, NULL); + nullptr, 0, nullptr); offs += num_rows * row_size; } @@ -375,7 +375,7 @@ static void gdraw_gpu_memcpy(GDrawHandleCache *c, void *dst, void *src, U32 num_ 0, 0, SCE_GXM_TRANSFER_COLORKEY_NONE, SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, srcp + offs, 0, 0, row_size, SCE_GXM_TRANSFER_FORMAT_RAW128, SCE_GXM_TRANSFER_LINEAR, dstp + offs, 0, 0, row_size, - NULL, 0, NULL); + nullptr, 0, nullptr); } if (c->is_vertex) @@ -436,7 +436,7 @@ static void api_free_resource(GDrawHandle *r) if (!r->cache->is_vertex) { for (S32 i=0; i < MAX_SAMPLERS; i++) if (gdraw->active_tex[i] == (GDrawTexture *) r) - gdraw->active_tex[i] = NULL; + gdraw->active_tex[i] = nullptr; } } @@ -462,7 +462,7 @@ static void track_dynamic_alloc_attempt(U32 size, U32 align) static void track_dynamic_alloc_failed() { if (gdraw->dynamic_stats.allocs_attempted == gdraw->dynamic_stats.allocs_succeeded + 1) { // warn the first time we run out of mem - IggyGDrawSendWarning(NULL, "GDraw out of dynamic memory"); + IggyGDrawSendWarning(nullptr, "GDraw out of dynamic memory"); } } @@ -506,7 +506,7 @@ GDrawTexture * RADLINK gdraw_psp2_WrappedTextureCreate(SceGxmTexture *tex) { GDrawStats stats = {}; GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); gdraw_psp2_WrappedTextureChange((GDrawTexture *) p, tex); return (GDrawTexture *) p; } @@ -561,11 +561,11 @@ static U32 tex_linear_stride(U32 width) static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format gformat, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { S32 bytes_pixel = 4; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; SceGxmTextureFormat format = SCE_GXM_TEXTURE_FORMAT_U8U8U8U8_ABGR; if (width > MAX_TEXTURE2D_DIM || height > MAX_TEXTURE2D_DIM) { - IggyGDrawSendWarning(NULL, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM); + IggyGDrawSendWarning(nullptr, "GDraw %d x %d texture not supported by hardware (dimension limit %d)", width, height, MAX_TEXTURE2D_DIM); return false; } @@ -611,7 +611,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, if (flags & GDRAW_MAKETEXTURE_FLAGS_mipmap) { rrbool ok; - assert(p->temp_buffer != NULL); + assert(p->temp_buffer != nullptr); ok = gdraw_MipmapBegin(&gdraw->mipmap, width, height, mipmaps, bytes_pixel, p->temp_buffer, p->temp_buffer_bytes); if (!ok) @@ -626,7 +626,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, p->i2 = height; } else { // non-mipmapped textures, we just upload straight to their destination - p->p1 = NULL; + p->p1 = nullptr; p->texture_data = (U8 *)t->raw_ptr; p->num_rows = height; p->stride_in_bytes = base_stride * bytes_pixel; @@ -723,8 +723,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void *unique_id, GDr static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != NULL); - if (t->owner == unique_id || unique_id == NULL) { + assert(t != nullptr); + if (t->owner == unique_id || unique_id == nullptr) { gdraw_res_kill(t, stats); } } @@ -744,7 +744,7 @@ static void RADLINK gdraw_DescribeTexture(GDrawTexture *tex, GDraw_Texture_Descr static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba) { - if (sceGxmTextureGetData(&gdraw->aa_tex) != NULL) + if (sceGxmTextureGetData(&gdraw->aa_tex) != nullptr) return; assert(width <= MAX_AATEX_WIDTH); @@ -801,7 +801,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != NULL); // @GDRAW_ASSERT + assert(h != nullptr); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_kill(h, stats); } @@ -931,8 +931,8 @@ static void set_common_renderstate() // clear our state caching memset(gdraw->active_tex, 0, sizeof(gdraw->active_tex)); gdraw->scissor_state = 0; - gdraw->cur_fp = NULL; - gdraw->cur_vp = NULL; + gdraw->cur_fp = nullptr; + gdraw->cur_vp = nullptr; // all the state we won't touch again until we're done rendering sceGxmSetCullMode(gxm, SCE_GXM_CULL_NONE); @@ -1032,7 +1032,7 @@ static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, F32 // must include anything necessary for texture creation/update static void RADLINK gdraw_RenderingBegin(void) { - assert(gdraw->gxm != NULL); // call after gdraw_psp2_Begin + assert(gdraw->gxm != nullptr); // call after gdraw_psp2_Begin set_common_renderstate(); } @@ -1061,7 +1061,7 @@ static void RADLINK gdraw_RenderTileBegin(S32 x0, S32 y0, S32 x1, S32 y1, S32 pa // clear our depth/stencil buffers (and also color if requested) clear_whole_surf(true, true, gdraw->next_tile_clear, stats); - gdraw->next_tile_clear = NULL; + gdraw->next_tile_clear = nullptr; } static void RADLINK gdraw_RenderTileEnd(GDrawStats *stats) @@ -1079,7 +1079,7 @@ void gdraw_psp2_Begin(SceGxmContext *context, const SceGxmColorSurface *color, c { U32 xmin, ymin, xmax, ymax; - assert(gdraw->gxm == NULL); // may not nest Begin calls + assert(gdraw->gxm == nullptr); // may not nest Begin calls // need to wait for the buffer to become idle before we can use it! gdraw_psp2_WaitForDynamicBufferIdle(dynamic_buf); @@ -1106,7 +1106,7 @@ void gdraw_psp2_Begin(SceGxmContext *context, const SceGxmColorSurface *color, c // - We need the stencil buffer to support Flash masking operations. // - We need the mask bit to perform pixel-accurate scissor testing. // There's only one format that satisfies both requirements. - IggyGDrawSendWarning(NULL, "Iggy rendering will not work correctly unless a depth/stencil buffer in DF32M_S8 format is provided."); + IggyGDrawSendWarning(nullptr, "Iggy rendering will not work correctly unless a depth/stencil buffer in DF32M_S8 format is provided."); } // For immediate contexts, we need to flush pending vertex transfers before @@ -1125,15 +1125,15 @@ SceGxmNotification gdraw_psp2_End() GDrawStats gdraw_stats = {}; SceGxmNotification notify; - assert(gdraw->gxm != NULL); // please keep Begin / End pairs properly matched + assert(gdraw->gxm != nullptr); // please keep Begin / End pairs properly matched notify = scene_end_notification(); gdraw->dyn_buf->sync = gdraw->scene_end_fence.value; gdraw->dyn_buf->stats = gdraw->dynamic_stats; - gdraw_arena_init(&gdraw->dynamic, NULL, 0); - gdraw->gxm = NULL; - gdraw->dyn_buf = NULL; + gdraw_arena_init(&gdraw->dynamic, nullptr, 0); + gdraw->gxm = nullptr; + gdraw->dyn_buf = nullptr; // NOTE: the stats from these go nowhere. That's a bit unfortunate, but the // GDrawStats model is that things can be accounted to something in the @@ -1173,13 +1173,13 @@ static void RADLINK gdraw_GetInfo(GDrawInfo *d) static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format format, U32 flags, void *owner, GDrawStats *stats) { - IggyGDrawSendWarning(NULL, "GDraw no rendertarget support on PSP2"); + IggyGDrawSendWarning(nullptr, "GDraw no rendertarget support on PSP2"); return false; } static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) { - return NULL; + return nullptr; } //////////////////////////////////////////////////////////////////////// @@ -1190,13 +1190,13 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) static void RADLINK gdraw_ClearStencilBits(U32 bits) { GDrawStats stats = {}; - clear_whole_surf(false, true, NULL, &stats); + clear_whole_surf(false, true, nullptr, &stats); } static void RADLINK gdraw_ClearID(void) { GDrawStats stats = {}; - clear_whole_surf(true, false, NULL, &stats); + clear_whole_surf(true, false, nullptr, &stats); } //////////////////////////////////////////////////////////////////////// @@ -1451,7 +1451,7 @@ static GDrawHandle *check_resource(void *ptr) #define check_resource(ptr) ((GDrawHandle *)(ptr)) #endif -static RADINLINE void fence_resources(void *r1, void *r2=NULL, void *r3=NULL) +static RADINLINE void fence_resources(void *r1, void *r2=nullptr, void *r3=nullptr) { GDrawFence fence = get_next_fence(); if (r1) check_resource(r1)->fence = fence; @@ -1592,7 +1592,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 // actual filter effects and special blends aren't supported on PSP2. if (r->blend_mode == GDRAW_BLEND_filter || r->blend_mode == GDRAW_BLEND_special) { - IggyGDrawSendWarning(NULL, "GDraw no filter or special blend support on PSP2"); + IggyGDrawSendWarning(nullptr, "GDraw no filter or special blend support on PSP2"); // just don't do anything. } else { // just a plain quad. @@ -1614,7 +1614,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 static bool gxm_check(SceGxmErrorCode err) { if (err != SCE_OK) - IggyGDrawSendWarning(NULL, "GXM error"); + IggyGDrawSendWarning(nullptr, "GXM error"); return err == SCE_OK; } @@ -1643,9 +1643,9 @@ static bool register_and_create_vertex_prog(SceGxmVertexProgram **out_prog, SceG SceGxmVertexStream stream; if (!register_shader(patcher, shader)) - return NULL; + return nullptr; - *out_prog = NULL; + *out_prog = nullptr; if (attr_bytes) { attr.streamIndex = 0; @@ -1659,7 +1659,7 @@ static bool register_and_create_vertex_prog(SceGxmVertexProgram **out_prog, SceG return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, &attr, 1, &stream, 1, out_prog)); } else - return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, NULL, 0, NULL, 0, out_prog)); + return gxm_check(sceGxmShaderPatcherCreateVertexProgram(patcher, shader->id, nullptr, 0, nullptr, 0, out_prog)); } static void destroy_vertex_prog(SceGxmShaderPatcher *patcher, SceGxmVertexProgram *prog) @@ -1670,8 +1670,8 @@ static void destroy_vertex_prog(SceGxmShaderPatcher *patcher, SceGxmVertexProgra static bool create_fragment_prog(SceGxmFragmentProgram **out_prog, SceGxmShaderPatcher *patcher, ShaderCode *shader, const SceGxmBlendInfo *blend, SceGxmOutputRegisterFormat out_fmt) { - *out_prog = NULL; - return gxm_check(sceGxmShaderPatcherCreateFragmentProgram(patcher, shader->id, out_fmt, SCE_GXM_MULTISAMPLE_NONE, blend, NULL, out_prog)); + *out_prog = nullptr; + return gxm_check(sceGxmShaderPatcherCreateFragmentProgram(patcher, shader->id, out_fmt, SCE_GXM_MULTISAMPLE_NONE, blend, nullptr, out_prog)); } static void destroy_fragment_prog(SceGxmShaderPatcher *patcher, SceGxmFragmentProgram *prog) @@ -1731,10 +1731,10 @@ static bool create_all_programs(SceGxmOutputRegisterFormat reg_format) } if (!register_shader(patcher, pshader_manual_clear_arr) || - !create_fragment_prog(&gdraw->clear_fp, patcher, pshader_manual_clear_arr, NULL, reg_format)) + !create_fragment_prog(&gdraw->clear_fp, patcher, pshader_manual_clear_arr, nullptr, reg_format)) return false; - gdraw->mask_update_fp = NULL; + gdraw->mask_update_fp = nullptr; return gxm_check(sceGxmShaderPatcherCreateMaskUpdateFragmentProgram(patcher, &gdraw->mask_update_fp)); } @@ -1786,7 +1786,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali one_pool_bytes = align_down(one_pool_bytes / 2, align); if (one_pool_bytes < (S32)align) - return NULL; + return nullptr; cache = (GDrawHandleCache *) IggyGDrawMalloc(cache_size + header_size); if (cache) { @@ -1805,7 +1805,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali cache->alloc = gfxalloc_create(gdraw_limits[type].ptr, one_pool_bytes, align, num_handles); if (!cache->alloc) { IggyGDrawFree(cache); - return NULL; + return nullptr; } if (use_twopool) { @@ -1813,7 +1813,7 @@ static GDrawHandleCache *make_handle_cache(gdraw_psp2_resourcetype type, U32 ali if (!cache->alloc_other) { IggyGDrawFree(cache->alloc); IggyGDrawFree(cache); - return NULL; + return nullptr; } // two dummy copies to make sure we have gpu read/write access @@ -1898,12 +1898,12 @@ int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 num_handles, case GDRAW_PSP2_RESOURCE_texture: free_handle_cache(gdraw->texturecache); gdraw->texturecache = make_handle_cache(GDRAW_PSP2_RESOURCE_texture, GDRAW_PSP2_TEXTURE_ALIGNMENT, true); - return gdraw->texturecache != NULL; + return gdraw->texturecache != nullptr; case GDRAW_PSP2_RESOURCE_vertexbuffer: free_handle_cache(gdraw->vbufcache); gdraw->vbufcache = make_handle_cache(GDRAW_PSP2_RESOURCE_vertexbuffer, GDRAW_PSP2_VERTEXBUFFER_ALIGNMENT, true); - return gdraw->vbufcache != NULL; + return gdraw->vbufcache != nullptr; default: return 0; @@ -1912,8 +1912,8 @@ int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 num_handles, void gdraw_psp2_ResetAllResourceMemory() { - gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_texture, 0, NULL, 0); - gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_vertexbuffer, 0, NULL, 0); + gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_texture, 0, nullptr, 0); + gdraw_psp2_SetResourceMemory(GDRAW_PSP2_RESOURCE_vertexbuffer, 0, nullptr, 0); } GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, void *context_mem, volatile U32 *notification, SceGxmOutputRegisterFormat reg_format) @@ -1935,7 +1935,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo }; gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return NULL; + if (!gdraw) return nullptr; memset(gdraw, 0, sizeof(*gdraw)); @@ -1961,7 +1961,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo if (!gdraw->quad_ib || !gdraw->mask_ib || !create_all_programs(reg_format)) { gdraw_psp2_DestroyContext(); - return NULL; + return nullptr; } // init quad index buffer @@ -1977,7 +1977,7 @@ GDrawFunctions *gdraw_psp2_CreateContext(SceGxmShaderPatcher *shader_patcher, vo gdraw->mask_draw_gpu = gdraw_arena_alloc(&gdraw->context_arena, sceGxmGetPrecomputedDrawSize(gdraw->mask_vp), SCE_GXM_PRECOMPUTED_ALIGNMENT); if (!gdraw->mask_draw_gpu) { gdraw_psp2_DestroyContext(); - return NULL; + return nullptr; } memcpy(gdraw->mask_ib, mask_ib_data, sizeof(mask_ib_data)); @@ -2048,7 +2048,7 @@ void gdraw_psp2_DestroyContext(void) free_handle_cache(gdraw->vbufcache); destroy_all_programs(); IggyGDrawFree(gdraw); - gdraw = NULL; + gdraw = nullptr; } } @@ -2070,7 +2070,7 @@ void RADLINK gdraw_psp2_EndCustomDraw(IggyCustomDrawCallbackRegion *region) GDrawTexture * RADLINK gdraw_psp2_MakeTextureFromResource(U8 *file_in_memory, S32 len, IggyFileTexturePSP2 *tex) { - SceGxmErrorCode (*init_func)(SceGxmTexture *texture, const void *data, SceGxmTextureFormat texFormat, uint32_t width, uint32_t height, uint32_t mipCount) = NULL; + SceGxmErrorCode (*init_func)(SceGxmTexture *texture, const void *data, SceGxmTextureFormat texFormat, uint32_t width, uint32_t height, uint32_t mipCount) = nullptr; switch (tex->texture.type) { case SCE_GXM_TEXTURE_SWIZZLED: init_func = sceGxmTextureInitSwizzled; break; @@ -2080,15 +2080,15 @@ GDrawTexture * RADLINK gdraw_psp2_MakeTextureFromResource(U8 *file_in_memory, S3 } if (!init_func) { - IggyGDrawSendWarning(NULL, "Unsupported texture type in MakeTextureFromResource"); - return NULL; + IggyGDrawSendWarning(nullptr, "Unsupported texture type in MakeTextureFromResource"); + return nullptr; } SceGxmTexture gxm; SceGxmErrorCode err = init_func(&gxm, file_in_memory + tex->file_offset, (SceGxmTextureFormat)tex->texture.format, tex->texture.width, tex->texture.height, tex->texture.mip_count); if (err != SCE_OK) { - IggyGDrawSendWarning(NULL, "Texture init failed in MakeTextureFromResource (bad data?)"); - return NULL; + IggyGDrawSendWarning(nullptr, "Texture init failed in MakeTextureFromResource (bad data?)"); + return nullptr; } return gdraw_psp2_WrappedTextureCreate(&gxm); diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.h b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.h index a606fbe3b..da31de707 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.h +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2.h @@ -68,7 +68,7 @@ IDOC extern int gdraw_psp2_SetResourceMemory(gdraw_psp2_resourcetype type, S32 n mapped to the GPU and *writeable*. If it isn't, the GPU will crash during either this function or CreateContext! - Pass in NULL for "ptr" and zero "num_bytes" to free the memory allocated to + Pass in nullptr for "ptr" and zero "num_bytes" to free the memory allocated to a specific pool. GDraw can run into cases where resource memory gets fragmented; we defragment @@ -121,7 +121,7 @@ IDOC extern GDrawFunctions * gdraw_psp2_CreateContext(SceGxmShaderPatcher *shade be valid for as long as a GDraw context is alive. If initialization fails for some reason (the main reason would be an out of memory condition), - NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_psp2_DestroyContext(void); /* Destroys the current GDraw context, if any. diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl index 9e2870eb2..6b0448f5c 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_psp2_shaders.inl @@ -532,24 +532,24 @@ static unsigned char pshader_basic_17[436] = { }; static ShaderCode pshader_basic_arr[18] = { - { pshader_basic_0, { NULL } }, - { pshader_basic_1, { NULL } }, - { pshader_basic_2, { NULL } }, - { pshader_basic_3, { NULL } }, - { pshader_basic_4, { NULL } }, - { pshader_basic_5, { NULL } }, - { pshader_basic_6, { NULL } }, - { pshader_basic_7, { NULL } }, - { pshader_basic_8, { NULL } }, - { pshader_basic_9, { NULL } }, - { pshader_basic_10, { NULL } }, - { pshader_basic_11, { NULL } }, - { pshader_basic_12, { NULL } }, - { pshader_basic_13, { NULL } }, - { pshader_basic_14, { NULL } }, - { pshader_basic_15, { NULL } }, - { pshader_basic_16, { NULL } }, - { pshader_basic_17, { NULL } }, + { pshader_basic_0, { nullptr } }, + { pshader_basic_1, { nullptr } }, + { pshader_basic_2, { nullptr } }, + { pshader_basic_3, { nullptr } }, + { pshader_basic_4, { nullptr } }, + { pshader_basic_5, { nullptr } }, + { pshader_basic_6, { nullptr } }, + { pshader_basic_7, { nullptr } }, + { pshader_basic_8, { nullptr } }, + { pshader_basic_9, { nullptr } }, + { pshader_basic_10, { nullptr } }, + { pshader_basic_11, { nullptr } }, + { pshader_basic_12, { nullptr } }, + { pshader_basic_13, { nullptr } }, + { pshader_basic_14, { nullptr } }, + { pshader_basic_15, { nullptr } }, + { pshader_basic_16, { nullptr } }, + { pshader_basic_17, { nullptr } }, }; static unsigned char pshader_manual_clear_0[220] = { @@ -570,7 +570,7 @@ static unsigned char pshader_manual_clear_0[220] = { }; static ShaderCode pshader_manual_clear_arr[1] = { - { pshader_manual_clear_0, { NULL } }, + { pshader_manual_clear_0, { nullptr } }, }; static unsigned char vshader_vspsp2_0[360] = { @@ -664,9 +664,9 @@ static unsigned char vshader_vspsp2_2[336] = { }; static ShaderCode vshader_vspsp2_arr[3] = { - { vshader_vspsp2_0, { NULL } }, - { vshader_vspsp2_1, { NULL } }, - { vshader_vspsp2_2, { NULL } }, + { vshader_vspsp2_0, { nullptr } }, + { vshader_vspsp2_1, { nullptr } }, + { vshader_vspsp2_2, { nullptr } }, }; static unsigned char vshader_vspsp2_mask_0[304] = { @@ -692,6 +692,6 @@ static unsigned char vshader_vspsp2_mask_0[304] = { }; static ShaderCode vshader_vspsp2_mask_arr[1] = { - { vshader_vspsp2_mask_0, { NULL } }, + { vshader_vspsp2_mask_0, { nullptr } }, }; diff --git a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl index ab78cd93a..6a439d8f1 100644 --- a/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/PSVita/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != NULL) { + while (s != nullptr) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, NULL); + return gdraw_HandleCacheLockStats(t, owner, nullptr); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = NULL; - c->state[i].cache = NULL; // should never follow cache link from sentinels! + c->state[i].owner = nullptr; + c->state[i].cache = nullptr; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = NULL; + c->state[i].raw_ptr = nullptr; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = NULL; + c->handle[i].raw_ptr = nullptr; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = NULL; + c->alloc = nullptr; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = NULL; + c->alloc_other = nullptr; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = NULL; + t->raw_ptr = nullptr; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -562,7 +562,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : NULL; + return (sentinel->next != sentinel) ? sentinel->next : nullptr; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -1094,7 +1094,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = NULL; + *start = nullptr; *num_bytes = 0; return; } else { @@ -1131,7 +1131,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return NULL; + return nullptr; arena->current = ptr + size; return ptr; @@ -1156,7 +1156,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, NULL-terminated list of elements in each hash +// There's a single-linked, nullptr-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1165,7 +1165,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, NULL-terminated list of unused blocks. Every block is either +// single-linked, nullptr-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1383,7 +1383,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != NULL); + GFXALLOC_ASSERT(alloc->unused_list != nullptr); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1456,7 +1456,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return NULL; + return nullptr; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1464,7 +1464,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return NULL; + return nullptr; memset(a, 0, size); @@ -1505,16 +1505,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, NULL, 0,0); + debug_complete_check(a, nullptr, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = NULL; + gfx_block_info *cur, *best = nullptr; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, NULL, 0,0); +debug_complete_check(alloc, nullptr, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1564,7 +1564,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return NULL; // not enough space! + return nullptr; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1734,7 +1734,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = NULL; + b->prev = nullptr; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1747,7 +1747,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1909,7 +1909,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = NULL; + void *ptr = nullptr; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2299,7 +2299,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = NULL; + ring->cur = nullptr; ring->seg_size = 0; } @@ -2309,7 +2309,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return NULL; // nope, won't fit + return nullptr; // nope, won't fit assert(align <= ring->align); @@ -2414,7 +2414,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2434,8 +2434,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return NULL; + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return nullptr; } #ifndef GDRAW_MANAGE_MEM @@ -2444,7 +2444,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2452,7 +2452,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, NULL, "memory"); + gdraw_res_alloc_outofmem(c, nullptr, "memory"); break; } } @@ -2467,8 +2467,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == NULL) { - gdraw_res_alloc_outofmem(c, NULL, "handles"); + if (t == nullptr) { + gdraw_res_alloc_outofmem(c, nullptr, "handles"); } } } @@ -2512,7 +2512,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = NULL; + r->owner = nullptr; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2520,11 +2520,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = NULL; + void *ptr = nullptr; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2536,7 +2536,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, NULL, "handles"); + return gdraw_res_alloc_outofmem(c, nullptr, "handles"); } // try to allocate first diff --git a/Minecraft.Client/PSVita/Iggy/include/gdraw.h b/Minecraft.Client/PSVita/Iggy/include/gdraw.h index 404a2642b..7cc4ddd0e 100644 --- a/Minecraft.Client/PSVita/Iggy/include/gdraw.h +++ b/Minecraft.Client/PSVita/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is NULL, then the pointers in 'prim' are machine pointers, and + If buf is nullptr, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-NULL, then use the appropriate vertex buffer, and the + If buf is non-nullptr, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or NULL if an error occured + $:return Handle for the newly created texture, or nullptr if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/PSVita/Iggy/include/iggyexpruntime.h b/Minecraft.Client/PSVita/Iggy/include/iggyexpruntime.h index 1f1a90a1c..a42ccbfff 100644 --- a/Minecraft.Client/PSVita/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/PSVita/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP +Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp b/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp index 958999e4b..c5a44878d 100644 --- a/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp +++ b/Minecraft.Client/PSVita/Leaderboards/PSVitaLeaderboardManager.cpp @@ -20,7 +20,7 @@ PSVitaLeaderboardManager::PSVitaLeaderboardManager() : SonyLeaderboardManager() HRESULT PSVitaLeaderboardManager::initialiseScoreUtility() { - return sceNpScoreInit( SCE_KERNEL_DEFAULT_PRIORITY_USER, SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT, NULL); + return sceNpScoreInit( SCE_KERNEL_DEFAULT_PRIORITY_USER, SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT, nullptr); } bool PSVitaLeaderboardManager::scoreUtilityAlreadyInitialised(HRESULT hr) diff --git a/Minecraft.Client/PSVita/Miles/include/mss.h b/Minecraft.Client/PSVita/Miles/include/mss.h index 531dcbc92..a9fd231a9 100644 --- a/Minecraft.Client/PSVita/Miles/include/mss.h +++ b/Minecraft.Client/PSVita/Miles/include/mss.h @@ -584,7 +584,7 @@ typedef enum } MSS_SPEAKER; // -// Pass to AIL_midiOutOpen for NULL MIDI driver +// Pass to AIL_midiOutOpen for nullptr MIDI driver // #define MIDI_NULL_DRIVER ((U32)(S32)-2) @@ -833,7 +833,7 @@ the enumeration function until it returns 0. #define DEFAULT_DPWOD ((UINTa)-1) // Preferred WaveOut device == WAVE_MAPPER #define DIG_PREFERRED_DS_DEVICE 20 -#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default NULL GUID +#define DEFAULT_DPDSD 0 // Preferred DirectSound device == default nullptr GUID #define MDI_SEQUENCES 21 @@ -1305,7 +1305,7 @@ typedef ASIRESULT (AILCALL *ASI_STARTUP)(void); typedef ASIRESULT (AILCALL * ASI_SHUTDOWN)(void); // -// Return codec error message, or NULL if no errors have occurred since +// Return codec error message, or nullptr if no errors have occurred since // last call // // The ASI error text state is global to all streams @@ -1878,7 +1878,7 @@ typedef struct _S3DSTATE // Portion of HSAMPLE that deals with 3D posi F32 spread; - HSAMPLE owner; // May be NULL if used for temporary/internal calculations + HSAMPLE owner; // May be nullptr if used for temporary/internal calculations AILFALLOFFCB falloff_function; // User function for min/max distance calculations, if desired MSSVECTOR3D position_graph[MILES_MAX_SEGMENT_COUNT]; @@ -2460,7 +2460,7 @@ typedef struct _DIG_DRIVER // Handle to digital audio driver S32 DS_initialized; - AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or NULL if none) + AILLPDIRECTSOUNDBUFFER DS_sec_buff; // Secondary buffer (or nullptr if none) AILLPDIRECTSOUNDBUFFER DS_out_buff; // Output buffer (may be sec or prim) S32 DS_buffer_size; // Size of entire output buffer @@ -4866,10 +4866,10 @@ typedef struct U8 *MP3_file_image; // Original MP3_file_image pointer passed to AIL_inspect_MP3() S32 MP3_image_size; // Original MP3_image_size passed to AIL_inspect_MP3() - U8 *ID3v2; // ID3v2 tag, if not NULL + U8 *ID3v2; // ID3v2 tag, if not nullptr S32 ID3v2_size; // Size of tag in bytes - U8 *ID3v1; // ID3v1 tag, if not NULL (always 128 bytes long if present) + U8 *ID3v1; // ID3v1 tag, if not nullptr (always 128 bytes long if present) U8 *start_MP3_data; // Pointer to start of data area in file (not necessarily first valid frame) U8 *end_MP3_data; // Pointer to last valid byte in MP3 data area (before ID3v1 tag, if any) diff --git a/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp b/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp index 1c5c45e31..9ed61d214 100644 --- a/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp +++ b/Minecraft.Client/PSVita/Network/PSVita_NPToolkit.cpp @@ -331,7 +331,7 @@ void hexStrToBin( val <<= 4; } else { - if (pBinBuf != NULL && binOffset < binBufSize) { + if (pBinBuf != nullptr && binOffset < binBufSize) { memcpy(pBinBuf + binOffset, &val, 1); val = 0; } @@ -339,7 +339,7 @@ void hexStrToBin( } } - if (val != 0 && pBinBuf != NULL && binOffset < binBufSize) { + if (val != 0 && pBinBuf != nullptr && binOffset < binBufSize) { memcpy(pBinBuf + binOffset, &val, 1); } @@ -403,7 +403,7 @@ void PSVitaNPToolkit::init() // extern void npStateCallback(SceNpServiceState state, int retCode, void *userdata); - ret = sceNpRegisterServiceStateCallback(npStateCallback, NULL); + ret = sceNpRegisterServiceStateCallback(npStateCallback, nullptr); if (ret < 0) { app.DebugPrintf("sceNpRegisterServiceStateCallback() failed. ret = 0x%x\n", ret); diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp index dc9ad61e6..1483d8e9d 100644 --- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.cpp @@ -45,8 +45,8 @@ int SQRNetworkManager_AdHoc_Vita::m_adhocStatus = false; static unsigned char s_Matching2Pool[SCE_NET_ADHOC_MATCHING_POOLSIZE_DEFAULT]; -int (* SQRNetworkManager_AdHoc_Vita::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = NULL; -void * SQRNetworkManager_AdHoc_Vita::s_SignInCompleteParam = NULL; +int (* SQRNetworkManager_AdHoc_Vita::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = nullptr; +void * SQRNetworkManager_AdHoc_Vita::s_SignInCompleteParam = nullptr; sce::Toolkit::NP::PresenceDetails SQRNetworkManager_AdHoc_Vita::s_lastPresenceInfo; int SQRNetworkManager_AdHoc_Vita::s_resendPresenceCountdown = 0; bool SQRNetworkManager_AdHoc_Vita::s_presenceStatusDirty = false; @@ -127,8 +127,8 @@ SQRNetworkManager_AdHoc_Vita::SQRNetworkManager_AdHoc_Vita(ISQRNetworkManagerLis m_isInSession = false; m_offlineGame = false; m_offlineSQR = false; - m_aServerId = NULL; -// m_gameBootInvite = NULL; + m_aServerId = nullptr; +// m_gameBootInvite = nullptr; m_adhocStatus = false; m_bLinkDisconnected = false; m_bIsInitialised=false; @@ -166,7 +166,7 @@ void SQRNetworkManager_AdHoc_Vita::Initialise() int32_t ret = 0; // int32_t libCtxId = 0; -// ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, NULL); +// ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, nullptr); // assert (ret >= 0); // libCtxId = ret; @@ -203,7 +203,7 @@ void SQRNetworkManager_AdHoc_Vita::Initialise() // npConf.commId = &s_npCommunicationId; // npConf.commPassphrase = &s_npCommunicationPassphrase; // npConf.commSignature = &s_npCommunicationSignature; -// ret = sceNpInit(&npConf, NULL); +// ret = sceNpInit(&npConf, nullptr); // if (ret < 0 && ret != SCE_NP_ERROR_ALREADY_INITIALIZED) // { // app.DebugPrintf("sceNpInit failed, ret=%x\n", ret); @@ -392,10 +392,10 @@ bool SQRNetworkManager_AdHoc_Vita::CreateMatchingContext(bool bServer /*= false* { if(m_aFriendSearchResults[i].m_RoomExtDataReceived) free(m_aFriendSearchResults[i].m_RoomExtDataReceived); - m_aFriendSearchResults[i].m_RoomExtDataReceived = NULL; + m_aFriendSearchResults[i].m_RoomExtDataReceived = nullptr; if(m_aFriendSearchResults[i].m_gameSessionData) free(m_aFriendSearchResults[i].m_gameSessionData); - m_aFriendSearchResults[i].m_gameSessionData = NULL; + m_aFriendSearchResults[i].m_gameSessionData = nullptr; } m_friendCount = 0; m_aFriendSearchResults.clear(); @@ -406,7 +406,7 @@ bool SQRNetworkManager_AdHoc_Vita::CreateMatchingContext(bool bServer /*= false* ret = sceNetAdhocMatchingStart(m_matchingContext, SCE_KERNEL_DEFAULT_PRIORITY_USER, MATCHING_EVENT_HANDLER_STACK_SIZE, SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT, - 0, NULL);//sizeof(g_myInfo.name), &g_myInfo.name); + 0, nullptr);//sizeof(g_myInfo.name), &g_myInfo.name); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_CONTEXT_START_ASYNC ) ) { @@ -448,7 +448,7 @@ void SQRNetworkManager_AdHoc_Vita::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } return; } @@ -512,7 +512,7 @@ void SQRNetworkManager_AdHoc_Vita::Tick() // if( ( m_gameBootInvite m) && ( s_safeToRespondToGameBootInvite ) ) // { // m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); -// m_gameBootInvite = NULL; +// m_gameBootInvite = nullptr; // } ErrorHandlingTick(); @@ -585,7 +585,7 @@ void SQRNetworkManager_AdHoc_Vita::ErrorHandlingTick() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); if( m_isInSession && m_offlineSQR ) @@ -777,7 +777,7 @@ void SQRNetworkManager_AdHoc_Vita::FriendSearchTick() // { // m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; // delete m_getFriendCountThread; -// m_getFriendCountThread = NULL; +// m_getFriendCountThread = nullptr; FriendRoomManagerSearch2(); // } } @@ -797,7 +797,7 @@ int SQRNetworkManager_AdHoc_Vita::BasicEventThreadProc( void *lpParameter ) // // do // { -// ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL); +// ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, nullptr); // // // If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread // if( event.udata == 0 ) @@ -855,7 +855,7 @@ int SQRNetworkManager_AdHoc_Vita::BasicEventThreadProc( void *lpParameter ) // // There shouldn't ever be more than 100 friends returned but limit here just in case // if( manager->m_friendCount > 100 ) manager->m_friendCount = 100; // -// SceNpId* friendIDs = NULL; +// SceNpId* friendIDs = nullptr; // if(manager->m_friendCount > 0) // { // // grab all the friend IDs first @@ -995,7 +995,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerByIndex(int idx) } else { - return NULL; + return nullptr; } } @@ -1012,7 +1012,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetLocalPlayerByUserIndex(int idx) @@ -1028,7 +1028,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetLocalPlayerByUserIndex(int id } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetHostPlayer() @@ -1041,11 +1041,11 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == NULL ) return NULL; + if( player == nullptr ) return nullptr; if( player->IsReady() ) return player; - return NULL; + return nullptr; } // Update state internally @@ -1117,7 +1117,7 @@ bool SQRNetworkManager_AdHoc_Vita::JoinRoom(SQRNetworkManager_AdHoc_Vita::Sessio { // Set up the presence info we would like to synchronise out when we have fully joined the game // CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(&s_lastPresenceSyncInfo, searchResult->m_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_netAddr, localPlayerMask, NULL); + return JoinRoom(searchResult->m_netAddr, localPlayerMask, nullptr); } bool SQRNetworkManager_AdHoc_Vita::JoinRoom(SceNpMatching2RoomId roomId, SceNpMatching2ServerId serverId, int localPlayerMask, const PresenceSyncInfo *presence) @@ -1162,7 +1162,7 @@ bool SQRNetworkManager_AdHoc_Vita::JoinRoom(SceNetInAddr netAddr, int localPlaye if(!CreateMatchingContext()) return false; - int err = sceNetAdhocMatchingSelectTarget(m_matchingContext, &netAddr, 0, NULL); + int err = sceNetAdhocMatchingSelectTarget(m_matchingContext, &netAddr, 0, nullptr); m_hostMemberId = getRoomMemberID(&netAddr); m_hostIPAddr = netAddr; @@ -1323,7 +1323,7 @@ void SQRNetworkManager_AdHoc_Vita::FindOrCreateNonNetworkPlayer(int slot, int pl } } // Create the player - non-network players can be considered complete as soon as we create them as we aren't waiting on their network connections becoming complete, so can flag them as such and notify via callback - PlayerUID *pUID = NULL; + PlayerUID *pUID = nullptr; PlayerUID localUID; if( ( playerType == SQRNetworkPlayer::SNP_TYPE_LOCAL ) || m_isHosting && ( playerType == SQRNetworkPlayer::SNP_TYPE_HOST ) ) @@ -1390,7 +1390,7 @@ void SQRNetworkManager_AdHoc_Vita::MapRoomSlotPlayers(int roomSlotPlayerCount/*= if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1446,7 +1446,7 @@ void SQRNetworkManager_AdHoc_Vita::MapRoomSlotPlayers(int roomSlotPlayerCount/*= if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1538,7 +1538,7 @@ void SQRNetworkManager_AdHoc_Vita::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_AdHoc_Vita::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) +bool SQRNetworkManager_AdHoc_Vita::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) { assert( m_isHosting ); @@ -1658,7 +1658,7 @@ void SQRNetworkManager_AdHoc_Vita::RemoveRemotePlayersAndSync( SceNpMatching2Roo } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; } else { @@ -1701,7 +1701,7 @@ void SQRNetworkManager_AdHoc_Vita::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } // And delete the reference from the ctx->player map @@ -1843,7 +1843,7 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe case SCE_NET_ADHOC_MATCHING_EVENT_REQUEST: // A join request was received app.DebugPrintf("P2P SCE_NET_ADHOC_MATCHING_EVENT_REQUEST Received!!\n"); - if (optlen > 0 && opt != NULL) + if (optlen > 0 && opt != nullptr) { ret = SCE_OK;// parentRequestAdd(opt); if (ret != SCE_OK) @@ -1987,7 +1987,7 @@ void SQRNetworkManager_AdHoc_Vita::MatchingEventHandler(int id, int event, SceNe { app.DebugPrintf("P2P SCE_NET_ADHOC_MATCHING_EVENT_DATA Received!!\n"); - if (optlen <= 0 || opt == NULL) + if (optlen <= 0 || opt == nullptr) { assert(0); break; @@ -2270,7 +2270,7 @@ bool SQRNetworkManager_AdHoc_Vita::CreateRudpConnections(SceNetInAddr peer) if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT) ) return false; if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, getRoomMemberID((&peer)), 0, rudpCtx, NULL ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, getRoomMemberID((&peer)), 0, rudpCtx, nullptr ); m_RudpCtxToIPAddrMap[ rudpCtx ] = peer; } else @@ -2311,7 +2311,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerFromRudpCtx(int rudpCtx { return it->second; } - return NULL; + return nullptr; } @@ -2322,7 +2322,7 @@ SceNetInAddr* SQRNetworkManager_AdHoc_Vita::GetIPAddrFromRudpCtx(int rudpCtx) { return &it->second; } - return NULL; + return nullptr; } @@ -2336,7 +2336,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerFromRoomMemberAndLocalI return it->second; } } - return NULL; + return nullptr; } @@ -2406,7 +2406,7 @@ void SQRNetworkManager_AdHoc_Vita::HandleMatchingContextStart() if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { SetState( SNM_INT_STATE_IDLE ); - GetExtDataForRoom(0, NULL, NULL, NULL); + GetExtDataForRoom(0, nullptr, nullptr, nullptr); } else if( m_state == SNM_INT_STATE_HOSTING_STARTING_MATCHING_CONTEXT ) { @@ -2431,7 +2431,7 @@ void SQRNetworkManager_AdHoc_Vita::HandleMatchingContextStart() if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } @@ -2446,7 +2446,7 @@ int SQRNetworkManager_AdHoc_Vita::BasicEventCallback(int event, int retCode, uin PSVITA_STUBBED; // SQRNetworkManager_AdHoc_Vita *manager = (SQRNetworkManager_AdHoc_Vita *)arg; // // We aren't allowed to actually get the event directly from this callback, so send our own internal event to a thread dedicated to doing this - // sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, NULL); + // sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, nullptr); return 0; } @@ -2490,7 +2490,7 @@ void SQRNetworkManager_AdHoc_Vita::SysUtilCallback(uint64_t status, uint64_t par // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } - // s_SignInCompleteCallbackFn = NULL; + // s_SignInCompleteCallbackFn = nullptr; // } // return; // } @@ -2505,7 +2505,7 @@ void SQRNetworkManager_AdHoc_Vita::SysUtilCallback(uint64_t status, uint64_t par // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } - // s_SignInCompleteCallbackFn = NULL; + // s_SignInCompleteCallbackFn = nullptr; // } // } // @@ -2542,7 +2542,7 @@ void SQRNetworkManager_AdHoc_Vita::updateNetCheckDialog() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } else @@ -2561,7 +2561,7 @@ void SQRNetworkManager_AdHoc_Vita::updateNetCheckDialog() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } @@ -2577,7 +2577,7 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id, { case SCE_RUDP_CONTEXT_EVENT_CLOSED: { - SQRVoiceConnection* pVoice = NULL; + SQRVoiceConnection* pVoice = nullptr; if(sc_voiceChatEnabled) SonyVoiceChat_Vita::GetVoiceConnectionFromRudpCtx(ctx_id); @@ -2638,7 +2638,7 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id, case SCE_RUDP_CONTEXT_EVENT_READABLE: if( manager->m_listener ) { - SQRVoiceConnection* pVoice = NULL; + SQRVoiceConnection* pVoice = nullptr; if(sc_voiceChatEnabled) { SonyVoiceChat_Vita::GetVoiceConnectionFromRudpCtx(ctx_id); @@ -2698,7 +2698,7 @@ void SQRNetworkManager_AdHoc_Vita::RudpContextCallback(int ctx_id, int event_id, playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) + if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -2761,7 +2761,7 @@ void SQRNetworkManager_AdHoc_Vita::ServerContextValid_CreateRoom() int ret = -1; if( !ForceErrorPoint(SNM_FORCE_ERROR_GET_WORLD_INFO_LIST) ) { - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); } if (ret < 0) { @@ -2790,7 +2790,7 @@ void SQRNetworkManager_AdHoc_Vita::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -2814,14 +2814,14 @@ const SceNpCommunicationSignature* SQRNetworkManager_AdHoc_Vita::GetSceNpCommsSi const SceNpTitleId* SQRNetworkManager_AdHoc_Vita::GetSceNpTitleId() { PSVITA_STUBBED; - return NULL; + return nullptr; // return &s_npTitleId; } const SceNpTitleSecret* SQRNetworkManager_AdHoc_Vita::GetSceNpTitleSecret() { PSVITA_STUBBED; - return NULL; + return nullptr; // return &s_npTitleSecret; } @@ -2964,7 +2964,7 @@ void SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(int (*SignInCompleteCallba { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } @@ -3039,7 +3039,7 @@ void SQRNetworkManager_AdHoc_Vita::AttemptPSNSignIn(int (*SignInCompleteCallback { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } @@ -3234,7 +3234,7 @@ SQRNetworkPlayer *SQRNetworkManager_AdHoc_Vita::GetPlayerByXuid(PlayerUID xuid) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } void SQRNetworkManager_AdHoc_Vita::UpdateLocalIPAddress() diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h index c1b2d2668..a5b9513ee 100644 --- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h +++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_AdHoc_Vita.h @@ -163,7 +163,7 @@ private: void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize); int GetSessionIndex(SQRNetworkPlayer *player); - bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = NULL ); + bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = nullptr ); void RemoveRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int mask ); void RemoveNetworkPlayers( int mask ); void SetLocalPlayersAndSync(); diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp index a1534f541..93021dd4d 100644 --- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.cpp @@ -16,8 +16,8 @@ // image used for the invite gui, filesize must be smaller than SCE_NP_MESSAGE_DIALOG_MAX_INDEX_ICON_SIZE ( 64K ) #define SESSION_IMAGE_PATH "app0:PSVita/session_image.png" -int (* SQRNetworkManager_Vita::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = NULL; -void * SQRNetworkManager_Vita::s_SignInCompleteParam = NULL; +int (* SQRNetworkManager_Vita::s_SignInCompleteCallbackFn)(void *pParam, bool bContinue, int pad) = nullptr; +void * SQRNetworkManager_Vita::s_SignInCompleteParam = nullptr; sce::Toolkit::NP::PresenceDetails SQRNetworkManager_Vita::s_lastPresenceInfo; int SQRNetworkManager_Vita::s_resendPresenceCountdown = 0; bool SQRNetworkManager_Vita::s_presenceStatusDirty = false; @@ -98,8 +98,8 @@ SQRNetworkManager_Vita::SQRNetworkManager_Vita(ISQRNetworkManagerListener *liste m_isInSession = false; m_offlineGame = false; m_offlineSQR = false; - m_aServerId = NULL; - m_gameBootInvite = NULL; + m_aServerId = nullptr; + m_gameBootInvite = nullptr; m_onlineStatus = false; m_bLinkDisconnected = false; m_bShuttingDown = false; @@ -129,7 +129,7 @@ void SQRNetworkManager_Vita::Initialise() m_bShuttingDown = false; int32_t ret = 0; // int32_t libCtxId = 0; - // ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, NULL); + // ret = sceNpInGameMessageInitialize(NP_IN_GAME_MESSAGE_POOL_SIZE, nullptr); // assert (ret >= 0); // libCtxId = ret; @@ -162,7 +162,7 @@ void SQRNetworkManager_Vita::Initialise() } SetState(SNM_INT_STATE_SIGNING_IN); - // AttemptPSNSignIn(NULL, NULL); + // AttemptPSNSignIn(nullptr, nullptr); // SonyHttp::init(); @@ -170,7 +170,7 @@ void SQRNetworkManager_Vita::Initialise() // npConf.commId = &s_npCommunicationId; // npConf.commPassphrase = &s_npCommunicationPassphrase; // npConf.commSignature = &s_npCommunicationSignature; - // ret = sceNpInit(&npConf, NULL); + // ret = sceNpInit(&npConf, nullptr); // if (ret < 0 && ret != SCE_NP_ERROR_ALREADY_INITIALIZED) // { // app.DebugPrintf("sceNpInit failed, ret=%x\n", ret); @@ -295,7 +295,7 @@ void SQRNetworkManager_Vita::InitialiseAfterOnline() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } return; } @@ -329,7 +329,7 @@ void SQRNetworkManager_Vita::InitialiseAfterOnline() app.DebugPrintf("sceNpMatching2CreateContext\n"); ret = sceNpMatching2CreateContext(&npID, GetSceNpCommsId(), &s_npCommunicationPassphrase, &m_matchingContext); - //ret = sceNpMatching2CreateContext(&npID, NULL, NULL, &m_matchingContext); + //ret = sceNpMatching2CreateContext(&npID, nullptr, nullptr, &m_matchingContext); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_CREATE_MATCHING_CONTEXT ) ) { @@ -377,7 +377,7 @@ void SQRNetworkManager_Vita::Tick() if( ( m_gameBootInvite ) && ( s_safeToRespondToGameBootInvite ) ) { m_listener->HandleInviteReceived( ProfileManager.GetPrimaryPad(), m_gameBootInvite ); - m_gameBootInvite = NULL; + m_gameBootInvite = nullptr; } ErrorHandlingTick(); @@ -444,12 +444,12 @@ void SQRNetworkManager_Vita::Tick() if( s_signInCompleteCallbackIfFailed ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } else if(s_SignInCompleteCallbackFn) { s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } @@ -467,7 +467,7 @@ void SQRNetworkManager_Vita::ErrorHandlingTick() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } app.DebugPrintf("Network error: SNM_INT_STATE_INITIALISE_FAILED\n"); if( m_isInSession && m_offlineGame) // m_offlineSQR ) // MGH - changed this to m_offlineGame, as m_offlineSQR can be true when running an online game but the init has failed because the servers are down @@ -578,7 +578,7 @@ void SQRNetworkManager_Vita::UpdateExternalRoomData() reqParam.roomBinAttrExternal = &roomBinAttr; app.DebugPrintf("sceNpMatching2SetRoomDataExternal\n"); - int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); + int ret = sceNpMatching2SetRoomDataExternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2SetRoomDataExternal returns 0x%x, number of players %d\n",ret,((char *)m_joinExtData)[174]); if( ( ret < 0 ) || ForceErrorPoint( SNM_FORCE_ERROR_SET_EXTERNAL_ROOM_DATA ) ) { @@ -612,7 +612,7 @@ bool SQRNetworkManager_Vita::FriendRoomManagerSearch() { if(m_aFriendSearchResults[i].m_RoomExtDataReceived) free(m_aFriendSearchResults[i].m_RoomExtDataReceived); - m_aFriendSearchResults[i].m_RoomExtDataReceived = NULL; + m_aFriendSearchResults[i].m_RoomExtDataReceived = nullptr; } m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_COUNT; @@ -675,7 +675,7 @@ void SQRNetworkManager_Vita::FriendSearchTick() { m_friendSearchState = SNM_FRIEND_SEARCH_STATE_GETTING_FRIEND_INFO; delete m_getFriendCountThread; - m_getFriendCountThread = NULL; + m_getFriendCountThread = nullptr; FriendRoomManagerSearch2(); } } @@ -695,7 +695,7 @@ int SQRNetworkManager_Vita::BasicEventThreadProc( void *lpParameter ) // // do // { - // ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, NULL); + // ret = sceKernelWaitEqueue(manager->m_basicEventQueue, &event, 1, &outEv, nullptr); // // // If the sys_event_t we've sent here from the handler has a non-zero data1 element, this is to signify that we should terminate the thread // if( event.udata == 0 ) @@ -753,7 +753,7 @@ int SQRNetworkManager_Vita::GetFriendsThreadProc( void* lpParameter ) // There shouldn't ever be more than 100 friends returned but limit here just in case if( manager->m_friendCount > 100 ) manager->m_friendCount = 100; - SceNpId* friendIDs = NULL; + SceNpId* friendIDs = nullptr; if(manager->m_friendCount > 0) { // grab all the friend IDs first @@ -890,7 +890,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerByIndex(int idx) } else { - return NULL; + return nullptr; } } @@ -907,7 +907,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerBySmallId(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_Vita::GetLocalPlayerByUserIndex(int idx) @@ -923,7 +923,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetLocalPlayerByUserIndex(int idx) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } SQRNetworkPlayer *SQRNetworkManager_Vita::GetHostPlayer() @@ -936,11 +936,11 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetHostPlayer() SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerIfReady(SQRNetworkPlayer *player) { - if( player == NULL ) return NULL; + if( player == nullptr ) return nullptr; if( player->IsReady() ) return player; - return NULL; + return nullptr; } // Update state internally @@ -1039,7 +1039,7 @@ bool SQRNetworkManager_Vita::JoinRoom(SQRNetworkManager_Vita::SessionSearchResul { // Set up the presence info we would like to synchronise out when we have fully joined the game CPlatformNetworkManagerSony::SetSQRPresenceInfoFromExtData(&s_lastPresenceSyncInfo, searchResult->m_extData, searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId); - return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, NULL); + return JoinRoom(searchResult->m_sessionId.m_RoomId, searchResult->m_sessionId.m_ServerId, localPlayerMask, nullptr); } // Join room with a specified roomId. This is used when joining from an invite, as well as by the previous method @@ -1106,7 +1106,7 @@ void SQRNetworkManager_Vita::LeaveRoom(bool bActuallyLeaveRoom) SetState(SNM_INT_STATE_LEAVING); app.DebugPrintf("sceNpMatching2LeaveRoom\n"); - int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, NULL, &m_leaveRoomRequestId ); + int ret = sceNpMatching2LeaveRoom( m_matchingContext, &reqParam, nullptr, &m_leaveRoomRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_LEAVE_ROOM) ) { SetState(SNM_INT_STATE_LEAVING_FAILED); @@ -1214,7 +1214,7 @@ bool SQRNetworkManager_Vita::AddLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternal = &binAttr; app.DebugPrintf("sceNpMatching2SetRoomMemberDataInternal\n"); - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL) ) { @@ -1264,7 +1264,7 @@ bool SQRNetworkManager_Vita::RemoveLocalPlayerByUserIndex(int idx) // And do any adjusting necessary to the mappings from this room data, to the SQRNetworkPlayers. // This will also delete the SQRNetworkPlayer and do all the callbacks that requires etc. MapRoomSlotPlayers(roomSlotPlayerCount); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; // Sync this back out to our networked clients... SyncRoomData(); @@ -1302,7 +1302,7 @@ bool SQRNetworkManager_Vita::RemoveLocalPlayerByUserIndex(int idx) reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, NULL, &m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( m_matchingContext, &reqParam, nullptr, &m_setRoomMemberInternalDataRequestId ); if( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_SET_ROOM_MEMBER_DATA_INTERNAL2) ) { @@ -1526,14 +1526,14 @@ void SQRNetworkManager_Vita::TickJoinablePresenceData() // // Signed in to PSN but not connected (no internet access) // UINT uiIDA[1]; // uiIDA[0] = IDS_OK; - // ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL, NULL, app.GetStringTable()); + // ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr, app.GetStringTable()); // } // else { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &MustSignInReturnedPresenceInvite, NULL); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &MustSignInReturnedPresenceInvite, nullptr); } } @@ -1573,7 +1573,7 @@ void SQRNetworkManager_Vita::FindOrCreateNonNetworkPlayer(int slot, int playerTy } } // Create the player - non-network players can be considered complete as soon as we create them as we aren't waiting on their network connections becoming complete, so can flag them as such and notify via callback - PlayerUID *pUID = NULL; + PlayerUID *pUID = nullptr; PlayerUID localUID; if( ( playerType == SQRNetworkPlayer::SNP_TYPE_LOCAL ) || m_isHosting && ( playerType == SQRNetworkPlayer::SNP_TYPE_HOST ) ) @@ -1640,7 +1640,7 @@ void SQRNetworkManager_Vita::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_REMOTE ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1696,7 +1696,7 @@ void SQRNetworkManager_Vita::MapRoomSlotPlayers(int roomSlotPlayerCount/*=-1*/) if( m_aRoomSlotPlayers[i]->m_type != SQRNetworkPlayer::SNP_TYPE_LOCAL ) { m_vecTempPlayers.push_back(m_aRoomSlotPlayers[i]); - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } } @@ -1788,7 +1788,7 @@ void SQRNetworkManager_Vita::UpdatePlayersFromRoomSyncUIDs() } // Host only - add remote players to our internal storage of player slots, and synchronise this with other room members. -bool SQRNetworkManager_Vita::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==NULL*/ ) +bool SQRNetworkManager_Vita::AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull/*==nullptr*/ ) { assert( m_isHosting ); @@ -1908,7 +1908,7 @@ void SQRNetworkManager_Vita::RemoveRemotePlayersAndSync( SceNpMatching2RoomMembe } // Zero last element, that isn't part of the currently sized array anymore memset(&m_roomSyncData.players[m_roomSyncData.getPlayerCount()],0,sizeof(PlayerSyncData)); - m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = NULL; + m_aRoomSlotPlayers[m_roomSyncData.getPlayerCount()] = nullptr; } else { @@ -1951,7 +1951,7 @@ void SQRNetworkManager_Vita::RemoveNetworkPlayers( int mask ) { if( m_aRoomSlotPlayers[i] == player ) { - m_aRoomSlotPlayers[i] = NULL; + m_aRoomSlotPlayers[i] = nullptr; } } // And delete the reference from the ctx->player map @@ -2004,7 +2004,7 @@ void SQRNetworkManager_Vita::SyncRoomData() roomBinAttr.size = sizeof( m_roomSyncData ); reqParam.roomBinAttrInternalNum = 1; reqParam.roomBinAttrInternal = &roomBinAttr; - sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, NULL, &m_setRoomDataRequestId ); + sceNpMatching2SetRoomDataInternal ( m_matchingContext, &reqParam, nullptr, &m_setRoomDataRequestId ); } // Check if the matching context is valid, and if not attempt to create one. If to do this requires starting an asynchronous process, then sets the internal state to the state passed in @@ -2037,7 +2037,7 @@ bool SQRNetworkManager_Vita::GetMatchingContext(eSQRNetworkManagerInternalState // Create context app.DebugPrintf("sceNpMatching2CreateContext\n"); ret = sceNpMatching2CreateContext(&npId, &s_npCommunicationId, &s_npCommunicationPassphrase, &m_matchingContext/*, option*/); - //ret = sceNpMatching2CreateContext(&npId, NULL,NULL, &m_matchingContext/*, option*/); + //ret = sceNpMatching2CreateContext(&npId, nullptr,nullptr, &m_matchingContext/*, option*/); if( ret < 0 ) { app.DebugPrintf("SQRNetworkManager::GetMatchingContext - sceNpMatching2CreateContext failed with code 0x%08x\n", ret); @@ -2137,7 +2137,7 @@ bool SQRNetworkManager_Vita::GetServerContext(SceNpMatching2ServerId serverId) // { // // Get list of server IDs of servers allocated to the application. We don't actually need to do this, but it is as good a way as any to try a matching2 service and check that // // the context *really* is valid. - // int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, NULL, 0 ); + // int serverCount = sceNpMatching2GetServerIdListLocal( m_matchingContext, nullptr, 0 ); // // If an error is returned here, we need to destroy and recerate our server - if this goes ok we should come back through this path again // if( ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_UNAVAILABLE ) || // This error has been seen (occasionally) in a normal working environment // ( serverCount == SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED ) ) // Also checking for this as a means of simulating the previous error @@ -2233,7 +2233,7 @@ void SQRNetworkManager_Vita::RoomCreateTick() app.DebugPrintf(CMinecraftApp::USER_RR,">> Creating room start\n"); s_roomStartTime = System::currentTimeMillis(); app.DebugPrintf("sceNpMatching2CreateJoinRoom\n"); - int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, NULL, &m_createRoomRequestId ); + int ret = sceNpMatching2CreateJoinRoom( m_matchingContext, &reqParam, nullptr, &m_createRoomRequestId ); if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_JOIN_ROOM) ) { SetState(SNM_INT_STATE_HOSTING_CREATE_ROOM_FAILED); @@ -2468,7 +2468,7 @@ bool SQRNetworkManager_Vita::CreateVoiceRudpConnections(SceNpMatching2RoomId roo // create this connection if we don't have it already SQRVoiceConnection* pConnection = SonyVoiceChat_Vita::getVoiceConnectionFromRoomMemberID(peerMemberId); - if(pConnection == NULL) + if(pConnection == nullptr) { // Create an Rudp context for the voice connection, this will happen regardless of whether the peer is client or host @@ -2542,7 +2542,7 @@ bool SQRNetworkManager_Vita::CreateRudpConnections(SceNpMatching2RoomId roomId, if ( ( ret < 0 ) || ForceErrorPoint(SNM_FORCE_ERROR_CREATE_RUDP_CONTEXT) ) return false; if( m_isHosting ) { - m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, NULL ); + m_RudpCtxToPlayerMap[ rudpCtx ] = new SQRNetworkPlayer( this, SQRNetworkPlayer::SNP_TYPE_REMOTE, true, playersMemberId, i, rudpCtx, nullptr ); } else { @@ -2576,7 +2576,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerFromRudpCtx(int rudpCtx) { return it->second; } - return NULL; + return nullptr; } @@ -2590,7 +2590,7 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerFromRoomMemberAndLocalIdx(int return it->second; } } - return NULL; + return nullptr; } @@ -2693,7 +2693,7 @@ void SQRNetworkManager_Vita::ContextCallback(SceNpMatching2ContextId id, SceNpM if( manager->m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { manager->SetState( SNM_INT_STATE_IDLE ); - manager->GetExtDataForRoom(0, NULL, NULL, NULL); + manager->GetExtDataForRoom(0, nullptr, nullptr, nullptr); break; } @@ -2729,7 +2729,7 @@ void SQRNetworkManager_Vita::ContextCallback(SceNpMatching2ContextId id, SceNpM // if(s_SignInCompleteCallbackFn) // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam, true, 0); - // s_SignInCompleteCallbackFn = NULL; + // s_SignInCompleteCallbackFn = nullptr; // } @@ -2966,12 +2966,12 @@ void SQRNetworkManager_Vita::DefaultRequestCallback(SceNpMatching2ContextId id, // Set flag to indicate whether we were kicked for being out of room or not reqParam.optData.data[0] = isFull ? 1 : 0; reqParam.optData.len = 1; - int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, NULL, &manager->m_kickRequestId); + int ret = sceNpMatching2KickoutRoomMember(manager->m_matchingContext, &reqParam, nullptr, &manager->m_kickRequestId); app.DebugPrintf(CMinecraftApp::USER_RR,"sceNpMatching2KickoutRoomMember returns error 0x%x\n",ret); } else { - if(pRoomMemberData->roomMemberDataInternal->roomMemberBinAttrInternal->data.ptr == NULL) + if(pRoomMemberData->roomMemberDataInternal->roomMemberBinAttrInternal->data.ptr == nullptr) { // the host doesn't send out data, so this must be the host we're connecting to @@ -3220,7 +3220,7 @@ void SQRNetworkManager_Vita::RoomEventCallback(SceNpMatching2ContextId id, SceNp reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_setRoomMemberInternalDataRequestId ); + int ret = sceNpMatching2SetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_setRoomMemberInternalDataRequestId ); } else { @@ -3309,7 +3309,7 @@ void SQRNetworkManager_Vita::SignallingCallback(SceNpMatching2ContextId ctxId, S { SonyVoiceChat_Vita::disconnectRemoteConnection(pVoice); } - if(peerMemberId == manager->m_hostMemberId || pVoice == NULL) // MGH - added check for voice, as we sometime get here before m_hostMemberId has been filled in + if(peerMemberId == manager->m_hostMemberId || pVoice == nullptr) // MGH - added check for voice, as we sometime get here before m_hostMemberId has been filled in { // Host has left the game... so its all over for this client too. Finish everything up now, including deleting the server context which belongs to this gaming session // This also might be a response to a request to leave the game from our end too so don't need to do anything in that case @@ -3336,7 +3336,7 @@ void SQRNetworkManager_Vita::SignallingCallback(SceNpMatching2ContextId ctxId, S reqParam.attrId = attrs; reqParam.attrIdNum = 1; - sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, NULL, &manager->m_roomMemberDataRequestId); + sceNpMatching2GetRoomMemberDataInternal( manager->m_matchingContext, &reqParam, nullptr, &manager->m_roomMemberDataRequestId); } break; } @@ -3349,7 +3349,7 @@ int SQRNetworkManager_Vita::BasicEventCallback(int event, int retCode, uint32_t PSVITA_STUBBED; // SQRNetworkManager_Vita *manager = (SQRNetworkManager_Vita *)arg; // // We aren't allowed to actually get the event directly from this callback, so send our own internal event to a thread dedicated to doing this - // sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, NULL); + // sceKernelTriggerUserEvent(m_basicEventQueue, sc_UserEventHandle, nullptr); return 0; } @@ -3408,7 +3408,7 @@ void SQRNetworkManager_Vita::SysUtilCallback(uint64_t status, uint64_t param, vo // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } - // s_SignInCompleteCallbackFn = NULL; + // s_SignInCompleteCallbackFn = nullptr; // } // return; // } @@ -3423,7 +3423,7 @@ void SQRNetworkManager_Vita::SysUtilCallback(uint64_t status, uint64_t param, vo // { // s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); // } - // s_SignInCompleteCallbackFn = NULL; + // s_SignInCompleteCallbackFn = nullptr; // } // } // @@ -3472,7 +3472,7 @@ void SQRNetworkManager_Vita::updateNetCheckDialog() if( s_SignInCompleteCallbackFn ) { s_SignInCompleteCallbackFn(s_SignInCompleteParam,true,0); - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } else @@ -3488,7 +3488,7 @@ void SQRNetworkManager_Vita::updateNetCheckDialog() { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } @@ -3611,7 +3611,7 @@ void SQRNetworkManager_Vita::RudpContextCallback(int ctx_id, int event_id, int e playerFrom = manager->m_aRoomSlotPlayers[0]; playerTo = manager->GetPlayerFromRudpCtx( ctx_id ); } - if( ( playerFrom != NULL ) && ( playerTo != NULL ) ) + if( ( playerFrom != nullptr ) && ( playerTo != nullptr ) ) { manager->m_listener->HandleDataReceived( playerFrom, playerTo, data, bytesRead ); } @@ -3677,7 +3677,7 @@ void SQRNetworkManager_Vita::ServerContextValid_CreateRoom() { app.DebugPrintf("sceNpMatching2GetWorldInfoList\n"); m_getWorldRequestId=0; - ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, NULL, &m_getWorldRequestId); + ret = sceNpMatching2GetWorldInfoList( m_matchingContext, &reqParam, nullptr, &m_getWorldRequestId); } if (ret < 0) { @@ -3706,7 +3706,7 @@ void SQRNetworkManager_Vita::ServerContextValid_JoinRoom() reqParam.roomMemberBinAttrInternalNum = 1; reqParam.roomMemberBinAttrInternal = &binAttr; - int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, NULL, &m_joinRoomRequestId ); + int ret = sceNpMatching2JoinRoom( m_matchingContext, &reqParam, nullptr, &m_joinRoomRequestId ); if ( (ret < 0) || ForceErrorPoint(SNM_FORCE_ERROR_JOIN_ROOM) ) { if( ret == SCE_NP_MATCHING2_SERVER_ERROR_NAT_TYPE_MISMATCH) @@ -3730,14 +3730,14 @@ const SceNpCommunicationSignature* SQRNetworkManager_Vita::GetSceNpCommsSig() const SceNpTitleId* SQRNetworkManager_Vita::GetSceNpTitleId() { PSVITA_STUBBED; - return NULL; + return nullptr; // return &s_npTitleId; } const SceNpTitleSecret* SQRNetworkManager_Vita::GetSceNpTitleSecret() { PSVITA_STUBBED; - return NULL; + return nullptr; // return &s_npTitleSecret; } @@ -3771,9 +3771,9 @@ void SQRNetworkManager_Vita::GetExtDataForRoom( SceNpMatching2RoomId roomId, voi static SceNpMatching2RoomId aRoomId[1]; static SceNpMatching2AttributeId attr[1]; - // All parameters will be NULL if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). - // NULL parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList - if( extData != NULL ) + // All parameters will be nullptr if this is being called a second time, after creating a new matching context via one of the paths below (using GetMatchingContext). + // nullptr parameters therefore basically represents an attempt to retry the last sceNpMatching2GetRoomDataExternalList + if( extData != nullptr ) { aRoomId[0] = roomId; attr[0] = SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_1_ID; @@ -3797,14 +3797,14 @@ void SQRNetworkManager_Vita::GetExtDataForRoom( SceNpMatching2RoomId roomId, voi return; } - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { app.DebugPrintf("Having to recreate matching context, setting state to SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT\n"); return; } - int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, NULL, &m_roomDataExternalListRequestId ); + int ret = sceNpMatching2GetRoomDataExternalList( m_matchingContext, &reqParam, nullptr, &m_roomDataExternalListRequestId ); // If we hadn't properly detected that a matching context was unvailable, we might still get an error indicating that it is from the previous call. Handle similarly, but we need // to destroy the context first. @@ -3818,7 +3818,7 @@ void SQRNetworkManager_Vita::GetExtDataForRoom( SceNpMatching2RoomId roomId, voi m_FriendSessionUpdatedFn(false, m_pParamFriendSessionUpdated); return; }; - // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with NULL params) once done, so we can reattempt. Don't do anything more now. + // Kicked off an asynchronous thing that will create a matching context, and then call this method back again (with nullptr params) once done, so we can reattempt. Don't do anything more now. if( m_state == SNM_INT_STATE_IDLE_RECREATING_MATCHING_CONTEXT ) { return; @@ -3957,7 +3957,7 @@ void SQRNetworkManager_Vita::AttemptPSNSignIn(int (*SignInCompleteCallbackFn)(vo { s_SignInCompleteCallbackFn(s_SignInCompleteParam,false,0); } - s_SignInCompleteCallbackFn = NULL; + s_SignInCompleteCallbackFn = nullptr; } } } @@ -4127,6 +4127,6 @@ SQRNetworkPlayer *SQRNetworkManager_Vita::GetPlayerByXuid(PlayerUID xuid) } } LeaveCriticalSection(&m_csRoomSyncData); - return NULL; + return nullptr; } diff --git a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h index 0fd0b4149..79befe039 100644 --- a/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h +++ b/Minecraft.Client/PSVita/Network/SQRNetworkManager_Vita.h @@ -149,7 +149,7 @@ private: void LocalDataSend(SQRNetworkPlayer *playerFrom, SQRNetworkPlayer *playerTo, const void *data, unsigned int dataSize); int GetSessionIndex(SQRNetworkPlayer *player); - bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = NULL ); + bool AddRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int playerMask, bool *isFull = nullptr ); void RemoveRemotePlayersAndSync( SceNpMatching2RoomMemberId memberId, int mask ); void RemoveNetworkPlayers( int mask ); void SetLocalPlayersAndSync(); diff --git a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp index 09852ccbe..88e661c6c 100644 --- a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.cpp @@ -10,22 +10,22 @@ bool SonyCommerce_Vita::m_bCommerceInitialised = false; // SceNpCommerce2SessionInfo SonyCommerce_Vita::m_sessionInfo; SonyCommerce_Vita::State SonyCommerce_Vita::m_state = e_state_noSession; int SonyCommerce_Vita::m_errorCode = 0; -LPVOID SonyCommerce_Vita::m_callbackParam = NULL; +LPVOID SonyCommerce_Vita::m_callbackParam = nullptr; -void* SonyCommerce_Vita::m_receiveBuffer = NULL; +void* SonyCommerce_Vita::m_receiveBuffer = nullptr; SonyCommerce_Vita::Event SonyCommerce_Vita::m_event; std::queue SonyCommerce_Vita::m_messageQueue; -std::vector* SonyCommerce_Vita::m_pProductInfoList = NULL; -SonyCommerce_Vita::ProductInfoDetailed* SonyCommerce_Vita::m_pProductInfoDetailed = NULL; -SonyCommerce_Vita::ProductInfo* SonyCommerce_Vita::m_pProductInfo = NULL; +std::vector* SonyCommerce_Vita::m_pProductInfoList = nullptr; +SonyCommerce_Vita::ProductInfoDetailed* SonyCommerce_Vita::m_pProductInfoDetailed = nullptr; +SonyCommerce_Vita::ProductInfo* SonyCommerce_Vita::m_pProductInfo = nullptr; -SonyCommerce_Vita::CategoryInfo* SonyCommerce_Vita::m_pCategoryInfo = NULL; -const char* SonyCommerce_Vita::m_pProductID = NULL; -char* SonyCommerce_Vita::m_pCategoryID = NULL; +SonyCommerce_Vita::CategoryInfo* SonyCommerce_Vita::m_pCategoryInfo = nullptr; +const char* SonyCommerce_Vita::m_pProductID = nullptr; +char* SonyCommerce_Vita::m_pCategoryID = nullptr; SonyCommerce_Vita::CheckoutInputParams SonyCommerce_Vita::m_checkoutInputParams; SonyCommerce_Vita::DownloadListInputParams SonyCommerce_Vita::m_downloadInputParams; -SonyCommerce_Vita::CallbackFunc SonyCommerce_Vita::m_callbackFunc = NULL; +SonyCommerce_Vita::CallbackFunc SonyCommerce_Vita::m_callbackFunc = nullptr; // sys_memory_container_t SonyCommerce_Vita::m_memContainer = SYS_MEMORY_CONTAINER_ID_INVALID; bool SonyCommerce_Vita::m_bUpgradingTrial = false; @@ -39,7 +39,7 @@ bool SonyCommerce_Vita::m_contextCreated=false; ///< npcommerce2 conte SonyCommerce_Vita::Phase SonyCommerce_Vita::m_currentPhase = e_phase_stopped; ///< Current commerce2 util // char SonyCommerce_Vita::m_commercebuffer[SCE_NP_COMMERCE2_RECV_BUF_SIZE]; -C4JThread* SonyCommerce_Vita::m_tickThread = NULL; +C4JThread* SonyCommerce_Vita::m_tickThread = nullptr; bool SonyCommerce_Vita::m_bLicenseChecked=false; // Check the trial/full license for the game bool SonyCommerce_Vita::m_bLicenseInstalled=false; // set to true when the licence has been downloaded and installed (but maybe not checked yet) bool SonyCommerce_Vita::m_bDownloadsPending=false; // set to true if there are any downloads happening in the background, so we check for them completing, and install when finished @@ -60,12 +60,12 @@ static bool s_showingPSStoreIcon = false; SonyCommerce_Vita::ProductInfoDetailed s_trialUpgradeProductInfoDetailed; void SonyCommerce_Vita::Delete() { - m_pProductInfoList=NULL; - m_pProductInfoDetailed=NULL; - m_pProductInfo=NULL; - m_pCategoryInfo = NULL; - m_pProductID = NULL; - m_pCategoryID = NULL; + m_pProductInfoList=nullptr; + m_pProductInfoDetailed=nullptr; + m_pProductInfo=nullptr; + m_pCategoryInfo = nullptr; + m_pProductID = nullptr; + m_pCategoryID = nullptr; } void SonyCommerce_Vita::Init() @@ -108,7 +108,7 @@ bool SonyCommerce_Vita::LicenseChecked() void SonyCommerce_Vita::CheckForTrialUpgradeKey() { - StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, NULL); + StorageManager.CheckForTrialUpgradeKey(CheckForTrialUpgradeKey_Callback, nullptr); } int SonyCommerce_Vita::Shutdown() @@ -163,7 +163,7 @@ void SonyCommerce_Vita::checkBackgroundDownloadStatus() // install the content if(bInstallContent) { - InstallContent(InstallContentCallback, NULL); + InstallContent(InstallContentCallback, nullptr); } } } @@ -665,7 +665,7 @@ int SonyCommerce_Vita::createContext() // } // // // Create commerce2 context - // ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, NULL, &m_contextId); + // ret = sceNpCommerce2CreateCtx(SCE_NP_COMMERCE2_VERSION, &npId, commerce2Handler, nullptr, &m_contextId); // if (ret < 0) // { // app.DebugPrintf(4,"createContext sceNpCommerce2CreateCtx problem\n"); @@ -771,7 +771,7 @@ void SonyCommerce_Vita::commerce2Handler( const sce::Toolkit::NP::Event& event) // if(ret == SCE_OK) // { copyCategoryInfo(m_pCategoryInfo, g_categoryInfo.get()); - m_pCategoryInfo = NULL; + m_pCategoryInfo = nullptr; m_event = e_event_commerceGotCategoryInfo; // } @@ -781,7 +781,7 @@ void SonyCommerce_Vita::commerce2Handler( const sce::Toolkit::NP::Event& event) case sce::Toolkit::NP::Event::UserEvent::commerceGotProductList: { copyProductList(m_pProductInfoList, g_productList.get()); - m_pProductInfoDetailed = NULL; + m_pProductInfoDetailed = nullptr; m_event = e_event_commerceGotProductList; break; } @@ -791,12 +791,12 @@ void SonyCommerce_Vita::commerce2Handler( const sce::Toolkit::NP::Event& event) if(m_pProductInfoDetailed) { copyDetailedProductInfo(m_pProductInfoDetailed, g_detailedProductInfo.get()); - m_pProductInfoDetailed = NULL; + m_pProductInfoDetailed = nullptr; } else { copyAddDetailedProductInfo(m_pProductInfo, g_detailedProductInfo.get()); - m_pProductInfo = NULL; + m_pProductInfo = nullptr; } m_event = e_event_commerceGotDetailedProductInfo; break; @@ -1180,7 +1180,7 @@ void SonyCommerce_Vita::processEvent() break; case e_event_commerceProductBrowseFinished: app.DebugPrintf(4,"e_event_commerceProductBrowseFinished succeeded: 0x%x\n", m_errorCode); - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1232,7 +1232,7 @@ void SonyCommerce_Vita::processEvent() ProfileManager.SetSysUIShowing(false); // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { // get the detailed product info again, to see if the purchase has happened or not EnterCriticalSection(&m_queueLock); @@ -1260,7 +1260,7 @@ void SonyCommerce_Vita::processEvent() ProfileManager.SetSysUIShowing(false); // 4J-PB - if there's been an error - like dlc already purchased, the runcallback has already happened, and will crash this time - if(m_callbackFunc!=NULL) + if(m_callbackFunc!=nullptr) { runCallback(); } @@ -1328,10 +1328,10 @@ void SonyCommerce_Vita::CreateSession( CallbackFunc cb, LPVOID lpParam ) if(m_tickThread && (m_tickThread->isRunning() == false)) { delete m_tickThread; - m_tickThread = NULL; + m_tickThread = nullptr; } - if(m_tickThread == NULL) - m_tickThread = new C4JThread(TickLoop, NULL, "SonyCommerce_Vita tick"); + if(m_tickThread == nullptr) + m_tickThread = new C4JThread(TickLoop, nullptr, "SonyCommerce_Vita tick"); if(m_tickThread->isRunning() == false) { m_currentPhase = e_phase_idle; @@ -1439,7 +1439,7 @@ void SonyCommerce_Vita::DownloadAlreadyPurchased_Game( CallbackFunc cb, LPVOID l void SonyCommerce_Vita::InstallContent( CallbackFunc cb, LPVOID lpParam ) { - if(m_callbackFunc == NULL && m_messageQueue.size() == 0) // wait till other processes have finished + if(m_callbackFunc == nullptr && m_messageQueue.size() == 0) // wait till other processes have finished { EnterCriticalSection(&m_queueLock); m_bInstallingContent = true; diff --git a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h index 6285832cd..c8f76bf7d 100644 --- a/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h +++ b/Minecraft.Client/PSVita/Network/SonyCommerce_Vita.h @@ -121,14 +121,14 @@ class SonyCommerce_Vita : public SonyCommerce { assert(m_callbackFunc); CallbackFunc func = m_callbackFunc; - m_callbackFunc = NULL; + m_callbackFunc = nullptr; if(func) func(m_callbackParam, m_errorCode); m_errorCode = SCE_OK; } static void setCallback(CallbackFunc cb,LPVOID lpParam) { - assert(m_callbackFunc == NULL); + assert(m_callbackFunc == nullptr); m_callbackFunc = cb; m_callbackParam = lpParam; } diff --git a/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp index fd311fa7b..2015f9303 100644 --- a/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyHttp_Vita.cpp @@ -215,7 +215,7 @@ bool SonyHttp_Vita::http_get(const char *targetUrl, void** ppOutData, int* pData } reqId = ret; - ret = sceHttpSendRequest(reqId, NULL, 0); + ret = sceHttpSendRequest(reqId, nullptr, 0); if (ret < 0) { app.DebugPrintf("sceHttpSendRequest() error: 0x%08X\n", ret); diff --git a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp index ed7fa5ccb..dd6c83727 100644 --- a/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyRemoteStorage_Vita.cpp @@ -218,7 +218,7 @@ bool SonyRemoteStorage_Vita::init(CallbackFunc cb, LPVOID lpParam) params.timeout.receiveMs = 120 * 1000; //120 seconds is the default params.timeout.sendMs = 120 * 1000; //120 seconds is the default params.pool.memPoolSize = 7 * 1024 * 1024; - if(m_memPoolBuffer == NULL) + if(m_memPoolBuffer == nullptr) m_memPoolBuffer = malloc(params.pool.memPoolSize); params.pool.memPoolBuffer = m_memPoolBuffer; @@ -298,7 +298,7 @@ bool SonyRemoteStorage_Vita::setDataInternal() snprintf(m_saveFilename, sizeof(m_saveFilename), "%s:%s/GAMEDATA.bin", "savedata0", m_setDataSaveInfo->UTF8SaveFilename); - SceFiosSize outSize = sceFiosFileGetSizeSync(NULL, m_saveFilename); + SceFiosSize outSize = sceFiosFileGetSizeSync(nullptr, m_saveFilename); m_uploadSaveSize = static_cast(outSize); strcpy(m_saveFileDesc, m_setDataSaveInfo->UTF8SaveTitle); diff --git a/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp b/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp index 842e6b8de..9833f6fe0 100644 --- a/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp +++ b/Minecraft.Client/PSVita/Network/SonyVoiceChat_Vita.cpp @@ -67,7 +67,7 @@ void LoadPCMVoiceData() { char filename[64]; sprintf(filename, "voice%d.pcm", i+1); - HANDLE file = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(filename, GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); DWORD dwHigh=0; g_loadedPCMVoiceDataSizes[i] = GetFileSize(file,&dwHigh); @@ -75,7 +75,7 @@ void LoadPCMVoiceData() { g_loadedPCMVoiceData[i] = new char[g_loadedPCMVoiceDataSizes[i]]; DWORD bytesRead; - BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, NULL); + BOOL bSuccess = ReadFile(file, g_loadedPCMVoiceData[i], g_loadedPCMVoiceDataSizes[i], &bytesRead, nullptr); assert(bSuccess); } g_loadedPCMVoiceDataPos[i] = 0; @@ -285,7 +285,7 @@ void SQRVoiceConnection::readRemoteData() if( dataSize > 0 ) { VoicePacket packet; - unsigned int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, NULL ); + unsigned int bytesRead = sceRudpRead( m_rudpCtx, &packet, dataSize, 0, nullptr ); unsigned int writeSize; if( bytesRead > 0 ) { @@ -470,7 +470,7 @@ void SonyVoiceChat_Vita::sendAllVoiceData() if(m_localVoiceDevices[i].isValid()) { bool bChatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(i,true,&bChatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(i,true,&bChatRestricted,nullptr,nullptr); if(bChatRestricted) { @@ -911,7 +911,7 @@ void SonyVoiceChat_Vita::initLocalPlayer(int playerIndex) if(m_localVoiceDevices[playerIndex].isValid() == false) { bool chatRestricted = false; - ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); + ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,nullptr,nullptr); // create all device ports required m_localVoiceDevices[playerIndex].init(chatRestricted); @@ -948,7 +948,7 @@ SQRVoiceConnection* SonyVoiceChat_Vita::GetVoiceConnectionFromRudpCtx( int RudpC if(m_remoteConnections[i]->m_rudpCtx == RudpCtx) return m_remoteConnections[i]; } - return NULL; + return nullptr; } void SonyVoiceChat_Vita::connectPlayerToAll( int playerIndex ) @@ -973,7 +973,7 @@ SQRVoiceConnection* SonyVoiceChat_Vita::getVoiceConnectionFromRoomMemberID( SceN } } - return NULL; + return nullptr; } void SonyVoiceChat_Vita::disconnectLocalPlayer( int localIdx ) diff --git a/Minecraft.Client/PSVita/PSVitaExtras/CustomMap.cpp b/Minecraft.Client/PSVita/PSVitaExtras/CustomMap.cpp index 9203c30d0..7265eb041 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/CustomMap.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/CustomMap.cpp @@ -4,7 +4,7 @@ CustomMap::CustomMap() { - m_NodePool = NULL; + m_NodePool = nullptr; m_NodePoolSize = 0; m_NodePoolIndex = 0; @@ -87,7 +87,7 @@ void CustomMap::insert(const ChunkPos &Key, bool Value) Node->Hash = Hash; Node->first = Key; Node->second = Value; - Node->Next = NULL; + Node->Next = nullptr; // are any nodes in this hash index if( !m_HashTable[Index] ) diff --git a/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp b/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp index 108425931..4b96f1aa7 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/CustomSet.cpp @@ -4,7 +4,7 @@ CustomSet::CustomSet() { - m_NodePool = NULL; + m_NodePool = nullptr; m_NodePoolSize = 0; m_NodePoolIndex = 0; @@ -85,7 +85,7 @@ void CustomSet::insert(const ChunkPos &Key) unsigned int Index = Hash & (m_HashSize-1); Node->Hash = Hash; Node->key = Key; - Node->Next = NULL; + Node->Next = nullptr; // are any nodes in this hash index if( !m_HashTable[Index] ) diff --git a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStrings.cpp b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStrings.cpp index ad9e423bb..b33a56015 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStrings.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaStrings.cpp @@ -15,7 +15,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) if( result != S_OK ) { app.DebugPrintf("sceCesUcsContextInit failed\n"); - return NULL; + return nullptr; } uint32_t utf16Len; @@ -44,7 +44,7 @@ uint8_t *mallocAndCreateUTF8ArrayFromString(int iID) if( result != SCE_OK ) { app.DebugPrintf("sceCesUtf16StrToUtf8Str: conversion error : 0x%x\n", result); - return NULL; + return nullptr; } return strUtf8; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTLSStorage.cpp b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTLSStorage.cpp index 0261f318a..054e9f025 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTLSStorage.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/PSVitaTLSStorage.cpp @@ -137,7 +137,7 @@ BOOL PSVitaTLSStorage::SetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) #else -PSVitaTLSStorage* m_pInstance = NULL; +PSVitaTLSStorage* m_pInstance = nullptr; #define sc_maxSlots 64 BOOL m_activeList[sc_maxSlots]; @@ -157,7 +157,7 @@ void PSVitaTLSStorage::Init() for(int i=0;iwMilliseconds = sceRtcGetMicrosecond(&dateTime)/1000; } -HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PSVITA_STUBBED; return NULL; } +HANDLE CreateEvent(void* lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName) { PSVITA_STUBBED; return nullptr; } VOID Sleep(DWORD dwMilliseconds) { C4JThread::Sleep(dwMilliseconds); @@ -186,7 +186,7 @@ VOID InitializeCriticalSection(PCRITICAL_SECTION CriticalSection) { char name[1] = {0}; - int err = sceKernelCreateLwMutex((SceKernelLwMutexWork *)(&CriticalSection->mutex), name, SCE_KERNEL_LW_MUTEX_ATTR_TH_PRIO | SCE_KERNEL_LW_MUTEX_ATTR_RECURSIVE, 0, NULL); + int err = sceKernelCreateLwMutex((SceKernelLwMutexWork *)(&CriticalSection->mutex), name, SCE_KERNEL_LW_MUTEX_ATTR_TH_PRIO | SCE_KERNEL_LW_MUTEX_ATTR_RECURSIVE, 0, nullptr); PSVITA_ASSERT_SCE_ERROR(err); } @@ -207,7 +207,7 @@ extern CRITICAL_SECTION g_singleThreadCS; VOID EnterCriticalSection(PCRITICAL_SECTION CriticalSection) { - int err = sceKernelLockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1, NULL); + int err = sceKernelLockLwMutex ((SceKernelLwMutexWork *)(&CriticalSection->mutex), 1, nullptr); PSVITA_ASSERT_SCE_ERROR(err); } @@ -233,7 +233,7 @@ VOID InitializeCriticalRWSection(PCRITICAL_RW_SECTION CriticalSection) { char name[1] = {0}; - CriticalSection->RWLock = sceKernelCreateRWLock(name, SCE_KERNEL_RW_LOCK_ATTR_TH_PRIO | SCE_KERNEL_RW_LOCK_ATTR_RECURSIVE, NULL); + CriticalSection->RWLock = sceKernelCreateRWLock(name, SCE_KERNEL_RW_LOCK_ATTR_TH_PRIO | SCE_KERNEL_RW_LOCK_ATTR_RECURSIVE, nullptr); } VOID DeleteCriticalRWSection(PCRITICAL_RW_SECTION CriticalSection) @@ -274,7 +274,7 @@ VOID LeaveCriticalRWSection(PCRITICAL_RW_SECTION CriticalSection, bool Write) BOOL CloseHandle(HANDLE hObject) { - sceFiosFHCloseSync(NULL,(SceFiosFH)((int32_t)hObject)); + sceFiosFHCloseSync(nullptr,(SceFiosFH)((int32_t)hObject)); return true; } @@ -514,7 +514,7 @@ BOOL VirtualWriteFile(LPCSTR lpFileName, LPCVOID lpBuffer, DWORD nNumberOfBytesT void* Data = VirtualAllocs[Page]; DWORD numberOfBytesWritten=0; - WriteFileWithName(lpFileName, Data, BytesToWrite, &numberOfBytesWritten,NULL); + WriteFileWithName(lpFileName, Data, BytesToWrite, &numberOfBytesWritten,nullptr); *lpNumberOfBytesWritten += numberOfBytesWritten; nNumberOfBytesToWrite -= BytesToWrite; @@ -656,7 +656,7 @@ DWORD GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ) //SceFiosSize FileSize; //FileSize=sceFiosFHGetSize(fh); SceFiosStat statData; - int err = sceFiosFHStatSync(NULL,fh,&statData); + int err = sceFiosFHStatSync(nullptr,fh,&statData); SceFiosOffset FileSize = statData.fileSize; if(lpFileSizeHigh) @@ -675,7 +675,7 @@ BOOL WriteFileWithName(LPCSTR lpFileName, LPCVOID lpBuffer, DWORD nNumberOfByte { char filePath[256]; sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); - SceFiosSize bytesWritten = sceFiosFileWriteSync( NULL, filePath, lpBuffer, nNumberOfBytesToWrite, 0 ); + SceFiosSize bytesWritten = sceFiosFileWriteSync( nullptr, filePath, lpBuffer, nNumberOfBytesToWrite, 0 ); if(bytesWritten != nNumberOfBytesToWrite) { // error @@ -698,7 +698,7 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD { SceFiosFH fh = (SceFiosFH)((int64_t)hFile); // sceFiosFHReadSync - Non-negative values are the number of bytes read, 0 <= result <= length. Negative values are error codes. - SceFiosSize bytesRead = sceFiosFHReadSync(NULL, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToRead); + SceFiosSize bytesRead = sceFiosFHReadSync(nullptr, fh, lpBuffer, (SceFiosSize)nNumberOfBytesToRead); if(bytesRead < 0) { // error @@ -718,7 +718,7 @@ BOOL SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHi uint64_t bitsToMove = (int64_t) lDistanceToMove; SceFiosOffset pos = 0; - if (lpDistanceToMoveHigh != NULL) + if (lpDistanceToMoveHigh != nullptr) bitsToMove |= ((uint64_t) (*lpDistanceToMoveHigh)) << 32; SceFiosWhence whence = SCE_FIOS_SEEK_SET; @@ -761,7 +761,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, if( dwDesiredAccess == GENERIC_WRITE ) { //CD - Create a blank file - int err = sceFiosFileWriteSync( NULL, filePath, NULL, 0, 0 ); + int err = sceFiosFileWriteSync( nullptr, filePath, nullptr, 0, 0 ); assert( err == SCE_FIOS_OK ); } @@ -770,7 +770,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, #endif SceFiosFH fh; - int err = sceFiosFHOpenSync(NULL, &fh, filePath, NULL); + int err = sceFiosFHOpenSync(nullptr, &fh, filePath, nullptr); assert( err == SCE_FIOS_OK ); return (void*)fh; @@ -816,7 +816,7 @@ DWORD GetFileAttributesA(LPCSTR lpFileName) // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) { app.DebugPrintf("*** sceFiosStatSync Failed\n"); return -1; @@ -904,7 +904,7 @@ BOOL GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId, // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) { app.DebugPrintf("*** sceFiosStatSync Failed\n"); return false; @@ -937,7 +937,7 @@ errno_t _i64toa_s(__int64 _Val, char * _DstBuf, size_t _Size, int _Radix) { if(_ int _wtoi(const wchar_t *_Str) { - return wcstol(_Str, NULL, 10); + return wcstol(_Str, nullptr, 10); } DWORD XGetLanguage() diff --git a/Minecraft.Client/PSVita/PSVitaExtras/ShutdownManager.cpp b/Minecraft.Client/PSVita/PSVitaExtras/ShutdownManager.cpp index e7eca53f4..a04e45d9f 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/ShutdownManager.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/ShutdownManager.cpp @@ -16,12 +16,12 @@ C4JThread::EventArray *ShutdownManager::s_eventArray[eThreadIdCount]; void ShutdownManager::Initialise() { #ifdef __PS3__ - cellSysutilRegisterCallback( 1, SysUtilCallback, NULL ); + cellSysutilRegisterCallback( 1, SysUtilCallback, nullptr ); for( int i = 0; i < eThreadIdCount; i++ ) { s_threadShouldRun[i] = true; s_threadRunning[i] = 0; - s_eventArray[i] = NULL; + s_eventArray[i] = nullptr; } // Special case for storage manager, which we will manually set now to be considered as running - this will be unset by StorageManager.ExitRequest if required s_threadRunning[eStorageManagerThreads] = true; diff --git a/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h b/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h index e480ed198..d3a1d954a 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h +++ b/Minecraft.Client/PSVita/PSVitaExtras/libdivide.h @@ -478,7 +478,7 @@ static uint64_t libdivide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, int s; // Shift amount for norm. if (u1 >= v) { // If overflow, set rem. - if (r != NULL) // to an impossible value, + if (r != nullptr) // to an impossible value, *r = static_cast(-1); // and return the largest return static_cast(-1);} // possible quotient. @@ -513,7 +513,7 @@ again2: rhat = rhat + vn1; if (rhat < b) goto again2;} - if (r != NULL) // If remainder is wanted, + if (r != nullptr) // If remainder is wanted, *r = (un21*b + un0 - q0*v) >> s; // return it. return q1*b + q0; } @@ -1141,11 +1141,11 @@ namespace libdivide_internal { #endif /* Some bogus unswitch functions for unsigned types so the same (presumably templated) code can work for both signed and unsigned. */ - uint32_t crash_u32(uint32_t, const libdivide_u32_t *) { abort(); return *static_cast(NULL); } - uint64_t crash_u64(uint64_t, const libdivide_u64_t *) { abort(); return *static_cast(NULL); } + uint32_t crash_u32(uint32_t, const libdivide_u32_t *) { abort(); return *static_cast(nullptr); } + uint64_t crash_u64(uint64_t, const libdivide_u64_t *) { abort(); return *static_cast(nullptr); } #if LIBDIVIDE_USE_SSE2 - __m128i crash_u32_vector(__m128i, const libdivide_u32_t *) { abort(); return *(__m128i *)NULL; } - __m128i crash_u64_vector(__m128i, const libdivide_u64_t *) { abort(); return *(__m128i *)NULL; } + __m128i crash_u32_vector(__m128i, const libdivide_u32_t *) { abort(); return *(__m128i *)nullptr; } + __m128i crash_u64_vector(__m128i, const libdivide_u64_t *) { abort(); return *(__m128i *)nullptr; } #endif template diff --git a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c index 7036728f3..6b0e67b72 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c +++ b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc.c @@ -52,14 +52,14 @@ typedef struct int Malloc_BlocksAlloced; // this shows how many block node chunks have been allocated in Malloc_BlocksMemory } SThreadStorage; -__thread SThreadStorage *Malloc_ThreadStorage = NULL; +__thread SThreadStorage *Malloc_ThreadStorage = nullptr; /**E Replace _malloc_init function. */ /**J _malloc_init 関数と置き換わる */ void user_malloc_init(void) { int res; - void *base = NULL; + void *base = nullptr; /**E Allocate a memory block from the kernel */ /**J カーネルからメモリブロックを確保する */ @@ -80,7 +80,7 @@ void user_malloc_init(void) /**E Generate mspace */ /**J mspace を生成する */ s_mspace = mspace_create(base, HEAP_SIZE); - if (s_mspace == NULL) { + if (s_mspace == nullptr) { /**E Error handling */ /**J エラー処理 */ sceLibcSetHeapInitError(HEAP_ERROR3); @@ -95,7 +95,7 @@ void user_malloc_finalize(void) { int res; - if (s_mspace != NULL) { + if (s_mspace != nullptr) { /**E Free mspace */ /**J mspace を解放する */ res = mspace_destroy(s_mspace); @@ -104,7 +104,7 @@ void user_malloc_finalize(void) /**J エラー処理 */ __breakpoint(0); } - s_mspace = NULL; + s_mspace = nullptr; } if (SCE_OK <= s_heapUid) { @@ -125,9 +125,9 @@ void user_malloc_finalize(void) void user_registerthread() { Malloc_ThreadStorage = mspace_malloc(s_mspace, sizeof(SThreadStorage)); - Malloc_ThreadStorage->Malloc_Blocks = NULL; + Malloc_ThreadStorage->Malloc_Blocks = nullptr; Malloc_ThreadStorage->Malloc_BlocksAlloced = 0; - Malloc_ThreadStorage->Malloc_MemoryPool = NULL; + Malloc_ThreadStorage->Malloc_MemoryPool = nullptr; } // before a thread is destroyed make sure we free any space it might be holding on to @@ -157,7 +157,7 @@ void user_removethread() } mspace_free(s_mspace, psStorage); - Malloc_ThreadStorage = NULL; + Malloc_ThreadStorage = nullptr; } } @@ -165,19 +165,19 @@ void user_removethread() /**J malloc 関数と置き換わる */ void *user_malloc(size_t size) { - void *p = NULL; + void *p = nullptr; SThreadStorage *psStorage = Malloc_ThreadStorage; if( psStorage ) { // is this the first time we've malloced - if( psStorage->Malloc_MemoryPool == NULL ) + if( psStorage->Malloc_MemoryPool == nullptr ) { // create an array of pointers to Block nodes, one pointer for each memory bytes size up to 1036 psStorage->Malloc_MemoryPool = mspace_malloc(s_mspace, (MaxRetainedBytes+1) * 4); for( int i = 0;i < (MaxRetainedBytes+1);i += 1 ) { - psStorage->Malloc_MemoryPool[i] = NULL; + psStorage->Malloc_MemoryPool[i] = nullptr; } } @@ -261,7 +261,7 @@ void user_free(void *ptr) } // we need a block node to retain the memory on our stack. do we have any block nodes available - if( psStorage->Malloc_Blocks == NULL ) + if( psStorage->Malloc_Blocks == nullptr ) { if( psStorage->Malloc_BlocksAlloced == Malloc_BlocksMemorySize ) { @@ -319,7 +319,7 @@ void *user_calloc(size_t nelem, size_t size) /**J realloc 関数と置き換わる */ void *user_realloc(void *ptr, size_t size) { - void* p = NULL; + void* p = nullptr; if( Malloc_ThreadStorage ) { diff --git a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc_for_tls.c b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc_for_tls.c index 531bbd604..54cc0d728 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/user_malloc_for_tls.c +++ b/Minecraft.Client/PSVita/PSVitaExtras/user_malloc_for_tls.c @@ -27,7 +27,7 @@ void user_free_for_tls(void *ptr); void user_malloc_for_tls_init(void) { int res; - void *base = NULL; + void *base = nullptr; /**E Allocate a memory block from the kernel */ /**J カーネルからメモリブロックを確保する */ @@ -48,7 +48,7 @@ void user_malloc_for_tls_init(void) /**E Generate mspace */ /**J mspace を生成する */ s_mspace = mspace_create(base, HEAP_SIZE); - if (s_mspace == NULL) { + if (s_mspace == nullptr) { /**E Error handling */ /**J エラー処理 */ sceLibcSetHeapInitError(HEAP_ERROR3); @@ -63,7 +63,7 @@ void user_malloc_for_tls_finalize(void) { int res; - if (s_mspace != NULL) { + if (s_mspace != nullptr) { /**E Free mspace */ /**J mspace を解放する */ res = mspace_destroy(s_mspace); diff --git a/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp b/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp index 1f71f6d21..b9cc48502 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp +++ b/Minecraft.Client/PSVita/PSVitaExtras/user_new.cpp @@ -28,13 +28,13 @@ void *user_new(std::size_t size) throw(std::bad_alloc) if (size == 0) size = 1; - while ((ptr = (void *)std::malloc(size)) == NULL) { + while ((ptr = (void *)std::malloc(size)) == nullptr) { /**E Obtain new_handler */ /**J new_handler を取得する */ std::new_handler handler = std::_get_new_handler(); - /**E When new_handler is a NULL pointer, bad_alloc is send. If not, new_handler is called. */ - /**J new_handler が NULL ポインタの場合、bad_alloc を送出する、そうでない場合、new_handler を呼び出す */ + /**E When new_handler is a nullptr pointer, bad_alloc is send. If not, new_handler is called. */ + /**J new_handler が nullptr ポインタの場合、bad_alloc を送出する、そうでない場合、new_handler を呼び出す */ if (!handler) throw std::bad_alloc(); else @@ -56,22 +56,22 @@ void *user_new(std::size_t size, const std::nothrow_t& x) throw() if (size == 0) size = 1; - while ((ptr = (void *)std::malloc(size)) == NULL) { + while ((ptr = (void *)std::malloc(size)) == nullptr) { /**E Obtain new_handler */ /**J new_handler を取得する */ std::new_handler handler = std::_get_new_handler(); - /**E When new_handler is a NULL pointer, NULL is returned. */ - /**J new_handler が NULL ポインタの場合、NULL を返す */ + /**E When new_handler is a nullptr pointer, nullptr is returned. */ + /**J new_handler が nullptr ポインタの場合、nullptr を返す */ if (!handler) - return NULL; + return nullptr; - /**E Call new_handler. If new_handler sends bad_alloc, NULL is returned. */ - /**J new_handler を呼び出す、new_handler が bad_alloc を送出した場合、NULL を返す */ + /**E Call new_handler. If new_handler sends bad_alloc, nullptr is returned. */ + /**J new_handler を呼び出す、new_handler が bad_alloc を送出した場合、nullptr を返す */ try { (*handler)(); } catch (std::bad_alloc) { - return NULL; + return nullptr; } } return ptr; @@ -98,9 +98,9 @@ void *user_new_array(std::size_t size, const std::nothrow_t& x) throw() void user_delete(void *ptr) throw() { // SCE_DBG_LOG_TRACE("Called operator delete(%p)", ptr); - /**E In the case of the NULL pointer, no action will be taken. */ - /**J NULL ポインタの場合、何も行わない */ - if (ptr != NULL) + /**E In the case of the nullptr pointer, no action will be taken. */ + /**J nullptr ポインタの場合、何も行わない */ + if (ptr != nullptr) std::free(ptr); } diff --git a/Minecraft.Client/PSVita/PSVitaExtras/zlib.h b/Minecraft.Client/PSVita/PSVitaExtras/zlib.h index 3e0c7672a..b0e74c454 100644 --- a/Minecraft.Client/PSVita/PSVitaExtras/zlib.h +++ b/Minecraft.Client/PSVita/PSVitaExtras/zlib.h @@ -91,7 +91,7 @@ typedef struct z_stream_s { uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total number of bytes output so far */ - z_const char *msg; /* last error message, NULL if no error */ + z_const char *msg; /* last error message, nullptr if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ @@ -1254,7 +1254,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); reading, this will be detected automatically by looking for the magic two- byte gzip header. - gzopen returns NULL if the file could not be opened, if there was + gzopen returns nullptr if the file could not be opened, if there was insufficient memory to allocate the gzFile state, or if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). errno can be checked to determine if the reason gzopen failed was that the @@ -1277,7 +1277,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); close the associated file descriptor, so they need to have different file descriptors. - gzdopen returns NULL if there was insufficient memory to allocate the + gzdopen returns nullptr if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided), or if fd is -1. The file descriptor is not used until the next gz* read, write, seek, or close operation, so gzdopen @@ -1377,7 +1377,7 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); string is terminated with a null character. If no characters are read due to an end-of-file or len < 1, then the buffer is left untouched. - gzgets returns buf which is a null-terminated string, or it returns NULL + gzgets returns buf which is a null-terminated string, or it returns nullptr for end-of-file or in case of error. If there was an error, the contents at buf are indeterminate. */ @@ -1393,7 +1393,7 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. - it does not check to see if file is NULL, nor whether the structure file + it does not check to see if file is nullptr, nor whether the structure file points to has been clobbered or not. */ diff --git a/Minecraft.Client/PSVita/PSVita_App.cpp b/Minecraft.Client/PSVita/PSVita_App.cpp index 956e10b62..8502e5208 100644 --- a/Minecraft.Client/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/PSVita/PSVita_App.cpp @@ -32,15 +32,15 @@ CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() m_bVoiceChatAndUGCRestricted=false; m_bDisplayFullVersionPurchase=false; - m_ProductListA=NULL; + m_ProductListA=nullptr; m_pRemoteStorage = new SonyRemoteStorage_Vita; m_bSaveIncompleteDialogRunning = false; m_bSaveDataDeleteDialogState = eSaveDataDeleteState_idle; - m_pSaveToDelete = NULL; - m_pCheckoutProductInfo = NULL; + m_pSaveToDelete = nullptr; + m_pCheckoutProductInfo = nullptr; } void CConsoleMinecraftApp::SetRichPresenceContext(int iPad, int contextId) @@ -62,7 +62,7 @@ char *CConsoleMinecraftApp::GetCommerceCategory() } char *CConsoleMinecraftApp::GetTexturePacksCategoryID() { - return NULL; // ProductCodes.chTexturePackID; + return nullptr; // ProductCodes.chTexturePackID; } char *CConsoleMinecraftApp::GetUpgradeKey() { @@ -101,7 +101,7 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(char *pchTitle) { app.DebugPrintf("Couldn't find DLC info for %s\n", pchTitle); assert(0); - return NULL; + return nullptr; } return it->second; @@ -118,7 +118,7 @@ SONYDLC *CConsoleMinecraftApp::GetSONYDLCInfo(int iTexturePackID) if(it->second->iConfig == iTexturePackID) return it->second; } - return NULL; + return nullptr; } @@ -128,7 +128,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() char chDLCTitle[64]; // 4J-PB - Read the file containing the product codes. This will be different for the SCEE/SCEA/SCEJ builds - HANDLE file = CreateFile("PSVita/PSVitaProductCodes.bin", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile("PSVita/PSVitaProductCodes.bin", GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -143,13 +143,13 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() { DWORD bytesRead; - WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,NULL); - WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,NULL); - //WRAPPED_READFILE(file,ProductCodes.chDiscSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,NULL); - WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,NULL); - //WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,NULL); // TODO - WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,NULL); - //WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,NULL); + WRAPPED_READFILE(file,ProductCodes.chProductCode,PRODUCT_CODE_SIZE,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,nullptr); + //WRAPPED_READFILE(file,ProductCodes.chDiscSaveFolderPrefix,SAVEFOLDERPREFIX_SIZE,&bytesRead,nullptr); + WRAPPED_READFILE(file,ProductCodes.chCommerceCategory,COMMERCE_CATEGORY_SIZE,&bytesRead,nullptr); + //WRAPPED_READFILE(file,ProductCodes.chTexturePackID,SCE_NP_COMMERCE2_CATEGORY_ID_LEN,&bytesRead,nullptr); // TODO + WRAPPED_READFILE(file,ProductCodes.chUpgradeKey,UPGRADE_KEY_SIZE,&bytesRead,nullptr); + //WRAPPED_READFILE(file,ProductCodes.chSkuPostfix,SKU_POSTFIX_SIZE,&bytesRead,nullptr); app.DebugPrintf("ProductCodes.chProductCode %s\n",ProductCodes.chProductCode); app.DebugPrintf("ProductCodes.chSaveFolderPrefix %s\n",ProductCodes.chSaveFolderPrefix); @@ -161,7 +161,7 @@ BOOL CConsoleMinecraftApp::ReadProductCodes() // DLC unsigned int uiDLC; - WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&uiDLC,sizeof(int),&bytesRead,nullptr); for(unsigned int i=0;ichDLCKeyname,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,pDLCInfo->chDLCKeyname,sizeof(char)*uiVal,&bytesRead,nullptr); - WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,NULL); + WRAPPED_READFILE(file,&uiVal,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,chDLCTitle,sizeof(char)*uiVal,&bytesRead,nullptr); app.DebugPrintf("DLC title %s\n",chDLCTitle); - WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,NULL); - WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,NULL); + WRAPPED_READFILE(file,&pDLCInfo->eDLCType,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->iFirstSkin,sizeof(int),&bytesRead,nullptr); + WRAPPED_READFILE(file,&pDLCInfo->iConfig,sizeof(int),&bytesRead,nullptr); // push this into a vector @@ -296,7 +296,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(NULL); + app.setLevelGenerationOptions(nullptr); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -322,7 +322,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = NULL; + param->saveData = nullptr; g_NetworkManager.HostGame(0,false,true,MINECRAFT_NET_MAX_PLAYERS,0); @@ -545,7 +545,7 @@ SonyCommerce::CategoryInfo *CConsoleMinecraftApp::GetCategoryInfo() { if(m_bCommerceCategoriesRetrieved==false) { - return NULL; + return nullptr; } return &m_CategoryInfo; @@ -561,10 +561,10 @@ void CConsoleMinecraftApp::ClearCommerceDetails() pProductList->clear(); } - if(m_ProductListA!=NULL) + if(m_ProductListA!=nullptr) { delete [] m_ProductListA; - m_ProductListA=NULL; + m_ProductListA=nullptr; } m_ProductListRetrievedC=0; @@ -613,7 +613,7 @@ void CConsoleMinecraftApp::GetDLCSkuIDFromProductList(char * pchDLCProductID, ch void CConsoleMinecraftApp::Checkout(char *pchSkuID) { - SonyCommerce::ProductInfo* productInfo = NULL; + SonyCommerce::ProductInfo* productInfo = nullptr; for(int i=0;i* CConsoleMinecraftApp::GetProductList(int { if((m_bCommerceProductListRetrieved==false) || (m_bProductListAdditionalDetailsRetrieved==false) ) { - return NULL; + return nullptr; } return &m_ProductListA[iIndex]; @@ -1076,7 +1076,7 @@ bool CConsoleMinecraftApp::CheckForEmptyStore(int iPad) SonyCommerce::CategoryInfo *pCategories=app.GetCategoryInfo(); bool bEmptyStore=true; - if(pCategories!=NULL) + if(pCategories!=nullptr) { if(pCategories->countOfProducts>0) { @@ -1288,7 +1288,7 @@ int CConsoleMinecraftApp::cbConfirmDeleteMessageBox(void *pParam, int iPad, cons { CConsoleMinecraftApp *pClass = (CConsoleMinecraftApp*) pParam; - if (pClass != NULL && pClass->m_pSaveToDelete != NULL) + if (pClass != nullptr && pClass->m_pSaveToDelete != nullptr) { if (result == C4JStorage::EMessage_ResultDecline) { @@ -1408,12 +1408,12 @@ void CConsoleMinecraftApp::initSaveDataDeleteDialog() ui.SetSysUIShowing(true); // Start getting saves data to use when deleting. - if (StorageManager.ReturnSavesInfo() == NULL) + if (StorageManager.ReturnSavesInfo() == nullptr) { C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo( ProfileManager.GetPrimaryPad(), - NULL, + nullptr, this, "save" ); @@ -1471,15 +1471,15 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() if ( dialogResult.result == SCE_COMMON_DIALOG_RESULT_OK ) { SceAppUtilSaveDataSlotParam slotParam; - ret = sceAppUtilSaveDataSlotGetParam( dialogResult.slotId, &slotParam, NULL ); + ret = sceAppUtilSaveDataSlotGetParam( dialogResult.slotId, &slotParam, nullptr ); if (ret == SCE_OK) { int saveindex = -1; - PSAVE_INFO pSaveInfo = NULL; + PSAVE_INFO pSaveInfo = nullptr; PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - if (pSaveDetails != NULL) + if (pSaveDetails != nullptr) { app.DebugPrintf("[SaveDataDeleteDialog] Searching for save files:\n"); @@ -1504,7 +1504,7 @@ void CConsoleMinecraftApp::updateSaveDataDeleteDialog() app.DebugPrintf("[SaveDataDeleteDialog] ERROR: PERFORMING DELETE OPERATION, pSavesDetails is null.\n"); } - if (pSaveInfo != NULL) + if (pSaveInfo != nullptr) { app.DebugPrintf( "[SaveDataDeleteDialog] User wishes to delete slot_%d:\n\t" @@ -1603,7 +1603,7 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * for (unsigned int i = 2; i < SCE_APPUTIL_SAVEDATA_SLOT_MAX; i++) { SceAppUtilSaveDataSlotParam slotParam; - int ret = sceAppUtilSaveDataSlotGetParam( i, &slotParam, NULL ); + int ret = sceAppUtilSaveDataSlotGetParam( i, &slotParam, nullptr ); if (ret == SCE_OK) { @@ -1645,8 +1645,8 @@ void CConsoleMinecraftApp::getSaveDataDeleteDialogParam(SceSaveDataDialogParam * // baseParam->commonParam.dimmerColor = &s_dColor; - static uint8_t *strPtr = NULL; - if (strPtr != NULL) delete strPtr; + static uint8_t *strPtr = nullptr; + if (strPtr != nullptr) delete strPtr; strPtr = mallocAndCreateUTF8ArrayFromString( IDS_TOOLTIPS_DELETESAVE ); listParam.listTitle = (const SceChar8 *) strPtr; diff --git a/Minecraft.Client/PSVita/PSVita_App.h b/Minecraft.Client/PSVita/PSVita_App.h index 209fb91a0..5e31a3bea 100644 --- a/Minecraft.Client/PSVita/PSVita_App.h +++ b/Minecraft.Client/PSVita/PSVita_App.h @@ -83,7 +83,7 @@ public: // BANNED LEVEL LIST virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false) {} - C4JStringTable *GetStringTable() { return NULL;} + C4JStringTable *GetStringTable() { return nullptr;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp index a82adf00f..f511bed3b 100644 --- a/Minecraft.Client/PSVita/PSVita_Minecraft.cpp +++ b/Minecraft.Client/PSVita/PSVita_Minecraft.cpp @@ -288,7 +288,7 @@ void MemSect(int sect) void debugSaveGameDirect() { - C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, NULL, "debugSaveGameDirect"); + C4JThread* thread = new C4JThread(&IUIScene_PauseMenu::SaveWorldThreadProc, nullptr, "debugSaveGameDirect"); thread->Run(); thread->WaitForCompletion(1000); } @@ -520,7 +520,7 @@ int main() PSVitaNPToolkit::init(); // initialise the storage manager with a default save display name, a Minimum save size, and a callback for displaying the saving message - StorageManager.Init( 0, L"savegame.dat", "savePackName", FIFTY_ONE_MB, &CConsoleMinecraftApp::DisplaySavingMessage, (LPVOID)&app, NULL); + StorageManager.Init( 0, L"savegame.dat", "savePackName", FIFTY_ONE_MB, &CConsoleMinecraftApp::DisplaySavingMessage, (LPVOID)&app, nullptr); StorageManager.SetDLCProductCode(app.GetProductCode()); StorageManager.SetProductUpgradeKey(app.GetUpgradeKey()); ProfileManager.SetServiceID(app.GetCommerceCategory()); @@ -624,9 +624,9 @@ int main() StorageManager.SetDefaultImages((PBYTE)baOptionsIcon.data, baOptionsIcon.length,(PBYTE)baSaveImage.data, baSaveImage.length,(PBYTE)baSaveThumbnail.data, baSaveThumbnail.length); - if(baOptionsIcon.data!=NULL){ delete [] baOptionsIcon.data; } - if(baSaveThumbnail.data!=NULL){ delete [] baSaveThumbnail.data; } - if(baSaveImage.data!=NULL){ delete [] baSaveImage.data; } + if(baOptionsIcon.data!=nullptr){ delete [] baOptionsIcon.data; } + if(baSaveThumbnail.data!=nullptr){ delete [] baSaveThumbnail.data; } + if(baSaveImage.data!=nullptr){ delete [] baSaveImage.data; } StorageManager.SetIncompleteSaveCallback(CConsoleMinecraftApp::Callback_SaveGameIncomplete, (LPVOID)&app); @@ -655,7 +655,7 @@ int main() #endif StorageManager.SetDLCInfoMap(app.GetSonyDLCMap()); - app.CommerceInit(); // MGH - moved this here so GetCommerce isn't NULL + app.CommerceInit(); // MGH - moved this here so GetCommerce isn't nullptr // 4J-PB - Kick of the check for trial or full version - requires ui to be initialised app.GetCommerce()->CheckForTrialUpgradeKey(); @@ -856,7 +856,7 @@ int main() else { MemSect(28); - pMinecraft->soundEngine->tick(NULL, 0.0f); + pMinecraft->soundEngine->tick(nullptr, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1064,7 +1064,7 @@ vector vRichPresenceStrings; uint8_t * AddRichPresenceString(int iID) { uint8_t *strUtf8 = mallocAndCreateUTF8ArrayFromString(iID); - if( strUtf8 != NULL ) + if( strUtf8 != nullptr ) { vRichPresenceStrings.push_back(strUtf8); } diff --git a/Minecraft.Client/PSVita/PSVita_UIController.cpp b/Minecraft.Client/PSVita/PSVita_UIController.cpp index c3a03acea..fe6cf7582 100644 --- a/Minecraft.Client/PSVita/PSVita_UIController.cpp +++ b/Minecraft.Client/PSVita/PSVita_UIController.cpp @@ -145,7 +145,7 @@ void ConsoleUIController::render() /* End the GXM scene. Note that we pass "notify" (returned from $gdraw_psp2_End) as the fragment notification. */ - //sceGxmEndScene(gxm, NULL, ¬ify); + //sceGxmEndScene(gxm, nullptr, ¬ify); RenderManager.setFragmentNotification(notify); #endif } diff --git a/Minecraft.Client/PSVita/XML/ATGXmlParser.h b/Minecraft.Client/PSVita/XML/ATGXmlParser.h index 75142e3e3..12f597372 100644 --- a/Minecraft.Client/PSVita/XML/ATGXmlParser.h +++ b/Minecraft.Client/PSVita/XML/ATGXmlParser.h @@ -138,7 +138,7 @@ private: DWORD m_dwCharsTotal; DWORD m_dwCharsConsumed; - BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL + BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; BYTE* m_pReadPtr; diff --git a/Minecraft.Client/Particle.cpp b/Minecraft.Client/Particle.cpp index 25ec2ec4c..643dc6695 100644 --- a/Minecraft.Client/Particle.cpp +++ b/Minecraft.Client/Particle.cpp @@ -19,7 +19,7 @@ void Particle::_init(Level *level, double x, double y, double z) { // 4J - added these initialisers alpha = 1.0f; - tex = NULL; + tex = nullptr; gravity = 0.0f; setSize(0.2f, 0.2f); @@ -156,7 +156,7 @@ void Particle::render(Tesselator *t, float a, float xa, float ya, float za, floa float v1 = v0 + 0.999f / 16.0f; float r = 0.1f * size; - if (tex != NULL) + if (tex != nullptr) { u0 = tex->getU0(); u1 = tex->getU1(); diff --git a/Minecraft.Client/ParticleEngine.cpp b/Minecraft.Client/ParticleEngine.cpp index 7fe260632..82dd4ce1c 100644 --- a/Minecraft.Client/ParticleEngine.cpp +++ b/Minecraft.Client/ParticleEngine.cpp @@ -17,7 +17,7 @@ ResourceLocation ParticleEngine::PARTICLES_LOCATION = ResourceLocation(TN_PARTIC ParticleEngine::ParticleEngine(Level *level, Textures *textures) { -// if (level != NULL) // 4J - removed - we want level to be initialised to *something* +// if (level != nullptr) // 4J - removed - we want level to be initialised to *something* { this->level = level; } @@ -188,8 +188,8 @@ void ParticleEngine::renderLit(shared_ptr player, float a, int list) void ParticleEngine::setLevel(Level *level) { this->level = level; - // 4J - we've now got a set of particle vectors for each dimension, and only clearing them when its game over & the level is set to NULL - if( level == NULL ) + // 4J - we've now got a set of particle vectors for each dimension, and only clearing them when its game over & the level is set to nullptr + if( level == nullptr ) { for( int l = 0; l < 3; l++ ) { diff --git a/Minecraft.Client/PauseScreen.cpp b/Minecraft.Client/PauseScreen.cpp index 791d819b5..a17e52dfb 100644 --- a/Minecraft.Client/PauseScreen.cpp +++ b/Minecraft.Client/PauseScreen.cpp @@ -54,12 +54,12 @@ void PauseScreen::buttonClicked(Button button) minecraft->level->disconnect(); } - minecraft->setLevel(NULL); + minecraft->setLevel(nullptr); minecraft->setScreen(new TitleScreen()); } if (button.id == 4) { - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J - removed } diff --git a/Minecraft.Client/PendingConnection.cpp b/Minecraft.Client/PendingConnection.cpp index 72b8f3825..2adc1bb1e 100644 --- a/Minecraft.Client/PendingConnection.cpp +++ b/Minecraft.Client/PendingConnection.cpp @@ -45,7 +45,7 @@ PendingConnection::~PendingConnection() void PendingConnection::tick() { - if (acceptedLogin != NULL) + if (acceptedLogin != nullptr) { this->handleAcceptedLogin(acceptedLogin); acceptedLogin = nullptr; @@ -121,7 +121,7 @@ void PendingConnection::sendPreLoginResponse() // Need to use the online XUID otherwise friend checks will fail on the client ugcXuids[ugcXuidCount] = player->connection->m_onlineXUID; - if( player->connection->getNetworkPlayer() != NULL && player->connection->getNetworkPlayer()->IsHost() ) hostIndex = ugcXuidCount; + if( player->connection->getNetworkPlayer() != nullptr && player->connection->getNetworkPlayer()->IsHost() ) hostIndex = ugcXuidCount; ++ugcXuidCount; } @@ -199,7 +199,7 @@ void PendingConnection::handleLogin(shared_ptr packet) vector >& pl = server->getPlayers()->players; for (const auto& i : pl) { - if (i != NULL && i->name == name) + if (i != nullptr && i->name == name) { nameTaken = true; break; @@ -262,10 +262,10 @@ void PendingConnection::handleAcceptedLogin(shared_ptr packet) if(playerXuid == INVALID_XUID) playerXuid = packet->m_onlineXuid; shared_ptr playerEntity = server->getPlayers()->getPlayerForLogin(this, name, playerXuid,packet->m_onlineXuid); - if (playerEntity != NULL) + if (playerEntity != nullptr) { server->getPlayers()->placeNewPlayer(connection, playerEntity, packet); - connection = NULL; // We've moved responsibility for this over to the new PlayerConnection, NULL so we don't delete our reference to it here in our dtor + connection = nullptr; // We've moved responsibility for this over to the new PlayerConnection, nullptr so we don't delete our reference to it here in our dtor } done = true; diff --git a/Minecraft.Client/PistonPieceRenderer.cpp b/Minecraft.Client/PistonPieceRenderer.cpp index ca7294fc8..0982e69ae 100644 --- a/Minecraft.Client/PistonPieceRenderer.cpp +++ b/Minecraft.Client/PistonPieceRenderer.cpp @@ -12,7 +12,7 @@ ResourceLocation PistonPieceRenderer::SIGN_LOCATION = ResourceLocation(TN_ITEM_S PistonPieceRenderer::PistonPieceRenderer() { - tileRenderer = NULL; + tileRenderer = nullptr; } void PistonPieceRenderer::render(shared_ptr _entity, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled) @@ -21,7 +21,7 @@ void PistonPieceRenderer::render(shared_ptr _entity, double x, doubl shared_ptr entity = dynamic_pointer_cast(_entity); Tile *tile = Tile::tiles[entity->getId()]; - if (tile != NULL && entity->getProgress(a) <= 1) // 4J - changed condition from < to <= as our chunk update is async to main thread and so we can have to render these with progress of 1 + if (tile != nullptr && entity->getProgress(a) <= 1) // 4J - changed condition from < to <= as our chunk update is async to main thread and so we can have to render these with progress of 1 { Tesselator *t = Tesselator::getInstance(); bindTexture(&TextureAtlas::LOCATION_BLOCKS); diff --git a/Minecraft.Client/PlayerChunkMap.cpp b/Minecraft.Client/PlayerChunkMap.cpp index 01d1b8fdb..2078093ed 100644 --- a/Minecraft.Client/PlayerChunkMap.cpp +++ b/Minecraft.Client/PlayerChunkMap.cpp @@ -82,7 +82,7 @@ void PlayerChunkMap::PlayerChunk::add(shared_ptr player, bool send void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) { - PlayerChunkMap::PlayerChunk *toDelete = NULL; + PlayerChunkMap::PlayerChunk *toDelete = nullptr; //app.DebugPrintf("--- PlayerChunkMap::PlayerChunk::remove x=%d\tz=%d\n",x,z); auto it = find(players.begin(), players.end(), player); @@ -121,7 +121,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) // 4J - I don't think there's any point sending these anymore, as we don't need to unload chunks with fixed sized maps // 4J - We do need to send these to unload entities in chunks when players are dead. If we do not and the entity is removed // while they are dead, that entity will remain in the clients world - if (player->connection != NULL && player->seenChunks.find(pos) != player->seenChunks.end()) + if (player->connection != nullptr && player->seenChunks.find(pos) != player->seenChunks.end()) { INetworkPlayer *thisNetPlayer = player->connection->getNetworkPlayer(); bool noOtherPlayersFound = true; @@ -133,7 +133,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) if ( currPlayer ) { INetworkPlayer *currNetPlayer = currPlayer->connection->getNetworkPlayer(); - if( currNetPlayer != NULL && currNetPlayer->IsSameSystem( thisNetPlayer ) && currPlayer->seenChunks.find(pos) != currPlayer->seenChunks.end() ) + if( currNetPlayer != nullptr && currNetPlayer->IsSameSystem( thisNetPlayer ) && currPlayer->seenChunks.find(pos) != currPlayer->seenChunks.end() ) { noOtherPlayersFound = false; break; @@ -148,7 +148,7 @@ void PlayerChunkMap::PlayerChunk::remove(shared_ptr player) } else { - //app.DebugPrintf("PlayerChunkMap::PlayerChunk::remove - QNetPlayer is NULL\n"); + //app.DebugPrintf("PlayerChunkMap::PlayerChunk::remove - QNetPlayer is nullptr\n"); } } @@ -220,7 +220,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) if( sentTo.size() ) { INetworkPlayer *thisPlayer = player->connection->getNetworkPlayer(); - if( thisPlayer == NULL ) + if( thisPlayer == nullptr ) { dontSend = true; } @@ -230,7 +230,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) { shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { dontSend = true; } @@ -269,7 +269,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) { shared_ptr player = parent->level->getServer()->getPlayers()->players[i]; // Don't worry about local players, they get all their updates through sharing level with the server anyway - if ( player->connection == NULL ) continue; + if ( player->connection == nullptr ) continue; if( player->connection->isLocal() ) continue; // Don't worry about this player if they haven't had this chunk yet (this flag will be the @@ -282,7 +282,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) if( sentTo.size() ) { INetworkPlayer *thisPlayer = player->connection->getNetworkPlayer(); - if( thisPlayer == NULL ) + if( thisPlayer == nullptr ) { dontSend = true; } @@ -292,7 +292,7 @@ void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr packet) { shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { dontSend = true; } @@ -386,10 +386,10 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) void PlayerChunkMap::PlayerChunk::broadcast(shared_ptr te) { - if (te != NULL) + if (te != nullptr) { shared_ptr p = te->getUpdatePacket(); - if (p != NULL) + if (p != nullptr) { broadcast(p); } @@ -579,7 +579,7 @@ void PlayerChunkMap::broadcastTileUpdate(shared_ptr packet, int x, int y int xc = x >> 4; int zc = z >> 4; PlayerChunk *chunk = getChunk(xc, zc, false); - if (chunk != NULL) + if (chunk != nullptr) { chunk->broadcast(packet); } @@ -590,7 +590,7 @@ void PlayerChunkMap::tileChanged(int x, int y, int z) int xc = x >> 4; int zc = z >> 4; PlayerChunk *chunk = getChunk(xc, zc, false); - if (chunk != NULL) + if (chunk != nullptr) { chunk->tileChanged(x & 15, y, z & 15); } @@ -611,7 +611,7 @@ void PlayerChunkMap::prioritiseTileChanges(int x, int y, int z) int xc = x >> 4; int zc = z >> 4; PlayerChunk *chunk = getChunk(xc, zc, false); - if (chunk != NULL) + if (chunk != nullptr) { chunk->prioritiseTileChanges(); } @@ -731,7 +731,7 @@ void PlayerChunkMap::remove(shared_ptr player) for (int z = zc - radius; z <= zc + radius; z++) { PlayerChunk *playerChunk = getChunk(x, z, false); - if (playerChunk != NULL) playerChunk->remove(player); + if (playerChunk != nullptr) playerChunk->remove(player); } auto it = find(players.begin(), players.end(), player); @@ -811,7 +811,7 @@ bool PlayerChunkMap::isPlayerIn(shared_ptr player, int xChunk, int { PlayerChunk *chunk = getChunk(xChunk, zChunk, false); - if(chunk == NULL) + if(chunk == nullptr) { return false; } @@ -822,7 +822,7 @@ bool PlayerChunkMap::isPlayerIn(shared_ptr player, int xChunk, int return it1 != chunk->players.end() && it2 == player->chunksToSend.end(); } - //return chunk == NULL ? false : chunk->players->contains(player) && !player->chunksToSend->contains(chunk->pos); + //return chunk == nullptr ? false : chunk->players->contains(player) && !player->chunksToSend->contains(chunk->pos); } int PlayerChunkMap::convertChunkRangeToBlock(int radius) diff --git a/Minecraft.Client/PlayerCloudParticle.cpp b/Minecraft.Client/PlayerCloudParticle.cpp index 5132dfc6b..476803a33 100644 --- a/Minecraft.Client/PlayerCloudParticle.cpp +++ b/Minecraft.Client/PlayerCloudParticle.cpp @@ -50,7 +50,7 @@ void PlayerCloudParticle::tick() yd *= 0.96f; zd *= 0.96f; shared_ptr p = level->getNearestPlayer(shared_from_this(), 2); - if (p != NULL) + if (p != nullptr) { if (y > p->bb->y0) { diff --git a/Minecraft.Client/PlayerConnection.cpp b/Minecraft.Client/PlayerConnection.cpp index c8311ebf1..48fd4e08d 100644 --- a/Minecraft.Client/PlayerConnection.cpp +++ b/Minecraft.Client/PlayerConnection.cpp @@ -164,7 +164,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) if (synched) { - if (player->riding != NULL) + if (player->riding != nullptr) { float yRotT = player->yRot; @@ -185,7 +185,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) player->doTick(false); player->ySlideOffset = 0; player->absMoveTo(xt, yt, zt, yRotT, xRotT); - if (player->riding != NULL) player->riding->positionRider(); + if (player->riding != nullptr) player->riding->positionRider(); server->getPlayers()->move(player); // player may have been kicked off the mount during the tick, so @@ -460,7 +460,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) bool canEditSpawn = level->canEditSpawn; // = level->dimension->id != 0 || server->players->isOp(player->name); if (packet->getFace() == 255) { - if (item == NULL) return; + if (item == nullptr) return; player->gameMode->useItem(player, level, item); } else if ((packet->getY() < server->getMaxBuildHeight() - 1) || (packet->getFace() != Facing::UP && packet->getY() < server->getMaxBuildHeight())) @@ -508,17 +508,17 @@ void PlayerConnection::handleUseItem(shared_ptr packet) item = player->inventory->getSelected(); bool forceClientUpdate = false; - if(item != NULL && packet->getItem() == NULL) + if(item != nullptr && packet->getItem() == nullptr) { forceClientUpdate = true; } - if (item != NULL && item->count == 0) + if (item != nullptr && item->count == 0) { player->inventory->items[player->inventory->selected] = nullptr; item = nullptr; } - if (item == NULL || item->getUseDuration() == 0) + if (item == nullptr || item->getUseDuration() == 0) { player->ignoreSlotUpdateHack = true; player->inventory->items[player->inventory->selected] = ItemInstance::clone(player->inventory->items[player->inventory->selected]); @@ -561,7 +561,7 @@ void PlayerConnection::onUnhandledPacket(shared_ptr packet) void PlayerConnection::send(shared_ptr packet) { - if( connection->getSocket() != NULL ) + if( connection->getSocket() != nullptr ) { if( !server->getPlayers()->canReceiveAllPackets( player ) ) { @@ -579,7 +579,7 @@ void PlayerConnection::send(shared_ptr packet) // 4J Added void PlayerConnection::queueSend(shared_ptr packet) { - if( connection->getSocket() != NULL ) + if( connection->getSocket() != nullptr ) { if( !server->getPlayers()->canReceiveAllPackets( player ) ) { @@ -685,7 +685,7 @@ void PlayerConnection::handlePlayerCommand(shared_ptr packe else if (packet->action == PlayerCommandPacket::RIDING_JUMP) { // currently only supported by horses... - if ( (player->riding != NULL) && player->riding->GetType() == eTYPE_HORSE) + if ( (player->riding != nullptr) && player->riding->GetType() == eTYPE_HORSE) { dynamic_pointer_cast(player->riding)->onPlayerJump(packet->data); } @@ -693,7 +693,7 @@ void PlayerConnection::handlePlayerCommand(shared_ptr packe else if (packet->action == PlayerCommandPacket::OPEN_INVENTORY) { // also only supported by horses... - if ( (player->riding != NULL) && player->riding->instanceof(eTYPE_HORSE) ) + if ( (player->riding != nullptr) && player->riding->instanceof(eTYPE_HORSE) ) { dynamic_pointer_cast(player->riding)->openInventory(player); } @@ -752,7 +752,7 @@ void PlayerConnection::handleInteract(shared_ptr packet) // 4J Stu - If the client says that we hit something, then agree with it. The canSee can fail here as it checks // a ray from head->head, but we may actually be looking at a different part of the entity that can be seen // even though the ray is blocked. - if (target != NULL) // && player->canSee(target) && player->distanceToSqr(target) < 6 * 6) + if (target != nullptr) // && player->canSee(target) && player->distanceToSqr(target) < 6 * 6) { //boole canSee = player->canSee(target); //double maxDist = 6 * 6; @@ -797,7 +797,7 @@ void PlayerConnection::handleTexture(shared_ptr packet) #ifndef _CONTENT_PACKAGE wprintf(L"Server received request for custom texture %ls\n",packet->textureName.c_str()); #endif - PBYTE pbData=NULL; + PBYTE pbData=nullptr; DWORD dwBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwBytes); @@ -831,7 +831,7 @@ void PlayerConnection::handleTextureAndGeometry(shared_ptrtextureName.c_str()); #endif - PBYTE pbData=NULL; + PBYTE pbData=nullptr; DWORD dwTextureBytes=0; app.GetMemFileDetails(packet->textureName,&pbData,&dwTextureBytes); DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(packet->textureName); @@ -895,7 +895,7 @@ void PlayerConnection::handleTextureReceived(const wstring &textureName) auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(), textureName); if( it != m_texturesRequested.end() ) { - PBYTE pbData=NULL; + PBYTE pbData=nullptr; DWORD dwBytes=0; app.GetMemFileDetails(textureName,&pbData,&dwBytes); @@ -913,7 +913,7 @@ void PlayerConnection::handleTextureAndGeometryReceived(const wstring &textureNa auto it = find(m_texturesRequested.begin(), m_texturesRequested.end(), textureName); if( it != m_texturesRequested.end() ) { - PBYTE pbData=NULL; + PBYTE pbData=nullptr; DWORD dwTextureBytes=0; app.GetMemFileDetails(textureName,&pbData,&dwTextureBytes); DLCSkinFile *pDLCSkinFile=app.m_dlcManager.getSkinFile(textureName); @@ -963,13 +963,13 @@ void PlayerConnection::handleTextureChange(shared_ptr packe #ifndef _CONTENT_PACKAGE wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",packet->path.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TexturePacket(packet->path,NULL,0) ) ); + send(shared_ptr( new TexturePacket(packet->path,nullptr,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path,NULL,0); + app.AddMemoryTextureFile(packet->path,nullptr,0); } server->getPlayers()->broadcastAll( shared_ptr( new TextureChangePacket(player,packet->action,packet->path) ), player->dimension ); } @@ -990,13 +990,13 @@ void PlayerConnection::handleTextureAndGeometryChange(shared_ptrpath.c_str(), player->name.c_str()); #endif - send(shared_ptr( new TextureAndGeometryPacket(packet->path,NULL,0) ) ); + send(shared_ptr( new TextureAndGeometryPacket(packet->path,nullptr,0) ) ); } } else if(!packet->path.empty() && app.IsFileInMemoryTextures(packet->path)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(packet->path,NULL,0); + app.AddMemoryTextureFile(packet->path,nullptr,0); player->setCustomSkin(packet->dwSkinID); @@ -1014,7 +1014,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptrIsHost()) || player->isModerator()) + if( (networkPlayer != nullptr && networkPlayer->IsHost()) || player->isModerator()) { app.SetGameHostOption(eGameHostOption_FireSpreads, app.GetGameHostOption(packet->data,eGameHostOption_FireSpreads)); app.SetGameHostOption(eGameHostOption_TNT, app.GetGameHostOption(packet->data,eGameHostOption_TNT)); @@ -1037,7 +1037,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptr packet) { INetworkPlayer *networkPlayer = getNetworkPlayer(); - if( (networkPlayer != NULL && networkPlayer->IsHost()) || player->isModerator()) + if( (networkPlayer != nullptr && networkPlayer->IsHost()) || player->isModerator()) { server->getPlayers()->kickPlayerByShortId(packet->m_networkSmallId); } @@ -1106,9 +1106,9 @@ void PlayerConnection::handleContainerSetSlot(shared_ptr if (packet->containerId == AbstractContainerMenu::CONTAINER_ID_INVENTORY && packet->slot >= 36 && packet->slot < 36 + 9) { shared_ptr lastItem = player->inventoryMenu->getSlot(packet->slot)->getItem(); - if (packet->item != NULL) + if (packet->item != nullptr) { - if (lastItem == NULL || lastItem->count < packet->item->count) + if (lastItem == nullptr || lastItem->count < packet->item->count) { packet->item->popTime = Inventory::POP_TIME_DURATION; } @@ -1184,7 +1184,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrslotNum < 0; shared_ptr item = packet->item; - if(item != NULL && item->id == Item::map_Id) + if(item != nullptr && item->id == Item::map_Id) { int mapScale = 3; #ifdef _LARGE_WORLDS @@ -1204,7 +1204,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrgetAuxValue()); std::wstring id = wstring(buf); - if( data == NULL ) + if( data == nullptr ) { data = shared_ptr( new MapItemSavedData(id) ); } @@ -1219,12 +1219,12 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrslotNum >= InventoryMenu::CRAFT_SLOT_START && packet->slotNum < (InventoryMenu::USE_ROW_SLOT_START + Inventory::getSelectionSize())); - bool validItem = item == NULL || (item->id < Item::items.length && item->id >= 0 && Item::items[item->id] != NULL); - bool validData = item == NULL || (item->getAuxValue() >= 0 && item->count > 0 && item->count <= 64); + bool validItem = item == nullptr || (item->id < Item::items.length && item->id >= 0 && Item::items[item->id] != nullptr); + bool validData = item == nullptr || (item->getAuxValue() >= 0 && item->count > 0 && item->count <= 64); if (validSlot && validItem && validData) { - if (item == NULL) + if (item == nullptr) { player->inventoryMenu->setItem(packet->slotNum, nullptr); } @@ -1242,14 +1242,14 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr dropped = player->drop(item); - if (dropped != NULL) + if (dropped != nullptr) { dropped->setShortLifeTime(); } } } - if( item != NULL && item->id == Item::map_Id ) + if( item != nullptr && item->id == Item::map_Id ) { // 4J Stu - Maps need to have their aux value update, so the client should always be assumed to be wrong // This is how the Java works, as the client also incorrectly predicts the auxvalue of the mapItem @@ -1283,7 +1283,7 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) { shared_ptr te = level->getTileEntity(packet->x, packet->y, packet->z); - if (dynamic_pointer_cast(te) != NULL) + if (dynamic_pointer_cast(te) != nullptr) { shared_ptr ste = dynamic_pointer_cast(te); if (!ste->isEditable() || ste->getPlayerWhoMayEdit() != player) @@ -1294,7 +1294,7 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) } // 4J-JEV: Changed to allow characters to display as a []. - if (dynamic_pointer_cast(te) != NULL) + if (dynamic_pointer_cast(te) != nullptr) { int x = packet->x; int y = packet->y; @@ -1327,20 +1327,20 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) // Need to check that this player has permission to change each individual setting? INetworkPlayer *networkPlayer = getNetworkPlayer(); - if( (networkPlayer != NULL && networkPlayer->IsHost()) || player->isModerator() ) + if( (networkPlayer != nullptr && networkPlayer->IsHost()) || player->isModerator() ) { shared_ptr serverPlayer; // Find the player being edited for(auto& checkingPlayer : server->getPlayers()->players) { - if(checkingPlayer->connection->getNetworkPlayer() != NULL && checkingPlayer->connection->getNetworkPlayer()->GetSmallId() == packet->m_networkSmallId) + if(checkingPlayer->connection->getNetworkPlayer() != nullptr && checkingPlayer->connection->getNetworkPlayer()->GetSmallId() == packet->m_networkSmallId) { serverPlayer = checkingPlayer; break; } } - if(serverPlayer != NULL) + if(serverPlayer != nullptr) { unsigned int origPrivs = serverPlayer->getAllPlayerGamePrivileges(); @@ -1514,7 +1514,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo shared_ptr tileEntity = player->level->getTileEntity(x, y, z); shared_ptr cbe = dynamic_pointer_cast(tileEntity); - if (tileEntity != NULL && cbe != NULL) + if (tileEntity != nullptr && cbe != nullptr) { cbe->setCommand(command); player->level->sendTileUpdated(x, y, z); @@ -1528,7 +1528,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo } else if (CustomPayloadPacket::SET_BEACON_PACKET.compare(customPayloadPacket->identifier) == 0) { - if ( dynamic_cast( player->containerMenu) != NULL) + if ( dynamic_cast( player->containerMenu) != nullptr) { ByteArrayInputStream bais(customPayloadPacket->data); DataInputStream input(&bais); @@ -1552,7 +1552,7 @@ void PlayerConnection::handleCustomPayload(shared_ptr custo AnvilMenu *menu = dynamic_cast( player->containerMenu); if (menu) { - if (customPayloadPacket->data.data == NULL || customPayloadPacket->data.length < 1) + if (customPayloadPacket->data.data == nullptr || customPayloadPacket->data.length < 1) { menu->setItemName(L""); } @@ -1616,7 +1616,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) Recipy::INGREDIENTS_REQUIRED &req = pRecipeIngredientsRequired[iRecipe]; - if (req.iType == RECIPE_TYPE_3x3 && dynamic_cast(player->containerMenu) == NULL) + if (req.iType == RECIPE_TYPE_3x3 && dynamic_cast(player->containerMenu) == nullptr) { server->warn(L"Player " + player->getName() + L" tried to craft a 3x3 recipe without a crafting bench"); return; @@ -1651,7 +1651,7 @@ void PlayerConnection::handleCraftItem(shared_ptr packet) } // 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when crafting Cake - if (ingItemInst != NULL) + if (ingItemInst != nullptr) { if (ingItemInst->getItem()->hasCraftingRemainingItem()) { @@ -1735,7 +1735,7 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) int buyAMatches = player->inventory->countMatches(buyAItem); int buyBMatches = player->inventory->countMatches(buyBItem); - if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) ) + if( (buyAItem != nullptr && buyAMatches >= buyAItem->count) && (buyBItem == nullptr || buyBMatches >= buyBItem->count) ) { menu->getMerchant()->notifyTrade(activeRecipe); @@ -1769,13 +1769,13 @@ void PlayerConnection::handleTradeItem(shared_ptr packet) INetworkPlayer *PlayerConnection::getNetworkPlayer() { - if( connection != NULL && connection->getSocket() != NULL) return connection->getSocket()->getPlayer(); - else return NULL; + if( connection != nullptr && connection->getSocket() != nullptr) return connection->getSocket()->getPlayer(); + else return nullptr; } bool PlayerConnection::isLocal() { - if( connection->getSocket() == NULL ) + if( connection->getSocket() == nullptr ) { return false; } @@ -1788,7 +1788,7 @@ bool PlayerConnection::isLocal() bool PlayerConnection::isGuest() { - if( connection->getSocket() == NULL ) + if( connection->getSocket() == nullptr ) { return false; } @@ -1796,7 +1796,7 @@ bool PlayerConnection::isGuest() { INetworkPlayer *networkPlayer = connection->getSocket()->getPlayer(); bool isGuest = false; - if(networkPlayer != NULL) + if(networkPlayer != nullptr) { isGuest = networkPlayer->IsGuest() == TRUE; } diff --git a/Minecraft.Client/PlayerList.cpp b/Minecraft.Client/PlayerList.cpp index 3f5da980f..24457bee8 100644 --- a/Minecraft.Client/PlayerList.cpp +++ b/Minecraft.Client/PlayerList.cpp @@ -38,12 +38,12 @@ PlayerList::PlayerList(MinecraftServer *server) { - playerIo = NULL; + playerIo = nullptr; this->server = server; sendAllPlayerInfoIn = 0; - overrideGameMode = NULL; + overrideGameMode = nullptr; allowCheatsForAllPlayers = false; #ifdef __PSVITA__ @@ -83,14 +83,14 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr { CompoundTag *playerTag = load(player); - bool newPlayer = playerTag == NULL; + bool newPlayer = playerTag == nullptr; player->setLevel(server->getLevel(player->dimension)); player->gameMode->setLevel(static_cast(player->level)); // Make sure these privileges are always turned off for the host player INetworkPlayer *networkPlayer = connection->getSocket()->getPlayer(); - if(networkPlayer != NULL && networkPlayer->IsHost()) + if(networkPlayer != nullptr && networkPlayer->IsHost()) { player->enableAllPlayerPrivileges(true); player->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_HOST,1); @@ -100,18 +100,18 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr // PS3 networking library doesn't automatically assign PlayerUIDs to the network players for anything remote, so need to tell it what to set from the data in this packet now if( !g_NetworkManager.IsLocalGame() ) { - if( networkPlayer != NULL ) + if( networkPlayer != nullptr ) { ((NetworkPlayerSony *)networkPlayer)->SetUID( packet->m_onlineXuid ); } } #endif #ifdef _WINDOWS64 - if (networkPlayer != NULL) + if (networkPlayer != nullptr) { NetworkPlayerXbox* nxp = static_cast(networkPlayer); IQNetPlayer* qnp = nxp->GetQNetPlayer(); - if (qnp != NULL) + if (qnp != nullptr) { if (!networkPlayer->IsLocal()) { @@ -168,7 +168,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr #endif // 4J Added - Give every player a map the first time they join a server player->inventory->setItem( 9, shared_ptr( new ItemInstance(Item::map_Id, 1, level->getAuxValueForMap(player->getXuid(),0,centreXC, centreZC, mapScale ) ) ) ); - if(app.getGameRuleDefinitions() != NULL) + if(app.getGameRuleDefinitions() != nullptr) { app.getGameRuleDefinitions()->postProcessPlayer(player); } @@ -181,13 +181,13 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr #ifndef _CONTENT_PACKAGE wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl.c_str(), player->name.c_str()); #endif - playerConnection->send(shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,NULL,0) ) ); + playerConnection->send(shared_ptr( new TextureAndGeometryPacket(player->customTextureUrl,nullptr,0) ) ); } } else if(!player->customTextureUrl.empty() && app.IsFileInMemoryTextures(player->customTextureUrl)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl,NULL,0); + app.AddMemoryTextureFile(player->customTextureUrl,nullptr,0); } if(!player->customTextureUrl2.empty() && player->customTextureUrl2.substr(0,3).compare(L"def") != 0 && !app.IsFileInMemoryTextures(player->customTextureUrl2)) @@ -197,13 +197,13 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr #ifndef _CONTENT_PACKAGE wprintf(L"Sending texture packet to get custom skin %ls from player %ls\n",player->customTextureUrl2.c_str(), player->name.c_str()); #endif - playerConnection->send(shared_ptr( new TexturePacket(player->customTextureUrl2,NULL,0) ) ); + playerConnection->send(shared_ptr( new TexturePacket(player->customTextureUrl2,nullptr,0) ) ); } } else if(!player->customTextureUrl2.empty() && app.IsFileInMemoryTextures(player->customTextureUrl2)) { // Update the ref count on the memory texture data - app.AddMemoryTextureFile(player->customTextureUrl2,NULL,0); + app.AddMemoryTextureFile(player->customTextureUrl2,nullptr,0); } player->setIsGuest( packet->m_isGuest ); @@ -268,11 +268,11 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr player->initMenu(); - if (playerTag != NULL && playerTag->contains(Entity::RIDING_TAG)) + if (playerTag != nullptr && playerTag->contains(Entity::RIDING_TAG)) { // this player has been saved with a mount tag shared_ptr mount = EntityIO::loadStatic(playerTag->getCompound(Entity::RIDING_TAG), level); - if (mount != NULL) + if (mount != nullptr) { mount->forcedLoading = true; level->addEntity(mount); @@ -311,7 +311,7 @@ void PlayerList::updateEntireScoreboard(ServerScoreboard *scoreboard, shared_ptr //{ // Objective objective = scoreboard->getDisplayObjective(slot); - // if (objective != NULL && !objectives->contains(objective)) + // if (objective != nullptr && !objectives->contains(objective)) // { // vector > *packets = scoreboard->getStartTrackingPackets(objective); @@ -334,7 +334,7 @@ void PlayerList::changeDimension(shared_ptr player, ServerLevel *f { ServerLevel *to = player->getLevel(); - if (from != NULL) from->getChunkMap()->remove(player); + if (from != nullptr) from->getChunkMap()->remove(player); to->getChunkMap()->add(player); to->cache->create(static_cast(player->x) >> 4, static_cast(player->z) >> 4); @@ -406,10 +406,10 @@ void PlayerList::validatePlayerSpawnPosition(shared_ptr player) delete levelSpawn; Pos *bedPosition = player->getRespawnPosition(); - if (bedPosition != NULL) + if (bedPosition != nullptr) { Pos *respawnPosition = Player::checkBedValidRespawnPosition(server->getLevel(player->dimension), bedPosition, spawnForced); - if (respawnPosition != NULL) + if (respawnPosition != nullptr) { player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f, respawnPosition->z + 0.5f, 0, 0); player->setRespawnPosition(bedPosition, spawnForced); @@ -447,7 +447,7 @@ void PlayerList::add(shared_ptr player) // 4J Stu - Swapped these lines about so that we get the chunk visiblity packet way ahead of all the add tracked entity packets // Fix for #9169 - ART : Sign text is replaced with the words �Awaiting approval�. - changeDimension(player, NULL); + changeDimension(player, nullptr); level->addEntity(player); for (int i = 0; i < players.size(); i++) @@ -468,7 +468,7 @@ void PlayerList::add(shared_ptr player) shared_ptr thisPlayer = players[i]; if(thisPlayer->isSleeping()) { - if(firstSleepingPlayer == NULL) firstSleepingPlayer = thisPlayer; + if(firstSleepingPlayer == nullptr) firstSleepingPlayer = thisPlayer; thisPlayer->connection->send(shared_ptr( new ChatPacket(thisPlayer->name, ChatPacket::e_ChatBedMeSleep))); } } @@ -487,7 +487,7 @@ void PlayerList::remove(shared_ptr player) //4J Stu - We don't want to save the map data for guests, so when we are sure that the player is gone delete the map if(player->isGuest()) playerIo->deleteMapFilesForPlayer(player); ServerLevel *level = player->getLevel(); -if (player->riding != NULL) +if (player->riding != nullptr) { level->removeEntityImmediately(player->riding); app.DebugPrintf("removing player mount"); @@ -505,10 +505,10 @@ if (player->riding != NULL) removePlayerFromReceiving(player); player->connection = nullptr; // Must remove reference to connection, or else there is a circular dependency delete player->gameMode; // Gamemode also needs deleted as it references back to this player - player->gameMode = NULL; + player->gameMode = nullptr; // 4J Stu - Save all the players currently in the game, which will also free up unused map id slots if required, and remove old players - saveAll(NULL,false); + saveAll(nullptr,false); } shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendingConnection, const wstring& userName, PlayerUID xuid, PlayerUID onlineXuid) @@ -531,7 +531,7 @@ shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendin // Use packet-supplied identity from LoginPacket. // Do not recompute from name here: mixed-version clients must stay compatible. INetworkPlayer* np = pendingConnection->connection->getSocket()->getPlayer(); - if (np != NULL) + if (np != nullptr) { player->setOnlineXuid(np->GetUID()); @@ -547,14 +547,14 @@ shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendin #endif // Work out the base server player settings INetworkPlayer *networkPlayer = pendingConnection->connection->getSocket()->getPlayer(); - if(networkPlayer != NULL && !networkPlayer->IsHost()) + if(networkPlayer != nullptr && !networkPlayer->IsHost()) { player->enableAllPlayerPrivileges( app.GetGameHostOption(eGameHostOption_TrustPlayers)>0 ); } // 4J Added LevelRuleset *serverRuleDefs = app.getGameRuleDefinitions(); - if(serverRuleDefs != NULL) + if(serverRuleDefs != nullptr) { player->gameMode->setGameRules( GameRuleDefinition::generateNewGameRulesInstance(GameRulesInstance::eGameRulesInstanceType_ServerPlayer, serverRuleDefs, pendingConnection->connection) ); } @@ -581,7 +581,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay if( ep->dimension != oldDimension ) continue; INetworkPlayer * otherPlayer = ep->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { // There's another player here in the same dimension - we're not the last one out isEmptying = false; @@ -674,7 +674,7 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay { // If the player is still alive and respawning to the same dimension, they are just being added back from someone else viewing the Win screen player->moveTo(serverPlayer->x, serverPlayer->y, serverPlayer->z, serverPlayer->yRot, serverPlayer->xRot); - if(bedPosition != NULL) + if(bedPosition != nullptr) { player->setRespawnPosition(bedPosition, spawnForced); delete bedPosition; @@ -682,10 +682,10 @@ shared_ptr PlayerList::respawn(shared_ptr serverPlay // Fix for #81759 - TU9: Content: Gameplay: Entering The End Exit Portal replaces the Player's currently held item with the first one from the Quickbar player->inventory->selected = serverPlayer->inventory->selected; } - else if (bedPosition != NULL) + else if (bedPosition != nullptr) { Pos *respawnPosition = Player::checkBedValidRespawnPosition(server->getLevel(serverPlayer->dimension), bedPosition, spawnForced); - if (respawnPosition != NULL) + if (respawnPosition != nullptr) { player->moveTo(respawnPosition->x + 0.5f, respawnPosition->y + 0.1f, respawnPosition->z + 0.5f, 0, 0); player->setRespawnPosition(bedPosition, spawnForced); @@ -765,7 +765,7 @@ void PlayerList::toggleDimension(shared_ptr player, int targetDime if( ep->dimension != lastDimension ) continue; INetworkPlayer * otherPlayer = ep->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { // There's another player here in the same dimension - we're not the last one out isEmptying = false; @@ -966,15 +966,15 @@ void PlayerList::tick() for(unsigned int i = 0; i < players.size(); i++) { shared_ptr p = players.at(i); - // 4J Stu - May be being a bit overprotective with all the NULL checks, but adding late in TU7 so want to be safe - if (p != NULL && p->connection != NULL && p->connection->connection != NULL && p->connection->connection->getSocket() != NULL && p->connection->connection->getSocket()->getSmallId() == smallId ) + // 4J Stu - May be being a bit overprotective with all the nullptr checks, but adding late in TU7 so want to be safe + if (p != nullptr && p->connection != nullptr && p->connection->connection != nullptr && p->connection->connection->getSocket() != nullptr && p->connection->connection->getSocket()->getSmallId() == smallId ) { player = p; break; } } - if (player != NULL) + if (player != nullptr) { player->connection->disconnect( DisconnectPacket::eDisconnect_Closed ); } @@ -987,7 +987,7 @@ void PlayerList::tick() BYTE smallId = m_smallIdsToKick.front(); m_smallIdsToKick.pop_front(); INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(smallId); - if( selectedPlayer != NULL ) + if( selectedPlayer != nullptr ) { if( selectedPlayer->IsLocal() != TRUE ) { @@ -1000,14 +1000,14 @@ void PlayerList::tick() { shared_ptr p = players.at(i); PlayerUID playersXuid = p->getOnlineXuid(); - if (p != NULL && ProfileManager.AreXUIDSEqual(playersXuid, xuid ) ) + if (p != nullptr && ProfileManager.AreXUIDSEqual(playersXuid, xuid ) ) { player = p; break; } } - if (player != NULL) + if (player != nullptr) { m_bannedXuids.push_back( player->getOnlineXuid() ); // 4J Stu - If we have kicked a player, make sure that they have no privileges if they later try to join the world when trust players is off @@ -1030,7 +1030,7 @@ void PlayerList::tick() if(currentPlayer->removed) { shared_ptr newPlayer = findAlivePlayerOnSystem(currentPlayer); - if(newPlayer != NULL) + if(newPlayer != nullptr) { receiveAllPlayers[dim][i] = newPlayer; app.DebugPrintf("Replacing primary player %ls with %ls in dimension %d\n", currentPlayer->name.c_str(), newPlayer->name.c_str(), dim); @@ -1097,7 +1097,7 @@ bool PlayerList::isOp(shared_ptr player) cheatsEnabled = cheatsEnabled || app.GetUseDPadForDebug(); #endif INetworkPlayer *networkPlayer = player->connection->getNetworkPlayer(); - bool isOp = cheatsEnabled && (player->isModerator() || (networkPlayer != NULL && networkPlayer->IsHost())); + bool isOp = cheatsEnabled && (player->isModerator() || (networkPlayer != nullptr && networkPlayer->IsHost())); return isOp; } @@ -1131,7 +1131,7 @@ shared_ptr PlayerList::getPlayer(PlayerUID uid) shared_ptr PlayerList::getNearestPlayer(Pos *position, int range) { if (players.empty()) return nullptr; - if (position == NULL) return players.at(0); + if (position == nullptr) return players.at(0); shared_ptr current = nullptr; double dist = -1; int rangeSqr = range * range; @@ -1154,9 +1154,9 @@ shared_ptr PlayerList::getNearestPlayer(Pos *position, int range) vector *PlayerList::getPlayers(Pos *position, int rangeMin, int rangeMax, int count, int mode, int levelMin, int levelMax, unordered_map *scoreRequirements, const wstring &playerName, const wstring &teamName, Level *level) { app.DebugPrintf("getPlayers NOT IMPLEMENTED!"); - return NULL; + return nullptr; - /*if (players.empty()) return NULL; + /*if (players.empty()) return nullptr; vector > result = new vector >(); bool reverse = count < 0; bool playerNameNot = !playerName.empty() && playerName.startsWith("!"); @@ -1238,7 +1238,7 @@ bool PlayerList::meetsScoreRequirements(shared_ptr player, unordered_map void PlayerList::sendMessage(const wstring& name, const wstring& message) { shared_ptr player = getPlayer(name); - if (player != NULL) + if (player != nullptr) { player->connection->send( shared_ptr( new ChatPacket(message) ) ); } @@ -1254,7 +1254,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double // 4J - altered so that we don't send to the same machine more than once. Add the source player to the machines we have "sent" to as it doesn't need to go to that // machine either vector< shared_ptr > sentTo; - if( except != NULL ) + if( except != nullptr ) { sentTo.push_back(dynamic_pointer_cast(except)); } @@ -1270,7 +1270,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double if( sentTo.size() ) { INetworkPlayer *thisPlayer = p->connection->getNetworkPlayer(); - if( thisPlayer == NULL ) + if( thisPlayer == nullptr ) { dontSend = true; } @@ -1280,7 +1280,7 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double { shared_ptr player2 = sentTo[j]; INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { dontSend = true; } @@ -1318,8 +1318,8 @@ void PlayerList::broadcast(shared_ptr except, double x, double y, double void PlayerList::saveAll(ProgressListener *progressListener, bool bDeleteGuestMaps /*= false*/) { - if(progressListener != NULL) progressListener->progressStart(IDS_PROGRESS_SAVING_PLAYERS); - // 4J - playerIo can be NULL if we have have to exit a game really early on due to network failure + if(progressListener != nullptr) progressListener->progressStart(IDS_PROGRESS_SAVING_PLAYERS); + // 4J - playerIo can be nullptr if we have have to exit a game really early on due to network failure if(playerIo) { playerIo->saveAllCachedData(); @@ -1330,7 +1330,7 @@ void PlayerList::saveAll(ProgressListener *progressListener, bool bDeleteGuestMa //4J Stu - We don't want to save the map data for guests, so when we are sure that the player is gone delete the map if(bDeleteGuestMaps && players[i]->isGuest()) playerIo->deleteMapFilesForPlayer(players[i]); - if(progressListener != NULL) progressListener->progressStagePercentage((i * 100)/ static_cast(players.size())); + if(progressListener != nullptr) progressListener->progressStagePercentage((i * 100)/ static_cast(players.size())); } playerIo->clearOldPlayerFiles(); playerIo->saveMapIdLookup(); @@ -1419,11 +1419,11 @@ void PlayerList::updatePlayerGameMode(shared_ptr newPlayer, shared // reset the player's game mode (first pick from old, then copy level if // necessary) - if (oldPlayer != NULL) + if (oldPlayer != nullptr) { newPlayer->gameMode->setGameModeForPlayer(oldPlayer->gameMode->getGameModeForPlayer()); } - else if (overrideGameMode != NULL) + else if (overrideGameMode != nullptr) { newPlayer->gameMode->setGameModeForPlayer(overrideGameMode); } @@ -1507,10 +1507,10 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool } } } - else if( thisPlayer == NULL ) + else if( thisPlayer == nullptr ) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf("Remove: Qnet player for %ls was NULL so re-checking all players\n", player->name.c_str() ); + app.DebugPrintf("Remove: Qnet player for %ls was nullptr so re-checking all players\n", player->name.c_str() ); #endif // 4J Stu - Something went wrong, or possibly the QNet player left before we got here. // Re-check all active players and make sure they have someone on their system to receive all packets @@ -1527,7 +1527,7 @@ void PlayerList::removePlayerFromReceiving(shared_ptr player, bool for(auto& primaryPlayer : receiveAllPlayers[newPlayerDim]) { INetworkPlayer *primPlayer = primaryPlayer->connection->getNetworkPlayer(); - if(primPlayer != NULL && checkingPlayer->IsSameSystem( primPlayer ) ) + if(primPlayer != nullptr && checkingPlayer->IsSameSystem( primPlayer ) ) { foundPrimary = true; break; @@ -1559,10 +1559,10 @@ void PlayerList::addPlayerToReceiving(shared_ptr player) INetworkPlayer *thisPlayer = player->connection->getNetworkPlayer(); - if( thisPlayer == NULL ) + if( thisPlayer == nullptr ) { #ifndef _CONTENT_PACKAGE - app.DebugPrintf("Add: Qnet player for player %ls is NULL so not adding them\n", player->name.c_str() ); + app.DebugPrintf("Add: Qnet player for player %ls is nullptr so not adding them\n", player->name.c_str() ); #endif shouldAddPlayer = false; } @@ -1571,7 +1571,7 @@ void PlayerList::addPlayerToReceiving(shared_ptr player) for(auto& oldPlayer : receiveAllPlayers[playerDim]) { INetworkPlayer *checkingPlayer = oldPlayer->connection->getNetworkPlayer(); - if(checkingPlayer != NULL && checkingPlayer->IsSameSystem( thisPlayer ) ) + if(checkingPlayer != nullptr && checkingPlayer->IsSameSystem( thisPlayer ) ) { shouldAddPlayer = false; break; diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index 09d754183..f4803eaee 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -60,7 +60,7 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, fl } shared_ptr itemInstance = player->inventory->getArmor(3 - layer); - if (itemInstance != NULL) + if (itemInstance != nullptr) { Item *item = itemInstance->getItem(); if (dynamic_cast(item)) @@ -79,9 +79,9 @@ int PlayerRenderer::prepareArmor(shared_ptr _player, int layer, fl armor->leg1->visible = layer == 2 || layer == 3; setArmor(armor); - if (armor != NULL) armor->attackTime = model->attackTime; - if (armor != NULL) armor->riding = model->riding; - if (armor != NULL) armor->young = model->young; + if (armor != nullptr) armor->attackTime = model->attackTime; + if (armor != nullptr) armor->riding = model->riding; + if (armor != nullptr) armor->young = model->young; float brightness = SharedConstants::TEXTURE_LIGHTING ? 1 : player->getBrightness(a); if (armorItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH) @@ -114,7 +114,7 @@ void PlayerRenderer::prepareSecondPassArmor(shared_ptr _player, in // 4J - dynamic cast required because we aren't using templates/generics in our version shared_ptr player = dynamic_pointer_cast(_player); shared_ptr itemInstance = player->inventory->getArmor(3 - layer); - if (itemInstance != NULL) + if (itemInstance != nullptr) { Item *item = itemInstance->getItem(); if (dynamic_cast(item)) @@ -136,8 +136,8 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double if(mob->hasInvisiblePrivilege()) return; shared_ptr item = mob->inventory->getSelected(); - armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != NULL ? 1 : 0; - if (item != NULL) + armorParts1->holdingRightHand = armorParts2->holdingRightHand = humanoidModel->holdingRightHand = item != nullptr ? 1 : 0; + if (item != nullptr) { if (mob->getUseItemDuration() > 0) { @@ -153,7 +153,7 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double } } // 4J added, for 3rd person view of eating - if( item != NULL && mob->getUseItemDuration() > 0 && item->getUseAnimation() == UseAnim_eat ) + if( item != nullptr && mob->getUseItemDuration() > 0 && item->getUseAnimation() == UseAnim_eat ) { // These factors are largely lifted from ItemInHandRenderer to try and keep the 3rd person eating animation as similar as possible float t = (mob->getUseItemDuration() - a + 1); @@ -237,7 +237,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) shared_ptr mob = dynamic_pointer_cast(_mob); shared_ptr headGear = mob->inventory->getArmor(3); - if (headGear != NULL) + if (headGear != nullptr) { // don't render the pumpkin for the skins unsigned int uiAnimOverrideBitmask = mob->getSkinAnimOverrideBitmask( mob->getCustomSkin()); @@ -277,7 +277,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) } // need to add a custom texture for deadmau5 - if (mob != NULL && app.isXuidDeadmau5( mob->getXuid() ) && bindTexture(mob->customTextureUrl, L"" )) + if (mob != nullptr && app.isXuidDeadmau5( mob->getXuid() ) && bindTexture(mob->customTextureUrl, L"" )) { for (int i = 0; i < 2; i++) { @@ -345,13 +345,13 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) shared_ptr item = mob->inventory->getSelected(); - if (item != NULL) + if (item != nullptr) { glPushMatrix(); humanoidModel->arm0->translateTo(1 / 16.0f); glTranslatef(-1 / 16.0f, 7 / 16.0f, 1 / 16.0f); - if (mob->fishing != NULL) + if (mob->fishing != nullptr) { item = shared_ptr( new ItemInstance(Item::stick) ); } @@ -449,7 +449,7 @@ void PlayerRenderer::renderNameTags(shared_ptr player, double x, d Scoreboard *scoreboard = player->getScoreboard(); Objective *objective = scoreboard->getDisplayObjective(Scoreboard::DISPLAY_SLOT_BELOW_NAME); - if (objective != NULL) + if (objective != nullptr) { Score *score = scoreboard->getPlayerScore(player->getAName(), objective); @@ -535,7 +535,7 @@ void PlayerRenderer::renderShadow(shared_ptr e, double x, double y, doub if(app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) > 0) { shared_ptr player = dynamic_pointer_cast(e); - if(player != NULL && player->hasInvisiblePrivilege()) return; + if(player != nullptr && player->hasInvisiblePrivilege()) return; } EntityRenderer::renderShadow(e,x,y,z,pow,a); } diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index 5a98b3462..33e0b59ec 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -26,8 +26,8 @@ PreStitchedTextureMap::PreStitchedTextureMap(int type, const wstring &name, cons this->missingTexture = missingTexture; // 4J Initialisers - missingPosition = NULL; - stitchResult = NULL; + missingPosition = nullptr; + stitchResult = nullptr; m_mipMap = mipmap; missingPosition = static_cast(new SimpleIcon(NAME_MISSING_TEXTURE, NAME_MISSING_TEXTURE, 0, 0, 1, 1)); @@ -48,7 +48,7 @@ void PreStitchedTextureMap::stitch() //for (Tile tile : Tile.tiles) for(unsigned int i = 0; i < Tile::TILE_NUM_COUNT; ++i) { - if (Tile::tiles[i] != NULL) + if (Tile::tiles[i] != nullptr) { Tile::tiles[i]->registerIcons(this); } @@ -62,7 +62,7 @@ void PreStitchedTextureMap::stitch() for(unsigned int i = 0; i < Item::ITEM_NUM_COUNT; ++i) { Item *item = Item::items[i]; - if (item != NULL && item->getIconType() == iconType) + if (item != nullptr && item->getIconType() == iconType) { item->registerIcons(this); } @@ -121,7 +121,7 @@ void PreStitchedTextureMap::stitch() int height = image->getHeight(); int width = image->getWidth(); - if(stitchResult != NULL) + if(stitchResult != nullptr) { TextureManager::getInstance()->unregisterTexture(name, stitchResult); delete stitchResult; @@ -216,7 +216,7 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack *texturePack, Stitch // TODO: [EB] Put the frames into a proper object, not this inside out hack vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); - if (frames == NULL || frames->empty()) + if (frames == nullptr || frames->empty()) { return; // Couldn't load a texture, skip it } @@ -248,10 +248,10 @@ StitchedTexture *PreStitchedTextureMap::getTexture(const wstring &name) app.DebugPrintf("Not implemented!\n"); __debugbreak(); #endif - return NULL; + return nullptr; #if 0 StitchedTexture *result = texturesByName.find(name)->second; - if (result == NULL) result = missingPosition; + if (result == nullptr) result = missingPosition; return result; #endif } @@ -272,10 +272,10 @@ Texture *PreStitchedTextureMap::getStitchedTexture() // 4J Stu - register is a reserved keyword in C++ Icon *PreStitchedTextureMap::registerIcon(const wstring &name) { - Icon *result = NULL; + Icon *result = nullptr; if (name.empty()) { - app.DebugPrintf("Don't register NULL\n"); + app.DebugPrintf("Don't register nullptr\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif diff --git a/Minecraft.Client/ReceivingLevelScreen.cpp b/Minecraft.Client/ReceivingLevelScreen.cpp index 0e9fe3ec0..fda24773e 100644 --- a/Minecraft.Client/ReceivingLevelScreen.cpp +++ b/Minecraft.Client/ReceivingLevelScreen.cpp @@ -25,7 +25,7 @@ void ReceivingLevelScreen::tick() { connection->send( shared_ptr( new KeepAlivePacket() ) ); } - if (connection != NULL) + if (connection != nullptr) { connection->tick(); } diff --git a/Minecraft.Client/RemotePlayer.cpp b/Minecraft.Client/RemotePlayer.cpp index ea946db02..dcfd69926 100644 --- a/Minecraft.Client/RemotePlayer.cpp +++ b/Minecraft.Client/RemotePlayer.cpp @@ -58,7 +58,7 @@ void RemotePlayer::tick() walkAnimSpeed += (wst - walkAnimSpeed) * 0.4f; walkAnimPos += walkAnimSpeed; - if (!hasStartedUsingItem && isUsingItemFlag() && inventory->items[inventory->selected] != NULL) + if (!hasStartedUsingItem && isUsingItemFlag() && inventory->items[inventory->selected] != nullptr) { shared_ptr item = inventory->items[inventory->selected]; startUsingItem(inventory->items[inventory->selected], Item::items[item->id]->getUseDuration(item)); diff --git a/Minecraft.Client/RenameWorldScreen.cpp b/Minecraft.Client/RenameWorldScreen.cpp index ea05039af..4255201ca 100644 --- a/Minecraft.Client/RenameWorldScreen.cpp +++ b/Minecraft.Client/RenameWorldScreen.cpp @@ -8,7 +8,7 @@ RenameWorldScreen::RenameWorldScreen(Screen *lastScreen, const wstring& levelId) { - nameEdit = NULL; + nameEdit = nullptr; this->lastScreen = lastScreen; this->levelId = levelId; } diff --git a/Minecraft.Client/Screen.cpp b/Minecraft.Client/Screen.cpp index 3e632f0b6..59ec2c0a8 100644 --- a/Minecraft.Client/Screen.cpp +++ b/Minecraft.Client/Screen.cpp @@ -13,13 +13,13 @@ Screen::Screen() // 4J added { - minecraft = NULL; + minecraft = nullptr; width = 0; height = 0; passEvents = false; - font = NULL; - particles = NULL; - clickedButton = NULL; + font = nullptr; + particles = nullptr; + clickedButton = nullptr; } void Screen::render(int xm, int ym, float a) @@ -35,7 +35,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) { if (eventKey == Keyboard::KEY_ESCAPE) { - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); // minecraft->grabMouse(); // 4J - removed } } @@ -43,7 +43,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) wstring Screen::getClipboard() { // 4J - removed - return NULL; + return nullptr; } void Screen::setClipboard(const wstring& str) @@ -69,10 +69,10 @@ void Screen::mouseClicked(int x, int y, int buttonNum) void Screen::mouseReleased(int x, int y, int buttonNum) { - if (clickedButton!=NULL && buttonNum==0) + if (clickedButton!=nullptr && buttonNum==0) { clickedButton->released(x, y); - clickedButton = NULL; + clickedButton = nullptr; } } @@ -210,7 +210,7 @@ void Screen::renderBackground() void Screen::renderBackground(int vo) { - if (minecraft->level != NULL) + if (minecraft->level != nullptr) { fillGradient(0, 0, width, height, 0xc0101010, 0xd0101010); } diff --git a/Minecraft.Client/SelectWorldScreen.cpp b/Minecraft.Client/SelectWorldScreen.cpp index 75ccc268c..cc2090785 100644 --- a/Minecraft.Client/SelectWorldScreen.cpp +++ b/Minecraft.Client/SelectWorldScreen.cpp @@ -16,11 +16,11 @@ SelectWorldScreen::SelectWorldScreen(Screen *lastScreen) title = L"Select world"; done = false; selectedWorld = 0; - worldSelectionList = NULL; + worldSelectionList = nullptr; isDeleting = false; - deleteButton = NULL; - selectButton = NULL; - renameButton = NULL; + deleteButton = nullptr; + selectButton = nullptr; + renameButton = nullptr; this->lastScreen = lastScreen; } @@ -115,14 +115,14 @@ void SelectWorldScreen::buttonClicked(Button *button) else { // create demo world - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); if (done) return; done = true; // 4J Stu - Not used, so commenting to stop the build failing #if 0 minecraft->gameMode = new DemoMode(minecraft); minecraft->selectLevel(CreateWorldScreen::findAvailableFolderName(minecraft->getLevelSource(), L"Demo"), L"Demo World", 0L); - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); #endif } } @@ -142,20 +142,20 @@ void SelectWorldScreen::buttonClicked(Button *button) void SelectWorldScreen::worldSelected(int id) { - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); if (done) return; done = true; - minecraft->gameMode = NULL; //new SurvivalMode(minecraft); + minecraft->gameMode = nullptr; //new SurvivalMode(minecraft); wstring worldFolderName = getWorldId(id); - if (worldFolderName == L"") // 4J - was NULL comparison + if (worldFolderName == L"") // 4J - was nullptr comparison { worldFolderName = L"World" + std::to_wstring(id); } // 4J Stu - Not used, so commenting to stop the build failing #if 0 minecraft->selectLevel(worldFolderName, getWorldName(id), 0); - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); #endif } diff --git a/Minecraft.Client/ServerChunkCache.cpp b/Minecraft.Client/ServerChunkCache.cpp index 2f79c6caa..f4440200e 100644 --- a/Minecraft.Client/ServerChunkCache.cpp +++ b/Minecraft.Client/ServerChunkCache.cpp @@ -71,7 +71,7 @@ bool ServerChunkCache::hasChunk(int x, int z) if( ( iz < 0 ) || ( iz >= XZSIZE ) ) return true; int idx = ix * XZSIZE + iz; LevelChunk *lc = cache[idx]; - if( lc == NULL ) return false; + if( lc == nullptr ) return false; return true; } @@ -148,13 +148,13 @@ LevelChunk *ServerChunkCache::create(int x, int z, bool asyncPostProcess) // 4J LevelChunk *chunk = cache[idx]; LevelChunk *lastChunk = chunk; - if( ( chunk == NULL ) || ( chunk->x != x ) || ( chunk->z != z ) ) + if( ( chunk == nullptr ) || ( chunk->x != x ) || ( chunk->z != z ) ) { EnterCriticalSection(&m_csLoadCreate); chunk = load(x, z); - if (chunk == NULL) + if (chunk == nullptr) { - if (source == NULL) + if (source == nullptr) { chunk = emptyChunk; } @@ -163,7 +163,7 @@ LevelChunk *ServerChunkCache::create(int x, int z, bool asyncPostProcess) // 4J chunk = source->getChunk(x, z); } } - if (chunk != NULL) + if (chunk != nullptr) { chunk->load(); } @@ -320,7 +320,7 @@ void ServerChunkCache::overwriteLevelChunkFromSource(int x, int z) if( ( iz < 0 ) || ( iz >= XZSIZE ) ) assert(0); int idx = ix * XZSIZE + iz; - LevelChunk *chunk = NULL; + LevelChunk *chunk = nullptr; chunk = source->getChunk(x, z); assert(chunk); if(chunk) @@ -389,22 +389,22 @@ void ServerChunkCache::dontDrop(int x, int z) LevelChunk *ServerChunkCache::load(int x, int z) { - if (storage == NULL) return NULL; + if (storage == nullptr) return nullptr; - LevelChunk *levelChunk = NULL; + LevelChunk *levelChunk = nullptr; #ifdef _LARGE_WORLDS int ix = x + XZOFFSET; int iz = z + XZOFFSET; int idx = ix * XZSIZE + iz; levelChunk = m_unloadedCache[idx]; - m_unloadedCache[idx] = NULL; - if(levelChunk == NULL) + m_unloadedCache[idx] = nullptr; + if(levelChunk == nullptr) #endif { levelChunk = storage->load(level, x, z); } - if (levelChunk != NULL) + if (levelChunk != nullptr) { levelChunk->lastSaveTime = level->getGameTime(); } @@ -413,14 +413,14 @@ LevelChunk *ServerChunkCache::load(int x, int z) void ServerChunkCache::saveEntities(LevelChunk *levelChunk) { - if (storage == NULL) return; + if (storage == nullptr) return; storage->saveEntities(level, levelChunk); } void ServerChunkCache::save(LevelChunk *levelChunk) { - if (storage == NULL) return; + if (storage == nullptr) return; levelChunk->lastSaveTime = level->getGameTime(); storage->save(level, levelChunk); @@ -542,7 +542,7 @@ void ServerChunkCache::postProcess(ChunkSource *parent, int x, int z ) LevelChunk *chunk = getChunk(x, z); if ( (chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) == 0 ) { - if (source != NULL) + if (source != nullptr) { PIXBeginNamedEvent(0,"Main post processing"); source->postProcess(parent, x, z); @@ -659,7 +659,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) } // 4J - added this to support progressListener - if (progressListener != NULL) + if (progressListener != nullptr) { if (++cc % 10 == 0) { @@ -712,7 +712,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) } // 4J - added this to support progressListener - if (progressListener != NULL) + if (progressListener != nullptr) { if (++cc % 10 == 0) { @@ -741,21 +741,21 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) for(unsigned int i = 0; i < 3; ++i) { - saveThreads[i] = NULL; + saveThreads[i] = nullptr; threadData[i].cache = this; - wakeEvent[i] = new C4JThread::Event(); //CreateEvent(NULL,FALSE,FALSE,NULL); + wakeEvent[i] = new C4JThread::Event(); //CreateEvent(nullptr,FALSE,FALSE,nullptr); threadData[i].wakeEvent = wakeEvent[i]; - notificationEvent[i] = new C4JThread::Event(); //CreateEvent(NULL,FALSE,FALSE,NULL); + notificationEvent[i] = new C4JThread::Event(); //CreateEvent(nullptr,FALSE,FALSE,nullptr); threadData[i].notificationEvent = notificationEvent[i]; if(i==0) threadData[i].useSharedThreadStorage = true; else threadData[i].useSharedThreadStorage = false; } - LevelChunk *chunk = NULL; + LevelChunk *chunk = nullptr; byte workingThreads; bool chunkSet = false; @@ -804,13 +804,13 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) //app.DebugPrintf("Chunk to save set for thread %d\n", j); - if(saveThreads[j] == NULL) + if(saveThreads[j] == nullptr) { char threadName[256]; sprintf(threadName,"Save thread %d\n",j); SetThreadName(threadId[j], threadName); - //saveThreads[j] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); + //saveThreads[j] = CreateThread(nullptr,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); saveThreads[j] = new C4JThread(runSaveThreadProc,(void *)&threadData[j],threadName); @@ -836,7 +836,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) } // 4J - added this to support progressListener - if (progressListener != NULL) + if (progressListener != nullptr) { if (count > 0 && ++cc % 10 == 0) { @@ -850,7 +850,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) if( !chunkSet ) { - threadData[j].chunkToSave = NULL; + threadData[j].chunkToSave = nullptr; //app.DebugPrintf("No chunk to save set for thread %d\n",j); } } @@ -882,13 +882,13 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) unsigned char validThreads = 0; for(unsigned int i = 0; i < 3; ++i) { - //app.DebugPrintf("Settings chunk to NULL for save thread %d\n", i); - threadData[i].chunkToSave = NULL; + //app.DebugPrintf("Settings chunk to nullptr for save thread %d\n", i); + threadData[i].chunkToSave = nullptr; //app.DebugPrintf("Setting wake event for save thread %d\n",i); threadData[i].wakeEvent->Set(); //SetEvent(threadData[i].wakeEvent); - if(saveThreads[i] != NULL) ++validThreads; + if(saveThreads[i] != nullptr) ++validThreads; } //WaitForMultipleObjects(validThreads,saveThreads,TRUE,INFINITE); @@ -910,7 +910,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) if (force) { - if (storage == NULL) + if (storage == nullptr) { LeaveCriticalSection(&m_csLoadCreate); return true; @@ -955,14 +955,14 @@ bool ServerChunkCache::tick() int iz = chunk->z + XZOFFSET; int idx = ix * XZSIZE + iz; m_unloadedCache[idx] = chunk; - cache[idx] = NULL; + cache[idx] = nullptr; } } m_toDrop.pop_front(); } } #endif - if (storage != NULL) storage->tick(); + if (storage != nullptr) storage->tick(); } return source->tick(); @@ -1013,7 +1013,7 @@ int ServerChunkCache::runSaveThreadProc(LPVOID lpParam) //app.DebugPrintf("Save thread has started\n"); - while(params->chunkToSave != NULL) + while(params->chunkToSave != nullptr) { PIXBeginNamedEvent(0,"Saving entities"); //app.DebugPrintf("Save thread has started processing a chunk\n"); diff --git a/Minecraft.Client/ServerConnection.cpp b/Minecraft.Client/ServerConnection.cpp index 07616aa47..cca4c619f 100644 --- a/Minecraft.Client/ServerConnection.cpp +++ b/Minecraft.Client/ServerConnection.cpp @@ -78,7 +78,7 @@ void ServerConnection::tick() // uc.disconnect("Internal server error"); // logger.log(Level.WARNING, "Failed to handle packet: " + e, e); // } - if(uc->connection != NULL) uc->connection->flush(); + if(uc->connection != nullptr) uc->connection->flush(); } } @@ -167,7 +167,7 @@ void ServerConnection::handleServerSettingsChanged(shared_ptrlevels.length; ++i) { - if( pMinecraft->levels[i] != NULL ) + if( pMinecraft->levels[i] != nullptr ) { app.DebugPrintf("ClientConnection::handleServerSettingsChanged - Difficulty = %d",packet->data); pMinecraft->levels[i]->difficulty = packet->data; diff --git a/Minecraft.Client/ServerLevel.cpp b/Minecraft.Client/ServerLevel.cpp index 265a1428c..89fe12a4b 100644 --- a/Minecraft.Client/ServerLevel.cpp +++ b/Minecraft.Client/ServerLevel.cpp @@ -42,7 +42,7 @@ WeighedTreasureArray ServerLevel::RANDOM_BONUS_ITEMS; -C4JThread* ServerLevel::m_updateThread = NULL; +C4JThread* ServerLevel::m_updateThread = nullptr; C4JThread::EventArray* ServerLevel::m_updateTrigger; CRITICAL_SECTION ServerLevel::m_updateCS[3]; @@ -63,7 +63,7 @@ void ServerLevel::staticCtor() InitializeCriticalSection(&m_updateCS[1]); InitializeCriticalSection(&m_updateCS[2]); - m_updateThread = new C4JThread(runUpdate, NULL, "Tile update"); + m_updateThread = new C4JThread(runUpdate, nullptr, "Tile update"); m_updateThread->SetProcessor(CPU_CORE_TILE_UPDATE); #ifdef __ORBIS__ m_updateThread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); // On Orbis, this core is also used for Matching 2, and that priority of that seems to be always at default no matter what we set it to. Prioritise this below Matching 2. @@ -123,7 +123,7 @@ ServerLevel::ServerLevel(MinecraftServer *server, shared_ptrlevelS scoreboard = new ServerScoreboard(server); //shared_ptr scoreboardSaveData = dynamic_pointer_cast( savedDataStorage->get(typeid(ScoreboardSaveData), ScoreboardSaveData::FILE_ID) ); - //if (scoreboardSaveData == NULL) + //if (scoreboardSaveData == nullptr) //{ // scoreboardSaveData = shared_ptr( new ScoreboardSaveData() ); // savedDataStorage->set(ScoreboardSaveData::FILE_ID, scoreboardSaveData); @@ -258,7 +258,7 @@ void ServerLevel::tick() { //app.DebugPrintf("Incremental save\n"); PIXBeginNamedEvent(0,"Incremental save"); - save(false, NULL); + save(false, nullptr); PIXEndNamedEvent(); } @@ -313,7 +313,7 @@ void ServerLevel::tick() Biome::MobSpawnerData *ServerLevel::getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z) { vector *mobList = getChunkSource()->getMobsAt(mobCategory, x, y, z); - if (mobList == NULL || mobList->empty()) return NULL; + if (mobList == nullptr || mobList->empty()) return nullptr; return static_cast(WeighedRandom::getRandomItem(random, (vector *)mobList)); } @@ -433,7 +433,7 @@ void ServerLevel::tickTiles() if( hasChunkAt(x,y,z) ) { int id = getTile(x,y,z); - if (Tile::tiles[id] != NULL && Tile::tiles[id]->isTicking()) + if (Tile::tiles[id] != nullptr && Tile::tiles[id]->isTicking()) { /*if(id == 2) ++grassTicks; else if(id == 11) ++lavaTicks; @@ -776,7 +776,7 @@ void ServerLevel::tick(shared_ptr e, bool actual) { e->remove(); } - if (!server->isNpcsEnabled() && (dynamic_pointer_cast(e) != NULL)) + if (!server->isNpcsEnabled() && (dynamic_pointer_cast(e) != nullptr)) { e->remove(); } @@ -860,7 +860,7 @@ void ServerLevel::setInitialSpawn(LevelSettings *levelSettings) int minXZ = - (dimension->getXZSize() * 16 ) / 2; int maxXZ = (dimension->getXZSize() * 16 ) / 2 - 1; - if (findBiome != NULL) + if (findBiome != nullptr) { xSpawn = findBiome->x; zSpawn = findBiome->z; @@ -914,7 +914,7 @@ void ServerLevel::generateBonusItemsNearSpawn() if( getTile( x, y, z ) == Tile::chest_Id ) { shared_ptr chest = dynamic_pointer_cast(getTileEntity(x, y, z)); - if (chest != NULL) + if (chest != nullptr) { if( chest->isBonusChest ) { @@ -960,7 +960,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut if(StorageManager.GetSaveDisabled()) return; - if (progressListener != NULL) + if (progressListener != nullptr) { if(bAutosave) { @@ -976,7 +976,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut saveLevelData(); PIXEndNamedEvent(); - if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS); + if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_CHUNKS); #if defined(_XBOX_ONE) || defined(__ORBIS__) // Our autosave is a minimal save. All the chunks are saves by the constant save process @@ -1009,7 +1009,7 @@ void ServerLevel::save(bool force, ProgressListener *progressListener, bool bAut //if( force && !isClientSide ) //{ - // if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + // if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); // levelStorage->flushSaveFile(); //} } @@ -1034,7 +1034,7 @@ void ServerLevel::saveToDisc(ProgressListener *progressListener, bool autosave) } } - if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + if (progressListener != nullptr) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC); levelStorage->flushSaveFile(autosave); } @@ -1122,7 +1122,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, if( sentTo.size() ) { INetworkPlayer *thisPlayer = player->connection->getNetworkPlayer(); - if( thisPlayer == NULL ) + if( thisPlayer == nullptr ) { continue; } @@ -1131,7 +1131,7 @@ shared_ptr ServerLevel::explode(shared_ptr source, double x, for(auto& player2 : sentTo) { INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { knockbackOnly = true; } @@ -1578,7 +1578,7 @@ int ServerLevel::runUpdate(void* lpParam) if( (id == Tile::grass_Id && grassTicks >= MAX_GRASS_TICKS) || (id == Tile::calmLava_Id && lavaTicks >= MAX_LAVA_TICKS) ) continue; // 4J Stu - Added shouldTileTick as some tiles won't even do anything if they are set to tick and use up one of our updates - if (Tile::tiles[id] != NULL && Tile::tiles[id]->isTicking() && Tile::tiles[id]->shouldTileTick(m_level[iLev],x + (cx * 16), y, z + (cz * 16) ) ) + if (Tile::tiles[id] != nullptr && Tile::tiles[id]->isTicking() && Tile::tiles[id]->shouldTileTick(m_level[iLev],x + (cx * 16), y, z + (cz * 16) ) ) { if(id == Tile::grass_Id) ++grassTicks; else if(id == Tile::calmLava_Id) ++lavaTicks; diff --git a/Minecraft.Client/ServerPlayer.cpp b/Minecraft.Client/ServerPlayer.cpp index 898e4a66f..dc4628ab1 100644 --- a/Minecraft.Client/ServerPlayer.cpp +++ b/Minecraft.Client/ServerPlayer.cpp @@ -101,7 +101,7 @@ ServerPlayer::ServerPlayer(MinecraftServer *server, Level *level, const wstring& waterDepth++; } attemptCount++; - playerNear = ( level->getNearestPlayer(xx + 0.5, yy, zz + 0.5,3) != NULL ); + playerNear = ( level->getNearestPlayer(xx + 0.5, yy, zz + 0.5,3) != nullptr ); } while ( ( waterDepth > 1 ) && (!playerNear) && ( attemptCount < 20 ) ); xx = xx2; yy = yy2; @@ -180,7 +180,7 @@ void ServerPlayer::readAdditionalSaveData(CompoundTag *entityTag) } GameRulesInstance *grs = gameMode->getGameRules(); - if (entityTag->contains(L"GameRules") && grs != NULL) + if (entityTag->contains(L"GameRules") && grs != nullptr) { byteArray ba = entityTag->getByteArray(L"GameRules"); ByteArrayInputStream bais(ba); @@ -197,13 +197,13 @@ void ServerPlayer::addAdditonalSaveData(CompoundTag *entityTag) Player::addAdditonalSaveData(entityTag); GameRulesInstance *grs = gameMode->getGameRules(); - if (grs != NULL) + if (grs != nullptr) { ByteArrayOutputStream baos; DataOutputStream dos(&baos); grs->write(&dos); entityTag->putByteArray(L"GameRules", baos.buf); - baos.buf.data = NULL; + baos.buf.data = nullptr; dos.close(); baos.close(); } @@ -308,14 +308,14 @@ void ServerPlayer::doTickA() for (unsigned int i = 0; i < inventory->getContainerSize(); i++) { shared_ptr ie = inventory->getItem(i); - if (ie != NULL) + if (ie != nullptr) { // 4J - removed condition. These were getting lower priority than tile update packets etc. on the slow outbound queue, and so were extremely slow to send sometimes, // particularly at the start of a game. They don't typically seem to be massive and shouldn't be send when there isn't actually any updating to do. if (Item::items[ie->id]->isComplex() ) // && connection->countDelayedPackets() <= 2) { shared_ptr packet = (dynamic_cast(Item::items[ie->id])->getUpdatePacket(ie, level, dynamic_pointer_cast( shared_from_this() ) ) ); - if (packet != NULL) + if (packet != nullptr) { connection->send(packet); } @@ -352,7 +352,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) } } - // if (nearest != NULL) // 4J - removed as we don't have references here + // if (nearest != nullptr) // 4J - removed as we don't have references here if( nearestValid ) { bool okToSend = false; @@ -372,7 +372,7 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) // app.DebugPrintf("%d: canSendToPlayer %d, countDelayedPackets %d GetSendQueueSizeBytes %d done: %d\n", // connection->getNetworkPlayer()->GetSmallId(), // canSendToPlayer, connection->countDelayedPackets(), -// g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ), +// g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ), // connection->done); // } @@ -381,12 +381,12 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks) #ifdef _XBOX_ONE // The network manager on xbox one doesn't currently split data into slow & fast queues - since we can only measure // both together then bytes provides a better metric than count of data items to determine if we should avoid queueing too much up - (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeBytes( NULL, true ) < 8192 )&& + (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeBytes( nullptr, true ) < 8192 )&& #elif defined _XBOX - (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ) < 4 )&& + (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ) < 4 )&& #else (connection->countDelayedPackets() < 4 )&& - (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( NULL, true ) < 4 )&& + (g_NetworkManager.GetHostPlayer()->GetSendQueueSizeMessages( nullptr, true ) < 4 )&& #endif //(tickCount - lastBrupSendTickCount) > (connection->getNetworkPlayer()->GetCurrentRtt()>>4) && !connection->done) ) @@ -584,7 +584,7 @@ void ServerPlayer::die(DamageSource *source) } shared_ptr killer = getKillCredit(); - if (killer != NULL) killer->awardKillScore(shared_from_this(), deathScore); + if (killer != nullptr) killer->awardKillScore(shared_from_this(), deathScore); //awardStat(Stats::deaths, 1); } @@ -597,10 +597,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg) //bool allowFallDamage = server->isPvpAllowed() && server->isDedicatedServer() && server->isPvpAllowed() && (dmgSource->msgId.compare(L"fall") == 0); if (!server->isPvpAllowed() && invulnerableTime > 0 && dmgSource != DamageSource::outOfWorld) return false; - if (dynamic_cast(dmgSource) != NULL) + if (dynamic_cast(dmgSource) != nullptr) { // 4J Stu - Fix for #46422 - TU5: Crash: Gameplay: Crash when being hit by a trap using a dispenser - // getEntity returns the owner of projectiles, and this would never be the arrow. The owner is sometimes NULL. + // getEntity returns the owner of projectiles, and this would never be the arrow. The owner is sometimes nullptr. shared_ptr source = dmgSource->getDirectEntity(); if (source->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(source)->canHarmPlayer(dynamic_pointer_cast(shared_from_this()))) @@ -608,10 +608,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg) return false; } - if ( (source != NULL) && source->instanceof(eTYPE_ARROW) ) + if ( (source != nullptr) && source->instanceof(eTYPE_ARROW) ) { shared_ptr arrow = dynamic_pointer_cast(source); - if ( (arrow->owner != NULL) && arrow->owner->instanceof(eTYPE_PLAYER) && !canHarmPlayer(dynamic_pointer_cast(arrow->owner)) ) + if ( (arrow->owner != nullptr) && arrow->owner->instanceof(eTYPE_PLAYER) && !canHarmPlayer(dynamic_pointer_cast(arrow->owner)) ) { return false; } @@ -634,7 +634,7 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg) else { shared_ptr source = dmgSource->getEntity(); - if( source != NULL ) + if( source != nullptr ) { switch(source->GetType()) { @@ -670,10 +670,10 @@ bool ServerPlayer::hurt(DamageSource *dmgSource, float dmg) m_lastDamageSource = eTelemetryPlayerDeathSource_Explosion_Tnt; break; case eTYPE_ARROW: - if ((dynamic_pointer_cast(source))->owner != NULL) + if ((dynamic_pointer_cast(source))->owner != nullptr) { shared_ptr attacker = (dynamic_pointer_cast(source))->owner; - if (attacker != NULL) + if (attacker != nullptr) { switch(attacker->GetType()) { @@ -712,7 +712,7 @@ bool ServerPlayer::canHarmPlayer(wstring targetName) bool canHarm = true; shared_ptr owner = server->getPlayers()->getPlayer(targetName); - if (owner != NULL) + if (owner != nullptr) { if ((shared_from_this() != owner) && canHarmPlayer(owner)) canHarm = false; } @@ -749,7 +749,7 @@ void ServerPlayer::changeDimension(int i) for(auto& servPlayer : MinecraftServer::getInstance()->getPlayers()->players) { INetworkPlayer *checkPlayer = servPlayer->connection->getNetworkPlayer(); - if(thisPlayer != checkPlayer && checkPlayer != NULL && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame ) + if(thisPlayer != checkPlayer && checkPlayer != nullptr && thisPlayer->IsSameSystem( checkPlayer ) && !servPlayer->wonGame ) { servPlayer->wonGame = true; servPlayer->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::WIN_GAME, thisPlayer->GetUserIndex() ) ) ); @@ -766,7 +766,7 @@ void ServerPlayer::changeDimension(int i) awardStat(GenericStats::theEnd(), GenericStats::param_theEnd()); Pos *pos = server->getLevel(i)->getDimensionSpecificSpawn(); - if (pos != NULL) + if (pos != nullptr) { connection->teleport(pos->x, pos->y, pos->z, 0, 0); delete pos; @@ -789,10 +789,10 @@ void ServerPlayer::changeDimension(int i) // 4J Added delay param void ServerPlayer::broadcast(shared_ptr te, bool delay /*= false*/) { - if (te != NULL) + if (te != nullptr) { shared_ptr p = te->getUpdatePacket(); - if (p != NULL) + if (p != nullptr) { p->shouldDelay = delay; if(delay) connection->queueSend(p); @@ -827,7 +827,7 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::WAKE_UP) ) ); } Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint); - if (connection != NULL) connection->teleport(x, y, z, yRot, xRot); + if (connection != nullptr) connection->teleport(x, y, z, yRot, xRot); } void ServerPlayer::ride(shared_ptr e) @@ -853,7 +853,7 @@ void ServerPlayer::doCheckFallDamage(double ya, bool onGround) void ServerPlayer::openTextEdit(shared_ptr sign) { shared_ptr signTE = dynamic_pointer_cast(sign); - if (signTE != NULL) + if (signTE != nullptr) { signTE->setAllowedPlayerEditor(dynamic_pointer_cast(shared_from_this())); connection->send( shared_ptr( new TileEditorOpenPacket(TileEditorOpenPacket::SIGN, sign->x, sign->y, sign->z)) ); @@ -893,7 +893,7 @@ bool ServerPlayer::openFireworks(int x, int y, int z) containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); } - else if(dynamic_cast(containerMenu) != NULL) + else if(dynamic_cast(containerMenu) != nullptr) { closeContainer(); @@ -1092,7 +1092,7 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget, const wstring connection->send(shared_ptr(new ContainerOpenPacket(containerCounter, ContainerOpenPacket::TRADER_NPC, name.empty()?L"":name, container->getContainerSize(), !name.empty()))); MerchantRecipeList *offers = traderTarget->getOffers(dynamic_pointer_cast(shared_from_this())); - if (offers != NULL) + if (offers != nullptr) { ByteArrayOutputStream rawOutput; DataOutputStream output(&rawOutput); @@ -1203,7 +1203,7 @@ void ServerPlayer::doCloseContainer() void ServerPlayer::setPlayerInput(float xxa, float yya, bool jumping, bool sneaking) { - if(riding != NULL) + if(riding != nullptr) { if (xxa >= -1 && xxa <= 1) this->xxa = xxa; if (yya >= -1 && yya <= 1) this->yya = yya; @@ -1214,7 +1214,7 @@ void ServerPlayer::setPlayerInput(float xxa, float yya, bool jumping, bool sneak void ServerPlayer::awardStat(Stat *stat, byteArray param) { - if (stat == NULL) + if (stat == nullptr) { delete [] param.data; return; @@ -1237,7 +1237,7 @@ void ServerPlayer::awardStat(Stat *stat, byteArray param) void ServerPlayer::disconnect() { - if (rider.lock() != NULL) rider.lock()->ride(shared_from_this() ); + if (rider.lock() != nullptr) rider.lock()->ride(shared_from_this() ); if (m_isSleeping) { stopSleepInBed(true, false, false); @@ -1501,7 +1501,7 @@ void ServerPlayer::startUsingItem(shared_ptr instance, int duratio { Player::startUsingItem(instance, duration); - if (instance != NULL && instance->getItem() != NULL && instance->getItem()->getUseAnimation(instance) == UseAnim_eat) + if (instance != nullptr && instance->getItem() != nullptr && instance->getItem()->getUseAnimation(instance) == UseAnim_eat) { getLevel()->getTracker()->broadcastAndSend(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::EAT) ) ); } @@ -1553,7 +1553,7 @@ void ServerPlayer::magicCrit(shared_ptr entity) void ServerPlayer::onUpdateAbilities() { - if (connection == NULL) return; + if (connection == nullptr) return; connection->send(shared_ptr(new PlayerAbilitiesPacket(&abilities))); } @@ -1651,7 +1651,7 @@ int ServerPlayer::getPlayerViewDistanceModifier() { INetworkPlayer *player = connection->getNetworkPlayer(); - if( player != NULL ) + if( player != nullptr ) { DWORD rtt = player->GetCurrentRtt(); @@ -1666,7 +1666,7 @@ int ServerPlayer::getPlayerViewDistanceModifier() void ServerPlayer::handleCollectItem(shared_ptr item) { - if(gameMode->getGameRules() != NULL) gameMode->getGameRules()->onCollectItem(item); + if(gameMode->getGameRules() != nullptr) gameMode->getGameRules()->onCollectItem(item); } #ifndef _CONTENT_PACKAGE diff --git a/Minecraft.Client/ServerPlayerGameMode.cpp b/Minecraft.Client/ServerPlayerGameMode.cpp index 4495c4da8..daafc2ca6 100644 --- a/Minecraft.Client/ServerPlayerGameMode.cpp +++ b/Minecraft.Client/ServerPlayerGameMode.cpp @@ -29,12 +29,12 @@ ServerPlayerGameMode::ServerPlayerGameMode(Level *level) this->level = level; // 4J Added - m_gameRules = NULL; + m_gameRules = nullptr; } ServerPlayerGameMode::~ServerPlayerGameMode() { - if(m_gameRules!=NULL) delete m_gameRules; + if(m_gameRules!=nullptr) delete m_gameRules; } void ServerPlayerGameMode::setGameModeForPlayer(GameType *gameModeForPlayer) @@ -105,7 +105,7 @@ void ServerPlayerGameMode::tick() int t = level->getTile(xDestroyBlock, yDestroyBlock, zDestroyBlock); Tile *tile = Tile::tiles[t]; - if (tile == NULL) + if (tile == nullptr) { level->destroyTileProgress(player->entityId, xDestroyBlock, yDestroyBlock, zDestroyBlock, -1); lastSentState = -1; @@ -216,13 +216,13 @@ bool ServerPlayerGameMode::superDestroyBlock(int x, int y, int z) Tile *oldTile = Tile::tiles[level->getTile(x, y, z)]; int data = level->getData(x, y, z); - if (oldTile != NULL) + if (oldTile != nullptr) { oldTile->playerWillDestroy(level, x, y, z, data, player); } bool changed = level->removeTile(x, y, z); - if (oldTile != NULL && changed) + if (oldTile != nullptr && changed) { oldTile->destroy(level, x, y, z, data); } @@ -241,7 +241,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) if (gameModeForPlayer->isCreative()) { - if (player->getCarriedItem() != NULL && dynamic_cast(player->getCarriedItem()->getItem()) != NULL) + if (player->getCarriedItem() != nullptr && dynamic_cast(player->getCarriedItem()->getItem()) != nullptr) { return false; } @@ -298,7 +298,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) { shared_ptr item = player->getSelectedItem(); bool canDestroy = player->canDestroy(Tile::tiles[t]); - if (item != NULL) + if (item != nullptr) { item->mineBlock(level, t, x, y, z, player); if (item->count == 0) @@ -322,7 +322,7 @@ bool ServerPlayerGameMode::useItem(shared_ptr player, Level *level, shar int oldCount = item->count; int oldAux = item->getAuxValue(); shared_ptr itemInstance = item->use(level, player); - if (itemInstance != item || (itemInstance != NULL && (itemInstance->count != oldCount || itemInstance->getUseDuration() > 0 || itemInstance->getAuxValue() != oldAux))) + if (itemInstance != item || (itemInstance != nullptr && (itemInstance->count != oldCount || itemInstance->getUseDuration() > 0 || itemInstance->getAuxValue() != oldAux))) { player->inventory->items[player->inventory->selected] = itemInstance; if (isCreative()) @@ -348,7 +348,7 @@ bool ServerPlayerGameMode::useItemOn(shared_ptr player, Level *level, sh { // 4J-PB - Adding a test only version to allow tooltips to be displayed int t = level->getTile(x, y, z); - if (!player->isSneaking() || player->getCarriedItem() == NULL) + if (!player->isSneaking() || player->getCarriedItem() == nullptr) { if (t > 0 && player->isAllowedToUse(Tile::tiles[t])) { @@ -360,14 +360,14 @@ bool ServerPlayerGameMode::useItemOn(shared_ptr player, Level *level, sh { if (Tile::tiles[t]->use(level, x, y, z, player, face, clickX, clickY, clickZ)) { - if(m_gameRules != NULL) m_gameRules->onUseTile(t,x,y,z); + if(m_gameRules != nullptr) m_gameRules->onUseTile(t,x,y,z); return true; } } } } - if (item == NULL || !player->isAllowedToUse(item)) return false; + if (item == nullptr || !player->isAllowedToUse(item)) return false; if (isCreative()) { int aux = item->getAuxValue(); @@ -391,6 +391,6 @@ void ServerPlayerGameMode::setLevel(ServerLevel *newLevel) // 4J Added void ServerPlayerGameMode::setGameRules(GameRulesInstance *rules) { - if(m_gameRules != NULL) delete m_gameRules; + if(m_gameRules != nullptr) delete m_gameRules; m_gameRules = rules; } \ No newline at end of file diff --git a/Minecraft.Client/ServerPlayerGameMode.h b/Minecraft.Client/ServerPlayerGameMode.h index 89b9e9b44..509e16763 100644 --- a/Minecraft.Client/ServerPlayerGameMode.h +++ b/Minecraft.Client/ServerPlayerGameMode.h @@ -54,7 +54,7 @@ private: public: bool destroyBlock(int x, int y, int z); bool useItem(shared_ptr player, Level *level, shared_ptr item, bool bTestUseOnly=false); - bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false, bool *pbUsedItem=NULL); + bool useItemOn(shared_ptr player, Level *level, shared_ptr item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false, bool *pbUsedItem=nullptr); void setLevel(ServerLevel *newLevel); }; \ No newline at end of file diff --git a/Minecraft.Client/ServerScoreboard.cpp b/Minecraft.Client/ServerScoreboard.cpp index 738a29c92..9a0443245 100644 --- a/Minecraft.Client/ServerScoreboard.cpp +++ b/Minecraft.Client/ServerScoreboard.cpp @@ -37,7 +37,7 @@ void ServerScoreboard::setDisplayObjective(int slot, Objective *objective) //Scoreboard::setDisplayObjective(slot, objective); - //if (old != objective && old != NULL) + //if (old != objective && old != nullptr) //{ // if (getObjectiveDisplaySlotCount(old) > 0) // { @@ -49,7 +49,7 @@ void ServerScoreboard::setDisplayObjective(int slot, Objective *objective) // } //} - //if (objective != NULL) + //if (objective != nullptr) //{ // if (trackedObjectives.contains(objective)) // { @@ -146,7 +146,7 @@ void ServerScoreboard::setSaveData(ScoreboardSaveData *data) void ServerScoreboard::setDirty() { - //if (saveData != NULL) + //if (saveData != nullptr) //{ // saveData->setDirty(); //} @@ -154,7 +154,7 @@ void ServerScoreboard::setDirty() vector > *ServerScoreboard::getStartTrackingPackets(Objective *objective) { - return NULL; + return nullptr; //vector > *packets = new vector >(); //packets.push_back( shared_ptr( new SetObjectivePacket(objective, SetObjectivePacket::METHOD_ADD))); @@ -189,7 +189,7 @@ void ServerScoreboard::startTrackingObjective(Objective *objective) vector > *ServerScoreboard::getStopTrackingPackets(Objective *objective) { - return NULL; + return nullptr; //vector > *packets = new ArrayList(); //packets->push_back( shared_ptrgetPath(); } diff --git a/Minecraft.Client/SkullTileRenderer.cpp b/Minecraft.Client/SkullTileRenderer.cpp index e7b610bf1..7862043b2 100644 --- a/Minecraft.Client/SkullTileRenderer.cpp +++ b/Minecraft.Client/SkullTileRenderer.cpp @@ -6,7 +6,7 @@ #include "..\Minecraft.World\net.minecraft.h" #include "..\Minecraft.World\net.minecraft.world.level.tile.h" -SkullTileRenderer *SkullTileRenderer::instance = NULL; +SkullTileRenderer *SkullTileRenderer::instance = nullptr; ResourceLocation SkullTileRenderer::SKELETON_LOCATION = ResourceLocation(TN_MOB_SKELETON); ResourceLocation SkullTileRenderer::WITHER_SKELETON_LOCATION = ResourceLocation(TN_MOB_WITHER_SKELETON); diff --git a/Minecraft.Client/SlimeModel.cpp b/Minecraft.Client/SlimeModel.cpp index 834847f80..7d30ce663 100644 --- a/Minecraft.Client/SlimeModel.cpp +++ b/Minecraft.Client/SlimeModel.cpp @@ -27,9 +27,9 @@ SlimeModel::SlimeModel(int vOffs) } else { - eye0 = NULL; - eye1 = NULL; - mouth = NULL; + eye0 = nullptr; + eye1 = nullptr; + mouth = nullptr; } cube->compile(1.0f/16.0f); } @@ -39,7 +39,7 @@ void SlimeModel::render(shared_ptr entity, float time, float r, float bo setupAnim(time, r, bob, yRot, xRot, scale, entity); cube->render(scale,usecompiled); - if (eye0!=NULL) + if (eye0!=nullptr) { eye0->render(scale,usecompiled); eye1->render(scale,usecompiled); diff --git a/Minecraft.Client/SmallButton.cpp b/Minecraft.Client/SmallButton.cpp index 6bb3cd1fb..731f5f141 100644 --- a/Minecraft.Client/SmallButton.cpp +++ b/Minecraft.Client/SmallButton.cpp @@ -3,12 +3,12 @@ SmallButton::SmallButton(int id, int x, int y, const wstring& msg) : Button(id, x, y, 150, 20, msg) { - this->option = NULL; + this->option = nullptr; } SmallButton::SmallButton(int id, int x, int y, int width, int height, const wstring& msg) : Button(id, x, y, width, height, msg) { - this->option = NULL; + this->option = nullptr; } SmallButton::SmallButton(int id, int x, int y, const Options::Option *item, const wstring& msg) : Button(id, x, y, 150, 20, msg) diff --git a/Minecraft.Client/SnowManRenderer.cpp b/Minecraft.Client/SnowManRenderer.cpp index 11855fe37..853127bb7 100644 --- a/Minecraft.Client/SnowManRenderer.cpp +++ b/Minecraft.Client/SnowManRenderer.cpp @@ -23,7 +23,7 @@ void SnowManRenderer::additionalRendering(shared_ptr _mob, float a MobRenderer::additionalRendering(mob, a); shared_ptr headGear = shared_ptr( new ItemInstance(Tile::pumpkin, 1) ); - if (headGear != NULL && headGear->getItem()->id < 256) + if (headGear != nullptr && headGear->getItem()->id < 256) { glPushMatrix(); model->head->translateTo(1 / 16.0f); diff --git a/Minecraft.Client/StatsCounter.cpp b/Minecraft.Client/StatsCounter.cpp index 8f930fcf9..e92c43c0c 100644 --- a/Minecraft.Client/StatsCounter.cpp +++ b/Minecraft.Client/StatsCounter.cpp @@ -1314,30 +1314,30 @@ void StatsCounter::WipeLeaderboards() #if defined DEBUG_ENABLE_CLEAR_LEADERBOARDS && defined _XBOX - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_EASY, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_NORMAL, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_HARD, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_PEACEFUL, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_EASY, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_NORMAL, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_HARD, NULL); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_PEACEFUL, NULL); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_EASY, NULL); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_NORMAL, NULL); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_HARD, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_PEACEFUL, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_EASY, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_NORMAL, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_HARD, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_PEACEFUL, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_EASY, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_NORMAL, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_HARD, NULL); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_PEACEFUL, NULL); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_EASY, NULL); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_NORMAL, NULL); -// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_HARD, NULL); - if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_TOTAL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_TOTAL, NULL); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_EASY, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_NORMAL, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_KILLS_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_KILLS_HARD, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_PEACEFUL, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_EASY, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_NORMAL, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGBLOCKS_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_BLOCKS_HARD, nullptr); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_PEACEFUL, nullptr); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_EASY, nullptr); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_NORMAL, nullptr); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_MININGORE_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_MINING_ORE_HARD, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_PEACEFUL, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_EASY, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_NORMAL, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_FARMING_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_FARMING_HARD, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_PEACEFUL, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_EASY, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_NORMAL, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_HARD, nullptr); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_PEACEFUL ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_PEACEFUL, nullptr); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_EASY ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_EASY, nullptr); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_NORMAL ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_NORMAL, nullptr); +// if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_NETHER_HARD ) XUserResetStatsViewAllUsers(STATS_VIEW_NETHER_HARD, nullptr); + if( DEBUG_CLEAR_LEADERBOARDS & LEADERBOARD_TRAVELLING_TOTAL ) XUserResetStatsViewAllUsers(STATS_VIEW_TRAVELLING_TOTAL, nullptr); if( LeaderboardManager::Instance()->OpenSession() ) { writeStats(); diff --git a/Minecraft.Client/StatsScreen.cpp b/Minecraft.Client/StatsScreen.cpp index 6c42532db..c618a30f2 100644 --- a/Minecraft.Client/StatsScreen.cpp +++ b/Minecraft.Client/StatsScreen.cpp @@ -10,15 +10,15 @@ #include "..\Minecraft.World\net.minecraft.world.item.h" const float StatsScreen::SLOT_TEX_SIZE = 128.0f; -ItemRenderer *StatsScreen::itemRenderer = NULL; +ItemRenderer *StatsScreen::itemRenderer = nullptr; StatsScreen::StatsScreen(Screen *lastScreen, StatsCounter *stats) { // 4J - added initialisers itemRenderer = new ItemRenderer(); - statsList = NULL; - itemStatsList = NULL; - blockStatsList = NULL; + statsList = nullptr; + itemStatsList = nullptr; + blockStatsList = nullptr; this->lastScreen = lastScreen; this->stats = stats; } @@ -303,7 +303,7 @@ ItemStat *StatsScreen::StatisticsList::getSlotStat(int slot) void StatsScreen::StatisticsList::renderStat(ItemStat *stat, int x, int y, bool shaded) { - if (stat != NULL) + if (stat != nullptr) { wstring msg = stat->format(parent->stats->getTotalValue(stat)); parent->drawString(parent->font, msg, x - parent->font->width(msg), y + SLOT_TEXT_OFFSET, shaded ? 0xffffff : 0x909090); @@ -373,7 +373,7 @@ void StatsScreen::StatisticsList::renderMousehoverTooltip(ItemStat *stat, int x, { // 4J Stu - Unused #if 0 - if (stat == NULL) + if (stat == nullptr) { return; } @@ -429,11 +429,11 @@ StatsScreen::ItemStatisticsList::ItemStatisticsList(StatsScreen *ss) : StatsScre { addToList = true; } - else if (Stats::itemBroke[id] != NULL && parent->stats->getTotalValue(Stats::itemBroke[id]) > 0) + else if (Stats::itemBroke[id] != nullptr && parent->stats->getTotalValue(Stats::itemBroke[id]) > 0) { addToList = true; } - else if (Stats::itemCrafted[id] != NULL && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0) + else if (Stats::itemCrafted[id] != nullptr && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0) { addToList = true; } @@ -556,11 +556,11 @@ StatsScreen::BlockStatisticsList::BlockStatisticsList(StatsScreen *ss) : Statist { addToList = true; } - else if (Stats::itemUsed[id] != NULL && parent->stats->getTotalValue(Stats::itemUsed[id]) > 0) + else if (Stats::itemUsed[id] != nullptr && parent->stats->getTotalValue(Stats::itemUsed[id]) > 0) { addToList = true; } - else if (Stats::itemCrafted[id] != NULL && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0) + else if (Stats::itemCrafted[id] != nullptr && parent->stats->getTotalValue(Stats::itemCrafted[id]) > 0) { addToList = true; } diff --git a/Minecraft.Client/StitchSlot.cpp b/Minecraft.Client/StitchSlot.cpp index cdce61281..8de443ed4 100644 --- a/Minecraft.Client/StitchSlot.cpp +++ b/Minecraft.Client/StitchSlot.cpp @@ -5,8 +5,8 @@ StitchSlot::StitchSlot(int originX, int originY, int width, int height) : originX(originX), originY(originY), width(width), height(height) { - subSlots = NULL; - textureHolder = NULL; + subSlots = nullptr; + textureHolder = nullptr; } TextureHolder *StitchSlot::getHolder() @@ -27,7 +27,7 @@ int StitchSlot::getY() bool StitchSlot::add(TextureHolder *textureHolder) { // Already holding a texture -- doesn't account for subslots. - if (this->textureHolder != NULL) + if (this->textureHolder != nullptr) { return false; } @@ -42,7 +42,7 @@ bool StitchSlot::add(TextureHolder *textureHolder) } // Exact fit! best-case-solution - if (textureWidth == width && textureHeight == height && subSlots == NULL) + if (textureWidth == width && textureHeight == height && subSlots == nullptr) { // Store somehow this->textureHolder = textureHolder; @@ -50,7 +50,7 @@ bool StitchSlot::add(TextureHolder *textureHolder) } // See if we're already divided before, if not, setup subSlots - if (subSlots == NULL) + if (subSlots == nullptr) { subSlots = new vector(); diff --git a/Minecraft.Client/StitchedTexture.cpp b/Minecraft.Client/StitchedTexture.cpp index 29e3e4bd7..b9693f3da 100644 --- a/Minecraft.Client/StitchedTexture.cpp +++ b/Minecraft.Client/StitchedTexture.cpp @@ -26,7 +26,7 @@ StitchedTexture *StitchedTexture::create(const wstring &name) StitchedTexture::StitchedTexture(const wstring &name, const wstring &filename) : name(name) { // 4J Initialisers - source = NULL; + source = nullptr; rotated = false; x = 0; y = 0; @@ -40,9 +40,9 @@ StitchedTexture::StitchedTexture(const wstring &name, const wstring &filename) : heightTranslation = 0.0f; frame = 0; subFrame = 0; - frameOverride = NULL; + frameOverride = nullptr; flags = 0; - frames = NULL; + frames = nullptr; m_fileName = filename; } @@ -192,7 +192,7 @@ int StitchedTexture::getSourceHeight() const void StitchedTexture::cycleFrames() { - if (frameOverride != NULL) + if (frameOverride != nullptr) { pair current = frameOverride->at(frame); subFrame++; @@ -250,10 +250,10 @@ int StitchedTexture::getFrames() */ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) { - if(frameOverride != NULL) + if(frameOverride != nullptr) { delete frameOverride; - frameOverride = NULL; + frameOverride = nullptr; } frame = 0; subFrame = 0; @@ -303,10 +303,10 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader) void StitchedTexture::loadAnimationFrames(const wstring &string) { - if(frameOverride != NULL) + if(frameOverride != nullptr) { delete frameOverride; - frameOverride = NULL; + frameOverride = nullptr; } frame = 0; subFrame = 0; diff --git a/Minecraft.Client/Stitcher.cpp b/Minecraft.Client/Stitcher.cpp index d52954c44..fa206a75c 100644 --- a/Minecraft.Client/Stitcher.cpp +++ b/Minecraft.Client/Stitcher.cpp @@ -17,7 +17,7 @@ void Stitcher::_init(const wstring &name, int maxWidth, int maxHeight, bool forc // 4J init storageX = 0; storageY = 0; - stitchedTexture = NULL; + stitchedTexture = nullptr; } Stitcher::Stitcher(const wstring &name, int maxWidth, int maxHeight, bool forcePowerOfTwo) @@ -78,7 +78,7 @@ void Stitcher::stitch() //TextureHolder[] textureHolders = texturesToBeStitched.toArray(new TextureHolder[texturesToBeStitched.size()]); //Arrays.sort(textureHolders); - stitchedTexture = NULL; + stitchedTexture = nullptr; //for (int i = 0; i < textureHolders.length; i++) for( TextureHolder *textureHolder : texturesToBeStitched ) diff --git a/Minecraft.Client/TeleportCommand.cpp b/Minecraft.Client/TeleportCommand.cpp index 2132cfd4b..0ee269cd6 100644 --- a/Minecraft.Client/TeleportCommand.cpp +++ b/Minecraft.Client/TeleportCommand.cpp @@ -29,7 +29,7 @@ void TeleportCommand::execute(shared_ptr source, byteArray comman shared_ptr subject = players->getPlayer(subjectID); shared_ptr destination = players->getPlayer(destinationID); - if(subject != NULL && destination != NULL && subject->level->dimension->id == destination->level->dimension->id && subject->isAlive() ) + if(subject != nullptr && destination != nullptr && subject->level->dimension->id == destination->level->dimension->id && subject->isAlive() ) { subject->ride(nullptr); subject->connection->teleport(destination->x, destination->y, destination->z, destination->yRot, destination->xRot); diff --git a/Minecraft.Client/TerrainParticle.cpp b/Minecraft.Client/TerrainParticle.cpp index cec8df8fb..fb29118b8 100644 --- a/Minecraft.Client/TerrainParticle.cpp +++ b/Minecraft.Client/TerrainParticle.cpp @@ -47,7 +47,7 @@ void TerrainParticle::render(Tesselator *t, float a, float xa, float ya, float z float v1 = v0 + 0.999f / 16.0f / 4; float r = 0.1f * size; - if (tex != NULL) + if (tex != nullptr) { u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION); u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION); diff --git a/Minecraft.Client/TextEditScreen.cpp b/Minecraft.Client/TextEditScreen.cpp index 6b14ce5d1..d9804b92a 100644 --- a/Minecraft.Client/TextEditScreen.cpp +++ b/Minecraft.Client/TextEditScreen.cpp @@ -52,7 +52,7 @@ void TextEditScreen::buttonClicked(Button *button) if (button->id == 0) { sign->setChanged(); - minecraft->setScreen(NULL); + minecraft->setScreen(nullptr); } } diff --git a/Minecraft.Client/Texture.cpp b/Minecraft.Client/Texture.cpp index dd1804d7a..b7e58d5fa 100644 --- a/Minecraft.Client/Texture.cpp +++ b/Minecraft.Client/Texture.cpp @@ -24,7 +24,7 @@ Texture::Texture(const wstring &name, int mode, int width, int height, int depth void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap) { #ifdef __PS3__ - if(g_texBlitJobQueuePort == NULL) + if(g_texBlitJobQueuePort == nullptr) g_texBlitJobQueuePort = new C4JSpursJobQueue::Port("C4JSpursJob_Texture_blit"); #endif this->name = name; @@ -40,7 +40,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de m_bInitialised = false; for( int i = 0 ; i < 10; i++ ) { - data[i] = NULL; + data[i] = nullptr; } rect = new Rect2i(0, 0, width, height); @@ -105,7 +105,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap) { _init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, mipMap); - if (image == NULL) + if (image == nullptr) { if (width == -1 || height == -1) { @@ -195,7 +195,7 @@ Texture::~Texture() for(int i = 0; i < 10; i++ ) { - if(data[i] != NULL) delete data[i]; + if(data[i] != nullptr) delete data[i]; } if(glId >= 0) @@ -258,7 +258,7 @@ void Texture::writeAsBMP(const wstring &name) outFile.delete(); } - DataOutputStream *outStream = NULL; + DataOutputStream *outStream = nullptr; //try { outStream = new DataOutputStream(new FileOutputStream(outFile)); //} catch (IOException e) { @@ -384,7 +384,7 @@ void Texture::blit(int x, int y, Texture *source, bool rotated) { ByteBuffer *srcBuffer = source->getData(level); - if(srcBuffer == NULL) break; + if(srcBuffer == nullptr) break; int yy = y >> level; int xx = x >> level; @@ -598,10 +598,10 @@ void Texture::transferFromImage(BufferedImage *image) for(int i = 0; i < 10; i++ ) { - if(data[i] != NULL) + if(data[i] != nullptr) { delete data[i]; - data[i] = NULL; + data[i] = nullptr; } } @@ -618,7 +618,7 @@ void Texture::transferFromImage(BufferedImage *image) delete [] tempBytes.data; - if(mipmapped || image->getData(1) != NULL) + if(mipmapped || image->getData(1) != nullptr) { mipmapped = true; for(unsigned int level = 1; level < MAX_MIP_LEVELS; ++level) @@ -807,7 +807,7 @@ void Texture::updateOnGPU() { for (int level = 1; level < m_iMipLevels; level++) { - if(data[level] == NULL) break; + if(data[level] == nullptr) break; data[level]->flip(); } diff --git a/Minecraft.Client/Texture.h b/Minecraft.Client/Texture.h index 09b7495e9..5dcf2b481 100644 --- a/Minecraft.Client/Texture.h +++ b/Minecraft.Client/Texture.h @@ -59,7 +59,7 @@ private: #ifdef __PS3__ ByteBuffer_IO *data[10]; #else - ByteBuffer *data[10]; // Arrays for mipmaps - NULL if not used + ByteBuffer *data[10]; // Arrays for mipmaps - nullptr if not used #endif public: diff --git a/Minecraft.Client/TextureManager.cpp b/Minecraft.Client/TextureManager.cpp index 542b94998..d6cbe2c33 100644 --- a/Minecraft.Client/TextureManager.cpp +++ b/Minecraft.Client/TextureManager.cpp @@ -7,7 +7,7 @@ #include "TextureManager.h" #include "..\Minecraft.World\StringHelpers.h" -TextureManager *TextureManager::instance = NULL; +TextureManager *TextureManager::instance = nullptr; void TextureManager::createInstance() { @@ -36,7 +36,7 @@ Texture *TextureManager::getTexture(const wstring &name) return idToTextureMap.find(stringToIDMap.find(name)->second)->second; } - return NULL; + return nullptr; } void TextureManager::registerName(const wstring &name, Texture *texture) @@ -136,7 +136,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool for (int i = 0; i < frameCount; i++) { BufferedImage *subImage = image->getSubimage(0, frameHeight * i, frameWidth, frameHeight); - Texture *texture = createTexture(texName, mode, frameWidth, frameHeight, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != NULL, subImage); + Texture *texture = createTexture(texName, mode, frameWidth, frameHeight, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != nullptr, subImage); delete subImage; result->push_back(texture); } @@ -146,7 +146,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool // TODO: Remove this hack -- fix proper rotation support (needed for 'off-aspect textures') if (width == height) { - result->push_back(createTexture(texName, mode, width, height, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != NULL, image)); + result->push_back(createTexture(texName, mode, width, height, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != nullptr, image)); } else { @@ -191,6 +191,6 @@ Texture *TextureManager::createTexture(const wstring &name, int mode, int width, Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int format, bool mipmap) { // 4J Stu - Don't clamp as it causes issues with how we signal non-mipmmapped textures to the pixel shader - //return createTexture(name, mode, width, height, Texture::WM_CLAMP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL); - return createTexture(name, mode, width, height, Texture::WM_WRAP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL); + //return createTexture(name, mode, width, height, Texture::WM_CLAMP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, nullptr); + return createTexture(name, mode, width, height, Texture::WM_WRAP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, nullptr); } \ No newline at end of file diff --git a/Minecraft.Client/TextureMap.cpp b/Minecraft.Client/TextureMap.cpp index 9aefbb637..902dc9d66 100644 --- a/Minecraft.Client/TextureMap.cpp +++ b/Minecraft.Client/TextureMap.cpp @@ -22,8 +22,8 @@ TextureMap::TextureMap(int type, const wstring &name, const wstring &path, Buffe this->missingTexture = missingTexture; // 4J Initialisers - missingPosition = NULL; - stitchResult = NULL; + missingPosition = nullptr; + stitchResult = nullptr; m_mipMap = mipmap; } @@ -37,7 +37,7 @@ void TextureMap::stitch() //for (Tile tile : Tile.tiles) for(unsigned int i = 0; i < Tile::TILE_NUM_COUNT; ++i) { - if (Tile::tiles[i] != NULL) + if (Tile::tiles[i] != nullptr) { Tile::tiles[i]->registerIcons(this); } @@ -51,7 +51,7 @@ void TextureMap::stitch() for(unsigned int i = 0; i < Item::ITEM_NUM_COUNT; ++i) { Item *item = Item::items[i]; - if (item != NULL && item->getIconType() == iconType) + if (item != nullptr && item->getIconType() == iconType) { item->registerIcons(this); } @@ -89,7 +89,7 @@ void TextureMap::stitch() // TODO: [EB] Put the frames into a proper object, not this inside out hack vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); - if (frames == NULL || frames->empty()) + if (frames == nullptr || frames->empty()) { continue; // Couldn't load a texture, skip it } @@ -124,7 +124,7 @@ void TextureMap::stitch() vector *frames = textures.find(textureHolder)->second; - StitchedTexture *stored = NULL; + StitchedTexture *stored = nullptr; auto itTex = texturesToRegister.find(textureName); if(itTex != texturesToRegister.end() ) stored = itTex->second; @@ -188,7 +188,7 @@ void TextureMap::stitch() StitchedTexture *TextureMap::getTexture(const wstring &name) { StitchedTexture *result = texturesByName.find(name)->second; - if (result == NULL) result = missingPosition; + if (result == nullptr) result = missingPosition; return result; } @@ -212,7 +212,7 @@ Icon *TextureMap::registerIcon(const wstring &name) { if (name.empty()) { - app.DebugPrintf("Don't register NULL\n"); + app.DebugPrintf("Don't register nullptr\n"); #ifndef _CONTENT_PACKAGE __debugbreak(); #endif @@ -220,11 +220,11 @@ Icon *TextureMap::registerIcon(const wstring &name) } // TODO: [EB]: Why do we allow multiple registrations? - StitchedTexture *result = NULL; + StitchedTexture *result = nullptr; auto it = texturesToRegister.find(name); if(it != texturesToRegister.end()) result = it->second; - if (result == NULL) + if (result == nullptr) { result = StitchedTexture::create(name); texturesToRegister.insert( stringStitchedTextureMap::value_type(name, result) ); diff --git a/Minecraft.Client/TexturePack.cpp b/Minecraft.Client/TexturePack.cpp index 7ed208ae3..bacb29516 100644 --- a/Minecraft.Client/TexturePack.cpp +++ b/Minecraft.Client/TexturePack.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "TexturePack.h" -wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/,const char *pchBDPatchFileName /*= NULL*/) +wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/,const char *pchBDPatchFileName /*= nullptr*/) { wstring wDrive; #ifdef _XBOX @@ -24,8 +24,8 @@ wstring TexturePack::getPath(bool bTitleUpdateTexture /*= false*/,const char *pc #ifdef __PS3__ // 4J-PB - we need to check for a BD patch - this is going to be an issue for full DLC texture packs (Halloween) - char *pchUsrDir=NULL; - if(app.GetBootedFromDiscPatch() && pchBDPatchFileName!=NULL) + char *pchUsrDir=nullptr; + if(app.GetBootedFromDiscPatch() && pchBDPatchFileName!=nullptr) { pchUsrDir = app.GetBDUsrDirPath(pchBDPatchFileName); wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); diff --git a/Minecraft.Client/TexturePack.h b/Minecraft.Client/TexturePack.h index 23cb4f62e..8e6134233 100644 --- a/Minecraft.Client/TexturePack.h +++ b/Minecraft.Client/TexturePack.h @@ -35,11 +35,11 @@ public: */ return name; } - virtual DLCPack * getDLCPack() { return NULL;} + virtual DLCPack * getDLCPack() { return nullptr;} // 4J Added - virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=NULL); + virtual wstring getPath(bool bTitleUpdateTexture = false, const char *pchBDPatchFilename=nullptr); virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback) = 0; virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"") = 0; virtual void loadColourTable() = 0; diff --git a/Minecraft.Client/TexturePackRepository.cpp b/Minecraft.Client/TexturePackRepository.cpp index 6bb3ccccb..92032aae0 100644 --- a/Minecraft.Client/TexturePackRepository.cpp +++ b/Minecraft.Client/TexturePackRepository.cpp @@ -9,7 +9,7 @@ #include "..\Minecraft.World\StringHelpers.h" #include "Minimap.h" -TexturePack *TexturePackRepository::DEFAULT_TEXTURE_PACK = NULL; +TexturePack *TexturePackRepository::DEFAULT_TEXTURE_PACK = nullptr; TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *minecraft) { @@ -17,7 +17,7 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m // 4J - added usingWeb = false; - selected = NULL; + selected = nullptr; texturePacks = new vector; this->minecraft = minecraft; @@ -28,9 +28,9 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m DEFAULT_TEXTURE_PACK->loadColourTable(); - m_dummyTexturePack = NULL; - m_dummyDLCTexturePack = NULL; - lastSelected = NULL; + m_dummyTexturePack = nullptr; + m_dummyDLCTexturePack = nullptr; + lastSelected = nullptr; updateList(); } @@ -49,13 +49,13 @@ void TexturePackRepository::addDebugPacks() { DLCPack *pack = app.m_dlcManager.getPack(L"DLCTestPack"); - if( pack != NULL && pack->IsCorrupt() ) + if( pack != nullptr && pack->IsCorrupt() ) { app.m_dlcManager.removePack(pack); - pack = NULL; + pack = nullptr; } - if(pack == NULL) + if(pack == nullptr) { wprintf(L"Pack \"%ls\" is not installed, so adding it\n", L"DLCTestPack"); pack = new DLCPack(L"DLCTestPack",0xffffffff); @@ -164,7 +164,7 @@ void TexturePackRepository::updateList() currentPacks->push_back(m_dummyTexturePack); cacheById[m_dummyTexturePack->getId()] = m_dummyTexturePack; - if(m_dummyDLCTexturePack != NULL) + if(m_dummyDLCTexturePack != nullptr) { currentPacks->push_back(m_dummyDLCTexturePack); cacheById[m_dummyDLCTexturePack->getId()] = m_dummyDLCTexturePack; @@ -227,7 +227,7 @@ wstring TexturePackRepository::getIdOrNull(File file) return file.getName() + ":folder:" + file.lastModified(); } - return NULL; + return nullptr; #endif return L""; } @@ -357,17 +357,17 @@ TexturePack *TexturePackRepository::getTexturePackById(DWORD id) return it->second; } - return NULL; + return nullptr; } TexturePack *TexturePackRepository::addTexturePackFromDLC(DLCPack *dlcPack, DWORD id) { - TexturePack *newPack = NULL; + TexturePack *newPack = nullptr; // 4J-PB - The City texture pack went out with a child id for the texture pack of 1 instead of zero // we need to mask off the child id here to deal with this DWORD dwParentID=id&0xFFFFFF; // child id is <<24 and Or'd with parent - if(dlcPack != NULL) + if(dlcPack != nullptr) { newPack = new DLCTexturePack(dwParentID, dlcPack, DEFAULT_TEXTURE_PACK); texturePacks->push_back(newPack); @@ -408,7 +408,7 @@ void TexturePackRepository::removeTexturePackById(DWORD id) texturePacks->erase(it2); if(lastSelected == oldPack) { - lastSelected = NULL; + lastSelected = nullptr; } } m_texturePacksToDelete.push_back(oldPack); @@ -417,19 +417,19 @@ void TexturePackRepository::removeTexturePackById(DWORD id) void TexturePackRepository::updateUI() { - if(lastSelected != NULL && lastSelected != selected) + if(lastSelected != nullptr && lastSelected != selected) { lastSelected->unloadUI(); selected->loadUI(); Minimap::reloadColours(); ui.StartReloadSkinThread(); - lastSelected = NULL; + lastSelected = nullptr; } } bool TexturePackRepository::needsUIUpdate() { - return lastSelected != NULL && lastSelected != selected; + return lastSelected != nullptr && lastSelected != selected; } unsigned int TexturePackRepository::getTexturePackCount() @@ -439,7 +439,7 @@ unsigned int TexturePackRepository::getTexturePackCount() TexturePack *TexturePackRepository::getTexturePackByIndex(unsigned int index) { - TexturePack *pack = NULL; + TexturePack *pack = nullptr; if(index < texturePacks->size()) { pack = texturePacks->at(index); diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index e864a2f49..c724bd130 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -299,15 +299,15 @@ intArray Textures::loadTexturePixels(TEXTURE_NAME texId, const wstring& resource { intArray id = pixelsMap[resourceName]; // 4J - if resourceName isn't in the map, it should add an element and as that will use the default constructor, its - // internal data pointer will be NULL - if (id.data != NULL) return id; + // internal data pointer will be nullptr + if (id.data != nullptr) return id; } // 4J - removed try/catch // try { intArray res; //wstring in = skin->getResource(resourceName); - if (false)// 4J - removed - was ( in == NULL) + if (false)// 4J - removed - was ( in == nullptr) { res = loadTexturePixels(missingNo); } @@ -458,7 +458,7 @@ void Textures::bindTextureLayers(ResourceLocation *resource) wstring resourceName = wstring(preLoaded[textureName]) + L".png"; BufferedImage *image = readImage(textureName, resourceName); - if( image == NULL ) + if( image == nullptr ) { continue; } @@ -618,7 +618,7 @@ int Textures::loadTexture(TEXTURE_NAME texId, const wstring& resourceName) if (clamp) pathName = resourceName.substr(7); //wstring in = skins->getSelected()->getResource(pathName); - if (false ) // 4J - removed was ( in == NULL) + if (false ) // 4J - removed was ( in == nullptr) { loadTexture(missingNo, id, blur, clamp); } @@ -711,7 +711,7 @@ void Textures::loadTexture(BufferedImage *img, int id, bool blur, bool clamp) intArray rawPixels(w*h); img->getRGB(0, 0, w, h, rawPixels, 0, w); - if (options != NULL && options->anaglyph3d) + if (options != nullptr && options->anaglyph3d) { rawPixels = anaglyph(rawPixels); } @@ -877,7 +877,7 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - if (options != NULL && options->anaglyph3d) + if (options != nullptr && options->anaglyph3d) { rawPixels = anaglyph(rawPixels); } @@ -890,7 +890,7 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) int g = (rawPixels[i] >> 8) & 0xff; int b = (rawPixels[i]) & 0xff; - if (options != NULL && options->anaglyph3d) + if (options != nullptr && options->anaglyph3d) { int rr = (r * 30 + g * 59 + b * 11) / 100; int gg = (r * 30 + g * 70) / (100); @@ -1004,9 +1004,9 @@ void Textures::releaseTexture(int id) int Textures::loadHttpTexture(const wstring& url, const wstring& backup) { HttpTexture *texture = httpTextures[url]; - if (texture != NULL) + if (texture != nullptr) { - if (texture->loadedImage != NULL && !texture->isLoaded) + if (texture->loadedImage != nullptr && !texture->isLoaded) { if (texture->id < 0) { @@ -1019,7 +1019,7 @@ int Textures::loadHttpTexture(const wstring& url, const wstring& backup) texture->isLoaded = true; } } - if (texture == NULL || texture->id < 0) + if (texture == nullptr || texture->id < 0) { if (backup.empty() ) return -1; return loadTexture(TN_COUNT, backup); @@ -1030,9 +1030,9 @@ int Textures::loadHttpTexture(const wstring& url, const wstring& backup) int Textures::loadHttpTexture(const wstring& url, int backup) { HttpTexture *texture = httpTextures[url]; - if (texture != NULL) + if (texture != nullptr) { - if (texture->loadedImage != NULL && !texture->isLoaded) + if (texture->loadedImage != nullptr && !texture->isLoaded) { if (texture->id < 0) { @@ -1045,7 +1045,7 @@ int Textures::loadHttpTexture(const wstring& url, int backup) texture->isLoaded = true; } } - if (texture == NULL || texture->id < 0) + if (texture == nullptr || texture->id < 0) { return loadTexture(backup); } @@ -1060,7 +1060,7 @@ bool Textures::hasHttpTexture(const wstring &url) HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor *processor) { HttpTexture *texture = httpTextures[url]; - if (texture == NULL) + if (texture == nullptr) { httpTextures[url] = new HttpTexture(url, processor); } @@ -1074,7 +1074,7 @@ HttpTexture *Textures::addHttpTexture(const wstring& url, HttpTextureProcessor * void Textures::removeHttpTexture(const wstring& url) { HttpTexture *texture = httpTextures[url]; - if (texture != NULL) + if (texture != nullptr) { texture->count--; if (texture->count == 0) @@ -1088,20 +1088,20 @@ void Textures::removeHttpTexture(const wstring& url) // 4J-PB - adding for texture in memory (from global title storage) int Textures::loadMemTexture(const wstring& url, const wstring& backup) { - MemTexture *texture = NULL; + MemTexture *texture = nullptr; auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; } - if(texture == NULL && app.IsFileInMemoryTextures(url)) + if(texture == nullptr && app.IsFileInMemoryTextures(url)) { // If we haven't loaded it yet, but we have the data for it then add it texture = addMemTexture(url, new MobSkinMemTextureProcessor() ); } - if(texture != NULL) + if(texture != nullptr) { - if (texture->loadedImage != NULL && !texture->isLoaded) + if (texture->loadedImage != nullptr && !texture->isLoaded) { // 4J - Disable mipmapping in general for skins & capes. Have seen problems with edge-on polys for some eg mumbo jumbo if( ( url.substr(0,7) == L"dlcskin" ) || @@ -1122,7 +1122,7 @@ int Textures::loadMemTexture(const wstring& url, const wstring& backup) MIPMAP = true; } } - if (texture == NULL || texture->id < 0) + if (texture == nullptr || texture->id < 0) { if (backup.empty() ) return -1; return loadTexture(TN_COUNT,backup); @@ -1132,21 +1132,21 @@ int Textures::loadMemTexture(const wstring& url, const wstring& backup) int Textures::loadMemTexture(const wstring& url, int backup) { - MemTexture *texture = NULL; + MemTexture *texture = nullptr; auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; } - if(texture == NULL && app.IsFileInMemoryTextures(url)) + if(texture == nullptr && app.IsFileInMemoryTextures(url)) { // If we haven't loaded it yet, but we have the data for it then add it texture = addMemTexture(url, new MobSkinMemTextureProcessor() ); } - if(texture != NULL) + if(texture != nullptr) { texture->ticksSinceLastUse = 0; - if (texture->loadedImage != NULL && !texture->isLoaded) + if (texture->loadedImage != nullptr && !texture->isLoaded) { // 4J - Disable mipmapping in general for skins & capes. Have seen problems with edge-on polys for some eg mumbo jumbo if( ( url.substr(0,7) == L"dlcskin" ) || @@ -1166,7 +1166,7 @@ int Textures::loadMemTexture(const wstring& url, int backup) MIPMAP = true; } } - if (texture == NULL || texture->id < 0) + if (texture == nullptr || texture->id < 0) { return loadTexture(backup); } @@ -1175,16 +1175,16 @@ int Textures::loadMemTexture(const wstring& url, int backup) MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *processor) { - MemTexture *texture = NULL; + MemTexture *texture = nullptr; auto it = memTextures.find(name); if (it != memTextures.end()) { texture = (*it).second; } - if(texture == NULL) + if(texture == nullptr) { // can we find it in the app mem files? - PBYTE pbData=NULL; + PBYTE pbData=nullptr; DWORD dwBytes=0; app.GetMemFileDetails(name,&pbData,&dwBytes); @@ -1196,7 +1196,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro else { // 4J Stu - Make an entry for this anyway and we can populate it later - memTextures[name] = NULL; + memTextures[name] = nullptr; } } else @@ -1212,7 +1212,7 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro // MemTexture *Textures::getMemTexture(const wstring& url, MemTextureProcessor *processor) // { // MemTexture *texture = memTextures[url]; -// if (texture != NULL) +// if (texture != nullptr) // { // texture->count++; // } @@ -1221,16 +1221,16 @@ MemTexture *Textures::addMemTexture(const wstring& name,MemTextureProcessor *pro void Textures::removeMemTexture(const wstring& url) { - MemTexture *texture = NULL; + MemTexture *texture = nullptr; auto it = memTextures.find(url); if (it != memTextures.end()) { texture = (*it).second; - // If it's NULL then we should just remove the entry - if( texture == NULL ) memTextures.erase(url); + // If it's nullptr then we should just remove the entry + if( texture == nullptr ) memTextures.erase(url); } - if(texture != NULL) + if(texture != nullptr) { texture->count--; if (texture->count == 0) @@ -1380,7 +1380,7 @@ Icon *Textures::getMissingIcon(int type) BufferedImage *Textures::readImage(TEXTURE_NAME texId, const wstring& name) // 4J was InputStream *in { - BufferedImage *img=NULL; + BufferedImage *img=nullptr; MemSect(32); // is this image one of the Title Update ones? bool isTu = IsTUImage(texId, name); @@ -1534,7 +1534,7 @@ wchar_t *TUImagePaths[] = // - NULL + nullptr }; bool Textures::IsTUImage(TEXTURE_NAME texId, const wstring& name) @@ -1583,7 +1583,7 @@ wchar_t *OriginalImagesPaths[] = { L"misc/watercolor.png", - NULL + nullptr }; bool Textures::IsOriginalImage(TEXTURE_NAME texId, const wstring& name) diff --git a/Minecraft.Client/TileEntityRenderDispatcher.cpp b/Minecraft.Client/TileEntityRenderDispatcher.cpp index 887663fe1..5a1519c7f 100644 --- a/Minecraft.Client/TileEntityRenderDispatcher.cpp +++ b/Minecraft.Client/TileEntityRenderDispatcher.cpp @@ -15,7 +15,7 @@ #include "EnderChestRenderer.h" #include "BeaconRenderer.h" -TileEntityRenderDispatcher *TileEntityRenderDispatcher::instance = NULL; +TileEntityRenderDispatcher *TileEntityRenderDispatcher::instance = nullptr; double TileEntityRenderDispatcher::xOff = 0; double TileEntityRenderDispatcher::yOff = 0; double TileEntityRenderDispatcher::zOff = 0; @@ -28,9 +28,9 @@ void TileEntityRenderDispatcher::staticCtor() TileEntityRenderDispatcher::TileEntityRenderDispatcher() { // 4J -a dded - font = NULL; - textures = NULL; - level = NULL; + font = nullptr; + textures = nullptr; + level = nullptr; cameraEntity = nullptr; playerRotY = 0.0f; playerRotX = 0.0f;; @@ -45,7 +45,7 @@ TileEntityRenderDispatcher::TileEntityRenderDispatcher() renderers[eTYPE_ENCHANTMENTTABLEENTITY] = new EnchantTableRenderer(); renderers[eTYPE_THEENDPORTALTILEENTITY] = new TheEndPortalRenderer(); renderers[eTYPE_SKULLTILEENTITY] = new SkullTileRenderer(); - renderers[eTYPE_FURNACETILEENTITY] = NULL; + renderers[eTYPE_FURNACETILEENTITY] = nullptr; renderers[eTYPE_BEACONTILEENTITY] = new BeaconRenderer(); glDisable(GL_LIGHTING); @@ -57,13 +57,13 @@ TileEntityRenderDispatcher::TileEntityRenderDispatcher() TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(eINSTANCEOF e) { - TileEntityRenderer *r = NULL; + TileEntityRenderer *r = nullptr; //TileEntityRenderer *r = renderers[e]; auto it = renderers.find(e); // 4J Stu - The .at and [] accessors insert elements if they don't exist if( it == renderers.end() ) { - return NULL; + return nullptr; } /* 4J - not doing this hierarchical search anymore. We need to explicitly add renderers for any eINSTANCEOF type that we want to be able to render @@ -83,12 +83,12 @@ TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(eINSTANCEOF e) bool TileEntityRenderDispatcher::hasRenderer(shared_ptr e) { - return getRenderer(e) != NULL; + return getRenderer(e) != nullptr; } TileEntityRenderer *TileEntityRenderDispatcher::getRenderer(shared_ptr e) { - if (e == NULL) return NULL; + if (e == nullptr) return nullptr; return getRenderer(e->GetType()); } @@ -135,7 +135,7 @@ void TileEntityRenderDispatcher::render(shared_ptr e, float a, bool void TileEntityRenderDispatcher::render(shared_ptr entity, double x, double y, double z, float a, bool setColor/*=true*/, float alpha, bool useCompiled) { TileEntityRenderer *renderer = getRenderer(entity); - if (renderer != NULL) + if (renderer != nullptr) { renderer->render(entity, x, y, z, a, setColor, alpha, useCompiled); } diff --git a/Minecraft.Client/TileEntityRenderer.cpp b/Minecraft.Client/TileEntityRenderer.cpp index 94bdd39ce..86bfee7b2 100644 --- a/Minecraft.Client/TileEntityRenderer.cpp +++ b/Minecraft.Client/TileEntityRenderer.cpp @@ -5,13 +5,13 @@ void TileEntityRenderer::bindTexture(ResourceLocation *location) { Textures *t = tileEntityRenderDispatcher->textures; - if(t != NULL) t->bind(t->loadTexture(location->getTexture())); + if(t != nullptr) t->bind(t->loadTexture(location->getTexture())); } void TileEntityRenderer::bindTexture(const wstring& urlTexture, ResourceLocation *location) { Textures *t = tileEntityRenderDispatcher->textures; - if(t != NULL) t->bind(t->loadHttpTexture(urlTexture, location->getTexture())); + if(t != nullptr) t->bind(t->loadHttpTexture(urlTexture, location->getTexture())); } Level *TileEntityRenderer::getLevel() diff --git a/Minecraft.Client/TileRenderer.cpp b/Minecraft.Client/TileRenderer.cpp index acf6a57b6..cbc99554e 100644 --- a/Minecraft.Client/TileRenderer.cpp +++ b/Minecraft.Client/TileRenderer.cpp @@ -19,7 +19,7 @@ const float smallUV = ( 1.0f / 16.0f ); void TileRenderer::_init() { - fixedTexture = NULL; + fixedTexture = nullptr; xFlipTexture = false; noCulling = false; applyAmbienceOcclusion = false; @@ -44,7 +44,7 @@ void TileRenderer::_init() xMin = 0; yMin = 0; zMin = 0; - cache = NULL; + cache = nullptr; } bool TileRenderer::isTranslucentAt(LevelSource *level, int x, int y, int z) @@ -170,7 +170,7 @@ TileRenderer::TileRenderer( LevelSource* level ) TileRenderer::TileRenderer() { - this->level = NULL; + this->level = nullptr; _init(); } @@ -181,7 +181,7 @@ void TileRenderer::setFixedTexture( Icon *fixedTexture ) void TileRenderer::clearFixedTexture() { - this->fixedTexture = NULL; + this->fixedTexture = nullptr; } bool TileRenderer::hasFixedTexture() @@ -195,7 +195,7 @@ bool TileRenderer::hasFixedTexture() } #endif - return fixedTexture != NULL; + return fixedTexture != nullptr; } void TileRenderer::setShape(float x0, float y0, float z0, float x1, float y1, float z1) @@ -907,7 +907,7 @@ bool TileRenderer::tesselateFlowerPotInWorld(FlowerPotTile *tt, int x, int y, in float xOff = 0; float yOff = 4; float zOff = 0; - Tile *plant = NULL; + Tile *plant = nullptr; switch (type) { @@ -927,7 +927,7 @@ bool TileRenderer::tesselateFlowerPotInWorld(FlowerPotTile *tt, int x, int y, in t->addOffset(xOff / 16.0f, yOff / 16.0f, zOff / 16.0f); - if (plant != NULL) + if (plant != nullptr) { tesselateInWorld(plant, x, y, z); } @@ -1902,7 +1902,7 @@ bool TileRenderer::tesselateLeverInWorld( Tile* tt, int x, int y, int z ) } } - Vec3* c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; + Vec3* c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; for ( int i = 0; i < 6; i++ ) { if ( i == 0 ) @@ -2073,7 +2073,7 @@ bool TileRenderer::tesselateTripwireSourceInWorld(Tile *tt, int x, int y, int z) corners[i]->z += z + 0.5; } - Vec3 *c0 = NULL, *c1 = NULL, *c2 = NULL, *c3 = NULL; + Vec3 *c0 = nullptr, *c1 = nullptr, *c2 = nullptr, *c3 = nullptr; int stickX0 = 7; int stickX1 = 9; int stickY0 = 9; @@ -3241,7 +3241,7 @@ bool TileRenderer::tesselateThinPaneInWorld(Tile *tt, int x, int y, int z) Icon *tex; Icon *edgeTex; - bool stained = dynamic_cast(tt) != NULL; + bool stained = dynamic_cast(tt) != nullptr; if (hasFixedTexture()) { tex = fixedTexture; @@ -5207,7 +5207,7 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile* // but they also happen to draw a lot of faces, and the code for determining which texture to use is more complex than in most // cases. Optimisation here then to store a uniform texture where appropriate (could be extended beyond leaves) that will stop // any other faces being evaluated. - Icon *uniformTex = NULL; + Icon *uniformTex = nullptr; int id = tt->id; if( id == Tile::leaves_Id ) { @@ -5257,7 +5257,7 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionTexLighting( Tile* Tesselator* t = Tesselator::getInstance(); t->tex2( 0xf000f ); - if( uniformTex == NULL ) + if( uniformTex == nullptr ) { if ( getTexture(tt)->getFlags() == Icon::IS_GRASS_TOP ) tintSides = false; } @@ -8550,7 +8550,7 @@ Icon *TileRenderer::getTexture(Tile *tile) Icon *TileRenderer::getTextureOrMissing(Icon *icon) { - if (icon == NULL) return minecraft->textures->getMissingIcon(Icon::TYPE_TERRAIN); + if (icon == nullptr) return minecraft->textures->getMissingIcon(Icon::TYPE_TERRAIN); #ifdef __PSVITA__ // AP - alpha cut out is expensive on vita. Pass on the Alpha Cut out flag to the tesselator diff --git a/Minecraft.Client/TitleScreen.cpp b/Minecraft.Client/TitleScreen.cpp index 1c7d5125b..d522963ca 100644 --- a/Minecraft.Client/TitleScreen.cpp +++ b/Minecraft.Client/TitleScreen.cpp @@ -18,7 +18,7 @@ TitleScreen::TitleScreen() { // 4J - added initialisers vo = 0; - multiplayerButton = NULL; + multiplayerButton = nullptr; splash = L"missingno"; // try { // 4J - removed try/catch @@ -93,7 +93,7 @@ void TitleScreen::init() buttons.push_back(new Button(4, width / 2 + 2, topPos + spacing * 3 + 12, 98, 20, language->getElement(L"menu.quit"))); } - if (minecraft->user == NULL) + if (minecraft->user == nullptr) { multiplayerButton->active = false; } diff --git a/Minecraft.Client/TrackedEntity.cpp b/Minecraft.Client/TrackedEntity.cpp index 74cfbca32..386339543 100644 --- a/Minecraft.Client/TrackedEntity.cpp +++ b/Minecraft.Client/TrackedEntity.cpp @@ -63,7 +63,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl updatePlayers(tracker, players); } - if (lastRidingEntity != e->riding || (e->riding != NULL && tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0)) + if (lastRidingEntity != e->riding || (e->riding != nullptr && tickCount % (SharedConstants::TICKS_PER_SECOND * 3) == 0)) { lastRidingEntity = e->riding; broadcast(shared_ptr(new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, e, e->riding))); @@ -75,7 +75,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl shared_ptr frame = dynamic_pointer_cast (e); shared_ptr item = frame->getItem(); - if (item != NULL && item->getItem()->id == Item::map_Id && !e->removed) + if (item != nullptr && item->getItem()->id == Item::map_Id && !e->removed) { shared_ptr data = Item::map->getSavedData(item, e->level); for (auto& it : *players) @@ -86,7 +86,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (!player->removed && player->connection && player->connection->countDelayedPackets() <= 5) { shared_ptr packet = Item::map->getUpdatePacket(item, e->level, player); - if (packet != NULL) player->connection->send(packet); + if (packet != nullptr) player->connection->send(packet); } } } @@ -107,7 +107,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl int yRota = yRotn - yRotp; int xRota = xRotn - xRotp; - if(e->riding == NULL) + if(e->riding == nullptr) { teleportDelay++; @@ -264,7 +264,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl } - if (packet != NULL) + if (packet != nullptr) { broadcast(packet); } @@ -368,7 +368,7 @@ void TrackedEntity::broadcast(shared_ptr packet) if( sentTo.size() ) { INetworkPlayer *thisPlayer =player->connection->getNetworkPlayer(); - if( thisPlayer == NULL ) + if( thisPlayer == nullptr ) { dontSend = true; } @@ -377,7 +377,7 @@ void TrackedEntity::broadcast(shared_ptr packet) for(auto& player2 : sentTo) { INetworkPlayer *otherPlayer = player2->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { dontSend = true; } @@ -410,7 +410,7 @@ void TrackedEntity::broadcastAndSend(shared_ptr packet) vector< shared_ptr > sentTo; broadcast(packet); shared_ptr sp = e->instanceof(eTYPE_SERVERPLAYER) ? dynamic_pointer_cast(e) : nullptr; - if (sp != NULL && sp->connection) + if (sp != nullptr && sp->connection) { sp->connection->send(packet); } @@ -477,7 +477,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar if( ep->dimension != sp->dimension ) continue; INetworkPlayer * otherPlayer = ep->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { // 4J Stu - We call update players when the entity has moved more than a certain amount at the start of it's tick // Before this call we set xpu, ypu and zpu to the entities new position, but xp,yp and zp are the old position until later in the tick. @@ -499,7 +499,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar // 4J-JEV: ADDED! An entities mount has to be visible before the entity visible, // this is to ensure that the mount is already in the client's game when the rider is added. - if (canBeSeenBy && bVisible && e->riding != NULL) + if (canBeSeenBy && bVisible && e->riding != nullptr) { return tracker->getTracker(e->riding)->isVisible(tracker, sp, true); } @@ -530,11 +530,11 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr plr = dynamic_pointer_cast(e); app.DebugPrintf( "TrackedEntity:: Player '%ls' is now visible to player '%ls', %s.\n", plr->name.c_str(), sp->name.c_str(), - (e->riding==NULL?"not riding minecart":"in minecart") + (e->riding==nullptr?"not riding minecart":"in minecart") ); } - bool isAddMobPacket = dynamic_pointer_cast(packet) != NULL; + bool isAddMobPacket = dynamic_pointer_cast(packet) != nullptr; // 4J Stu brought forward to fix when Item Frames if (!e->getEntityData()->isEmpty() && !isAddMobPacket) @@ -560,11 +560,11 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptrconnection->send( shared_ptr( new SetEntityMotionPacket(e->entityId, e->xd, e->yd, e->zd) ) ); } - if (e->riding != NULL) + if (e->riding != nullptr) { sp->connection->send(shared_ptr(new SetEntityLinkPacket(SetEntityLinkPacket::RIDING, e, e->riding))); } - if ( e->instanceof(eTYPE_MOB) && dynamic_pointer_cast(e)->getLeashHolder() != NULL) + if ( e->instanceof(eTYPE_MOB) && dynamic_pointer_cast(e)->getLeashHolder() != nullptr) { sp->connection->send( shared_ptr( new SetEntityLinkPacket(SetEntityLinkPacket::LEASH, e, dynamic_pointer_cast(e)->getLeashHolder())) ); } @@ -574,7 +574,7 @@ void TrackedEntity::updatePlayer(EntityTracker *tracker, shared_ptr item = dynamic_pointer_cast(e)->getCarried(i); - if(item != NULL) sp->connection->send( shared_ptr( new SetEquippedItemPacket(e->entityId, i, item) ) ); + if(item != nullptr) sp->connection->send( shared_ptr( new SetEquippedItemPacket(e->entityId, i, item) ) ); } } @@ -636,7 +636,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() } // 4J-PB - replacing with a switch, rather than tons of ifs - if (dynamic_pointer_cast(e) != NULL) + if (dynamic_pointer_cast(e) != nullptr) { yHeadRotp = Mth::floor(e->getYHeadRot() * 256 / 360); return shared_ptr( new AddMobPacket(dynamic_pointer_cast(e), yRotp, xRotp, xp, yp, zp, yHeadRotp) ); @@ -653,7 +653,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() PlayerUID xuid = INVALID_XUID; PlayerUID OnlineXuid = INVALID_XUID; - if( player != NULL ) + if( player != nullptr ) { xuid = player->getXuid(); OnlineXuid = player->getOnlineXuid(); @@ -678,12 +678,12 @@ shared_ptr TrackedEntity::getAddEntityPacket() else if (e->instanceof(eTYPE_FISHINGHOOK)) { shared_ptr owner = dynamic_pointer_cast(e)->owner; - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::FISH_HOOK, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_ARROW)) { shared_ptr owner = (dynamic_pointer_cast(e))->owner; - return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != NULL ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); + return shared_ptr( new AddEntityPacket(e, AddEntityPacket::ARROW, owner != nullptr ? owner->entityId : e->entityId, yRotp, xRotp, xp, yp, zp) ); } else if (e->instanceof(eTYPE_SNOWBALL)) { @@ -728,7 +728,7 @@ shared_ptr TrackedEntity::getAddEntityPacket() shared_ptr fb = dynamic_pointer_cast(e); shared_ptr aep = nullptr; - if (fb->owner != NULL) + if (fb->owner != nullptr) { aep = shared_ptr( new AddEntityPacket(e, type, fb->owner->entityId, yRotp, xRotp, xp, yp, zp) ); } diff --git a/Minecraft.Client/VideoSettingsScreen.cpp b/Minecraft.Client/VideoSettingsScreen.cpp index 2fefe9298..cc13eab29 100644 --- a/Minecraft.Client/VideoSettingsScreen.cpp +++ b/Minecraft.Client/VideoSettingsScreen.cpp @@ -46,7 +46,7 @@ void VideoSettingsScreen::init() void VideoSettingsScreen::buttonClicked(Button *button) { if (!button->active) return; - if (button->id < 100 && (dynamic_cast(button) != NULL)) + if (button->id < 100 && (dynamic_cast(button) != nullptr)) { options->toggle(static_cast(button)->getOption(), 1); button->msg = options->getMessage(Options::Option::getItem(button->id)); diff --git a/Minecraft.Client/Windows64/4JLibs/inc/4J_Input.h b/Minecraft.Client/Windows64/4JLibs/inc/4J_Input.h index 9ac5c55d1..26e88e067 100644 --- a/Minecraft.Client/Windows64/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Windows64/4JLibs/inc/4J_Input.h @@ -107,8 +107,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); -// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); -// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=NULL); +// EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); +// EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,C4JStringTable *pStringTable=nullptr); EKeyboardResult RequestKeyboard(LPCWSTR Title, LPCWSTR Text, DWORD dwPad, UINT uiMaxChars, int( *Func)(LPVOID,const bool),LPVOID lpParam,C_4JInput::EKeyboardMode eMode); void GetText(uint16_t *UTF16String); diff --git a/Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h index f1bd85bbe..6b9cc2890 100644 --- a/Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h @@ -100,7 +100,7 @@ public: // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h b/Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h index 737caa98b..fb16ccb32 100644 --- a/Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h @@ -16,8 +16,8 @@ public: int GetType() { return m_type; } void *GetBufferPointer() { return m_pBuffer; } int GetBufferSize() { return m_bufferSize; } - void Release() { free(m_pBuffer); m_pBuffer = NULL; } - bool Allocated() { return m_pBuffer != NULL; } + void Release() { free(m_pBuffer); m_pBuffer = nullptr; } + bool Allocated() { return m_pBuffer != nullptr; } }; typedef struct @@ -60,7 +60,7 @@ public: void StartFrame(); void DoScreenGrabOnNextPresent(); void Present(); - void Clear(int flags, D3D11_RECT *pRect = NULL); + void Clear(int flags, D3D11_RECT *pRect = nullptr); void SetClearColour(const float colourRGBA[4]); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h index 896f730a7..07fa8fc7e 100644 --- a/Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h @@ -239,7 +239,7 @@ public: // Messages C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0); + int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, C4JStringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0); C4JStorage::EMessageResult GetMessageBoxResult(); @@ -296,17 +296,17 @@ public: C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); XCONTENT_DATA& GetDLC(DWORD dw); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=NULL); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive = NULL); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=nullptr); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive = nullptr); void GetMountedDLCFileList(const char* szMountDrive, std::vector& fileList); std::string GetMountedPath(std::string szMount); // Global title storage C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, - WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=NULL,LPVOID lpParam=NULL, int iAction=0); + WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=nullptr,LPVOID lpParam=nullptr, int iAction=0); bool WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize); bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename); - void StoreTMSPathName(WCHAR *pwchName=NULL); + void StoreTMSPathName(WCHAR *pwchName=nullptr); // TMS++ #ifdef _XBOX @@ -314,11 +314,11 @@ public: HRESULT GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam); #endif - // C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0); + // C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); // C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0); - // C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); - // C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); + // C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); + // C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=nullptr, int iUserData=0); // bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); // unsigned int CRC(unsigned char *buf, int len); diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d10_shaders.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d10_shaders.inl index d4d2bb229..6ea0d142f 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d10_shaders.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d10_shaders.inl @@ -1364,7 +1364,7 @@ static DWORD pshader_exceptional_blend_12[276] = { }; static ProgramWithCachedVariableLocations pshader_exceptional_blend_arr[13] = { - { NULL, 0, }, + { nullptr, 0, }, { pshader_exceptional_blend_1, 1340, }, { pshader_exceptional_blend_2, 1444, }, { pshader_exceptional_blend_3, 1424, }, @@ -2672,10 +2672,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { { pshader_filter_9, 708, }, { pshader_filter_10, 1644, }, { pshader_filter_11, 1372, }, - { NULL, 0, }, - { NULL, 0, }, - { NULL, 0, }, - { NULL, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, { pshader_filter_16, 1740, }, { pshader_filter_17, 1732, }, { pshader_filter_18, 1820, }, @@ -2688,10 +2688,10 @@ static ProgramWithCachedVariableLocations pshader_filter_arr[32] = { { pshader_filter_25, 1468, }, { pshader_filter_26, 1820, }, { pshader_filter_27, 1548, }, - { NULL, 0, }, - { NULL, 0, }, - { NULL, 0, }, - { NULL, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, }; static DWORD pshader_blur_2[320] = { @@ -3193,8 +3193,8 @@ static DWORD pshader_blur_9[621] = { }; static ProgramWithCachedVariableLocations pshader_blur_arr[10] = { - { NULL, 0, }, - { NULL, 0, }, + { nullptr, 0, }, + { nullptr, 0, }, { pshader_blur_2, 1280, }, { pshader_blur_3, 1452, }, { pshader_blur_4, 1624, }, diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp index dea9e3155..b2fb31e16 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.cpp @@ -64,7 +64,7 @@ static void *map_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf, bool discard) HRESULT hr = ctx->Map(buf, 0, discard ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE, 0, &msr); if (FAILED(hr)) { report_d3d_error(hr, "Map", "of buffer"); - return NULL; + return nullptr; } else return msr.pData; } @@ -76,12 +76,12 @@ static void unmap_buffer(ID3D1XContext *ctx, ID3D11Buffer *buf) static RADINLINE void set_pixel_shader(ID3D11DeviceContext *ctx, ID3D11PixelShader *shader) { - ctx->PSSetShader(shader, NULL, 0); + ctx->PSSetShader(shader, nullptr, 0); } static RADINLINE void set_vertex_shader(ID3D11DeviceContext *ctx, ID3D11VertexShader *shader) { - ctx->VSSetShader(shader, NULL, 0); + ctx->VSSetShader(shader, nullptr, 0); } static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11_BLEND src, D3D11_BLEND dst) @@ -100,7 +100,7 @@ static ID3D11BlendState *create_blend_state(ID3D11Device *dev, BOOL blend, D3D11 HRESULT hr = dev->CreateBlendState(&desc, &res); if (FAILED(hr)) { report_d3d_error(hr, "CreateBlendState", ""); - res = NULL; + res = nullptr; } return res; @@ -113,10 +113,10 @@ static void create_pixel_shader(ProgramWithCachedVariableLocations *p, ProgramWi { *p = *src; if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, NULL, &p->pshader); + HRESULT hr = gdraw->d3d_device->CreatePixelShader(p->bytecode, p->size, nullptr, &p->pshader); if (FAILED(hr)) { report_d3d_error(hr, "CreatePixelShader", ""); - p->pshader = NULL; + p->pshader = nullptr; return; } } @@ -126,10 +126,10 @@ static void create_vertex_shader(ProgramWithCachedVariableLocations *p, ProgramW { *p = *src; if(p->bytecode) { - HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, NULL, &p->vshader); + HRESULT hr = gdraw->d3d_device->CreateVertexShader(p->bytecode, p->size, nullptr, &p->vshader); if (FAILED(hr)) { report_d3d_error(hr, "CreateVertexShader", ""); - p->vshader = NULL; + p->vshader = nullptr; return; } } diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.h b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.h index 7fd7012fe..47fe3c29b 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.h +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d11.h @@ -42,7 +42,7 @@ IDOC extern GDrawFunctions * gdraw_D3D11_CreateContext(ID3D11Device *dev, ID3D11 There can only be one D3D GDraw context active at any one time. If initialization fails for some reason (the main reason would be an out of memory condition), - NULL is returned. Otherwise, you can pass the return value to IggySetGDraw. */ + nullptr is returned. Otherwise, you can pass the return value to IggySetGDraw. */ IDOC extern void gdraw_D3D11_DestroyContext(void); /* Destroys the current GDraw context, if any. */ @@ -70,7 +70,7 @@ IDOC extern void gdraw_D3D11_SetTileOrigin(ID3D11RenderTargetView *main_rt, ID3D If your rendertarget uses multisampling, you also need to specify a shader resource view for a non-MSAA rendertarget texture (identically sized to main_rt) in non_msaa_rt. This is only used if the Flash content includes non-standard - blend modes which have to use a special blend shader, so you can leave it NULL + blend modes which have to use a special blend shader, so you can leave it nullptr if you forbid such content. You need to call this before Iggy calls any rendering functions. */ diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl index 6e14791c4..856e708ca 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_d3d1x_shared.inl @@ -196,16 +196,16 @@ static void safe_release(T *&p) { if (p) { p->Release(); - p = NULL; + p = nullptr; } } static void report_d3d_error(HRESULT hr, char *call, char *context) { if (hr == E_OUTOFMEMORY) - IggyGDrawSendWarning(NULL, "GDraw D3D out of memory in %s%s", call, context); + IggyGDrawSendWarning(nullptr, "GDraw D3D out of memory in %s%s", call, context); else - IggyGDrawSendWarning(NULL, "GDraw D3D error in %s%s: 0x%08x", call, context, hr); + IggyGDrawSendWarning(nullptr, "GDraw D3D error in %s%s: 0x%08x", call, context, hr); } static void unbind_resources(void) @@ -215,12 +215,12 @@ static void unbind_resources(void) // unset active textures and vertex/index buffers, // to make sure there are no dangling refs static ID3D1X(ShaderResourceView) *no_views[3] = { 0 }; - ID3D1X(Buffer) *no_vb = NULL; + ID3D1X(Buffer) *no_vb = nullptr; UINT no_offs = 0; d3d->PSSetShaderResources(0, 3, no_views); d3d->IASetVertexBuffers(0, 1, &no_vb, &no_offs, &no_offs); - d3d->IASetIndexBuffer(NULL, DXGI_FORMAT_UNKNOWN, 0); + d3d->IASetIndexBuffer(nullptr, DXGI_FORMAT_UNKNOWN, 0); } static void api_free_resource(GDrawHandle *r) @@ -251,11 +251,11 @@ static void RADLINK gdraw_UnlockHandles(GDrawStats * /*stats*/) static void *start_write_dyn(DynBuffer *buf, U32 size) { - U8 *ptr = NULL; + U8 *ptr = nullptr; if (size > buf->size) { - IggyGDrawSendWarning(NULL, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size); - return NULL; + IggyGDrawSendWarning(nullptr, "GDraw dynamic vertex buffer usage of %d bytes in one call larger than buffer size %d", size, buf->size); + return nullptr; } // update statistics @@ -373,19 +373,19 @@ extern GDrawTexture *gdraw_D3D1X_(WrappedTextureCreate)(ID3D1X(ShaderResourceVie { GDrawStats stats={0}; GDrawHandle *p = gdraw_res_alloc_begin(gdraw->texturecache, 0, &stats); // it may need to free one item to give us a handle - p->handle.tex.d3d = NULL; + p->handle.tex.d3d = nullptr; p->handle.tex.d3d_view = tex_view; - p->handle.tex.d3d_rtview = NULL; + p->handle.tex.d3d_rtview = nullptr; p->handle.tex.w = 1; p->handle.tex.h = 1; - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); return (GDrawTexture *) p; } extern void gdraw_D3D1X_(WrappedTextureChange)(GDrawTexture *tex, ID3D1X(ShaderResourceView) *tex_view) { GDrawHandle *p = (GDrawHandle *) tex; - p->handle.tex.d3d = NULL; + p->handle.tex.d3d = nullptr; p->handle.tex.d3d_view = tex_view; } @@ -407,12 +407,12 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *stats) { - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; DXGI_FORMAT dxgi_fmt; S32 bpp, size = 0, nmips = 0; if (width >= 16384 || height >= 16384) { - IggyGDrawSendWarning(NULL, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height); + IggyGDrawSendWarning(nullptr, "GDraw texture size too large (%d x %d), dimension limit is 16384", width, height); return false; } @@ -433,7 +433,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, // try to allocate memory for the client to write to p->texture_data = (U8 *) IggyGDrawMalloc(size); if (!p->texture_data) { - IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); return false; } @@ -446,9 +446,9 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, t->handle.tex.w = width; t->handle.tex.h = height; - t->handle.tex.d3d = NULL; - t->handle.tex.d3d_view = NULL; - t->handle.tex.d3d_rtview = NULL; + t->handle.tex.d3d = nullptr; + t->handle.tex.d3d_view = nullptr; + t->handle.tex.d3d_rtview = nullptr; p->texture_type = GDRAW_TEXTURE_TYPE_rgba; p->p0 = t; @@ -512,7 +512,7 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI // and create a corresponding shader resource view failed_call = "CreateShaderResourceView"; - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); + hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view); done: if (!FAILED(hr)) { @@ -525,7 +525,7 @@ done: safe_release(t->handle.tex.d3d_view); gdraw_HandleCacheAllocateFail(t); - t = NULL; + t = nullptr; report_d3d_error(hr, failed_call, " while creating texture"); } @@ -554,8 +554,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *t, void * /*unique_id*/ static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *stats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != NULL); // @GDRAW_ASSERT - if (t->owner == unique_id || unique_id == NULL) { + assert(t != nullptr); // @GDRAW_ASSERT + if (t->owner == unique_id || unique_id == nullptr) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -595,7 +595,7 @@ static void RADLINK gdraw_SetAntialiasTexture(S32 width, U8 *rgba) return; } - hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, NULL, &gdraw->aa_tex_view); + hr = gdraw->d3d_device->CreateShaderResourceView(gdraw->aa_tex, nullptr, &gdraw->aa_tex_view); if (FAILED(hr)) { report_d3d_error(hr, "CreateShaderResourceView", " while creating texture"); safe_release(gdraw->aa_tex); @@ -616,8 +616,8 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat if (p->vertex_data && p->index_data) { GDrawHandle *vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, stats); if (vb) { - vb->handle.vbuf.verts = NULL; - vb->handle.vbuf.inds = NULL; + vb->handle.vbuf.verts = nullptr; + vb->handle.vbuf.inds = nullptr; p->vertex_data_length = vbuf_size; p->index_data_length = ibuf_size; @@ -661,7 +661,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf safe_release(vb->handle.vbuf.inds); gdraw_HandleCacheAllocateFail(vb); - vb = NULL; + vb = nullptr; report_d3d_error(hr, "CreateBuffer", " creating vertex buffer"); } else { @@ -682,7 +682,7 @@ static rrbool RADLINK gdraw_TryLockVertexBuffer(GDrawVertexBuffer *vb, void *uni static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != NULL); // @GDRAW_ASSERT + assert(h != nullptr); // @GDRAW_ASSERT if (h->owner == unique_id) gdraw_res_free(h, stats); } @@ -712,31 +712,31 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) // ran out of RTs, allocate a new one S32 size = gdraw->frametex_width * gdraw->frametex_height * 4; if (gdraw->rendertargets.bytes_free < size) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes); - return NULL; + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit size limit of %d bytes", gdraw->rendertargets.total_bytes); + return nullptr; } t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget allocation failed: hit handle limit"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget allocation failed: hit handle limit"); return t; } D3D1X_(TEXTURE2D_DESC) desc = { static_cast(gdraw->frametex_width), static_cast(gdraw->frametex_height), 1U, 1U, DXGI_FORMAT_R8G8B8A8_UNORM, { 1, 0 }, D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_SHADER_RESOURCE) | D3D1X_(BIND_RENDER_TARGET), 0U, 0U }; - t->handle.tex.d3d = NULL; - t->handle.tex.d3d_view = NULL; - t->handle.tex.d3d_rtview = NULL; + t->handle.tex.d3d = nullptr; + t->handle.tex.d3d_view = nullptr; + t->handle.tex.d3d_rtview = nullptr; - HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &t->handle.tex.d3d); + HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &t->handle.tex.d3d); failed_call = "CreateTexture2D"; if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_view); + hr = gdraw->d3d_device->CreateShaderResourceView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_view); failed_call = "CreateTexture2D"; } if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, NULL, &t->handle.tex.d3d_rtview); + hr = gdraw->d3d_device->CreateRenderTargetView(t->handle.tex.d3d, nullptr, &t->handle.tex.d3d_rtview); failed_call = "CreateRenderTargetView"; } @@ -748,7 +748,7 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *stats) report_d3d_error(hr, failed_call, " creating rendertarget"); - return NULL; + return nullptr; } gdraw_HandleCacheAllocateEnd(t, size, (void *) 1, GDRAW_HANDLE_STATE_locked); @@ -768,10 +768,10 @@ static ID3D1X(DepthStencilView) *get_rendertarget_depthbuffer(GDrawStats *stats) D3D1X_(TEXTURE2D_DESC) desc = { static_cast(gdraw->frametex_width), static_cast(gdraw->frametex_height), 1U, 1U, DXGI_FORMAT_D24_UNORM_S8_UINT, { 1, 0 }, D3D1X_(USAGE_DEFAULT), D3D1X_(BIND_DEPTH_STENCIL), 0U, 0U }; - HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, NULL, &gdraw->rt_depth_buffer); + HRESULT hr = gdraw->d3d_device->CreateTexture2D(&desc, nullptr, &gdraw->rt_depth_buffer); failed_call = "CreateTexture2D"; if (!FAILED(hr)) { - hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, NULL, &gdraw->depth_buffer[1]); + hr = gdraw->d3d_device->CreateDepthStencilView(gdraw->rt_depth_buffer, nullptr, &gdraw->depth_buffer[1]); failed_call = "CreateDepthStencilView while creating rendertarget"; } @@ -1113,7 +1113,7 @@ static void set_render_target(GDrawStats *stats) gdraw->d3d_context->OMSetRenderTargets(1, &target, gdraw->depth_buffer[0]); gdraw->d3d_context->RSSetState(gdraw->raster_state[gdraw->main_msaa]); } else { - ID3D1X(DepthStencilView) *depth = NULL; + ID3D1X(DepthStencilView) *depth = nullptr; if (gdraw->cur->flags & (GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_id | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_stencil)) depth = get_rendertarget_depthbuffer(stats); @@ -1128,15 +1128,15 @@ static void set_render_target(GDrawStats *stats) static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_texture_format /*format*/, U32 flags, void *owner, GDrawStats *stats) { GDrawFramebufferState *n = gdraw->cur+1; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(NULL, "GDraw warning: w=0,h=0 rendertarget"); + IggyGDrawSendWarning(nullptr, "GDraw warning: w=0,h=0 rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { assert(0); - IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeds MAX_RENDER_STACK_DEPTH"); return false; } @@ -1150,10 +1150,10 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex n->flags = flags; n->color_buffer = t; - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT ++gdraw->cur; - gdraw->cur->cached = owner != NULL; + gdraw->cur->cached = owner != nullptr; if (owner) { gdraw->cur->base_x = region->x0; gdraw->cur->base_y = region->y0; @@ -1232,9 +1232,9 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *stats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) { - assert(m->color_buffer != NULL); // @GDRAW_ASSERT + assert(m->color_buffer != nullptr); // @GDRAW_ASSERT } - assert(n->color_buffer != NULL); // @GDRAW_ASSERT + assert(n->color_buffer != nullptr); // @GDRAW_ASSERT // switch back to old render target set_render_target(stats); @@ -1291,8 +1291,8 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap { ID3D1XContext *d3d = gdraw->d3d_context; - if (tex == NULL) { - ID3D1X(ShaderResourceView) *notex = NULL; + if (tex == nullptr) { + ID3D1X(ShaderResourceView) *notex = nullptr; d3d->PSSetShaderResources(texunit, 1, ¬ex); } else { GDrawHandle *h = (GDrawHandle *) tex; @@ -1303,7 +1303,7 @@ static void set_texture(S32 texunit, GDrawTexture *tex, rrbool nearest, S32 wrap static void RADLINK gdraw_Set3DTransform(F32 *mat) { - if (mat == NULL) + if (mat == nullptr) gdraw->use_3d = 0; else { gdraw->use_3d = 1; @@ -1366,9 +1366,9 @@ static int set_renderstate_full(S32 vertex_format, GDrawRenderState *r, GDrawSta // in stencil set mode, prefer not doing any shading at all // but if alpha test is on, we need to make an exception -#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do NULL PS it seems +#ifndef GDRAW_D3D11_LEVEL9 // level9 can't do nullptr PS it seems if (which != GDRAW_TEXTURE_alpha_test) - program = NULL; + program = nullptr; else #endif { @@ -1478,7 +1478,7 @@ static int vertsize[GDRAW_vformat__basic_count] = { // Draw triangles with a given renderstate // -static void tag_resources(void *r1, void *r2=NULL, void *r3=NULL, void *r4=NULL) +static void tag_resources(void *r1, void *r2=nullptr, void *r3=nullptr, void *r4=nullptr) { U64 now = gdraw->frame_counter; if (r1) static_cast(r1)->fence.value = now; @@ -1690,7 +1690,7 @@ static void set_clamp_constant(F32 *constant, GDrawTexture *tex) static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *stats) { - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, stats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, stats)) return; set_texture(0, r->tex[0], false, GDRAW_WRAP_clamp); @@ -1778,7 +1778,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawHandle *blend_tex = NULL; + GDrawHandle *blend_tex = nullptr; // for crazy blend modes, we need to read back from the framebuffer // and do the blending in the pixel shader. we do this with copies @@ -1862,18 +1862,18 @@ static void destroy_shader(ProgramWithCachedVariableLocations *p) { if (p->pshader) { p->pshader->Release(); - p->pshader = NULL; + p->pshader = nullptr; } } static ID3D1X(Buffer) *create_dynamic_buffer(U32 size, U32 bind) { D3D1X_(BUFFER_DESC) desc = { size, D3D1X_(USAGE_DYNAMIC), bind, D3D1X_(CPU_ACCESS_WRITE), 0 }; - ID3D1X(Buffer) *buf = NULL; - HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, NULL, &buf); + ID3D1X(Buffer) *buf = nullptr; + HRESULT hr = gdraw->d3d_device->CreateBuffer(&desc, nullptr, &buf); if (FAILED(hr)) { report_d3d_error(hr, "CreateBuffer", " creating dynamic vertex buffer"); - buf = NULL; + buf = nullptr; } return buf; } @@ -1910,7 +1910,7 @@ static void create_all_shaders_and_state(void) HRESULT hr = d3d->CreateInputLayout(vformats[i].desc, vformats[i].nelem, vsh->bytecode, vsh->size, &gdraw->inlayout[i]); if (FAILED(hr)) { report_d3d_error(hr, "CreateInputLayout", ""); - gdraw->inlayout[i] = NULL; + gdraw->inlayout[i] = nullptr; } } @@ -2029,11 +2029,11 @@ static void create_all_shaders_and_state(void) hr = gdraw->d3d_device->CreateBuffer(&bufdesc, &data, &gdraw->quad_ib); if (FAILED(hr)) { report_d3d_error(hr, "CreateBuffer", " for constants"); - gdraw->quad_ib = NULL; + gdraw->quad_ib = nullptr; } IggyGDrawFree(inds); } else - gdraw->quad_ib = NULL; + gdraw->quad_ib = nullptr; } static void destroy_all_shaders_and_state() @@ -2106,7 +2106,7 @@ static void free_gdraw() if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = NULL; + gdraw = nullptr; } static bool alloc_dynbuffer(U32 size) @@ -2142,7 +2142,7 @@ static bool alloc_dynbuffer(U32 size) gdraw->max_quad_vert_count = RR_MIN(size / sizeof(gswf_vertex_xyst), QUAD_IB_COUNT * 4); gdraw->max_quad_vert_count &= ~3; // must be multiple of four - return gdraw->dyn_vb.buffer != NULL && gdraw->dyn_ib.buffer != NULL; + return gdraw->dyn_vb.buffer != nullptr && gdraw->dyn_ib.buffer != nullptr; } int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes) @@ -2181,7 +2181,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 IggyGDrawFree(gdraw->texturecache); } gdraw->texturecache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_texture)); - return gdraw->texturecache != NULL; + return gdraw->texturecache != nullptr; case GDRAW_D3D1X_(RESOURCE_vertexbuffer): if (gdraw->vbufcache) { @@ -2189,7 +2189,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 IggyGDrawFree(gdraw->vbufcache); } gdraw->vbufcache = make_handle_cache(GDRAW_D3D1X_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != NULL; + return gdraw->vbufcache != nullptr; case GDRAW_D3D1X_(RESOURCE_dynbuffer): unbind_resources(); @@ -2205,7 +2205,7 @@ int gdraw_D3D1X_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S3 static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 w, S32 h) { gdraw = (GDraw *) IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return NULL; + if (!gdraw) return nullptr; memset(gdraw, 0, sizeof(*gdraw)); @@ -2220,7 +2220,7 @@ static GDrawFunctions *create_context(ID3D1XDevice *dev, ID3D1XContext *ctx, S32 if (!gdraw->texturecache || !gdraw->vbufcache || !alloc_dynbuffer(gdraw_limits[GDRAW_D3D1X_(RESOURCE_dynbuffer)].num_bytes)) { free_gdraw(); - return NULL; + return nullptr; } create_all_shaders_and_state(); @@ -2291,7 +2291,7 @@ void gdraw_D3D1X_(DestroyContext)(void) if (gdraw->texturecache) gdraw_res_flush(gdraw->texturecache, &stats); if (gdraw->vbufcache) gdraw_res_flush(gdraw->vbufcache, &stats); - gdraw->d3d_device = NULL; + gdraw->d3d_device = nullptr; } free_gdraw(); @@ -2354,7 +2354,7 @@ void RADLINK gdraw_D3D1X_(GetResourceUsageStats)(gdraw_resourcetype type, S32 *h case GDRAW_D3D1X_(RESOURCE_texture): cache = gdraw->texturecache; break; case GDRAW_D3D1X_(RESOURCE_vertexbuffer): cache = gdraw->vbufcache; break; case GDRAW_D3D1X_(RESOURCE_dynbuffer): *handles_used = 0; *bytes_used = gdraw->last_dyn_maxalloc; return; - default: cache = NULL; break; + default: cache = nullptr; break; } *handles_used = *bytes_used = 0; @@ -2411,7 +2411,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, case IFT_FORMAT_DXT3 : size=16; d3dfmt = DXGI_FORMAT_BC2_UNORM; blk = 4; break; case IFT_FORMAT_DXT5 : size=16; d3dfmt = DXGI_FORMAT_BC3_UNORM; blk = 4; break; default: { - IggyGDrawSendWarning(NULL, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); + IggyGDrawSendWarning(nullptr, "GDraw .iggytex raw texture format %d not supported by hardware", texture->format); goto done; } } @@ -2427,7 +2427,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, free_data = (U8 *) IggyGDrawMalloc(total_size); if (!free_data) { - IggyGDrawSendWarning(NULL, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); + IggyGDrawSendWarning(nullptr, "GDraw out of memory to store texture data to pass to D3D for %d x %d texture", width, height); goto done; } @@ -2460,7 +2460,7 @@ GDrawTexture * RADLINK gdraw_D3D1X_(MakeTextureFromResource)(U8 *resource_file, if (FAILED(hr)) goto done; failed_call = "CreateShaderResourceView for texture creation"; - hr = gdraw->d3d_device->CreateShaderResourceView(tex, NULL, &view); + hr = gdraw->d3d_device->CreateShaderResourceView(tex, nullptr, &view); if (FAILED(hr)) goto done; t = gdraw_D3D1X_(WrappedTextureCreate)(view); diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shaders.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shaders.inl index dc8a0484d..74a292212 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shaders.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shaders.inl @@ -181,7 +181,7 @@ static char *pshader_basic_vars[] = { "color_mul", "color_add", "focal", - NULL + nullptr }; static char pshader_general2_frag0[] = @@ -293,7 +293,7 @@ static char **pshader_general2(void) static char *pshader_general2_vars[] = { "tex0", - NULL + nullptr }; static char pshader_exceptional_blend_frag0[] = @@ -414,7 +414,7 @@ static char pshader_exceptional_blend_frag13[] = #define NUMFRAGMENTS_pshader_exceptional_blend 3 static char *pshader_exceptional_blend_arr[13][NUMFRAGMENTS_pshader_exceptional_blend] = { - { NULL, NULL, NULL, }, + { nullptr, nullptr, nullptr, }, { pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag1, pshader_exceptional_blend_frag2, }, { pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag3, pshader_exceptional_blend_frag2, }, { pshader_exceptional_blend_frag0, pshader_exceptional_blend_frag4, pshader_exceptional_blend_frag2, }, @@ -439,7 +439,7 @@ static char *pshader_exceptional_blend_vars[] = { "tex1", "color_mul", "color_add", - NULL + nullptr }; static char pshader_filter_frag0[] = @@ -593,10 +593,10 @@ static char *pshader_filter_arr[32][NUMFRAGMENTS_pshader_filter] = { { pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag1, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag3, pshader_filter_frag2, }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, }, @@ -609,10 +609,10 @@ static char *pshader_filter_arr[32][NUMFRAGMENTS_pshader_filter] = { { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag1, pshader_filter_frag3, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag1, pshader_filter_frag2, }, { pshader_filter_frag0, pshader_filter_frag7, pshader_filter_frag6, pshader_filter_frag1, pshader_filter_frag4, pshader_filter_frag3, pshader_filter_frag2, }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, }; static char **pshader_filter(int bevel, int ontop, int inner, int gradient, int knockout) @@ -629,7 +629,7 @@ static char *pshader_filter_vars[] = { "clamp0", "clamp1", "color2", - NULL + nullptr }; static char pshader_blur_frag0[] = @@ -701,8 +701,8 @@ static char pshader_blur_frag9[] = #define NUMFRAGMENTS_pshader_blur 3 static char *pshader_blur_arr[10][NUMFRAGMENTS_pshader_blur] = { - { NULL, NULL, NULL, }, - { NULL, NULL, NULL, }, + { nullptr, nullptr, nullptr, }, + { nullptr, nullptr, nullptr, }, { pshader_blur_frag0, pshader_blur_frag1, pshader_blur_frag2, }, { pshader_blur_frag0, pshader_blur_frag3, pshader_blur_frag2, }, { pshader_blur_frag0, pshader_blur_frag4, pshader_blur_frag2, }, @@ -722,7 +722,7 @@ static char *pshader_blur_vars[] = { "tex0", "tap", "clampv", - NULL + nullptr }; static char pshader_color_matrix_frag0[] = @@ -804,7 +804,7 @@ static char **pshader_color_matrix(void) static char *pshader_color_matrix_vars[] = { "tex0", "data", - NULL + nullptr }; static char pshader_manual_clear_frag0[] = @@ -855,7 +855,7 @@ static char **pshader_manual_clear(void) static char *pshader_manual_clear_vars[] = { "color_mul", - NULL + nullptr }; static char vshader_vsgl_frag0[] = @@ -966,7 +966,7 @@ static char *vshader_vsgl_vars[] = { "texgen_s", "texgen_t", "viewproj", - NULL + nullptr }; static char vshader_vsglihud_frag0[] = @@ -1079,6 +1079,6 @@ static char *vshader_vsglihud_vars[] = { "worldview", "material", "textmode", - NULL + nullptr }; diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shared.inl index 9916096ad..f134b7407 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_gl_shared.inl @@ -60,7 +60,7 @@ static RADINLINE void break_on_err(GLint e) static void report_err(GLint e) { break_on_err(e); - IggyGDrawSendWarning(NULL, "OpenGL glGetError error"); + IggyGDrawSendWarning(nullptr, "OpenGL glGetError error"); } static void compilation_err(const char *msg) @@ -256,7 +256,7 @@ static void make_texture(GLuint tex) static void make_rendertarget(GDrawHandle *t, GLuint tex, GLenum int_type, GLenum ext_type, GLenum data_type, S32 w, S32 h, S32 size) { glBindTexture(GL_TEXTURE_2D, tex); - glTexImage2D(GL_TEXTURE_2D, 0, int_type, w, h, 0, ext_type, data_type, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, int_type, w, h, 0, ext_type, data_type, nullptr); make_texture(tex); glBindTexture(GL_TEXTURE_2D, 0); } @@ -309,7 +309,7 @@ extern GDrawTexture *gdraw_GLx_(WrappedTextureCreate)(S32 gl_texture_handle, S32 p->handle.tex.w = width; p->handle.tex.h = height; p->handle.tex.nonpow2 = !(is_pow2(width) && is_pow2(height)); - gdraw_HandleCacheAllocateEnd(p, 0, NULL, GDRAW_HANDLE_STATE_user_owned); + gdraw_HandleCacheAllocateEnd(p, 0, nullptr, GDRAW_HANDLE_STATE_user_owned); return (GDrawTexture *) p; } @@ -350,7 +350,7 @@ static void RADLINK gdraw_SetTextureUniqueID(GDrawTexture *tex, void *old_id, vo static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, gdraw_texture_format format, U32 flags, GDraw_MakeTexture_ProcessingInfo *p, GDrawStats *gstats) { S32 size=0, asize, stride; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; opengl_check(); stride = width; @@ -369,7 +369,7 @@ static rrbool RADLINK gdraw_MakeTextureBegin(void *owner, S32 width, S32 height, p->texture_data = IggyGDrawMalloc(size); if (!p->texture_data) { gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, "GDraw malloc for texture data failed"); + IggyGDrawSendWarning(nullptr, "GDraw malloc for texture data failed"); return false; } @@ -419,9 +419,9 @@ static GDrawTexture * RADLINK gdraw_MakeTextureEnd(GDraw_MakeTexture_ProcessingI if (e != 0) { gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, "GDraw OpenGL error creating texture"); + IggyGDrawSendWarning(nullptr, "GDraw OpenGL error creating texture"); eat_gl_err(); - return NULL; + return nullptr; } else { gdraw_HandleCacheAllocateEnd(t, p->i4, p->p1, (flags & GDRAW_MAKETEXTURE_FLAGS_never_flush) ? GDRAW_HANDLE_STATE_pinned : GDRAW_HANDLE_STATE_locked); stats->nonzero_flags |= GDRAW_STATS_alloc_tex; @@ -467,8 +467,8 @@ static void RADLINK gdraw_UpdateTextureEnd(GDrawTexture *tex, void *unique_id, G static void RADLINK gdraw_FreeTexture(GDrawTexture *tt, void *unique_id, GDrawStats *gstats) { GDrawHandle *t = (GDrawHandle *) tt; - assert(t != NULL); - if (t->owner == unique_id || unique_id == NULL) { + assert(t != nullptr); + if (t->owner == unique_id || unique_id == nullptr) { if (t->cache == &gdraw->rendertargets) { gdraw_HandleCacheUnlock(t); // cache it by simply not freeing it @@ -516,7 +516,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat opengl_check(); vb = gdraw_res_alloc_begin(gdraw->vbufcache, vbuf_size + ibuf_size, gstats); if (!vb) { - IggyGDrawSendWarning(NULL, "GDraw out of vertex buffer memory"); + IggyGDrawSendWarning(nullptr, "GDraw out of vertex buffer memory"); return false; } @@ -526,9 +526,9 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat glGenBuffers(1, &vb->handle.vbuf.base); glGenBuffers(1, &vb->handle.vbuf.indices); glBindBuffer(GL_ARRAY_BUFFER, vb->handle.vbuf.base); - glBufferData(GL_ARRAY_BUFFER, vbuf_size, NULL, GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, vbuf_size, nullptr, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vb->handle.vbuf.indices); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, ibuf_size, NULL, GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, ibuf_size, nullptr, GL_STATIC_DRAW); if (!e) e = glGetError(); if (e != GL_NO_ERROR) { glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -537,7 +537,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat glDeleteBuffers(1, &vb->handle.vbuf.indices); gdraw_HandleCacheAllocateFail(vb); eat_gl_err(); - IggyGDrawSendWarning(NULL, "GDraw OpenGL vertex buffer creation failed"); + IggyGDrawSendWarning(nullptr, "GDraw OpenGL vertex buffer creation failed"); return false; } @@ -556,7 +556,7 @@ static rrbool RADLINK gdraw_MakeVertexBufferBegin(void *unique_id, gdraw_vformat if (!p->vertex_data || !p->index_data) { if (p->vertex_data) IggyGDrawFree(p->vertex_data); if (p->index_data) IggyGDrawFree(p->index_data); - IggyGDrawSendWarning(NULL, "GDraw malloc for vertex buffer temporary memory failed"); + IggyGDrawSendWarning(nullptr, "GDraw malloc for vertex buffer temporary memory failed"); return false; } } else { @@ -602,7 +602,7 @@ static GDrawVertexBuffer * RADLINK gdraw_MakeVertexBufferEnd(GDraw_MakeVertexBuf glDeleteBuffers(1, &vb->handle.vbuf.indices); gdraw_HandleCacheAllocateFail(vb); eat_gl_err(); - return NULL; + return nullptr; } else gdraw_HandleCacheAllocateEnd(vb, p->i0 + p->i1, p->p1, GDRAW_HANDLE_STATE_locked); @@ -619,7 +619,7 @@ static rrbool RADLINK gdraw_TryToLockVertexBuffer(GDrawVertexBuffer *vb, void *u static void RADLINK gdraw_FreeVertexBuffer(GDrawVertexBuffer *vb, void *unique_id, GDrawStats *stats) { GDrawHandle *h = (GDrawHandle *) vb; - assert(h != NULL); + assert(h != nullptr); if (h->owner == unique_id) gdraw_res_free(h, stats); } @@ -678,13 +678,13 @@ static GDrawHandle *get_color_rendertarget(GDrawStats *gstats) // ran out of RTs, allocate a new one size = gdraw->frametex_width * gdraw->frametex_height * 4; if (gdraw->rendertargets.bytes_free < size) { - IggyGDrawSendWarning(NULL, "GDraw exceeded available rendertarget memory"); - return NULL; + IggyGDrawSendWarning(nullptr, "GDraw exceeded available rendertarget memory"); + return nullptr; } t = gdraw_HandleCacheAllocateBegin(&gdraw->rendertargets); if (!t) { - IggyGDrawSendWarning(NULL, "GDraw exceeded available rendertarget handles"); + IggyGDrawSendWarning(nullptr, "GDraw exceeded available rendertarget handles"); return t; } @@ -873,7 +873,7 @@ static void RADLINK gdraw_SetViewSizeAndWorldScale(S32 w, S32 h, F32 scalex, F32 static void RADLINK gdraw_Set3DTransform(F32 *mat) { - if (mat == NULL) + if (mat == nullptr) gdraw->use_3d = 0; else { gdraw->use_3d = 1; @@ -992,30 +992,30 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex GDrawHandle *t; int k; if (gdraw->tw == 0 || gdraw->th == 0) { - IggyGDrawSendWarning(NULL, "GDraw got a request for an empty rendertarget"); + IggyGDrawSendWarning(nullptr, "GDraw got a request for an empty rendertarget"); return false; } if (n >= &gdraw->frame[MAX_RENDER_STACK_DEPTH]) { - IggyGDrawSendWarning(NULL, "GDraw rendertarget nesting exceeded MAX_RENDER_STACK_DEPTH"); + IggyGDrawSendWarning(nullptr, "GDraw rendertarget nesting exceeded MAX_RENDER_STACK_DEPTH"); return false; } if (owner) { t = get_rendertarget_texture(region->x1 - region->x0, region->y1 - region->y0, owner, gstats); if (!t) { - IggyGDrawSendWarning(NULL, "GDraw ran out of rendertargets for cacheAsBItmap"); + IggyGDrawSendWarning(nullptr, "GDraw ran out of rendertargets for cacheAsBItmap"); return false; } } else { t = get_color_rendertarget(gstats); if (!t) { - IggyGDrawSendWarning(NULL, "GDraw ran out of rendertargets"); + IggyGDrawSendWarning(nullptr, "GDraw ran out of rendertargets"); return false; } } n->color_buffer = t; - assert(n->color_buffer != NULL); + assert(n->color_buffer != nullptr); if (n == gdraw->frame+1) n->stencil_depth = get_depthstencil_renderbuffer(gstats); @@ -1023,7 +1023,7 @@ static rrbool RADLINK gdraw_TextureDrawBufferBegin(gswf_recti *region, gdraw_tex n->stencil_depth = (n-1)->stencil_depth; ++gdraw->cur; - gdraw->cur->cached = owner != NULL; + gdraw->cur->cached = owner != nullptr; if (owner) { gdraw->cur->base_x = region->x0; gdraw->cur->base_y = region->y0; @@ -1161,8 +1161,8 @@ static GDrawTexture *RADLINK gdraw_TextureDrawBufferEnd(GDrawStats *gstats) assert(m >= gdraw->frame); // bug in Iggy -- unbalanced if (m != gdraw->frame) - assert(m->color_buffer != NULL); - assert(n->color_buffer != NULL); + assert(m->color_buffer != nullptr); + assert(n->color_buffer != nullptr); // remove color and stencil buffers glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , GL_RENDERBUFFER, 0); @@ -1274,7 +1274,7 @@ static float depth_from_id(S32 id) static void set_texture(U32 texunit, GDrawTexture *tex) { glActiveTexture(GL_TEXTURE0 + texunit); - if (tex == NULL) + if (tex == nullptr) glBindTexture(GL_TEXTURE_2D, 0); else glBindTexture(GL_TEXTURE_2D, ((GDrawHandle *) tex)->handle.tex.gl); @@ -1575,7 +1575,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } - if (!set_render_state(r,p->vertex_format, NULL, p, gstats)) return; + if (!set_render_state(r,p->vertex_format, nullptr, p, gstats)) return; gstats->nonzero_flags |= GDRAW_STATS_batches; gstats->num_batches += 1; gstats->drawn_indices += p->num_indices; @@ -1593,7 +1593,7 @@ static void RADLINK gdraw_DrawIndexedTriangles(GDrawRenderState *r, GDrawPrimiti while (pos < p->num_vertices) { S32 vert_count = RR_MIN(p->num_vertices - pos, QUAD_IB_COUNT * 4); set_vertex_format(p->vertex_format, p->vertices + pos*stride); - glDrawElements(GL_TRIANGLES, (vert_count >> 2) * 6, GL_UNSIGNED_SHORT, NULL); + glDrawElements(GL_TRIANGLES, (vert_count >> 2) * 6, GL_UNSIGNED_SHORT, nullptr); pos += vert_count; } @@ -1719,7 +1719,7 @@ static void gdraw_DriverBlurPass(GDrawRenderState *r, int taps, F32 *data, gswf_ static void gdraw_Colormatrix(GDrawRenderState *r, gswf_recti *s, float *tc, GDrawStats *gstats) { ProgramWithCachedVariableLocations *prg = &gdraw->colormatrix; - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, gstats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, gstats)) return; use_lazy_shader(prg); set_texture(0, r->tex[0]); @@ -1752,7 +1752,7 @@ static void set_clamp_constant(GLint constant, GDrawTexture *tex) static void gdraw_Filter(GDrawRenderState *r, gswf_recti *s, float *tc, int isbevel, GDrawStats *gstats) { ProgramWithCachedVariableLocations *prg = &gdraw->filter_prog[isbevel][r->filter_mode]; - if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, NULL, gstats)) + if (!gdraw_TextureDrawBufferBegin(s, GDRAW_TEXTURE_FORMAT_rgba32, GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_color | GDRAW_TEXTUREDRAWBUFFER_FLAGS_needs_alpha, nullptr, gstats)) return; use_lazy_shader(prg); set_texture(0, r->tex[0]); @@ -1845,7 +1845,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 assert(0); } } else { - GDrawTexture *blend_tex = NULL; + GDrawTexture *blend_tex = nullptr; const int *vvars; // for crazy blend modes, we need to read back from the framebuffer @@ -1864,7 +1864,7 @@ static void RADLINK gdraw_FilterQuad(GDrawRenderState *r, S32 x0, S32 y0, S32 x1 set_texture(1, blend_tex); } - if (!set_render_state(r, GDRAW_vformat_v2tc2, &vvars, NULL, gstats)) + if (!set_render_state(r, GDRAW_vformat_v2tc2, &vvars, nullptr, gstats)) return; do_screen_quad(&s, tc, vvars, gstats, 0); tag_resources(r->tex[0],r->tex[1],0); @@ -1932,7 +1932,7 @@ static void make_fragment_program(ProgramWithCachedVariableLocations *p, int num } shad = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(shad, num_strings, (const GLchar **)strings, NULL); + glShaderSource(shad, num_strings, (const GLchar **)strings, nullptr); glCompileShader(shad); glGetShaderiv(shad, GL_COMPILE_STATUS, &res); if (!res) { @@ -1994,7 +1994,7 @@ static void make_vertex_program(GLuint *vprog, int num_strings, char **strings) if(strings[0]) { shad = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(shad, num_strings, (const GLchar **)strings, NULL); + glShaderSource(shad, num_strings, (const GLchar **)strings, nullptr); glCompileShader(shad); glGetShaderiv(shad, GL_COMPILE_STATUS, &res); if (!res) { @@ -2154,7 +2154,7 @@ static void free_gdraw() if (gdraw->texturecache) IggyGDrawFree(gdraw->texturecache); if (gdraw->vbufcache) IggyGDrawFree(gdraw->vbufcache); IggyGDrawFree(gdraw); - gdraw = NULL; + gdraw = nullptr; } int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 num_bytes) @@ -2193,7 +2193,7 @@ int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 IggyGDrawFree(gdraw->texturecache); } gdraw->texturecache = make_handle_cache(GDRAW_GLx_(RESOURCE_texture)); - return gdraw->texturecache != NULL; + return gdraw->texturecache != nullptr; case GDRAW_GLx_(RESOURCE_vertexbuffer): if (gdraw->vbufcache) { @@ -2201,7 +2201,7 @@ int gdraw_GLx_(SetResourceLimits)(gdraw_resourcetype type, S32 num_handles, S32 IggyGDrawFree(gdraw->vbufcache); } gdraw->vbufcache = make_handle_cache(GDRAW_GLx_(RESOURCE_vertexbuffer)); - return gdraw->vbufcache != NULL; + return gdraw->vbufcache != nullptr; default: return 0; @@ -2220,12 +2220,12 @@ GDrawTexture * RADLINK gdraw_GLx_(MakeTextureFromResource)(U8 *resource_file, S3 while (fmt->iggyfmt != texture->format && fmt->blkbytes) fmt++; if (!fmt->blkbytes) // end of list - i.e. format not supported - return NULL; + return nullptr; // prepare texture glGenTextures(1, &gl_texture_handle); if (gl_texture_handle == 0) - return NULL; + return nullptr; opengl_check(); make_texture(gl_texture_handle); @@ -2283,7 +2283,7 @@ GDrawTexture * RADLINK gdraw_GLx_(MakeTextureFromResource)(U8 *resource_file, S3 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mips-1); tex = gdraw_GLx_(WrappedTextureCreate)(gl_texture_handle, texture->w, texture->h, mips > 1); - if (tex == NULL) + if (tex == nullptr) glDeleteTextures(1, &gl_texture_handle); opengl_check(); return tex; @@ -2301,7 +2301,7 @@ static rrbool hasext(const char *exts, const char *which) size_t len; #ifdef GDRAW_USE_glGetStringi - if (exts == NULL) { + if (exts == nullptr) { GLint i, num_exts; glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts); for (i=0; i < num_exts; ++i) @@ -2316,7 +2316,7 @@ static rrbool hasext(const char *exts, const char *which) for(;;) { where = strstr(where, which); - if (where == NULL) + if (where == nullptr) return false; if ( (where == exts || *(where - 1) == ' ') // starts with terminator @@ -2329,7 +2329,7 @@ static rrbool hasext(const char *exts, const char *which) static GDrawFunctions *create_context(S32 w, S32 h) { gdraw = IggyGDrawMalloc(sizeof(*gdraw)); - if (!gdraw) return NULL; + if (!gdraw) return nullptr; memset(gdraw, 0, sizeof(*gdraw)); @@ -2339,7 +2339,7 @@ static GDrawFunctions *create_context(S32 w, S32 h) if (!gdraw->texturecache || !gdraw->vbufcache || !make_quad_indices()) { free_gdraw(); - return NULL; + return nullptr; } opengl_check(); @@ -2380,7 +2380,7 @@ static GDrawFunctions *create_context(S32 w, S32 h) gdraw_funcs.ClearID = gdraw_ClearID; gdraw_funcs.MakeTextureBegin = gdraw_MakeTextureBegin; - gdraw_funcs.MakeTextureMore = NULL; + gdraw_funcs.MakeTextureMore = nullptr; gdraw_funcs.MakeTextureEnd = gdraw_MakeTextureEnd; gdraw_funcs.UpdateTextureRect = gdraw_UpdateTextureRect; diff --git a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl index 11a197e67..1790de77e 100644 --- a/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl +++ b/Minecraft.Client/Windows64/Iggy/gdraw/gdraw_shared.inl @@ -226,7 +226,7 @@ static void debug_check_raw_values(GDrawHandleCache *c) s = s->next; } s = c->active; - while (s != NULL) { + while (s != nullptr) { assert(s->raw_ptr != t->raw_ptr); s = s->next; } @@ -433,7 +433,7 @@ static rrbool gdraw_HandleCacheLockStats(GDrawHandle *t, void *owner, GDrawStats static rrbool gdraw_HandleCacheLock(GDrawHandle *t, void *owner) { - return gdraw_HandleCacheLockStats(t, owner, NULL); + return gdraw_HandleCacheLockStats(t, owner, nullptr); } static void gdraw_HandleCacheUnlock(GDrawHandle *t) @@ -461,11 +461,11 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->is_thrashing = false; c->did_defragment = false; for (i=0; i < GDRAW_HANDLE_STATE__count; i++) { - c->state[i].owner = NULL; - c->state[i].cache = NULL; // should never follow cache link from sentinels! + c->state[i].owner = nullptr; + c->state[i].cache = nullptr; // should never follow cache link from sentinels! c->state[i].next = c->state[i].prev = &c->state[i]; #ifdef GDRAW_MANAGE_MEM - c->state[i].raw_ptr = NULL; + c->state[i].raw_ptr = nullptr; #endif c->state[i].fence.value = 0; c->state[i].bytes = 0; @@ -478,7 +478,7 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->handle[i].bytes = 0; c->handle[i].state = GDRAW_HANDLE_STATE_free; #ifdef GDRAW_MANAGE_MEM - c->handle[i].raw_ptr = NULL; + c->handle[i].raw_ptr = nullptr; #endif } c->state[GDRAW_HANDLE_STATE_free].next = &c->handle[0]; @@ -486,10 +486,10 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte c->prev_frame_start.value = 0; c->prev_frame_end.value = 0; #ifdef GDRAW_MANAGE_MEM - c->alloc = NULL; + c->alloc = nullptr; #endif #ifdef GDRAW_MANAGE_MEM_TWOPOOL - c->alloc_other = NULL; + c->alloc_other = nullptr; #endif check_lists(c); } @@ -497,14 +497,14 @@ static void gdraw_HandleCacheInit(GDrawHandleCache *c, S32 num_handles, S32 byte static GDrawHandle *gdraw_HandleCacheAllocateBegin(GDrawHandleCache *c) { GDrawHandle *free_list = &c->state[GDRAW_HANDLE_STATE_free]; - GDrawHandle *t = NULL; + GDrawHandle *t = nullptr; if (free_list->next != free_list) { t = free_list->next; gdraw_HandleTransitionTo(t, GDRAW_HANDLE_STATE_alloc); t->bytes = 0; t->owner = 0; #ifdef GDRAW_MANAGE_MEM - t->raw_ptr = NULL; + t->raw_ptr = nullptr; #endif #ifdef GDRAW_CORRUPTION_CHECK t->has_check_value = false; @@ -558,7 +558,7 @@ static GDrawHandle *gdraw_HandleCacheGetLRU(GDrawHandleCache *c) // at the front of the LRU list are the oldest ones, since in-use resources // will get appended on every transition from "locked" to "live". GDrawHandle *sentinel = &c->state[GDRAW_HANDLE_STATE_live]; - return (sentinel->next != sentinel) ? sentinel->next : NULL; + return (sentinel->next != sentinel) ? sentinel->next : nullptr; } static void gdraw_HandleCacheTick(GDrawHandleCache *c, GDrawFence now) @@ -1090,7 +1090,7 @@ static void make_pool_aligned(void **start, S32 *num_bytes, U32 alignment) if (addr_aligned != addr_orig) { S32 diff = (S32) (addr_aligned - addr_orig); if (*num_bytes < diff) { - *start = NULL; + *start = nullptr; *num_bytes = 0; return; } else { @@ -1127,7 +1127,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) UINTa remaining = arena->end - arena->current; UINTa total_size = (ptr - arena->current) + size; if (remaining < total_size) // doesn't fit - return NULL; + return nullptr; arena->current = ptr + size; return ptr; @@ -1152,7 +1152,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // (i.e. block->next->prev == block->prev->next == block) // - All allocated blocks are also kept in a hash table, indexed by their // pointer (to allow free to locate the corresponding block_info quickly). -// There's a single-linked, NULL-terminated list of elements in each hash +// There's a single-linked, nullptr-terminated list of elements in each hash // bucket. // - The physical block list is ordered. It always contains all currently // active blocks and spans the whole managed memory range. There are no @@ -1161,7 +1161,7 @@ static void *gdraw_arena_alloc(GDrawArena *arena, U32 size, U32 align) // they are coalesced immediately. // - The maximum number of blocks that could ever be necessary is allocated // on initialization. All block_infos not currently in use are kept in a -// single-linked, NULL-terminated list of unused blocks. Every block is either +// single-linked, nullptr-terminated list of unused blocks. Every block is either // in the physical block list or the unused list, and the total number of // blocks is constant. // These invariants always hold before and after an allocation/free. @@ -1379,7 +1379,7 @@ static void gfxalloc_check2(gfx_allocator *alloc) static gfx_block_info *gfxalloc_pop_unused(gfx_allocator *alloc) { - GFXALLOC_ASSERT(alloc->unused_list != NULL); + GFXALLOC_ASSERT(alloc->unused_list != nullptr); GFXALLOC_ASSERT(alloc->unused_list->is_unused); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_unused);) @@ -1452,7 +1452,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma U32 i, max_blocks, size; if (!align || (align & (align - 1)) != 0) // align must be >0 and a power of 2 - return NULL; + return nullptr; // for <= max_allocs live allocs, there's <= 2*max_allocs+1 blocks. worst case: // [free][used][free] .... [free][used][free] @@ -1460,7 +1460,7 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma size = sizeof(gfx_allocator) + max_blocks * sizeof(gfx_block_info); a = (gfx_allocator *) IggyGDrawMalloc(size); if (!a) - return NULL; + return nullptr; memset(a, 0, size); @@ -1501,16 +1501,16 @@ static gfx_allocator *gfxalloc_create(void *mem, U32 mem_size, U32 align, U32 ma a->blocks[i].is_unused = 1; gfxalloc_check(a); - debug_complete_check(a, NULL, 0,0); + debug_complete_check(a, nullptr, 0,0); return a; } static void *gfxalloc_alloc(gfx_allocator *alloc, U32 size_in_bytes) { - gfx_block_info *cur, *best = NULL; + gfx_block_info *cur, *best = nullptr; U32 i, best_wasted = ~0u; U32 size = size_in_bytes; -debug_complete_check(alloc, NULL, 0,0); +debug_complete_check(alloc, nullptr, 0,0); gfxalloc_check(alloc); GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_blocks == alloc->num_alloc + alloc->num_free + alloc->num_unused);) GFXALLOC_IF_CHECK(GFXALLOC_ASSERT(alloc->num_free <= alloc->num_blocks+1);) @@ -1560,7 +1560,7 @@ gfxalloc_check(alloc); debug_check_overlap(alloc->cache, best->ptr, best->size); return best->ptr; } else - return NULL; // not enough space! + return nullptr; // not enough space! } static void gfxalloc_free(gfx_allocator *alloc, void *ptr) @@ -1730,7 +1730,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta // (unused for allocated blocks, we'll use it to store a back-pointer to the corresponding handle) for (b = alloc->blocks[0].next_phys; b != alloc->blocks; b=b->next_phys) if (!b->is_free) - b->prev = NULL; + b->prev = nullptr; // go through all handles and store a pointer to the handle in the corresponding memory block for (i=0; i < c->max_handles; i++) @@ -1743,7 +1743,7 @@ static void gdraw_DefragmentMain(GDrawHandleCache *c, U32 flags, GDrawStats *sta break; } - GFXALLOC_ASSERT(b != NULL); // didn't find this block anywhere! + GFXALLOC_ASSERT(b != nullptr); // didn't find this block anywhere! } // clear alloc hash table (we rebuild it during defrag) @@ -1905,7 +1905,7 @@ static rrbool gdraw_CanDefragment(GDrawHandleCache *c) static rrbool gdraw_MigrateResource(GDrawHandle *t, GDrawStats *stats) { GDrawHandleCache *c = t->cache; - void *ptr = NULL; + void *ptr = nullptr; assert(t->state == GDRAW_HANDLE_STATE_live || t->state == GDRAW_HANDLE_STATE_locked || t->state == GDRAW_HANDLE_STATE_pinned); // anything we migrate should be in the "other" (old) pool @@ -2295,7 +2295,7 @@ static void gdraw_bufring_init(gdraw_bufring * RADRESTRICT ring, void *ptr, U32 static void gdraw_bufring_shutdown(gdraw_bufring * RADRESTRICT ring) { - ring->cur = NULL; + ring->cur = nullptr; ring->seg_size = 0; } @@ -2305,7 +2305,7 @@ static void *gdraw_bufring_alloc(gdraw_bufring * RADRESTRICT ring, U32 size, U32 gdraw_bufring_seg *seg; if (size > ring->seg_size) - return NULL; // nope, won't fit + return nullptr; // nope, won't fit assert(align <= ring->align); @@ -2410,7 +2410,7 @@ static rrbool gdraw_res_free_lru(GDrawHandleCache *c, GDrawStats *stats) // was it referenced since end of previous frame (=in this frame)? // if some, we're thrashing; report it to the user, but only once per frame. if (c->prev_frame_end.value < r->fence.value && !c->is_thrashing) { - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Thrashing vertex memory" : "GDraw Thrashing texture memory"); c->is_thrashing = true; } @@ -2430,8 +2430,8 @@ static GDrawHandle *gdraw_res_alloc_outofmem(GDrawHandleCache *c, GDrawHandle *t { if (t) gdraw_HandleCacheAllocateFail(t); - IggyGDrawSendWarning(NULL, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); - return NULL; + IggyGDrawSendWarning(nullptr, c->is_vertex ? "GDraw Out of static vertex buffer %s" : "GDraw Out of texture %s", failed_type); + return nullptr; } #ifndef GDRAW_MANAGE_MEM @@ -2440,7 +2440,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt { GDrawHandle *t; if (size > c->total_bytes) - gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); else { // given how much data we're going to allocate, throw out // data until there's "room" (this basically lets us use @@ -2448,7 +2448,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // packing it and being exact) while (c->bytes_free < size) { if (!gdraw_res_free_lru(c, stats)) { - gdraw_res_alloc_outofmem(c, NULL, "memory"); + gdraw_res_alloc_outofmem(c, nullptr, "memory"); break; } } @@ -2463,8 +2463,8 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt // we'd trade off cost of regenerating) if (gdraw_res_free_lru(c, stats)) { t = gdraw_HandleCacheAllocateBegin(c); - if (t == NULL) { - gdraw_res_alloc_outofmem(c, NULL, "handles"); + if (t == nullptr) { + gdraw_res_alloc_outofmem(c, nullptr, "handles"); } } } @@ -2508,7 +2508,7 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) { GDRAW_FENCE_FLUSH(); // dead list is sorted by fence index - make sure all fence values are current. - r->owner = NULL; + r->owner = nullptr; gdraw_HandleCacheInsertDead(r); gdraw_res_reap(r->cache, stats); } @@ -2516,11 +2516,11 @@ static void gdraw_res_kill(GDrawHandle *r, GDrawStats *stats) static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawStats *stats) { GDrawHandle *t; - void *ptr = NULL; + void *ptr = nullptr; gdraw_res_reap(c, stats); // NB this also does GDRAW_FENCE_FLUSH(); if (size > c->total_bytes) - return gdraw_res_alloc_outofmem(c, NULL, "memory (single resource larger than entire pool)"); + return gdraw_res_alloc_outofmem(c, nullptr, "memory (single resource larger than entire pool)"); // now try to allocate a handle t = gdraw_HandleCacheAllocateBegin(c); @@ -2532,7 +2532,7 @@ static GDrawHandle *gdraw_res_alloc_begin(GDrawHandleCache *c, S32 size, GDrawSt gdraw_res_free_lru(c, stats); t = gdraw_HandleCacheAllocateBegin(c); if (!t) - return gdraw_res_alloc_outofmem(c, NULL, "handles"); + return gdraw_res_alloc_outofmem(c, nullptr, "handles"); } // try to allocate first diff --git a/Minecraft.Client/Windows64/Iggy/include/gdraw.h b/Minecraft.Client/Windows64/Iggy/include/gdraw.h index 404a2642b..7cc4ddd0e 100644 --- a/Minecraft.Client/Windows64/Iggy/include/gdraw.h +++ b/Minecraft.Client/Windows64/Iggy/include/gdraw.h @@ -356,13 +356,13 @@ IDOC typedef struct GDrawPrimitive IDOC typedef void RADLINK gdraw_draw_indexed_triangles(GDrawRenderState *r, GDrawPrimitive *prim, GDrawVertexBuffer *buf, GDrawStats *stats); /* Draws a collection of indexed triangles, ignoring special filters or blend modes. - If buf is NULL, then the pointers in 'prim' are machine pointers, and + If buf is nullptr, then the pointers in 'prim' are machine pointers, and you need to make a copy of the data (note currently all triangles implementing strokes (wide lines) go this path). - If buf is non-NULL, then use the appropriate vertex buffer, and the + If buf is non-nullptr, then use the appropriate vertex buffer, and the pointers in prim are actually offsets from the beginning of the - vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) NULL; + vertex buffer -- i.e. offset = (char*) prim->whatever - (char*) nullptr; (note there are separate spaces for vertices and indices; e.g. the first mesh in a given vertex buffer will normally have a 0 offset for the vertices and a 0 offset for the indices) @@ -455,7 +455,7 @@ IDOC typedef GDrawTexture * RADLINK gdraw_make_texture_end(GDraw_MakeTexture_Pro /* Ends specification of a new texture. $:info The same handle initially passed to $gdraw_make_texture_begin - $:return Handle for the newly created texture, or NULL if an error occured + $:return Handle for the newly created texture, or nullptr if an error occured */ IDOC typedef rrbool RADLINK gdraw_update_texture_begin(GDrawTexture *tex, void *unique_id, GDrawStats *stats); diff --git a/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h b/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h index 1f1a90a1c..a42ccbfff 100644 --- a/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h +++ b/Minecraft.Client/Windows64/Iggy/include/iggyexpruntime.h @@ -25,8 +25,8 @@ IDOC RADEXPFUNC HIGGYEXP RADEXPLINK IggyExpCreate(char *ip_address, S32 port, vo $:storage A small block of storage that needed to store the $HIGGYEXP, must be at least $IGGYEXP_MIN_STORAGE $:storage_size_in_bytes The size of the block pointer to by storage -Returns a NULL HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer -can be contacted at the specified address/port. Otherwise returns a non-NULL $HIGGYEXP +Returns a nullptr HIGGYEXP if the IP address/hostname can't be resolved, or no Iggy Explorer +can be contacted at the specified address/port. Otherwise returns a non-nullptr $HIGGYEXP which you can pass to $IggyUseExplorer. */ IDOC RADEXPFUNC void RADEXPLINK IggyExpDestroy(HIGGYEXP p); diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp index d3e408065..cc4710abe 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp @@ -288,7 +288,7 @@ void KeyboardMouseInput::SetMouseGrabbed(bool grabbed) else if (!grabbed && !m_cursorHiddenForUI && g_hWnd) { while (ShowCursor(TRUE) < 0) {} - ClipCursor(NULL); + ClipCursor(nullptr); } } @@ -317,7 +317,7 @@ void KeyboardMouseInput::SetCursorHiddenForUI(bool hidden) else if (!hidden && !m_mouseGrabbed && g_hWnd) { while (ShowCursor(TRUE) < 0) {} - ClipCursor(NULL); + ClipCursor(nullptr); } } @@ -347,13 +347,13 @@ void KeyboardMouseInput::SetWindowFocused(bool focused) else { while (ShowCursor(TRUE) < 0) {} - ClipCursor(NULL); + ClipCursor(nullptr); } } else { while (ShowCursor(TRUE) < 0) {} - ClipCursor(NULL); + ClipCursor(nullptr); } } diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp index fde78e308..b1f15565b 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp @@ -11,8 +11,8 @@ SOCKET WinsockNetLayer::s_listenSocket = INVALID_SOCKET; SOCKET WinsockNetLayer::s_hostConnectionSocket = INVALID_SOCKET; -HANDLE WinsockNetLayer::s_acceptThread = NULL; -HANDLE WinsockNetLayer::s_clientRecvThread = NULL; +HANDLE WinsockNetLayer::s_acceptThread = nullptr; +HANDLE WinsockNetLayer::s_clientRecvThread = nullptr; bool WinsockNetLayer::s_isHost = false; bool WinsockNetLayer::s_connected = false; @@ -29,14 +29,14 @@ CRITICAL_SECTION WinsockNetLayer::s_connectionsLock; std::vector WinsockNetLayer::s_connections; SOCKET WinsockNetLayer::s_advertiseSock = INVALID_SOCKET; -HANDLE WinsockNetLayer::s_advertiseThread = NULL; +HANDLE WinsockNetLayer::s_advertiseThread = nullptr; volatile bool WinsockNetLayer::s_advertising = false; Win64LANBroadcast WinsockNetLayer::s_advertiseData = {}; CRITICAL_SECTION WinsockNetLayer::s_advertiseLock; int WinsockNetLayer::s_hostGamePort = WIN64_NET_DEFAULT_PORT; SOCKET WinsockNetLayer::s_discoverySock = INVALID_SOCKET; -HANDLE WinsockNetLayer::s_discoveryThread = NULL; +HANDLE WinsockNetLayer::s_discoveryThread = nullptr; volatile bool WinsockNetLayer::s_discovering = false; CRITICAL_SECTION WinsockNetLayer::s_discoveryLock; std::vector WinsockNetLayer::s_discoveredSessions; @@ -113,18 +113,18 @@ void WinsockNetLayer::Shutdown() s_connections.clear(); LeaveCriticalSection(&s_connectionsLock); - if (s_acceptThread != NULL) + if (s_acceptThread != nullptr) { WaitForSingleObject(s_acceptThread, 2000); CloseHandle(s_acceptThread); - s_acceptThread = NULL; + s_acceptThread = nullptr; } - if (s_clientRecvThread != NULL) + if (s_clientRecvThread != nullptr) { WaitForSingleObject(s_clientRecvThread, 2000); CloseHandle(s_clientRecvThread); - s_clientRecvThread = NULL; + s_clientRecvThread = nullptr; } if (s_initialized) @@ -157,22 +157,22 @@ bool WinsockNetLayer::HostGame(int port, const char* bindIp) LeaveCriticalSection(&s_freeSmallIdLock); struct addrinfo hints = {}; - struct addrinfo* result = NULL; + struct addrinfo* result = nullptr; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; - hints.ai_flags = (bindIp == NULL || bindIp[0] == 0) ? AI_PASSIVE : 0; + hints.ai_flags = (bindIp == nullptr || bindIp[0] == 0) ? AI_PASSIVE : 0; char portStr[16]; sprintf_s(portStr, "%d", port); - const char* resolvedBindIp = (bindIp != NULL && bindIp[0] != 0) ? bindIp : NULL; + const char* resolvedBindIp = (bindIp != nullptr && bindIp[0] != 0) ? bindIp : nullptr; int iResult = getaddrinfo(resolvedBindIp, portStr, &hints, &result); if (iResult != 0) { app.DebugPrintf("getaddrinfo failed for %s:%d - %d\n", - resolvedBindIp != NULL ? resolvedBindIp : "*", + resolvedBindIp != nullptr ? resolvedBindIp : "*", port, iResult); return false; @@ -211,10 +211,10 @@ bool WinsockNetLayer::HostGame(int port, const char* bindIp) s_active = true; s_connected = true; - s_acceptThread = CreateThread(NULL, 0, AcceptThreadProc, NULL, 0, NULL); + s_acceptThread = CreateThread(nullptr, 0, AcceptThreadProc, nullptr, 0, nullptr); app.DebugPrintf("Win64 LAN: Hosting on %s:%d\n", - resolvedBindIp != NULL ? resolvedBindIp : "*", + resolvedBindIp != nullptr ? resolvedBindIp : "*", port); return true; } @@ -235,7 +235,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port) } struct addrinfo hints = {}; - struct addrinfo* result = NULL; + struct addrinfo* result = nullptr; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; @@ -306,7 +306,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port) s_active = true; s_connected = true; - s_clientRecvThread = CreateThread(NULL, 0, ClientRecvThreadProc, NULL, 0, NULL); + s_clientRecvThread = CreateThread(nullptr, 0, ClientRecvThreadProc, nullptr, 0, nullptr); return true; } @@ -401,18 +401,18 @@ void WinsockNetLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, unsig INetworkPlayer* pPlayerFrom = g_NetworkManager.GetPlayerBySmallId(fromSmallId); INetworkPlayer* pPlayerTo = g_NetworkManager.GetPlayerBySmallId(toSmallId); - if (pPlayerFrom == NULL || pPlayerTo == NULL) return; + if (pPlayerFrom == nullptr || pPlayerTo == nullptr) return; if (s_isHost) { ::Socket* pSocket = pPlayerFrom->GetSocket(); - if (pSocket != NULL) + if (pSocket != nullptr) pSocket->pushDataToQueue(data, dataSize, false); } else { ::Socket* pSocket = pPlayerTo->GetSocket(); - if (pSocket != NULL) + if (pSocket != nullptr) pSocket->pushDataToQueue(data, dataSize, true); } } @@ -421,7 +421,7 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) { while (s_active) { - SOCKET clientSocket = accept(s_listenSocket, NULL, NULL); + SOCKET clientSocket = accept(s_listenSocket, nullptr, nullptr); if (clientSocket == INVALID_SOCKET) { if (s_active) @@ -473,7 +473,7 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) conn.tcpSocket = clientSocket; conn.smallId = assignedSmallId; conn.active = true; - conn.recvThread = NULL; + conn.recvThread = nullptr; EnterCriticalSection(&s_connectionsLock); s_connections.push_back(conn); @@ -492,7 +492,7 @@ DWORD WINAPI WinsockNetLayer::AcceptThreadProc(LPVOID param) DWORD* threadParam = new DWORD; *threadParam = connIdx; - HANDLE hThread = CreateThread(NULL, 0, RecvThreadProc, threadParam, 0, NULL); + HANDLE hThread = CreateThread(nullptr, 0, RecvThreadProc, threadParam, 0, nullptr); EnterCriticalSection(&s_connectionsLock); if (connIdx < static_cast(s_connections.size())) @@ -693,7 +693,7 @@ bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t* hostName, un setsockopt(s_advertiseSock, SOL_SOCKET, SO_BROADCAST, (const char*)&broadcast, sizeof(broadcast)); s_advertising = true; - s_advertiseThread = CreateThread(NULL, 0, AdvertiseThreadProc, NULL, 0, NULL); + s_advertiseThread = CreateThread(nullptr, 0, AdvertiseThreadProc, nullptr, 0, nullptr); app.DebugPrintf("Win64 LAN: Started advertising on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT); return true; @@ -709,11 +709,11 @@ void WinsockNetLayer::StopAdvertising() s_advertiseSock = INVALID_SOCKET; } - if (s_advertiseThread != NULL) + if (s_advertiseThread != nullptr) { WaitForSingleObject(s_advertiseThread, 2000); CloseHandle(s_advertiseThread); - s_advertiseThread = NULL; + s_advertiseThread = nullptr; } } @@ -792,7 +792,7 @@ bool WinsockNetLayer::StartDiscovery() setsockopt(s_discoverySock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout)); s_discovering = true; - s_discoveryThread = CreateThread(NULL, 0, DiscoveryThreadProc, NULL, 0, NULL); + s_discoveryThread = CreateThread(nullptr, 0, DiscoveryThreadProc, nullptr, 0, nullptr); app.DebugPrintf("Win64 LAN: Listening for LAN games on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT); return true; @@ -808,11 +808,11 @@ void WinsockNetLayer::StopDiscovery() s_discoverySock = INVALID_SOCKET; } - if (s_discoveryThread != NULL) + if (s_discoveryThread != nullptr) { WaitForSingleObject(s_discoveryThread, 2000); CloseHandle(s_discoveryThread); - s_discoveryThread = NULL; + s_discoveryThread = nullptr; } EnterCriticalSection(&s_discoveryLock); diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h index fd1280f7d..226eab2da 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.h +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.h @@ -65,7 +65,7 @@ public: static bool Initialize(); static void Shutdown(); - static bool HostGame(int port, const char* bindIp = NULL); + static bool HostGame(int port, const char* bindIp = nullptr); static bool JoinGame(const char* ip, int port); static bool SendToSmallId(BYTE targetSmallId, const void* data, int dataSize); diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp index 70e61f035..7c4a17313 100644 --- a/Minecraft.Client/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Windows64/Windows64_App.cpp @@ -52,8 +52,8 @@ void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) } else { - // No capture happened (e.g. first save on world creation) leave thumbnail as NULL - if (pbData) *pbData = NULL; + // No capture happened (e.g. first save on world creation) leave thumbnail as nullptr + if (pbData) *pbData = nullptr; if (pdwSize) *pdwSize = 0; } } @@ -69,7 +69,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() { ////////////////////////////////////////////////////////////////////////////////////////////// From CScene_Main::OnInit - app.setLevelGenerationOptions(NULL); + app.setLevelGenerationOptions(nullptr); // From CScene_Main::RunPlayGame Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -99,7 +99,7 @@ void CConsoleMinecraftApp::TemporaryCreateGameStart() NetworkGameInitData *param = new NetworkGameInitData(); param->seed = seedValue; - param->saveData = NULL; + param->saveData = nullptr; app.SetGameHostOption(eGameHostOption_Difficulty,0); app.SetGameHostOption(eGameHostOption_FriendsOfFriends,0); diff --git a/Minecraft.Client/Windows64/Windows64_App.h b/Minecraft.Client/Windows64/Windows64_App.h index af3192e2f..639cec739 100644 --- a/Minecraft.Client/Windows64/Windows64_App.h +++ b/Minecraft.Client/Windows64/Windows64_App.h @@ -27,7 +27,7 @@ public: // BANNED LEVEL LIST virtual void ReadBannedList(int iPad, eTMSAction action=static_cast(0), bool bCallback=false) {} - C4JStringTable *GetStringTable() { return NULL;} + C4JStringTable *GetStringTable() { return nullptr;} // original code virtual void TemporaryCreateGameStart(); diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 7f372c6b0..343dbd129 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -120,17 +120,17 @@ static void CopyWideArgToAnsi(LPCWSTR source, char* dest, size_t destSize) return; dest[0] = 0; - if (source == NULL) + if (source == nullptr) return; - WideCharToMultiByte(CP_ACP, 0, source, -1, dest, static_cast(destSize), NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, source, -1, dest, static_cast(destSize), nullptr, nullptr); dest[destSize - 1] = 0; } // ---------- Persistent options (options.txt next to exe) ---------- static void GetOptionsFilePath(char *out, size_t outSize) { - GetModuleFileNameA(NULL, out, static_cast(outSize)); + GetModuleFileNameA(nullptr, out, static_cast(outSize)); char *p = strrchr(out, '\\'); if (p) *(p + 1) = '\0'; strncat_s(out, outSize, "options.txt", _TRUNCATE); @@ -206,7 +206,7 @@ static Win64LaunchOptions ParseLaunchOptions() int argc = 0; LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); - if (argv == NULL) + if (argv == nullptr) return options; if (argc > 1 && lstrlenW(argv[1]) == 1) @@ -248,7 +248,7 @@ static Win64LaunchOptions ParseLaunchOptions() } else if (_wcsicmp(argv[i], L"-port") == 0 && (i + 1) < argc) { - wchar_t* endPtr = NULL; + wchar_t* endPtr = nullptr; long port = wcstol(argv[++i], &endPtr, 10); if (endPtr != argv[i] && *endPtr == 0 && port > 0 && port <= 65535) { @@ -286,7 +286,7 @@ static void SetupHeadlessServerConsole() { if (AllocConsole()) { - FILE* stream = NULL; + FILE* stream = nullptr; freopen_s(&stream, "CONIN$", "r", stdin); freopen_s(&stream, "CONOUT$", "w", stdout); freopen_s(&stream, "CONOUT$", "w", stderr); @@ -487,7 +487,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice, return pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, - NULL, + nullptr, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES, pd3dPP, ppDevice ); @@ -505,16 +505,16 @@ void MemSect(int sect) } #endif -HINSTANCE g_hInst = NULL; -HWND g_hWnd = NULL; +HINSTANCE g_hInst = nullptr; +HWND g_hWnd = nullptr; D3D_DRIVER_TYPE g_driverType = D3D_DRIVER_TYPE_NULL; D3D_FEATURE_LEVEL g_featureLevel = D3D_FEATURE_LEVEL_11_0; -ID3D11Device* g_pd3dDevice = NULL; -ID3D11DeviceContext* g_pImmediateContext = NULL; -IDXGISwapChain* g_pSwapChain = NULL; -ID3D11RenderTargetView* g_pRenderTargetView = NULL; -ID3D11DepthStencilView* g_pDepthStencilView = NULL; -ID3D11Texture2D* g_pDepthStencilBuffer = NULL; +ID3D11Device* g_pd3dDevice = nullptr; +ID3D11DeviceContext* g_pImmediateContext = nullptr; +IDXGISwapChain* g_pSwapChain = nullptr; +ID3D11RenderTargetView* g_pRenderTargetView = nullptr; +ID3D11DepthStencilView* g_pDepthStencilView = nullptr; +ID3D11Texture2D* g_pDepthStencilBuffer = nullptr; // // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) @@ -633,7 +633,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_INPUT: { UINT dwSize = 0; - GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)); + GetRawInputData((HRAWINPUT)lParam, RID_INPUT, nullptr, &dwSize, sizeof(RAWINPUTHEADER)); if (dwSize > 0 && dwSize <= 256) { BYTE rawBuffer[256]; @@ -676,7 +676,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance) wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, "Minecraft"); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = "Minecraft"; wcex.lpszClassName = "MinecraftClass"; @@ -709,10 +709,10 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) 0, wr.right - wr.left, // width of the window wr.bottom - wr.top, // height of the window - NULL, - NULL, + nullptr, + nullptr, hInstance, - NULL); + nullptr); if (!g_hWnd) { @@ -827,7 +827,7 @@ HRESULT InitDevice() for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ ) { g_driverType = driverTypes[driverTypeIndex]; - hr = D3D11CreateDeviceAndSwapChain( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels, + hr = D3D11CreateDeviceAndSwapChain( nullptr, g_driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext ); if( HRESULT_SUCCEEDED( hr ) ) break; @@ -836,7 +836,7 @@ HRESULT InitDevice() return hr; // Create a render target view - ID3D11Texture2D* pBackBuffer = NULL; + ID3D11Texture2D* pBackBuffer = nullptr; hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer ); if( FAILED( hr ) ) return hr; @@ -856,7 +856,7 @@ HRESULT InitDevice() descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; descDepth.CPUAccessFlags = 0; descDepth.MiscFlags = 0; - hr = g_pd3dDevice->CreateTexture2D(&descDepth, NULL, &g_pDepthStencilBuffer); + hr = g_pd3dDevice->CreateTexture2D(&descDepth, nullptr, &g_pDepthStencilBuffer); D3D11_DEPTH_STENCIL_VIEW_DESC descDSView; ZeroMemory(&descDSView, sizeof(descDSView)); @@ -866,7 +866,7 @@ HRESULT InitDevice() hr = g_pd3dDevice->CreateDepthStencilView(g_pDepthStencilBuffer, &descDSView, &g_pDepthStencilView); - hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView ); + hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, nullptr, &g_pRenderTargetView ); pBackBuffer->Release(); if( FAILED( hr ) ) return hr; @@ -926,7 +926,7 @@ void ToggleFullscreen() { SetWindowLong(g_hWnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW); SetWindowPlacement(g_hWnd, &g_wpPrev); - SetWindowPos(g_hWnd, NULL, 0, 0, 0, 0, + SetWindowPos(g_hWnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); } g_isFullscreen = !g_isFullscreen; @@ -1001,8 +1001,8 @@ static Minecraft* InitialiseMinecraftRuntime() Minecraft::main(); Minecraft* pMinecraft = Minecraft::GetInstance(); - if (pMinecraft == NULL) - return NULL; + if (pMinecraft == nullptr) + return nullptr; app.InitGameSettings(); app.InitialiseTips(); @@ -1034,7 +1034,7 @@ static int HeadlessServerConsoleThreadProc(void* lpParameter) continue; MinecraftServer* server = MinecraftServer::getInstance(); - if (server != NULL) + if (server != nullptr) { server->handleConsoleInput(command, server); } @@ -1066,7 +1066,7 @@ static int RunHeadlessServer() fflush(stdout); Minecraft* pMinecraft = InitialiseMinecraftRuntime(); - if (pMinecraft == NULL) + if (pMinecraft == nullptr) { fprintf(stderr, "Failed to initialise the Minecraft runtime.\n"); return 1; @@ -1132,13 +1132,13 @@ static int RunHeadlessServer() printf("Type 'help' for server commands.\n"); fflush(stdout); - C4JThread* consoleThread = new C4JThread(&HeadlessServerConsoleThreadProc, NULL, "Server console", 128 * 1024); + C4JThread* consoleThread = new C4JThread(&HeadlessServerConsoleThreadProc, nullptr, "Server console", 128 * 1024); consoleThread->Run(); MSG msg = { 0 }; while (WM_QUIT != msg.message && !app.m_bShutdown && !MinecraftServer::serverHalted()) { - if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); @@ -1176,7 +1176,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // 4J-Win64: set CWD to exe dir so asset paths resolve correctly { char szExeDir[MAX_PATH] = {}; - GetModuleFileNameA(NULL, szExeDir, MAX_PATH); + GetModuleFileNameA(nullptr, szExeDir, MAX_PATH); char *pSlash = strrchr(szExeDir, '\\'); if (pSlash) { *(pSlash + 1) = '\0'; SetCurrentDirectoryA(szExeDir); } } @@ -1188,7 +1188,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // Load username from username.txt char exePath[MAX_PATH] = {}; - GetModuleFileNameA(NULL, exePath, MAX_PATH); + GetModuleFileNameA(nullptr, exePath, MAX_PATH); char *lastSlash = strrchr(exePath, '\\'); if (lastSlash) { @@ -1272,7 +1272,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, MSG msg = {0}; while( WM_QUIT != msg.message ) { - if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) + if( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -1320,7 +1320,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, #endif Minecraft *pMinecraft = InitialiseMinecraftRuntime(); - if (pMinecraft == NULL) + if (pMinecraft == nullptr) { CleanupDevice(); return 1; @@ -1356,7 +1356,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, { g_KBMInput.Tick(); - while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) + while( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); @@ -1451,7 +1451,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, else { MemSect(28); - pMinecraft->soundEngine->tick(NULL, 0.0f); + pMinecraft->soundEngine->tick(nullptr, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); @@ -1545,7 +1545,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, // Update mouse grab: grab when in-game and no menu is open { static bool altToggleSuppressCapture = false; - bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL; + bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == nullptr; // Left Alt key toggles capture on/off for debugging if (g_KBMInput.IsKeyPressed(VK_LMENU) || g_KBMInput.IsKeyPressed(VK_RMENU)) { diff --git a/Minecraft.Client/Windows64/Windows64_UIController.cpp b/Minecraft.Client/Windows64/Windows64_UIController.cpp index b76b724a2..e251793ba 100644 --- a/Minecraft.Client/Windows64/Windows64_UIController.cpp +++ b/Minecraft.Client/Windows64/Windows64_UIController.cpp @@ -82,7 +82,7 @@ void ConsoleUIController::render() example, no resolve targets are required. */ gdraw_D3D11_SetTileOrigin( m_pRenderTargetView, m_pDepthStencilView, - NULL, + nullptr, 0, 0 ); @@ -147,7 +147,7 @@ void ConsoleUIController::setTileOrigin(S32 xPos, S32 yPos) { gdraw_D3D11_SetTileOrigin( m_pRenderTargetView, m_pDepthStencilView, - NULL, + nullptr, xPos, yPos ); } diff --git a/Minecraft.Client/Windows64/XML/ATGXmlParser.h b/Minecraft.Client/Windows64/XML/ATGXmlParser.h index 75142e3e3..12f597372 100644 --- a/Minecraft.Client/Windows64/XML/ATGXmlParser.h +++ b/Minecraft.Client/Windows64/XML/ATGXmlParser.h @@ -138,7 +138,7 @@ private: DWORD m_dwCharsTotal; DWORD m_dwCharsConsumed; - BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL + BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; BYTE* m_pReadPtr; diff --git a/Minecraft.Client/WitchRenderer.cpp b/Minecraft.Client/WitchRenderer.cpp index 5e0f2b103..ec2b8a76f 100644 --- a/Minecraft.Client/WitchRenderer.cpp +++ b/Minecraft.Client/WitchRenderer.cpp @@ -18,7 +18,7 @@ void WitchRenderer::render(shared_ptr entity, double x, double y, double shared_ptr item = mob->getCarriedItem(); - witchModel->holdingItem = item != NULL; + witchModel->holdingItem = item != nullptr; MobRenderer::render(mob, x, y, z, rot, a); } @@ -38,7 +38,7 @@ void WitchRenderer::additionalRendering(shared_ptr entity, float a shared_ptr item = mob->getCarriedItem(); - if (item != NULL) + if (item != nullptr) { glPushMatrix(); diff --git a/Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h b/Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h index 120e9c7b5..6d504b63e 100644 --- a/Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h +++ b/Minecraft.Client/Xbox/4JLibs/inc/4J_Input.h @@ -98,8 +98,8 @@ public: void SetMenuDisplayed(int iPad, bool bVal); - EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,CXuiStringTable *pStringTable=NULL); - EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,CXuiStringTable *pStringTable=NULL); + EKeyboardResult RequestKeyboard(UINT uiTitle, UINT uiText, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam,EKeyboardMode eMode,CXuiStringTable *pStringTable=nullptr); + EKeyboardResult RequestKeyboard(UINT uiTitle, LPCWSTR pwchDefault, UINT uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiResultSize,int( *Func)(LPVOID,const bool),LPVOID lpParam, EKeyboardMode eMode,CXuiStringTable *pStringTable=nullptr); // Online check strings against offensive list - TCR 92 // TCR # 092 CMTV Player Text String Verification diff --git a/Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h b/Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h index 28e717e8d..524d94173 100644 --- a/Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h +++ b/Minecraft.Client/Xbox/4JLibs/inc/4J_Profile.h @@ -96,7 +96,7 @@ public: // ACHIEVEMENTS & AWARDS void RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected=false, - CXuiStringTable*pStringTable=NULL, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=NULL, unsigned int uiThemeSize=0L); + CXuiStringTable*pStringTable=nullptr, int iTitleStr=-1, int iTextStr=-1, int iAcceptStr=-1, char *pszThemeName=nullptr, unsigned int uiThemeSize=0L); int GetAwardId(int iAwardNumber); eAwardType GetAwardType(int iAwardNumber); bool CanBeAwarded(int iQuadrant, int iAwardNumber); diff --git a/Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h b/Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h index 5f113d5d7..613486f0c 100644 --- a/Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h +++ b/Minecraft.Client/Xbox/4JLibs/inc/4J_Render.h @@ -116,7 +116,7 @@ public: void Initialise(IDirect3DDevice9 *pDevice); void InitialiseContext(); void Present(); - void Clear(int flags, D3DRECT *pRect = NULL); + void Clear(int flags, D3DRECT *pRect = nullptr); void SetClearColour(D3DCOLOR colour); bool IsWidescreen(); bool IsHiDef(); diff --git a/Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h b/Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h index 2988dc2c1..2a50e8dbe 100644 --- a/Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h +++ b/Minecraft.Client/Xbox/4JLibs/inc/4J_Storage.h @@ -217,7 +217,7 @@ public: // Messages C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, CXuiStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0); + int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, CXuiStringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0); void CancelMessageBoxRequest(); C4JStorage::EMessageResult GetMessageBoxResult(); @@ -239,7 +239,7 @@ public: unsigned int GetSaveSize(); void GetSaveData(void *pvData,unsigned int *puiBytes); PVOID AllocateSaveData(unsigned int uiBytes); - void SaveSaveData(unsigned int uiBytes,PBYTE pbThumbnail=NULL,DWORD cbThumbnail=0,PBYTE pbTextData=NULL, DWORD dwTextLen=0); + void SaveSaveData(unsigned int uiBytes,PBYTE pbThumbnail=nullptr,DWORD cbThumbnail=0,PBYTE pbTextData=nullptr, DWORD dwTextLen=0); void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(LPVOID lpParam, bool), LPVOID lpParam); void SetSaveDeviceSelected(unsigned int uiPad,bool bSelected); bool GetSaveDeviceSelected(unsigned int iPad); @@ -271,27 +271,27 @@ public: C4JStorage::EDLCStatus GetInstalledDLC(int iPad,int( *Func)(LPVOID, int, int),LPVOID lpParam); XCONTENT_DATA& GetDLC(DWORD dw); - DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=NULL); - DWORD UnmountInstalledDLC(LPCSTR szMountDrive=NULL); + DWORD MountInstalledDLC(int iPad,DWORD dwDLC,int( *Func)(LPVOID, int, DWORD,DWORD),LPVOID lpParam,LPCSTR szMountDrive=nullptr); + DWORD UnmountInstalledDLC(LPCSTR szMountDrive=nullptr); // Global title storage C4JStorage::ETMSStatus ReadTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,C4JStorage::eTMS_FileType eFileType, - WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=NULL,LPVOID lpParam=NULL, int iAction=0); + WCHAR *pwchFilename,BYTE **ppBuffer,DWORD *pdwBufferSize,int( *Func)(LPVOID, WCHAR *,int, bool, int)=nullptr,LPVOID lpParam=nullptr, int iAction=0); bool WriteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename,BYTE *pBuffer,DWORD dwBufferSize); bool DeleteTMSFile(int iQuadrant,eGlobalStorage eStorageFacility,WCHAR *pwchFilename); - void StoreTMSPathName(WCHAR *pwchName=NULL); + void StoreTMSPathName(WCHAR *pwchName=nullptr); // TMS++ - C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_WriteFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); C4JStorage::ETMSStatus TMSPP_GetUserQuotaInfo(int iPad,TMSCLIENT_CALLBACK Func,LPVOID lpParam, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=NULL,LPVOID lpParam=NULL, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=NULL,LPVOID lpParam=NULL, int iUserData=0); - C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=NULL, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_ReadFile(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,LPCSTR szFilename,int( *Func)(LPVOID,int,int,PTMSPP_FILEDATA, LPCSTR)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_ReadFileList(int iPad,C4JStorage::eGlobalStorage eStorageFacility,CHAR *pchFilePath,int( *Func)(LPVOID,int,int,PTMSPP_FILE_LIST)=nullptr,LPVOID lpParam=nullptr, int iUserData=0); + C4JStorage::ETMSStatus TMSPP_DeleteFile(int iPad,LPCSTR szFilePath,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,int( *Func)(LPVOID,int,int),LPVOID lpParam=nullptr, int iUserData=0); bool TMSPP_InFileList(eGlobalStorage eStorageFacility, int iPad,const wstring &Filename); unsigned int CRC(unsigned char *buf, int len); - C4JStorage::ETMSStatus TMSPP_WriteFileWithProgress(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=NULL,LPVOID lpParam=NULL, int iUserData=0, - int( *CompletionFunc)(LPVOID,float fComplete)=NULL,LPVOID lpCompletionParam=NULL); + C4JStorage::ETMSStatus TMSPP_WriteFileWithProgress(int iPad,C4JStorage::eGlobalStorage eStorageFacility,C4JStorage::eTMS_FILETYPEVAL eFileTypeVal,C4JStorage::eTMS_UGCTYPE eUGCType,CHAR *pchFilePath,CHAR *pchBuffer,DWORD dwBufferSize,int( *Func)(LPVOID,int,int)=nullptr,LPVOID lpParam=nullptr, int iUserData=0, + int( *CompletionFunc)(LPVOID,float fComplete)=nullptr,LPVOID lpCompletionParam=nullptr); void TMSPP_CancelWriteFileWithProgress(int iPad); HRESULT TMSPP_SetTitleGroupID(LPCSTR szGroupID); diff --git a/Minecraft.Client/Xbox/Audio/SoundEngine.cpp b/Minecraft.Client/Xbox/Audio/SoundEngine.cpp index 97eb0658e..9ba0e4dd8 100644 --- a/Minecraft.Client/Xbox/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Xbox/Audio/SoundEngine.cpp @@ -12,16 +12,16 @@ #include "..\..\DLCTexturePack.h" -IXAudio2* g_pXAudio2 = NULL; // pointer to XAudio2 instance used by QNet and XACT -IXAudio2MasteringVoice* g_pXAudio2MasteringVoice = NULL; // pointer to XAudio2 mastering voice +IXAudio2* g_pXAudio2 = nullptr; // pointer to XAudio2 instance used by QNet and XACT +IXAudio2MasteringVoice* g_pXAudio2MasteringVoice = nullptr; // pointer to XAudio2 mastering voice -IXACT3Engine *SoundEngine::m_pXACT3Engine = NULL; -IXACT3WaveBank *SoundEngine::m_pWaveBank = NULL; -IXACT3WaveBank *SoundEngine::m_pWaveBank2 = NULL; -IXACT3WaveBank *SoundEngine::m_pStreamedWaveBank = NULL; -IXACT3WaveBank *SoundEngine::m_pStreamedWaveBankAdditional = NULL; -IXACT3SoundBank *SoundEngine::m_pSoundBank = NULL; -IXACT3SoundBank *SoundEngine::m_pSoundBank2 = NULL; +IXACT3Engine *SoundEngine::m_pXACT3Engine = nullptr; +IXACT3WaveBank *SoundEngine::m_pWaveBank = nullptr; +IXACT3WaveBank *SoundEngine::m_pWaveBank2 = nullptr; +IXACT3WaveBank *SoundEngine::m_pStreamedWaveBank = nullptr; +IXACT3WaveBank *SoundEngine::m_pStreamedWaveBankAdditional = nullptr; +IXACT3SoundBank *SoundEngine::m_pSoundBank = nullptr; +IXACT3SoundBank *SoundEngine::m_pSoundBank2 = nullptr; CRITICAL_SECTION SoundEngine::m_CS; X3DAUDIO_HANDLE SoundEngine::m_xact3dInstance; @@ -97,9 +97,9 @@ void SoundEngine::init(Options *pOptions) // 4J-PB - move this to the title update, since we've corrected it to allow sounds to be pitch varied when they weren't before HANDLE file; #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\Minecraft.xgs", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("UPDATE:\\res\\audio\\Minecraft.xgs", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\Minecraft.xgs", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\Minecraft.xgs", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -107,11 +107,11 @@ void SoundEngine::init(Options *pOptions) assert(false); return; } - DWORD dwFileSize = GetFileSize(file,NULL); + DWORD dwFileSize = GetFileSize(file,nullptr); DWORD bytesRead = 0; DWORD memFlags = MAKE_XALLOC_ATTRIBUTES(0,FALSE,TRUE,FALSE,0,XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,XALLOC_MEMPROTECT_READWRITE,FALSE,XALLOC_MEMTYPE_PHYSICAL); void *pvGlobalSettings = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvGlobalSettings,dwFileSize,&bytesRead,NULL); + ReadFile(file,pvGlobalSettings,dwFileSize,&bytesRead,nullptr); CloseHandle(file); XACT_RUNTIME_PARAMETERS EngineParameters = {0}; @@ -161,7 +161,7 @@ void SoundEngine::init(Options *pOptions) // Create resident wave bank - leave memory for this managed by xact so it can free it - file = CreateFile("GAME:\\res\\audio\\resident.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("GAME:\\res\\audio\\resident.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { app.FatalLoadError(); @@ -169,9 +169,9 @@ void SoundEngine::init(Options *pOptions) return; } - dwFileSize = GetFileSize(file,NULL); + dwFileSize = GetFileSize(file,nullptr); void *pvWaveBank = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvWaveBank,dwFileSize,&bytesRead,NULL); + ReadFile(file,pvWaveBank,dwFileSize,&bytesRead,nullptr); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateInMemoryWaveBank( pvWaveBank, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, &m_pWaveBank ) ) ) @@ -183,9 +183,9 @@ void SoundEngine::init(Options *pOptions) // 4J-PB - add new sounds wavebank #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\additional.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("UPDATE:\\res\\audio\\additional.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\additional.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\additional.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -194,9 +194,9 @@ void SoundEngine::init(Options *pOptions) return; } - dwFileSize = GetFileSize(file,NULL); + dwFileSize = GetFileSize(file,nullptr); void *pvWaveBank2 = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvWaveBank2,dwFileSize,&bytesRead,NULL); + ReadFile(file,pvWaveBank2,dwFileSize,&bytesRead,nullptr); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateInMemoryWaveBank( pvWaveBank2, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, &m_pWaveBank2 ) ) ) @@ -208,7 +208,7 @@ void SoundEngine::init(Options *pOptions) // Create streamed sound bank - file = CreateFile("GAME:\\res\\audio\\streamed.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); + file = CreateFile("GAME:\\res\\audio\\streamed.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, nullptr); if( file == INVALID_HANDLE_VALUE ) { @@ -232,11 +232,11 @@ void SoundEngine::init(Options *pOptions) // Create streamed sound bank - //file = CreateFile("GAME:\\res\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); + //file = CreateFile("GAME:\\res\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, nullptr); #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("UPDATE:\\res\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\AdditionalMusic.xwb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -259,11 +259,11 @@ void SoundEngine::init(Options *pOptions) // Create sound bank - leave memory for this managed by xact so it can free it // 4J-PB - updated for the TU - //file = CreateFile("GAME:\\res\\audio\\minecraft.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + //file = CreateFile("GAME:\\res\\audio\\minecraft.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\minecraft.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("UPDATE:\\res\\audio\\minecraft.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\minecraft.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\minecraft.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -271,9 +271,9 @@ void SoundEngine::init(Options *pOptions) assert(false); return; } - dwFileSize = GetFileSize(file,NULL); + dwFileSize = GetFileSize(file,nullptr); void *pvSoundBank = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvSoundBank,dwFileSize,&bytesRead,NULL); + ReadFile(file,pvSoundBank,dwFileSize,&bytesRead,nullptr); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateSoundBank( pvSoundBank, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, &m_pSoundBank ) ) ) @@ -286,9 +286,9 @@ void SoundEngine::init(Options *pOptions) // Create sound bank2 - leave memory for this managed by xact so it can free it #ifdef _TU_BUILD - file = CreateFile("UPDATE:\\res\\audio\\additional.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("UPDATE:\\res\\audio\\additional.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #else - file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\additional.xsb", GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile("GAME:\\res\\TitleUpdate\\audio\\additional.xsb", GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -296,9 +296,9 @@ void SoundEngine::init(Options *pOptions) assert(false); return; } - dwFileSize = GetFileSize(file,NULL); + dwFileSize = GetFileSize(file,nullptr); void *pvSoundBank2 = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvSoundBank2,dwFileSize,&bytesRead,NULL); + ReadFile(file,pvSoundBank2,dwFileSize,&bytesRead,nullptr); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateSoundBank( pvSoundBank2, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, &m_pSoundBank2 ) ) ) @@ -324,7 +324,7 @@ void SoundEngine::CreateStreamingWavebank(const char *pchName, IXACT3WaveBank ** // Create streamed sound bank HRESULT hr; - HANDLE file = CreateFile(pchName, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL); + HANDLE file = CreateFile(pchName, GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, nullptr); if( file == INVALID_HANDLE_VALUE ) { @@ -350,7 +350,7 @@ void SoundEngine::CreateStreamingWavebank(const char *pchName, IXACT3WaveBank ** void SoundEngine::CreateSoundbank(const char *pchName, IXACT3SoundBank **ppSoundBank) { HRESULT hr; - HANDLE file = CreateFile(pchName, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(pchName, GENERIC_READ, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { @@ -358,11 +358,11 @@ void SoundEngine::CreateSoundbank(const char *pchName, IXACT3SoundBank **ppSound assert(false); return; } - DWORD dwFileSize = GetFileSize(file,NULL); + DWORD dwFileSize = GetFileSize(file,nullptr); DWORD bytesRead = 0; DWORD memFlags = MAKE_XALLOC_ATTRIBUTES(0,FALSE,TRUE,FALSE,0,XALLOC_PHYSICAL_ALIGNMENT_DEFAULT,XALLOC_MEMPROTECT_READWRITE,FALSE,XALLOC_MEMTYPE_PHYSICAL); void *pvSoundBank = XMemAlloc(dwFileSize, memFlags); - ReadFile(file,pvSoundBank,dwFileSize,&bytesRead,NULL); + ReadFile(file,pvSoundBank,dwFileSize,&bytesRead,nullptr); CloseHandle(file); if ( FAILED( hr = m_pXACT3Engine->CreateSoundBank( pvSoundBank, dwFileSize, XACT_FLAG_ENGINE_CREATE_MANAGEDATA, memFlags, ppSoundBank ) ) ) @@ -416,7 +416,7 @@ bool SoundEngine::isStreamingWavebankReady(IXACT3WaveBank *pWaveBank) void SoundEngine::XACTNotificationCallback( const XACT_NOTIFICATION* pNotification ) { - if(pNotification->pvContext!= NULL) + if(pNotification->pvContext!= nullptr) { if(pNotification->type==XACTNOTIFICATIONTYPE_WAVEBANKPREPARED) { @@ -462,7 +462,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa bool bSoundbank1=(iSound<=eSoundType_STEP_SAND); - if( (m_pSoundBank == NULL ) || (m_pSoundBank2 == NULL))return; + if( (m_pSoundBank == nullptr ) || (m_pSoundBank2 == nullptr))return; if( currentSounds.size() > MAX_POLYPHONY ) { @@ -570,7 +570,7 @@ void SoundEngine::playUI(int iSound, float, float) { bool bSoundBank1=(iSound<=eSoundType_STEP_SAND); - if( (m_pSoundBank == NULL ) || (m_pSoundBank2 == NULL)) return; + if( (m_pSoundBank == nullptr ) || (m_pSoundBank2 == nullptr)) return; if( currentSounds.size() > MAX_POLYPHONY ) { @@ -637,15 +637,15 @@ void SoundEngine::playUI(int iSound, float, float) void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, float vol, float pitch, bool bMusicDelay) { - IXACT3SoundBank *pSoundBank=NULL; + IXACT3SoundBank *pSoundBank=nullptr; bool bSoundBank2=false; MemSect(34); - if(m_MusicInfo.pCue!=NULL) + if(m_MusicInfo.pCue!=nullptr) { m_MusicInfo.pCue->Stop(0); m_MusicInfo.pCue->Destroy(); - m_MusicInfo.pCue = NULL; + m_MusicInfo.pCue = nullptr; } m_MusicInfo.volume = 1.0f;//m_fMusicVolume; @@ -673,7 +673,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, for(unsigned int i=0;ilocalplayers[i]!=NULL) + if(pMinecraft->localplayers[i]!=nullptr) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { @@ -743,7 +743,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, { // printf("Sound prep failed\n"); m_musicIDX = XACTINDEX_INVALID; // don't do anything in the tick - m_MusicInfo.pCue=NULL; + m_MusicInfo.pCue=nullptr; MemSect(0); return; } @@ -774,7 +774,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, } void SoundEngine::playMusicTick() { - if( (m_pSoundBank == NULL ) || (m_pSoundBank2 == NULL)) return; + if( (m_pSoundBank == nullptr ) || (m_pSoundBank2 == nullptr)) return; if( m_musicIDX == XACTINDEX_INVALID ) { @@ -785,7 +785,7 @@ void SoundEngine::playMusicTick() // check to see if the sound has stopped playing DWORD state; HRESULT hr; - if(m_MusicInfo.pCue!=NULL) + if(m_MusicInfo.pCue!=nullptr) { if( FAILED( hr = m_MusicInfo.pCue->GetState(&state) ) ) { @@ -804,14 +804,14 @@ void SoundEngine::playMusicTick() if(GetIsPlayingStreamingGameMusic()) { - if(m_MusicInfo.pCue!=NULL) + if(m_MusicInfo.pCue!=nullptr) { bool playerInEnd = false; bool playerInNether=false; Minecraft *pMinecraft = Minecraft::GetInstance(); for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { - if(pMinecraft->localplayers[i]!=NULL) + if(pMinecraft->localplayers[i]!=nullptr) { if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END) { @@ -852,7 +852,7 @@ void SoundEngine::playMusicTick() return; } - if(m_MusicInfo.pCue!=NULL) + if(m_MusicInfo.pCue!=nullptr) { update3DPosition(&m_MusicInfo, true); SetIsPlayingStreamingGameMusic(true); @@ -986,7 +986,7 @@ void SoundEngine::update3DPosition(SoundEngine::soundInfo *pInfo, bool bPlaceEmi void SoundEngine::tick(shared_ptr *players, float a) { - if( m_pXACT3Engine == NULL ) return; + if( m_pXACT3Engine == nullptr ) return; // Creater listener array from the local players int listenerCount = 0; @@ -995,7 +995,7 @@ void SoundEngine::tick(shared_ptr *players, float a) { for( int i = 0; i < 4; i++ ) { - if( players[i] != NULL ) + if( players[i] != nullptr ) { float yRot = players[i]->yRotO + (players[i]->yRot - players[i]->yRotO) * a; diff --git a/Minecraft.Client/Xbox/Font/XUI_Font.cpp b/Minecraft.Client/Xbox/Font/XUI_Font.cpp index f4ae9d069..2262f3459 100644 --- a/Minecraft.Client/Xbox/Font/XUI_Font.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_Font.cpp @@ -53,8 +53,8 @@ XUI_Font::~XUI_Font() VOID XUI_Font::GetTextExtent( const WCHAR* strText, FLOAT* pWidth, FLOAT* pHeight, BOOL bFirstLineOnly ) const { - assert( pWidth != NULL ); - assert( pHeight != NULL ); + assert( pWidth != nullptr ); + assert( pHeight != nullptr ); // Set default text extent in output parameters int iWidth = 0; @@ -146,8 +146,8 @@ VOID XUI_Font::Begin() //m_pFontTexture->GetLevelDesc( 0, &TextureDesc ); // Get the description // Set render state - assert(m_fontData->m_pFontTexture != NULL || m_fontData->m_iFontTexture > 0); - if(m_fontData->m_pFontTexture != NULL) + assert(m_fontData->m_pFontTexture != nullptr || m_fontData->m_iFontTexture > 0); + if(m_fontData->m_pFontTexture != nullptr) { pD3dDevice->SetTexture( 0, m_fontData->m_pFontTexture ); } @@ -236,7 +236,7 @@ VOID XUI_Font::DrawShadowText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, DW VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, const WCHAR* strText, DWORD dwFlags, FLOAT fMaxPixelWidth, bool darken /*= false*/ ) { - if( NULL == strText ) return; + if( nullptr == strText ) return; if( L'\0' == strText[0] ) return; // 4J-PB - if we're in 480 widescreen mode, we need to ensure that the font characters are aligned on an even boundary if they are a 2x multiple diff --git a/Minecraft.Client/Xbox/Font/XUI_FontData.cpp b/Minecraft.Client/Xbox/Font/XUI_FontData.cpp index d8d87547c..88d77d090 100644 --- a/Minecraft.Client/Xbox/Font/XUI_FontData.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_FontData.cpp @@ -157,11 +157,11 @@ XUI_FontData::SChar XUI_FontData::getChar(const wchar_t strChar) //-------------------------------------------------------------------------------------- XUI_FontData::XUI_FontData() { - m_pFontTexture = NULL; + m_pFontTexture = nullptr; m_iFontTexture = -1; m_dwNumGlyphs = 0L; - m_Glyphs = NULL; + m_Glyphs = nullptr; m_cMaxGlyph = 0; @@ -201,12 +201,12 @@ HRESULT XUI_FontData::Create( SFontData &sfontdata ) m_fontData = new CFontData( sfontdata, rawPixels.data ); - if (rawPixels.data != NULL) delete [] rawPixels.data; + if (rawPixels.data != nullptr) delete [] rawPixels.data; #if 0 { // 4J-JEV: Load in FontData (ABC) file, and initialize member variables from it. - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); //wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/font/Mojangles_10.abc"); wsprintfW(szResourceLocator,L"section://%X,%s#%s%s%s",c_ModuleHandle,L"media", L"media/font/",strFontFileName.c_str(),L".abc"); @@ -349,7 +349,7 @@ HRESULT XUI_FontData::Create( int iFontTexture, const VOID* pFontData ) //-------------------------------------------------------------------------------------- VOID XUI_FontData::Destroy() { - if(m_pFontTexture!=NULL) + if(m_pFontTexture!=nullptr) { m_pFontTexture->Release(); delete m_pFontTexture; @@ -357,7 +357,7 @@ VOID XUI_FontData::Destroy() m_fontData->release(); - m_pFontTexture = NULL; + m_pFontTexture = nullptr; m_dwNumGlyphs = 0L; m_cMaxGlyph = 0; diff --git a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp index 5fff04db6..f6619fd5f 100644 --- a/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_FontRenderer.cpp @@ -36,7 +36,7 @@ VOID XUI_FontRenderer::Term() HRESULT XUI_FontRenderer::GetCaps( DWORD * pdwCaps ) { - if( pdwCaps != NULL ) + if( pdwCaps != nullptr ) { // setting this means XUI calls the DrawCharsToDevice method *pdwCaps = XUI_FONT_RENDERER_CAP_INTERNAL_GLYPH_CACHE | XUI_FONT_RENDERER_CAP_POINT_SIZE_RESPECTED | XUI_FONT_RENDERER_STYLE_DROPSHADOW; @@ -60,8 +60,8 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri //app.DebugPrintf("point size is: %f, xuiSize is: %d\n", fPointSize, xuiSize); - XUI_Font *font = NULL; - XUI_FontData *fontData = NULL; + XUI_Font *font = nullptr; + XUI_FontData *fontData = nullptr; FLOAT scale = 1; eFontData efontdata; @@ -77,17 +77,17 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri } font = m_loadedFonts[efontdata][scale]; - if (font == NULL) + if (font == nullptr) { fontData = m_loadedFontData[efontdata]; - if (fontData == NULL) + if (fontData == nullptr) { SFontData *sfontdata; switch (efontdata) { case eFontData_Mojangles_7: sfontdata = &SFontData::Mojangles_7; break; case eFontData_Mojangles_11: sfontdata = &SFontData::Mojangles_11; break; - default: sfontdata = NULL; break; + default: sfontdata = nullptr; break; } fontData = new XUI_FontData(); @@ -108,7 +108,7 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri VOID XUI_FontRenderer::ReleaseFont( HFONTOBJ hFont ) { XUI_Font *xuiFont = static_cast(hFont); - if (xuiFont != NULL) + if (xuiFont != nullptr) { xuiFont->DecRefCount(); if (xuiFont->refCount <= 0) @@ -156,7 +156,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr HRESULT XUI_FontRenderer::DrawCharToTexture( HFONTOBJ hFont, WCHAR wch, HXUIDC hDC, IXuiTexture * pTexture, UINT x, UINT y, UINT width, UINT height, UINT insetX, UINT insetY ) { - if( hFont==0 || pTexture==NULL ) return E_INVALIDARG; + if( hFont==0 || pTexture==nullptr ) return E_INVALIDARG; return( S_OK ); } diff --git a/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp b/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp index 76fca0e48..55967327e 100644 --- a/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp +++ b/Minecraft.Client/Xbox/Leaderboards/XboxLeaderboardManager.cpp @@ -10,25 +10,25 @@ LeaderboardManager *LeaderboardManager::m_instance = new XboxLeaderboardManager( const XboxLeaderboardManager::LeaderboardDescriptor XboxLeaderboardManager::LEADERBOARD_DESCRIPTORS[XboxLeaderboardManager::NUM_LEADERBOARDS][4] = { { - XboxLeaderboardManager::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), - XboxLeaderboardManager::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), - XboxLeaderboardManager::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), - XboxLeaderboardManager::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), + XboxLeaderboardManager::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), + XboxLeaderboardManager::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), + XboxLeaderboardManager::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), + XboxLeaderboardManager::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), }, { - XboxLeaderboardManager::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 ), - XboxLeaderboardManager::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 ), - XboxLeaderboardManager::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 ), - XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), }, { - XboxLeaderboardManager::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 ), - XboxLeaderboardManager::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 ), - XboxLeaderboardManager::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 ), - XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), }, { - XboxLeaderboardManager::LeaderboardDescriptor( NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ), - XboxLeaderboardManager::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 ), - XboxLeaderboardManager::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 ), - XboxLeaderboardManager::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 ), + XboxLeaderboardManager::LeaderboardDescriptor( nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr ), + XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), + XboxLeaderboardManager::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 ), }, }; @@ -37,9 +37,9 @@ XboxLeaderboardManager::XboxLeaderboardManager() m_eStatsState = eStatsState_Idle; m_statsRead = false; - m_hSession = NULL; - m_spec = NULL; - m_stats = NULL; + m_hSession = nullptr; + m_spec = nullptr; + m_stats = nullptr; m_isQNetSession = false; m_endingSession = false; @@ -53,11 +53,11 @@ void XboxLeaderboardManager::Tick() { /*if( IsStatsReadComplete() ) - if( m_readCompleteCallback != NULL ) + if( m_readCompleteCallback != nullptr ) m_readCompleteCallback(m_readCompleteUserdata);*/ if ( IsStatsReadComplete() ) - if (m_readListener != NULL) + if (m_readListener != nullptr) { // 4J Stu - If the state is other than ready, then we don't have any stats to sort if(m_eFilterMode == LeaderboardManager::eFM_Friends && m_eStatsState == eStatsState_Ready) SortFriendStats(); @@ -83,12 +83,12 @@ bool XboxLeaderboardManager::OpenSession() if (m_endingSession) return false; //We've already got an open session - if (m_hSession != NULL) return true; + if (m_hSession != nullptr) return true; int lockedProfile = ProfileManager.GetLockedProfile(); if( lockedProfile == -1 ) { - m_hSession = NULL; + m_hSession = nullptr; return false; } @@ -112,26 +112,26 @@ bool XboxLeaderboardManager::OpenSession() XSESSION_INFO sessionInfo; ULONGLONG sessionNonce; - DWORD ret = XSessionCreate(XSESSION_CREATE_USES_STATS | XSESSION_CREATE_HOST, lockedProfile, 8, 8, &sessionNonce, &sessionInfo, NULL, &m_hSession); + DWORD ret = XSessionCreate(XSESSION_CREATE_USES_STATS | XSESSION_CREATE_HOST, lockedProfile, 8, 8, &sessionNonce, &sessionInfo, nullptr, &m_hSession); if( ret != ERROR_SUCCESS ) { - m_hSession = NULL; + m_hSession = nullptr; return false; } DWORD userIndices[1] = { lockedProfile }; BOOL privateSlots[1] = { FALSE }; - ret = XSessionJoinLocal(m_hSession, 1, userIndices, privateSlots, NULL); + ret = XSessionJoinLocal(m_hSession, 1, userIndices, privateSlots, nullptr); if( ret != ERROR_SUCCESS ) { - m_hSession = NULL; + m_hSession = nullptr; return false; } - ret = XSessionStart(m_hSession, 0, NULL); + ret = XSessionStart(m_hSession, 0, nullptr); if( ret != ERROR_SUCCESS ) { - m_hSession = NULL; + m_hSession = nullptr; return false; } @@ -151,7 +151,7 @@ void XboxLeaderboardManager::CloseSession() return; } - if (m_hSession == NULL) return; + if (m_hSession == nullptr) return; memset(&m_endSessionOverlapped, 0, sizeof(m_endSessionOverlapped)); @@ -166,15 +166,15 @@ void XboxLeaderboardManager::CloseSession() if (ret != ERROR_SUCCESS) DeleteSession(); } - m_readListener = NULL; + m_readListener = nullptr; } } void XboxLeaderboardManager::DeleteSession() { - XSessionDelete(m_hSession, NULL); + XSessionDelete(m_hSession, nullptr); CloseHandle(m_hSession); - m_hSession = NULL; + m_hSession = nullptr; } bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) @@ -190,7 +190,7 @@ bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) if(m_isQNetSession == true) { INetworkPlayer *player = g_NetworkManager.GetPlayerByXuid(m_myXUID); - if(player != NULL) + if(player != nullptr) { ret = static_cast(player)->GetQNetPlayer()->WriteStats(viewCount,views); //printf("Wrote stats to QNet player\n"); @@ -204,7 +204,7 @@ bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) } else { - ret = XSessionWriteStats(m_hSession, m_myXUID, viewCount, views, NULL); + ret = XSessionWriteStats(m_hSession, m_myXUID, viewCount, views, nullptr); } if (ret != ERROR_SUCCESS) return false; return true; @@ -213,7 +213,7 @@ bool XboxLeaderboardManager::WriteStats(unsigned int viewCount, ViewIn views) void XboxLeaderboardManager::CancelOperation() { //Need to have a session open - if( m_hSession == NULL ) + if( m_hSession == nullptr ) if( !OpenSession() ) return; @@ -249,7 +249,7 @@ bool XboxLeaderboardManager::ReadStats_MyScore(LeaderboardReadListener *callback //Allocate a buffer for the stats m_stats = (PXUSER_STATS_READ_RESULTS) new BYTE[m_numStats]; - if (m_stats == NULL) return false; + if (m_stats == nullptr) return false; memset(m_stats, 0, m_numStats); memset(&m_overlapped, 0, sizeof(m_overlapped)); @@ -258,7 +258,7 @@ bool XboxLeaderboardManager::ReadStats_MyScore(LeaderboardReadListener *callback hEnumerator, // Enumeration handle m_stats, // Buffer m_numStats, // Size of buffer - NULL, // Number of rows returned; not used for async + nullptr, // Number of rows returned; not used for async &m_overlapped ); // Overlapped structure; not used for sync if ( (ret!=ERROR_SUCCESS) && (ret!=ERROR_IO_PENDING) ) return false; @@ -280,12 +280,12 @@ bool XboxLeaderboardManager::ReadStats_Friends(LeaderboardReadListener *callback getFriends(friendCount, &friends); - if(friendCount == 0 || friends == NULL) + if(friendCount == 0 || friends == nullptr) { app.DebugPrintf("XboxLeaderboardManager::ReadStats_Friends - No friends found. Possibly you are offline?\n"); return false; } - assert(friendCount > 0 && friends != NULL); + assert(friendCount > 0 && friends != nullptr); m_numStats = 0; ret = XUserReadStats( @@ -295,8 +295,8 @@ bool XboxLeaderboardManager::ReadStats_Friends(LeaderboardReadListener *callback 1, //specCount, m_spec, &m_numStats, - NULL, - NULL + nullptr, + nullptr ); //Annoyingly, this returns ERROR_INSUFFICIENT_BUFFER when it is being asked to calculate the size of the buffer by passing zero resultsSize @@ -304,7 +304,7 @@ bool XboxLeaderboardManager::ReadStats_Friends(LeaderboardReadListener *callback //Allocate a buffer for the stats m_stats = (PXUSER_STATS_READ_RESULTS) new BYTE[m_numStats]; - if (m_stats == NULL) return false; + if (m_stats == nullptr) return false; memset(m_stats, 0, m_numStats); memset(&m_overlapped, 0, sizeof(m_overlapped)); @@ -346,7 +346,7 @@ bool XboxLeaderboardManager::ReadStats_TopRank(LeaderboardReadListener *callback //Allocate a buffer for the stats m_stats = (PXUSER_STATS_READ_RESULTS) new BYTE[m_numStats]; - if (m_stats == NULL) return false; + if (m_stats == nullptr) return false; memset(m_stats, 0, m_numStats); memset(&m_overlapped, 0, sizeof(m_overlapped)); @@ -355,7 +355,7 @@ bool XboxLeaderboardManager::ReadStats_TopRank(LeaderboardReadListener *callback hEnumerator, // Enumeration handle m_stats, // Buffer m_numStats, // Size of buffer - NULL, // Number of rows returned; not used for async + nullptr, // Number of rows returned; not used for async &m_overlapped ); // Overlapped structure; not used for sync if( (ret!=ERROR_SUCCESS) && (ret!=ERROR_IO_PENDING) ) return false; @@ -367,7 +367,7 @@ bool XboxLeaderboardManager::ReadStats_TopRank(LeaderboardReadListener *callback bool XboxLeaderboardManager::readStats(int difficulty, EStatsType type) { //Need to have a session open - if (m_hSession==NULL) if(!OpenSession()) return false; + if (m_hSession==nullptr) if(!OpenSession()) return false; m_eStatsState = eStatsState_Failed; m_statsRead = false; @@ -386,7 +386,7 @@ bool XboxLeaderboardManager::readStats(int difficulty, EStatsType type) void XboxLeaderboardManager::FlushStats() { - if( m_hSession == NULL || m_isQNetSession ) return; + if( m_hSession == nullptr || m_isQNetSession ) return; memset(&m_flushStatsOverlapped, 0, sizeof(m_flushStatsOverlapped)); XSessionFlushStats(m_hSession, &m_flushStatsOverlapped); } @@ -403,7 +403,7 @@ bool XboxLeaderboardManager::IsStatsReadComplete() if( m_stats ) { delete [] m_stats; - m_stats = NULL; + m_stats = nullptr; } } else @@ -415,7 +415,7 @@ bool XboxLeaderboardManager::IsStatsReadComplete() if( m_stats ) { delete [] m_stats; - m_stats = NULL; + m_stats = nullptr; } } else @@ -465,10 +465,10 @@ void XboxLeaderboardManager::SortFriendStats() #if 0 void XboxLeaderboardManager::SetStatsRetrieved(bool success) { - if( m_stats != NULL ) + if( m_stats != nullptr ) { delete [] m_stats; - m_stats = NULL; + m_stats = nullptr; } m_statsRead = success; @@ -496,7 +496,7 @@ bool XboxLeaderboardManager::getFriends(unsigned int &friendsCount, PlayerUID** xonlineFriends, resultsSize, &numFriends, - NULL + nullptr ); if (ret!=ERROR_SUCCESS) friendsCount = 0; diff --git a/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp b/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp index ea9ef39ea..9dc2d8c3c 100644 --- a/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp +++ b/Minecraft.Client/Xbox/Network/NetworkPlayerXbox.cpp @@ -4,7 +4,7 @@ NetworkPlayerXbox::NetworkPlayerXbox(IQNetPlayer *qnetPlayer) { m_qnetPlayer = qnetPlayer; - m_pSocket = NULL; + m_pSocket = nullptr; } unsigned char NetworkPlayerXbox::GetSmallId() @@ -34,14 +34,14 @@ int NetworkPlayerXbox::GetSendQueueSizeBytes( INetworkPlayer *player, bool lowPr { DWORD flags = QNET_GETSENDQUEUESIZE_BYTES; if( lowPriority ) flags |= QNET_GETSENDQUEUESIZE_SECONDARY_TYPE; - return m_qnetPlayer->GetSendQueueSize(player ? static_cast(player)->m_qnetPlayer : NULL , flags); + return m_qnetPlayer->GetSendQueueSize(player ? static_cast(player)->m_qnetPlayer : nullptr , flags); } int NetworkPlayerXbox::GetSendQueueSizeMessages( INetworkPlayer *player, bool lowPriority ) { DWORD flags = QNET_GETSENDQUEUESIZE_MESSAGES; if( lowPriority ) flags |= QNET_GETSENDQUEUESIZE_SECONDARY_TYPE; - return m_qnetPlayer->GetSendQueueSize(player ? static_cast(player)->m_qnetPlayer : NULL , flags); + return m_qnetPlayer->GetSendQueueSize(player ? static_cast(player)->m_qnetPlayer : nullptr , flags); } int NetworkPlayerXbox::GetCurrentRtt() diff --git a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.cpp b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.cpp index 882137eb8..f586f4470 100644 --- a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.cpp +++ b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.cpp @@ -187,7 +187,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerJoined( for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != NULL) + if(playerChangedCallback[idx] != nullptr) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, false ); } @@ -196,7 +196,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerJoined( int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; + if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -221,7 +221,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( // Get our wrapper object associated with this player. Socket *socket = networkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { // If we are in game then remove this player from the game as well. // We may get here either from the player requesting to exit the game, @@ -237,14 +237,14 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( // We need this as long as the game server still needs to communicate with the player //delete socket; - networkPlayer->SetSocket( NULL ); + networkPlayer->SetSocket( nullptr ); } if( m_pIQNet->IsHost() && !m_bHostChanged ) { if( isSystemPrimaryPlayer(pQNetPlayer) ) { - IQNetPlayer *pNewQNetPrimaryPlayer = NULL; + IQNetPlayer *pNewQNetPrimaryPlayer = nullptr; for(unsigned int i = 0; i < m_pIQNet->GetPlayerCount(); ++i ) { IQNetPlayer *pQNetPlayer2 = m_pIQNet->GetPlayerByIndex( i ); @@ -261,7 +261,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( m_machineQNetPrimaryPlayers.erase( it ); } - if( pNewQNetPrimaryPlayer != NULL ) + if( pNewQNetPrimaryPlayer != nullptr ) m_machineQNetPrimaryPlayers.push_back( pNewQNetPrimaryPlayer ); } @@ -274,7 +274,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( for( int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if(playerChangedCallback[idx] != NULL) + if(playerChangedCallback[idx] != nullptr) playerChangedCallback[idx]( playerChangedCallbackParam[idx], networkPlayer, true ); } @@ -283,7 +283,7 @@ VOID CPlatformNetworkManagerXbox::NotifyPlayerLeaving( int localPlayerCount = 0; for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) { - if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != NULL ) ++localPlayerCount; + if( m_pIQNet->GetLocalPlayerByUserIndex(idx) != nullptr ) ++localPlayerCount; } float appTime = app.getAppTime(); @@ -349,7 +349,7 @@ VOID CPlatformNetworkManagerXbox::NotifyDataReceived( INetworkPlayer *pPlayerFrom = getNetworkPlayer(pQNetPlayerFrom); Socket *socket = pPlayerFrom->GetSocket(); - if(socket != NULL) + if(socket != nullptr) socket->pushDataToQueue(pbData, dwDataSize, false); } else @@ -358,7 +358,7 @@ VOID CPlatformNetworkManagerXbox::NotifyDataReceived( INetworkPlayer *pPlayerTo = getNetworkPlayer(apQNetPlayersTo[dwPlayer]); Socket *socket = pPlayerTo->GetSocket(); //app.DebugPrintf( "Pushing data into read queue for user \"%ls\"\n", apPlayersTo[dwPlayer]->GetGamertag()); - if(socket != NULL) + if(socket != nullptr) socket->pushDataToQueue(pbData, dwDataSize); } } @@ -432,7 +432,7 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa g_pPlatformNetworkManager = this; for( int i = 0; i < XUSER_MAX_COUNT; i++ ) { - playerChangedCallback[ i ] = NULL; + playerChangedCallback[ i ] = nullptr; } HRESULT hr; @@ -440,7 +440,7 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa DWORD dwResult; // Start up XNet with default settings. - iResult = XNetStartup( NULL ); + iResult = XNetStartup( nullptr ); if( iResult != 0 ) { app.DebugPrintf( "Starting up XNet failed (err = %i)!\n", iResult ); @@ -457,7 +457,7 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa } // Create the QNet object. - hr = QNetCreateUsingXAudio2( QNET_SESSIONTYPE_LIVE_STANDARD, this, NULL, g_pXAudio2, &m_pIQNet ); + hr = QNetCreateUsingXAudio2( QNET_SESSIONTYPE_LIVE_STANDARD, this, nullptr, g_pXAudio2, &m_pIQNet ); if( FAILED( hr ) ) { app.DebugPrintf( "Creating QNet object failed (err = 0x%08x)!\n", hr ); @@ -489,8 +489,8 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; - m_pSearchParam = NULL; - m_SessionsUpdatedCallback = NULL; + m_pSearchParam = nullptr; + m_SessionsUpdatedCallback = nullptr; for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) { @@ -498,10 +498,10 @@ bool CPlatformNetworkManagerXbox::Initialise(CGameNetworkManager *pGameNetworkMa m_lastSearchStartTime[i] = 0; // The results that will be filled in with the current search - m_pSearchResults[i] = NULL; - m_pQoSResult[i] = NULL; - m_pCurrentSearchResults[i] = NULL; - m_pCurrentQoSResult[i] = NULL; + m_pSearchResults[i] = nullptr; + m_pQoSResult[i] = nullptr; + m_pCurrentSearchResults[i] = nullptr; + m_pCurrentQoSResult[i] = nullptr; m_currentSearchResultsCount[i] = 0; } @@ -629,11 +629,11 @@ bool CPlatformNetworkManagerXbox::RemoveLocalPlayerByUserIndex( int userIndex ) IQNetPlayer *pQNetPlayer = m_pIQNet->GetLocalPlayerByUserIndex(userIndex); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - if(pNetworkPlayer != NULL) + if(pNetworkPlayer != nullptr) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { // We can't remove the player from qnet until we have stopped using it to communicate C4JThread* thread = new C4JThread(&CPlatformNetworkManagerXbox::RemovePlayerOnSocketClosedThreadProc, pNetworkPlayer, "RemovePlayerOnSocketClosed"); @@ -701,11 +701,11 @@ bool CPlatformNetworkManagerXbox::LeaveGame(bool bMigrateHost) IQNetPlayer *pQNetPlayer = m_pIQNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); INetworkPlayer *pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - if(pNetworkPlayer != NULL) + if(pNetworkPlayer != nullptr) { Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { //printf("Waiting for socket closed event\n"); DWORD result = socket->m_socketClosedEvent->WaitForSignal(INFINITE); @@ -717,13 +717,13 @@ bool CPlatformNetworkManagerXbox::LeaveGame(bool bMigrateHost) // 4J Stu - Clear our reference to this socket pQNetPlayer = m_pIQNet->GetLocalPlayerByUserIndex(g_NetworkManager.GetPrimaryPad()); pNetworkPlayer = getNetworkPlayer(pQNetPlayer); - if(pNetworkPlayer) pNetworkPlayer->SetSocket( NULL ); + if(pNetworkPlayer) pNetworkPlayer->SetSocket( nullptr ); } delete socket; } else { - //printf("Socket is already NULL\n"); + //printf("Socket is already nullptr\n"); } } @@ -795,7 +795,7 @@ void CPlatformNetworkManagerXbox::_HostGame(int usersMask, unsigned char publicS publicSlots, // dwPublicSlots privateSlots, // dwPrivateSlots 0, // cProperties - NULL, // pProperties + nullptr, // pProperties ARRAYSIZE( aXUserContexts ), // cContexts aXUserContexts ); // pContexts @@ -899,8 +899,8 @@ void CPlatformNetworkManagerXbox::UnRegisterPlayerChangedCallback(int iPad, void { if(playerChangedCallbackParam[iPad] == callbackParam) { - playerChangedCallback[iPad] = NULL; - playerChangedCallbackParam[iPad] = NULL; + playerChangedCallback[iPad] = nullptr; + playerChangedCallbackParam[iPad] = nullptr; } } @@ -927,14 +927,14 @@ bool CPlatformNetworkManagerXbox::_RunNetworkGame() return true; } -void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= NULL*/) +void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving /*= nullptr*/) { DWORD playerCount = m_pIQNet->GetPlayerCount(); if( this->m_bLeavingGame ) return; - if( GetHostPlayer() == NULL ) + if( GetHostPlayer() == nullptr ) return; for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) @@ -954,13 +954,13 @@ void CPlatformNetworkManagerXbox::UpdateAndSetGameSessionData(INetworkPlayer *pN } else { - m_hostGameSessionData.players[i] = NULL; + m_hostGameSessionData.players[i] = nullptr; memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); } } else { - m_hostGameSessionData.players[i] = NULL; + m_hostGameSessionData.players[i] = nullptr; memset(m_hostGameSessionData.szPlayers[i],0,XUSER_NAME_SIZE); } } @@ -982,14 +982,14 @@ int CPlatformNetworkManagerXbox::RemovePlayerOnSocketClosedThreadProc( void* lpP Socket *socket = pNetworkPlayer->GetSocket(); - if( socket != NULL ) + if( socket != nullptr ) { //printf("Waiting for socket closed event\n"); socket->m_socketClosedEvent->WaitForSignal(INFINITE); //printf("Socket closed event has fired\n"); // 4J Stu - Clear our reference to this socket - pNetworkPlayer->SetSocket( NULL ); + pNetworkPlayer->SetSocket( nullptr ); delete socket; } @@ -1066,7 +1066,7 @@ void CPlatformNetworkManagerXbox::SystemFlagReset() void CPlatformNetworkManagerXbox::SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return; - if( pNetworkPlayer == NULL ) return; + if( pNetworkPlayer == nullptr ) return; for( unsigned int i = 0; i < m_playerFlags.size(); i++ ) { @@ -1082,7 +1082,7 @@ void CPlatformNetworkManagerXbox::SystemFlagSet(INetworkPlayer *pNetworkPlayer, bool CPlatformNetworkManagerXbox::SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index) { if( ( index < 0 ) || ( index >= m_flagIndexSize ) ) return false; - if( pNetworkPlayer == NULL ) + if( pNetworkPlayer == nullptr ) { return false; } @@ -1099,8 +1099,8 @@ bool CPlatformNetworkManagerXbox::SystemFlagGet(INetworkPlayer *pNetworkPlayer, wstring CPlatformNetworkManagerXbox::GatherStats() { - return L"Queue messages: " + std::to_wstring(static_cast(GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_MESSAGES ) ) - + L" Queue bytes: " + std::to_wstring( static_cast(GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ) ); + return L"Queue messages: " + std::to_wstring(static_cast(GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_MESSAGES ) ) + + L" Queue bytes: " + std::to_wstring( static_cast(GetHostPlayer())->GetQNetPlayer()->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ) ); } wstring CPlatformNetworkManagerXbox::GatherRTTStats() @@ -1132,23 +1132,23 @@ void CPlatformNetworkManagerXbox::TickSearch() m_currentSearchResultsCount[m_lastSearchPad] = m_searchResultsCount[m_lastSearchPad]; // Store the current search results so that we don't delete them too early - if( m_pCurrentSearchResults[m_lastSearchPad] != NULL ) + if( m_pCurrentSearchResults[m_lastSearchPad] != nullptr ) { delete m_pCurrentSearchResults[m_lastSearchPad]; - m_pCurrentSearchResults[m_lastSearchPad] = NULL; + m_pCurrentSearchResults[m_lastSearchPad] = nullptr; } m_pCurrentSearchResults[m_lastSearchPad] = m_pSearchResults[m_lastSearchPad]; - m_pSearchResults[m_lastSearchPad] = NULL; + m_pSearchResults[m_lastSearchPad] = nullptr; - if( m_pCurrentQoSResult[m_lastSearchPad] != NULL ) + if( m_pCurrentQoSResult[m_lastSearchPad] != nullptr ) { XNetQosRelease(m_pCurrentQoSResult[m_lastSearchPad]); - m_pCurrentQoSResult[m_lastSearchPad] = NULL; + m_pCurrentQoSResult[m_lastSearchPad] = nullptr; } m_pCurrentQoSResult[m_lastSearchPad] = m_pQoSResult[m_lastSearchPad]; - m_pQoSResult[m_lastSearchPad] = NULL; + m_pQoSResult[m_lastSearchPad] = nullptr; - if( m_SessionsUpdatedCallback != NULL ) m_SessionsUpdatedCallback(m_pSearchParam); + if( m_SessionsUpdatedCallback != nullptr ) m_SessionsUpdatedCallback(m_pSearchParam); m_bSearchResultsReady = false; m_bSearchPending = false; } @@ -1156,7 +1156,7 @@ void CPlatformNetworkManagerXbox::TickSearch() else { // Don't start searches unless we have registered a callback - if( m_SessionsUpdatedCallback != NULL && (m_lastSearchStartTime[g_NetworkManager.GetPrimaryPad()] + MINECRAFT_XSESSION_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) + if( m_SessionsUpdatedCallback != nullptr && (m_lastSearchStartTime[g_NetworkManager.GetPrimaryPad()] + MINECRAFT_XSESSION_SEARCH_DELAY_MILLISECONDS) < GetTickCount() ) { SearchForGames(); } @@ -1180,15 +1180,15 @@ void CPlatformNetworkManagerXbox::SearchForGames() } friendsSessions[m_lastSearchPad].clear(); - if( m_pSearchResults[m_lastSearchPad] != NULL ) + if( m_pSearchResults[m_lastSearchPad] != nullptr ) { delete m_pSearchResults[m_lastSearchPad]; - m_pSearchResults[m_lastSearchPad] = NULL; + m_pSearchResults[m_lastSearchPad] = nullptr; } - if( m_pQoSResult[m_lastSearchPad] != NULL ) + if( m_pQoSResult[m_lastSearchPad] != nullptr ) { XNetQosRelease(m_pQoSResult[m_lastSearchPad]); - m_pQoSResult[m_lastSearchPad] = NULL; + m_pQoSResult[m_lastSearchPad] = nullptr; } bool bMultiplayerAllowed = g_NetworkManager.IsSignedInLive( g_NetworkManager.GetPrimaryPad() ) && g_NetworkManager.AllowedToPlayMultiplayer( g_NetworkManager.GetPrimaryPad() ); @@ -1250,7 +1250,7 @@ void CPlatformNetworkManagerXbox::SearchForGames() buffer, bufferSize, &itemsReturned, - NULL + nullptr ); DWORD flagPlayingOnline = XONLINE_FRIENDSTATE_FLAG_ONLINE; // | XONLINE_FRIENDSTATE_FLAG_PLAYING; @@ -1317,8 +1317,8 @@ void CPlatformNetworkManagerXbox::SearchForGames() sessionIDList, g_NetworkManager.GetPrimaryPad(), &cbResults, // Pass in the address of the size variable - NULL, - NULL // This example uses the synchronous model + nullptr, + nullptr // This example uses the synchronous model ); XOVERLAPPED *pOverlapped = new XOVERLAPPED(); @@ -1423,7 +1423,7 @@ int CPlatformNetworkManagerXbox::SearchForGamesThreadProc( void* lpParameter ) } // Create an event object that is autoreset with an initial state of "not signaled". // Pass this event handle to the QoSLookup to receive notification of each QoS lookup. - HANDLE QoSLookupHandle = CreateEvent(NULL, false, false, NULL); + HANDLE QoSLookupHandle = CreateEvent(nullptr, false, false, nullptr); *threadData->ppQos = new XNQOS(); @@ -1433,8 +1433,8 @@ int CPlatformNetworkManagerXbox::SearchForGamesThreadProc( void* lpParameter ) QoSxnkid, // Array of pointers to XNKID structures that contain session IDs for the remote Xbox 360 consoles QoSxnkey, // Array of pointers to XNKEY structures that contain key-exchange keys for the remote Xbox 360 consoles 0, // Number of security gateways to probe - NULL, // Pointer to an array of IN_ADDR structures that contain the IP addresses of the security gateways - NULL, // Pointer to an array of service IDs for the security gateway + nullptr, // Pointer to an array of IN_ADDR structures that contain the IP addresses of the security gateways + nullptr, // Pointer to an array of service IDs for the security gateway 8, // Number of desired probe replies to receive 0, // Maximum upstream bandwidth that the outgoing QoS probe packets can consume 0, // Flags @@ -1489,11 +1489,11 @@ vector *CPlatformNetworkManagerXbox::GetSessionList(int iPa pSearchResult = &m_pCurrentSearchResults[iPad]->pResults[dwResult]; // No room for us, so ignore it - // 4J Stu - pSearchResult should never be NULL, but just in case... - if(pSearchResult == NULL || pSearchResult->dwOpenPublicSlots < localPlayers) continue; + // 4J Stu - pSearchResult should never be nullptr, but just in case... + if(pSearchResult == nullptr || pSearchResult->dwOpenPublicSlots < localPlayers) continue; bool foundSession = false; - FriendSessionInfo *sessionInfo = NULL; + FriendSessionInfo *sessionInfo = nullptr; auto itFriendSession = friendsSessions[iPad].begin(); for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession) { @@ -1595,7 +1595,7 @@ bool CPlatformNetworkManagerXbox::GetGameSessionInfo(int iPad, SessionID session if(memcmp( &pSearchResult->info.sessionID, &sessionId, sizeof(SessionID) ) != 0) continue; bool foundSession = false; - FriendSessionInfo *sessionInfo = NULL; + FriendSessionInfo *sessionInfo = nullptr; auto = itFriendSession, friendsSessions[iPad].begin(); for(itFriendSession = friendsSessions[iPad].begin(); itFriendSession < friendsSessions[iPad].end(); ++itFriendSession) { @@ -1637,7 +1637,7 @@ bool CPlatformNetworkManagerXbox::GetGameSessionInfo(int iPad, SessionID session sessionInfo->data.isJoinable) { foundSessionInfo->data = sessionInfo->data; - if(foundSessionInfo->displayLabel != NULL) delete [] foundSessionInfo->displayLabel; + if(foundSessionInfo->displayLabel != nullptr) delete [] foundSessionInfo->displayLabel; foundSessionInfo->displayLabel = new wchar_t[100]; memcpy(foundSessionInfo->displayLabel, sessionInfo->displayLabel, 100 * sizeof(wchar_t) ); foundSessionInfo->displayLabelLength = sessionInfo->displayLabelLength; @@ -1672,7 +1672,7 @@ void CPlatformNetworkManagerXbox::ForceFriendsSessionRefresh() m_searchResultsCount[i] = 0; m_lastSearchStartTime[i] = 0; delete m_pSearchResults[i]; - m_pSearchResults[i] = NULL; + m_pSearchResults[i] = nullptr; } } @@ -1699,7 +1699,7 @@ void CPlatformNetworkManagerXbox::removeNetworkPlayer(IQNetPlayer *pQNetPlayer) INetworkPlayer *CPlatformNetworkManagerXbox::getNetworkPlayer(IQNetPlayer *pQNetPlayer) { - return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : NULL; + return pQNetPlayer ? (INetworkPlayer *)(pQNetPlayer->GetCustomDataValue()) : nullptr; } diff --git a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h index 7c6112b4e..2784726c7 100644 --- a/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h +++ b/Minecraft.Client/Xbox/Network/PlatformNetworkManagerXbox.h @@ -88,7 +88,7 @@ private: GameSessionData m_hostGameSessionData; CGameNetworkManager *m_pGameNetworkManager; public: - virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL); + virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = nullptr); private: // TODO 4J Stu - Do we need to be able to have more than one of these? diff --git a/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp b/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp index 327e094c9..086b141ef 100644 --- a/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp +++ b/Minecraft.Client/Xbox/Sentient/DynamicConfigurations.cpp @@ -11,7 +11,7 @@ bool MinecraftDynamicConfigurations::s_bUpdatedConfigs[MinecraftDynamicConfigura MinecraftDynamicConfigurations::EDynamic_Configs MinecraftDynamicConfigurations::s_eCurrentConfig = MinecraftDynamicConfigurations::eDynamic_Config_Max; size_t MinecraftDynamicConfigurations::s_currentConfigSize = 0; size_t MinecraftDynamicConfigurations::s_dataWrittenSize = 0; -byte *MinecraftDynamicConfigurations::s_dataWritten = NULL; +byte *MinecraftDynamicConfigurations::s_dataWritten = nullptr; void MinecraftDynamicConfigurations::Tick() { @@ -57,7 +57,7 @@ void MinecraftDynamicConfigurations::UpdateConfiguration(EDynamic_Configs id) { app.DebugPrintf("DynamicConfig: Attempting to update dynamic configuration %d\n", id); - HRESULT hr = Sentient::SenDynamicConfigGetSize( id, &s_currentConfigSize, &MinecraftDynamicConfigurations::GetSizeCompletedCallback, NULL); + HRESULT hr = Sentient::SenDynamicConfigGetSize( id, &s_currentConfigSize, &MinecraftDynamicConfigurations::GetSizeCompletedCallback, nullptr); switch(hr) { @@ -76,7 +76,7 @@ void MinecraftDynamicConfigurations::UpdateConfiguration(EDynamic_Configs id) break; case E_POINTER: app.DebugPrintf("DynamicConfig: Failed to get size for config as pointer is invalid\n"); - //The out_size pointer is NULL. + //The out_size pointer is nullptr. break; } if(FAILED(hr) ) @@ -97,7 +97,7 @@ void MinecraftDynamicConfigurations::GetSizeCompletedCallback(HRESULT taskResult &s_dataWrittenSize, s_dataWritten, &MinecraftDynamicConfigurations::GetDataCompletedCallback, - NULL + nullptr ); switch(hr) @@ -115,8 +115,8 @@ void MinecraftDynamicConfigurations::GetSizeCompletedCallback(HRESULT taskResult //Sentient is not initialized. You must call SentientInitialize before you call this function. break; case E_POINTER: - app.DebugPrintf("DynamicConfig: Failed to get bytes for config as pointer is NULL\n"); - //The out_size pointer is NULL. + app.DebugPrintf("DynamicConfig: Failed to get bytes for config as pointer is nullptr\n"); + //The out_size pointer is nullptr. break; } if(FAILED(hr) ) @@ -160,7 +160,7 @@ void MinecraftDynamicConfigurations::GetDataCompletedCallback(HRESULT taskResu } delete [] s_dataWritten; - s_dataWritten = NULL; + s_dataWritten = nullptr; s_bUpdatedConfigs[s_eCurrentConfig] = true; UpdateNextConfiguration(); diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientAvatar.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientAvatar.h index dfccfd3b7..524c1bdc0 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientAvatar.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientAvatar.h @@ -108,7 +108,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_avatarInfoList is NULL. + /// E_POINTER: out_avatarInfoList is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -149,7 +149,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_avatarInfo is NULL. + /// E_POINTER: out_avatarInfo is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -192,7 +192,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: avatarInfo.resourceID or avatarInfo.[fe]male.metadata is invalid. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -235,7 +235,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: avatarInfo.resourceID or avatarInfo.[fe]male.assets is invalid. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -278,7 +278,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: avatarInfo.resourceID or avatarInfo.[fe]male.icon is invalid. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -316,7 +316,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: avatarInfo.resourceID or avatarInfo.xml is invalid. - /// E_POINTER: out_avatarExtraInfo is NULL. + /// E_POINTER: out_avatarExtraInfo is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -352,14 +352,14 @@ namespace Sentient // First method, filling a fixed-size buffer: // // wchar_t buffer[1234]; - // SenAvatarXMLGetTitle( xml, loc, _countof(buffer), NULL, buffer ); + // SenAvatarXMLGetTitle( xml, loc, _countof(buffer), nullptr, buffer ); // // Second method, filling a dynamically-allocated buffer: // // size_t bufferLength; - // SenAvatarXMLGetTitle( xml, loc, 0, &bufferLength, NULL ); + // SenAvatarXMLGetTitle( xml, loc, 0, &bufferLength, nullptr ); // wchar_t buffer = new wchar_t[bufferLength]; - // SenAvatarXMLGetTitle( xml, loc, bufferLength, NULL, buffer ); + // SenAvatarXMLGetTitle( xml, loc, bufferLength, nullptr, buffer ); // // Note that bufferLength is in wchars, and includes the terminating nul. // The actual length of the _string_ is (*out_bufferLength - 1). diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientBoxArt.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientBoxArt.h index 096622433..95a8c1881 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientBoxArt.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientBoxArt.h @@ -116,7 +116,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_boxArtInfoList is NULL. + /// E_POINTER: out_boxArtInfoList is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -160,7 +160,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: boxArtInfo.resourceID or boxArtInfo.image is invalid. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -198,7 +198,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: boxArtInfo.resourceID or boxArtInfo.xml is invalid. - /// E_POINTER: out_boxArtExtraInfo is NULL. + /// E_POINTER: out_boxArtExtraInfo is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -236,7 +236,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: boxArtInfo.resourceID or boxArtInfo.xml is invalid. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -263,7 +263,7 @@ namespace Sentient /// /// @param[in] culture /// This is the result of a call to SenCultureFind() or SenCultureGet*(). - /// You may also pass NULL to use the culture set with SenCultureSetCurrent(). + /// You may also pass nullptr to use the culture set with SenCultureSetCurrent(). /// /// @param[in] bufferLength /// Note that bufferLength is in wchars, and needs to _include_ space for the terminating nul. @@ -271,16 +271,16 @@ namespace Sentient /// @param[out] out_bufferLength /// Used to return the actual number of wchars written to the buffer, including the terminating nul. /// The actual length of the _string_ is (*out_bufferLength - 1). - /// Pass @a out_bufferLength = NULL if you don't care about the actual size. + /// Pass @a out_bufferLength = nullptr if you don't care about the actual size. /// /// @param[out] out_buffer /// The buffer to fill in with the string. /// It is assumed that this is preallocated to at least @a bufferLength wchars. - /// Pass @a out_buffer = NULL if you are only interested in finding out the necessary buffer size. + /// Pass @a out_buffer = nullptr if you are only interested in finding out the necessary buffer size. /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_UNEXPECTED: passed a NULL culture without a default culture being set first. + /// E_UNEXPECTED: passed a nullptr culture without a default culture being set first. /// E_INVALIDARG: senXML does not contain parsed XML data. /// E_FAIL: Failed to locate text. /// S_OK: Server call spawned successfully. @@ -291,14 +291,14 @@ namespace Sentient /// First method, filling a fixed-size buffer: /// /// wchar_t buffer[1234]; - /// SenBoxArtXMLGetTitle( xml, culture, _countof(buffer), NULL, buffer ); + /// SenBoxArtXMLGetTitle( xml, culture, _countof(buffer), nullptr, buffer ); /// /// Second method, filling a dynamically-allocated buffer: /// /// size_t bufferLength; - /// SenBoxArtXMLGetTitle( xml, culture, 0, &bufferLength, NULL ); + /// SenBoxArtXMLGetTitle( xml, culture, 0, &bufferLength, nullptr ); /// wchar_t buffer = new wchar_t[bufferLength]; - /// SenBoxArtXMLGetTitle( xml, culture, bufferLength, NULL, buffer ); + /// SenBoxArtXMLGetTitle( xml, culture, bufferLength, nullptr, buffer ); /// /// @related SenBoxArtDownloadXML() /// @related SenXMLParse() @@ -319,7 +319,7 @@ namespace Sentient /// /// @param[in] culture /// This is the result of a call to SenCultureFind() or SenCultureGet*(). - /// You may also pass NULL to use the culture set with SenCultureSetCurrent(). + /// You may also pass nullptr to use the culture set with SenCultureSetCurrent(). /// /// @param[in] bufferLength /// Note that bufferLength is in wchars, and needs to _include_ space for the terminating nul. @@ -327,16 +327,16 @@ namespace Sentient /// @param[out] out_bufferLength /// Used to return the actual number of wchars written to the buffer, including the terminating nul. /// The actual length of the _string_ is (*out_bufferLength - 1). - /// Pass @a out_bufferLength = NULL if you don't care about the actual size. + /// Pass @a out_bufferLength = nullptr if you don't care about the actual size. /// /// @param[out] out_buffer /// The buffer to fill in with the string. /// It is assumed that this is preallocated to at least @a bufferLength wchars. - /// Pass @a out_buffer = NULL if you are only interested in finding out the necessary buffer size. + /// Pass @a out_buffer = nullptr if you are only interested in finding out the necessary buffer size. /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_UNEXPECTED: passed a NULL culture without a default culture being set first. + /// E_UNEXPECTED: passed a nullptr culture without a default culture being set first. /// E_INVALIDARG: senXML does not contain parsed XML data. /// E_FAIL: Failed to locate text. /// S_OK: Server call spawned successfully. @@ -347,14 +347,14 @@ namespace Sentient /// First method, filling a fixed-size buffer: /// /// wchar_t buffer[1234]; - /// SenBoxArtXMLGetDescription( xml, culture, _countof(buffer), NULL, buffer ); + /// SenBoxArtXMLGetDescription( xml, culture, _countof(buffer), nullptr, buffer ); /// /// Second method, filling a dynamically-allocated buffer: /// /// size_t bufferLength; - /// SenBoxArtXMLGetDescription( xml, culture, 0, &bufferLength, NULL ); + /// SenBoxArtXMLGetDescription( xml, culture, 0, &bufferLength, nullptr ); /// wchar_t buffer = new wchar_t[bufferLength]; - /// SenBoxArtXMLGetDescription( xml, culture, bufferLength, NULL, buffer ); + /// SenBoxArtXMLGetDescription( xml, culture, bufferLength, nullptr, buffer ); /// /// @related SenBoxArtDownloadXML() /// @related SenXMLParse() @@ -390,7 +390,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: boxArtInfo.resourceID or boxArtInfo.image is invalid. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientConfig.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientConfig.h index 81c2f3cc6..0aca08ef3 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientConfig.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientConfig.h @@ -55,7 +55,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_configInfo is NULL. + /// E_POINTER: out_configInfo is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -95,7 +95,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// E_INVALIDARG: configInfo.resourceID or configInfo.config is invalid. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientCore.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientCore.h index f86eb92ae..4d3815d2a 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientCore.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientCore.h @@ -42,7 +42,7 @@ 3. Many functions are designed for asynchronous use, and will internally create a task that will only finish after feedback from the server. - a. These functions can be either blocking or asynchronous. If the callback pointer is NULL + a. These functions can be either blocking or asynchronous. If the callback pointer is nullptr then it is a blocking call. b. If the call is asynchronous, then it will always return instantly, and will return S_OK if a task has been created. diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientCultureBackCompat_SenClientUGC.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientCultureBackCompat_SenClientUGC.h index b36fd6e5e..02e255e86 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientCultureBackCompat_SenClientUGC.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientCultureBackCompat_SenClientUGC.h @@ -25,8 +25,8 @@ namespace Sentient /// /// @param[in] culture /// This is the result of a call to SenCultureFind() or SenCultureGet*(). - /// You may also pass NULL to use the culture set with SenCultureSetCurrent(). - /// May be NULL for default culture. + /// You may also pass nullptr to use the culture set with SenCultureSetCurrent(). + /// May be nullptr for default culture. /// /// @param[in] maxResults /// Used to indicate the number of items to be returned by @a out_feedInfo. diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientDynamicConfig.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientDynamicConfig.h index d6c5cb648..7b652aaef 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientDynamicConfig.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientDynamicConfig.h @@ -34,7 +34,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: size is NULL. + /// E_POINTER: size is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -66,7 +66,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: size is NULL. + /// E_POINTER: size is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -109,7 +109,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -149,7 +149,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_data is NULL. + /// E_POINTER: out_data is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientFame.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientFame.h index 1e823075f..8f07b1cef 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientFame.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientFame.h @@ -215,7 +215,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_userFameVIPArray is NULL. + /// E_POINTER: out_userFameVIPArray is nullptr. /// SENTIENT_E_TOO_MANY_CALLS: This call has been rejected to avoid excessive server load. Try again later. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. @@ -243,7 +243,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_fameVIPData is NULL. + /// E_POINTER: out_fameVIPData is nullptr. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_fameVIPData has not been filled in. /// S_OK: The operation completed successfully. /// @@ -304,8 +304,8 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_entryArray or out_leaderboardResults is NULL. - /// E_INVALIDARG: userCallback is NULL and out_senHandle is non-NULL. Task handles are not supported for synchronous requests. + /// E_POINTER: out_entryArray or out_leaderboardResults is nullptr. + /// E_INVALIDARG: userCallback is nullptr and out_senHandle is non-nullptr. Task handles are not supported for synchronous requests. /// SENTIENT_E_TOO_MANY_CALLS: This call has been rejected to avoid excessive server load. Try again later. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. @@ -331,7 +331,7 @@ namespace Sentient /// /// @return SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_awardData is NULL. + /// E_POINTER: out_awardData is nullptr. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_awardData has not been filled in. /// S_FALSE: The operation completed successfully but there were no awards to report. out_awardData has not been filled in. /// S_OK: The operation completed successfully and there was a valid award to report. out_awardData contains information about the award. @@ -351,7 +351,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_timeRemaining is NULL. + /// E_POINTER: out_timeRemaining is nullptr. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_timeRemaining has not been filled in. /// E_FAIL: Internal failure. Check log for output. /// S_OK: Call completed successfully and out_timeRemaining has been filled in. @@ -373,7 +373,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_timeRemaining is NULL. + /// E_POINTER: out_timeRemaining is nullptr. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_timeRemaining has not been filled in. /// S_FALSE: The VIP level of the supplied user does not expire. out_timeRemaining has not been filled in. /// E_FAIL: Internal failure. Check log for output. @@ -400,7 +400,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_name is NULL. + /// E_POINTER: out_name is nullptr. /// E_INVALIDARG: vipLevel is outside the range of known VIP levels. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_name has not been filled in. /// S_OK: The operation completed successfully. @@ -423,7 +423,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_count is NULL. + /// E_POINTER: out_count is nullptr. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and out_count has not been filled in. /// E_FAIL: Internal failure. Check log for output. /// S_OK: The operation completed successfully. @@ -456,7 +456,7 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_POINTER: out_dataCount or out_displayData is NULL. + /// E_POINTER: out_dataCount or out_displayData is nullptr. /// E_INVALIDARG: startIndex is greater than the total number of items available. /// SENTIENT_S_OPERATION_IN_PROGRESS: The call could not be completed immediately and output parameters have not been filled in. /// E_FAIL: Internal failure. Check log for output. @@ -553,8 +553,8 @@ namespace Sentient /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. /// SENTIENT_E_GUEST_ACCESS_VIOLATION: A guest may not spawn this call. - /// E_INVALIDARG: Either userCallback is NULL and out_senHandle is non-NULL, or participantCount is less than 2. - /// E_POINTER: participants is NULL. + /// E_INVALIDARG: Either userCallback is nullptr and out_senHandle is non-nullptr, or participantCount is less than 2. + /// E_POINTER: participants is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientUGC.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientUGC.h index da1b1f65d..b40245710 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientUGC.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientUGC.h @@ -97,7 +97,7 @@ namespace Sentient // metadata for a lot of UGCs at once. // Note: if a level has been uploaded with main data before, and the creator // wants to just modify the metadata, they can upload the metadata with the - // maindatablobs being NULL. + // maindatablobs being nullptr. // NOTE: for large items, use the SenUGCUploadMainData method with the SenUGCProgressInfo // signature so you can get the running progress and a cancellation token // to abort the upload (allowing UI for the user, etc) @@ -159,7 +159,7 @@ namespace Sentient // be used to abort the upload. This is useful for large uploads where // you may want to allow the user to cancel. // NOTE: This call is asynchronous ONLY and will error for synchronous - // attempts with a NULL param for userCallback. + // attempts with a nullptr param for userCallback. // There are multiple data blobs supported (the exact number is defined in // SenUGCMainData_NrBlobs) on subsequent calls. Slot zero is to be used by a // game to store a preview thumbnail, which can then be downloaded without @@ -172,7 +172,7 @@ namespace Sentient // metadata for a lot of UGCs at once. // NOTE: if a level has been uploaded with main data before, and the creator // wants to just modify the metadata, they can upload the metadata with the - // main data blob being NULL. + // main data blob being nullptr. // NOTE: If a creator uploads a data blob again, it will overwrite the previous // stored blob with the new one. //************************************ @@ -848,8 +848,8 @@ namespace Sentient /// /// @param[in] culture /// This is the result of a call to SenCultureFind() or SenCultureGet*(). - /// You may also pass NULL to use the culture set with SenCultureSetCurrent(). - /// May be NULL for default culture. + /// You may also pass nullptr to use the culture set with SenCultureSetCurrent(). + /// May be nullptr for default culture. /// /// @param[in] maxResults /// Used to indicate the number of items to be returned by @a out_feedInfo. diff --git a/Minecraft.Client/Xbox/Sentient/Include/SenClientUser.h b/Minecraft.Client/Xbox/Sentient/Include/SenClientUser.h index cf3ef0b3e..4c48ee501 100644 --- a/Minecraft.Client/Xbox/Sentient/Include/SenClientUser.h +++ b/Minecraft.Client/Xbox/Sentient/Include/SenClientUser.h @@ -61,7 +61,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_isInRole is NULL. + /// E_POINTER: out_isInRole is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// @@ -91,7 +91,7 @@ namespace Sentient /// /// @return Check SUCCEEDED( hresult ) or FAILED( hresult ) to determine success. Specific values include: /// SENTIENT_E_NOT_INITIALIZED: You did not call SentientInitialize() first. - /// E_POINTER: out_isInRole is NULL. + /// E_POINTER: out_isInRole is nullptr. /// E_FAIL: Failed to spawn server call. /// S_OK: Server call spawned successfully. /// diff --git a/Minecraft.Client/Xbox/Sentient/SentientManager.cpp b/Minecraft.Client/Xbox/Sentient/SentientManager.cpp index bf48c400a..49b0c26af 100644 --- a/Minecraft.Client/Xbox/Sentient/SentientManager.cpp +++ b/Minecraft.Client/Xbox/Sentient/SentientManager.cpp @@ -52,7 +52,7 @@ HRESULT CSentientManager::Tick() m_lastHeartbeat = currentTime; for(DWORD i = 0; i < XUSER_MAX_COUNT; ++i) { - if(Minecraft::GetInstance()->localplayers[i] != NULL) + if(Minecraft::GetInstance()->localplayers[i] != nullptr) { SenStatHeartBeat(i, m_lastHeartbeat - m_initialiseTime); } @@ -63,7 +63,7 @@ HRESULT CSentientManager::Tick() { for(DWORD i = 0; i < XUSER_MAX_COUNT; ++i) { - if(Minecraft::GetInstance()->localplayers[i] != NULL && m_fLevelStartTime[i] - currentTime > 60) + if(Minecraft::GetInstance()->localplayers[i] != nullptr && m_fLevelStartTime[i] - currentTime > 60) { Flush(); } @@ -257,7 +257,7 @@ INT CSentientManager::GetMode(DWORD dwUserId) Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localplayers[dwUserId] != NULL && pMinecraft->localplayers[dwUserId]->level != NULL && pMinecraft->localplayers[dwUserId]->level->getLevelData() != NULL ) + if( pMinecraft->localplayers[dwUserId] != nullptr && pMinecraft->localplayers[dwUserId]->level != nullptr && pMinecraft->localplayers[dwUserId]->level->getLevelData() != nullptr ) { GameType *gameType = pMinecraft->localplayers[dwUserId]->level->getLevelData()->getGameType(); @@ -329,7 +329,7 @@ INT CSentientManager::GetSubLevelId(DWORD dwUserId) Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft->localplayers[dwUserId] != NULL) + if(pMinecraft->localplayers[dwUserId] != nullptr) { switch(pMinecraft->localplayers[dwUserId]->dimension) { diff --git a/Minecraft.Client/Xbox/Sentient/SentientStats.cpp b/Minecraft.Client/Xbox/Sentient/SentientStats.cpp index 361d18eed..ffa9392d8 100644 --- a/Minecraft.Client/Xbox/Sentient/SentientStats.cpp +++ b/Minecraft.Client/Xbox/Sentient/SentientStats.cpp @@ -37,8 +37,8 @@ BOOL SenStatPlayerSessionStart ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 10; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -67,8 +67,8 @@ BOOL SenStatPlayerSessionExit ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 5; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -93,8 +93,8 @@ BOOL SenStatHeartBeat ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 1; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -136,8 +136,8 @@ BOOL SenStatLevelStart ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 18; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -172,8 +172,8 @@ BOOL SenStatLevelExit ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 11; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -209,8 +209,8 @@ BOOL SenStatLevelSaveOrCheckpoint ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 12; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -253,8 +253,8 @@ BOOL SenStatLevelResume ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 19; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -285,8 +285,8 @@ BOOL SenStatPauseOrInactive ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 7; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -317,8 +317,8 @@ BOOL SenStatUnpauseOrActive ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 7; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -351,8 +351,8 @@ BOOL SenStatMenuShown ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -385,8 +385,8 @@ BOOL SenStatAchievementUnlocked ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -419,8 +419,8 @@ BOOL SenStatMediaShareUpload ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -453,8 +453,8 @@ BOOL SenStatUpsellPresented ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -488,8 +488,8 @@ BOOL SenStatUpsellResponded ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 10; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -607,8 +607,8 @@ BOOL SenStatSkinChanged ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 8; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -639,8 +639,8 @@ BOOL SenStatBanLevel ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 7; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -671,8 +671,8 @@ BOOL SenStatUnBanLevel ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 7; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing @@ -705,8 +705,8 @@ BOOL SenStatTexturePackChanged ( DWORD dwUserID, INT SecondsSinceI st.dwNumProperties = 9; st.arrProperties = (CHAR*)&LocalStruct; st.dwNumValues = 0; - st.arrValues = NULL; - st.arrValueFlags = NULL; + st.arrValues = nullptr; + st.arrValueFlags = nullptr; #ifdef SEN_LOGTELEMETRY // if we're in debug build with logging then log the stat to a file for testing diff --git a/Minecraft.Client/Xbox/Social/SocialManager.cpp b/Minecraft.Client/Xbox/Social/SocialManager.cpp index b7a108bc7..b89fda709 100644 --- a/Minecraft.Client/Xbox/Social/SocialManager.cpp +++ b/Minecraft.Client/Xbox/Social/SocialManager.cpp @@ -67,14 +67,14 @@ CSocialManager::CSocialManager() // WESTY : Not sure if we even need to get social access key! /* - m_pAccessKeyText = NULL; + m_pAccessKeyText = nullptr; m_dwAccessKeyTextSize = 0; */ - m_pMainImageBuffer = NULL; + m_pMainImageBuffer = nullptr; m_dwMainImageBufferSize = 0; - m_PostPreviewImage.pBytes = NULL; + m_PostPreviewImage.pBytes = nullptr; m_dwCurrRequestUser = -1; ZeroMemory(m_wchTitleA,sizeof(WCHAR)*MAX_SOCIALPOST_CAPTION); @@ -304,14 +304,14 @@ bool CSocialManager::AreAllUsersAllowedToPostImages() void CSocialManager::DestroyMainPostImage() { delete [] m_PostImageParams.pFullImage; - m_PostImageParams.pFullImage=NULL; + m_PostImageParams.pFullImage=nullptr; m_dwMainImageBufferSize=0; } void CSocialManager::DestroyPreviewPostImage() { XPhysicalFree( (void *)m_PostPreviewImage.pBytes ); - m_PostPreviewImage.pBytes = NULL; + m_PostPreviewImage.pBytes = nullptr; } void CSocialManager::SetSocialPostText(LPCWSTR pwchTitle, LPCWSTR pwchCaption, LPCWSTR pwchDesc) @@ -459,7 +459,7 @@ bool CSocialManager::PostImageToSocialNetwork( ESocialNetwork eSocialNetwork, DW bool bResult = false; - PBYTE pbData=NULL; + PBYTE pbData=nullptr; DWORD dwDataSize; app.GetScreenshot(dwUserIndex,&pbData,&dwDataSize); @@ -536,10 +536,10 @@ bool CSocialManager::GetSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, D DWORD dwResult; // Ensure that we free any previously used access key buffer. - if ( m_pAccessKeyText != NULL ) + if ( m_pAccessKeyText != nullptr ) { delete [] m_pAccessKeyText; - m_pAccessKeyText = NULL; + m_pAccessKeyText = nullptr; } // Get social network ID and permissions. @@ -554,39 +554,39 @@ bool CSocialManager::GetSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, D { if ( bUsingKinect ) { - dwResult = XShowNuiSocialGetUserToken( dwUserTrackingIndex, dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); + dwResult = XShowNuiSocialGetUserToken( dwUserTrackingIndex, dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); // If buffer for key text was not large enough, reallocate buffer that is large enough and try again. if ( dwResult == ERROR_INSUFFICIENT_BUFFER ) { delete [] m_pAccessKeyText; m_pAccessKeyText = new wchar_t[ m_dwAccessKeyTextSize ]; - dwResult = XShowNuiSocialGetUserToken( dwUserTrackingIndex, dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); + dwResult = XShowNuiSocialGetUserToken( dwUserTrackingIndex, dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); } } else // using standard controller interface. { - dwResult = XShowSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); + dwResult = XShowSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); // If buffer for key text was not large enough, reallocate buffer that is large enough and try again. if ( dwResult == ERROR_INSUFFICIENT_BUFFER ) { delete [] m_pAccessKeyText; m_pAccessKeyText = new wchar_t[ m_dwAccessKeyTextSize ]; - dwResult = XShowSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); + dwResult = XShowSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); } } } else // we are trying to obtain cached user access key. { - dwResult = XSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); + dwResult = XSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); // If buffer for key text was not large enough, reallocate buffer that is large enough and try again. if ( dwResult == ERROR_INSUFFICIENT_BUFFER ) { delete [] m_pAccessKeyText; m_pAccessKeyText = new wchar_t[ m_dwAccessKeyTextSize ]; - dwResult = XSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), NULL ); + dwResult = XSocialGetUserToken( dwUserIndex, dwSocialNetworkID, pRequiredPermissions, m_pAccessKeyText, &( m_dwAccessKeyTextSize ), nullptr ); } } diff --git a/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp b/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp index 96b6bfc83..badade553 100644 --- a/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp +++ b/Minecraft.Client/Xbox/XML/ATGXmlParser.cpp @@ -27,7 +27,7 @@ XMLParser::XMLParser() { m_pWritePtr = m_pWriteBuf; m_pReadPtr = m_pReadBuf; - m_pISAXCallback = NULL; + m_pISAXCallback = nullptr; m_hFile = INVALID_HANDLE_VALUE; } @@ -49,7 +49,7 @@ VOID XMLParser::FillBuffer() m_pReadPtr = m_pReadBuf; - if( m_hFile == NULL ) + if( m_hFile == nullptr ) { if( m_uInXMLBufferCharsLeft > XML_READ_BUFFER_SIZE ) NChars = XML_READ_BUFFER_SIZE; @@ -62,7 +62,7 @@ VOID XMLParser::FillBuffer() } else { - if( !ReadFile( m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, NULL )) + if( !ReadFile( m_hFile, m_pReadBuf, XML_READ_BUFFER_SIZE, &NChars, nullptr )) { return; } @@ -359,7 +359,7 @@ HRESULT XMLParser::AdvanceCharacter( BOOL bOkToFail ) // Read more from the file FillBuffer(); - // We are at EOF if it is still NULL + // We are at EOF if it is still nullptr if ( ( m_pReadPtr[0] == '\0' ) && ( m_pReadPtr[1] == '\0' ) ) { if( !bOkToFail ) @@ -861,7 +861,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) { HRESULT hr; - if( m_pISAXCallback == NULL ) + if( m_pISAXCallback == nullptr ) return E_NOINTERFACE; m_pISAXCallback->m_LineNum = 1; @@ -874,9 +874,9 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) m_pReadBuf[ 0 ] = '\0'; m_pReadBuf[ 1 ] = '\0'; - m_pInXMLBuffer = NULL; + m_pInXMLBuffer = nullptr; m_uInXMLBufferCharsLeft = 0; - m_hFile = CreateFile( strFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL ); + m_hFile = CreateFile( strFilename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr ); if( m_hFile == INVALID_HANDLE_VALUE ) { @@ -899,7 +899,7 @@ HRESULT XMLParser::ParseXMLFile( CONST CHAR *strFilename ) m_hFile = INVALID_HANDLE_VALUE; // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = NULL; + m_pISAXCallback->m_strFilename = nullptr; return hr; } @@ -912,7 +912,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) { HRESULT hr; - if( m_pISAXCallback == NULL ) + if( m_pISAXCallback == nullptr ) return E_NOINTERFACE; m_pISAXCallback->m_LineNum = 1; @@ -925,7 +925,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) m_pReadBuf[ 0 ] = '\0'; m_pReadBuf[ 1 ] = '\0'; - m_hFile = NULL; + m_hFile = nullptr; m_pInXMLBuffer = strBuffer; m_uInXMLBufferCharsLeft = uBufferSize; m_dwCharsTotal = uBufferSize; @@ -934,7 +934,7 @@ HRESULT XMLParser::ParseXMLBuffer( CONST CHAR *strBuffer, UINT uBufferSize ) hr = MainParseLoop(); // we no longer own strFilename, so un-set it - m_pISAXCallback->m_strFilename = NULL; + m_pISAXCallback->m_strFilename = nullptr; return hr; } diff --git a/Minecraft.Client/Xbox/XML/ATGXmlParser.h b/Minecraft.Client/Xbox/XML/ATGXmlParser.h index 75142e3e3..12f597372 100644 --- a/Minecraft.Client/Xbox/XML/ATGXmlParser.h +++ b/Minecraft.Client/Xbox/XML/ATGXmlParser.h @@ -138,7 +138,7 @@ private: DWORD m_dwCharsTotal; DWORD m_dwCharsConsumed; - BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing NULL + BYTE m_pReadBuf[ XML_READ_BUFFER_SIZE + 2 ]; // room for a trailing nullptr WCHAR m_pWriteBuf[ XML_WRITE_BUFFER_SIZE ]; BYTE* m_pReadPtr; diff --git a/Minecraft.Client/Xbox/XML/xmlFilesCallback.h b/Minecraft.Client/Xbox/XML/xmlFilesCallback.h index 2ea670dfb..7571706e3 100644 --- a/Minecraft.Client/Xbox/XML/xmlFilesCallback.h +++ b/Minecraft.Client/Xbox/XML/xmlFilesCallback.h @@ -47,7 +47,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - xuid=_wcstoui64(wTemp,NULL,10); + xuid=_wcstoui64(wTemp,nullptr,10); } } else if (_wcsicmp(wAttName,L"cape")==0) @@ -138,7 +138,7 @@ public: #ifdef _XBOX iValue=_wtoi(wValue); #else - iValue=wcstol(wValue, NULL, 10); + iValue=wcstol(wValue, nullptr, 10); #endif } } @@ -220,7 +220,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - uiSortIndex=wcstoul(wTemp,NULL,16); + uiSortIndex=wcstoul(wTemp,nullptr,16); } } else if (_wcsicmp(wAttName,L"Banner")==0) @@ -236,7 +236,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - ullFull=_wcstoui64(wTemp,NULL,16); + ullFull=_wcstoui64(wTemp,nullptr,16); } } else if (_wcsicmp(wAttName,L"Trial")==0) @@ -245,7 +245,7 @@ public: { ZeroMemory(wTemp,sizeof(WCHAR)*35); wcsncpy_s( wTemp, pAttributes[i].strValue, pAttributes[i].ValueLen); - ullTrial=_wcstoui64(wTemp,NULL,16); + ullTrial=_wcstoui64(wTemp,nullptr,16); } } else if (_wcsicmp(wAttName,L"FirstSkin")==0) @@ -286,7 +286,7 @@ public: #ifdef _XBOX iConfig=_wtoi(wConfig); #else - iConfig=wcstol(wConfig, NULL, 10); + iConfig=wcstol(wConfig, nullptr, 10); #endif } } diff --git a/Minecraft.Client/Xbox/Xbox_App.cpp b/Minecraft.Client/Xbox/Xbox_App.cpp index eebeb827f..a717540bc 100644 --- a/Minecraft.Client/Xbox/Xbox_App.cpp +++ b/Minecraft.Client/Xbox/Xbox_App.cpp @@ -284,10 +284,10 @@ CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() m_bRead_TMS_XUIDS_XML=false; m_bRead_TMS_Config_XML=false; m_bRead_TMS_DLCINFO_XML=false; - m_pXuidsFileBuffer=NULL; + m_pXuidsFileBuffer=nullptr; m_dwXuidsFileSize=0; ZeroMemory(m_ScreenshotBuffer,sizeof(LPD3DXBUFFER)*XUSER_MAX_COUNT); - m_ThumbnailBuffer=NULL; + m_ThumbnailBuffer=nullptr; #ifdef _DEBUG_MENUS_ENABLED debugOverlayCreated = false; #endif @@ -301,12 +301,12 @@ CConsoleMinecraftApp::CConsoleMinecraftApp() : CMinecraftApp() m_bContainerMenuDisplayed[i]=false; m_bIgnoreAutosaveMenuDisplayed[i]=false; m_bIgnorePlayerJoinMenuDisplayed[i]=false; - m_hCurrentScene[i]=NULL; - m_hFirstScene[i]=NULL; + m_hCurrentScene[i]=nullptr; + m_hFirstScene[i]=nullptr; } m_titleDeploymentType = XTITLE_DEPLOYMENT_DOWNLOAD; - DWORD dwResult = XTitleGetDeploymentType(&m_titleDeploymentType, NULL); + DWORD dwResult = XTitleGetDeploymentType(&m_titleDeploymentType, nullptr); if( dwResult == ERROR_SUCCESS ) { switch( m_titleDeploymentType ) @@ -658,7 +658,7 @@ void CConsoleMinecraftApp::GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE *previe preview->pBytes = (BYTE *)XPhysicalAlloc(sizeBytes, MAXULONG_PTR, 0, PAGE_READWRITE | PAGE_WRITECOMBINE ); memcpy( (void *)preview->pBytes, (void *)m_PreviewBuffer[iPad].pBytes, sizeBytes ); XPhysicalFree((LPVOID)m_PreviewBuffer[iPad].pBytes); - m_PreviewBuffer[iPad].pBytes = NULL; + m_PreviewBuffer[iPad].pBytes = nullptr; } void CConsoleMinecraftApp::CaptureScreenshot(int iPad) @@ -678,7 +678,7 @@ HRESULT CConsoleMinecraftApp::LoadXuiResources() HRESULT hr; // load from the .xzp file - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); //#ifdef _CONTENT_PACKAGE @@ -894,7 +894,7 @@ HRESULT CConsoleMinecraftApp::LoadXuiResources() // int iStringC=0; // LPCWSTR lpTempString; // - // while((lpTempString=StringTable.Lookup(iStringC))!=NULL) + // while((lpTempString=StringTable.Lookup(iStringC))!=nullptr) // { // DebugPrintf("STRING %d = ",iStringC); // OutputDebugStringW(lpTempString); @@ -914,17 +914,17 @@ HRESULT CConsoleMinecraftApp::LoadXuiResources() wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/"); if(RenderManager.IsHiDef()) { - hr=LoadFirstScene( szResourceLocator, L"xuiscene_base.xur", NULL, &mainBaseScene ); + hr=LoadFirstScene( szResourceLocator, L"xuiscene_base.xur", nullptr, &mainBaseScene ); } else { if(RenderManager.IsWidescreen()) { - hr=LoadFirstScene( szResourceLocator, L"xuiscene_base.xur", NULL, &mainBaseScene ); + hr=LoadFirstScene( szResourceLocator, L"xuiscene_base.xur", nullptr, &mainBaseScene ); } else { - hr=LoadFirstScene( szResourceLocator, L"xuiscene_base_480.xur", NULL, &mainBaseScene ); + hr=LoadFirstScene( szResourceLocator, L"xuiscene_base_480.xur", nullptr, &mainBaseScene ); } } if( FAILED(hr) ) app.FatalLoadError(); @@ -989,7 +989,7 @@ HRESULT CConsoleMinecraftApp::RegisterFont(eFont eFontLanguage,eFont eFontFallba HRESULT hr=S_OK; 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); wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", wchTypefaceLocatorA[eFontLanguage]); // 4J Stu - Check that the font file actually exists @@ -1003,7 +1003,7 @@ HRESULT CConsoleMinecraftApp::RegisterFont(eFont eFontLanguage,eFont eFontFallba { if(eFontFallback!=eFont_None) { - hr = RegisterDefaultTypeface( wchTypefaceA[eFontLanguage],szResourceLocator,NULL,0.0f,wchTypefaceA[eFontFallback]); + hr = RegisterDefaultTypeface( wchTypefaceA[eFontLanguage],szResourceLocator,nullptr,0.0f,wchTypefaceA[eFontFallback]); } else { @@ -1410,7 +1410,7 @@ void CConsoleMinecraftApp::OverrideFontRenderer(bool set, bool immediate) } else { - XuiFontSetRenderer( NULL ); + XuiFontSetRenderer( nullptr ); } m_bFontRendererOverridden = set; @@ -1451,7 +1451,7 @@ void CConsoleMinecraftApp::CaptureSaveThumbnail() void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) { // on a save caused by a create world, the thumbnail capture won't have happened - if(m_ThumbnailBuffer!=NULL) + if(m_ThumbnailBuffer!=nullptr) { if( pbData ) { @@ -1460,28 +1460,28 @@ void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize) memcpy(*pbData,m_ThumbnailBuffer->GetBufferPointer(),*pdwSize); } m_ThumbnailBuffer->Release(); - m_ThumbnailBuffer=NULL; + m_ThumbnailBuffer=nullptr; } } void CConsoleMinecraftApp::ReleaseSaveThumbnail() { - if(m_ThumbnailBuffer!=NULL) + if(m_ThumbnailBuffer!=nullptr) { m_ThumbnailBuffer->Release(); - m_ThumbnailBuffer=NULL; + m_ThumbnailBuffer=nullptr; } } void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) { // on a save caused by a create world, the thumbnail capture won't have happened - if(m_ScreenshotBuffer[iPad]!=NULL) + if(m_ScreenshotBuffer[iPad]!=nullptr) { *pbData= new BYTE [m_ScreenshotBuffer[iPad]->GetBufferSize()]; *pdwSize=m_ScreenshotBuffer[iPad]->GetBufferSize(); memcpy(*pbData,m_ScreenshotBuffer[iPad]->GetBufferPointer(),*pdwSize); m_ScreenshotBuffer[iPad]->Release(); - m_ScreenshotBuffer[iPad]=NULL; + m_ScreenshotBuffer[iPad]=nullptr; } } @@ -1492,13 +1492,13 @@ void CConsoleMinecraftApp::EnableDebugOverlay(bool enable,int iPad) if(enable && !debugOverlayCreated) { - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string WCHAR szResourceLocator[ LOCATOR_SIZE ]; wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/"); - hr = XuiSceneCreate(szResourceLocator, L"xuiscene_debugoverlay.xur", NULL, &m_hDebugOverlay); + hr = XuiSceneCreate(szResourceLocator, L"xuiscene_debugoverlay.xur", nullptr, &m_hDebugOverlay); debugContainerScene.AddChild(m_hDebugOverlay); debugContainerScene.SetShow(false); @@ -1644,7 +1644,7 @@ WCHAR *CConsoleMinecraftApp::GetSceneName(EUIScene eScene,bool bAppendToName,boo return m_SceneName; } -HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *initData /* = NULL */, bool forceUsePad /*= false*/, BOOL bStayVisible /* = FALSE */, HXUIOBJ *phResultingScene /*= NULL*/ ) +HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *initData /* = nullptr */, bool forceUsePad /*= false*/, BOOL bStayVisible /* = FALSE */, HXUIOBJ *phResultingScene /*= nullptr*/ ) { ASSERT(m_bDefaultTypefaceRegistered); ASSERT(m_bSkinLoaded); @@ -1690,7 +1690,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in } // 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; @@ -1701,7 +1701,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in // If the init data is null, put the player pad in there - if(initData==NULL) + if(initData==nullptr) { initData = &iPad; } @@ -1843,7 +1843,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in m_bPauseMenuDisplayed[iPad] = true; Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) + if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; @@ -1883,7 +1883,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in break; } - if(phResultingScene!=NULL) + if(phResultingScene!=nullptr) { *phResultingScene=hScene; } @@ -1997,7 +1997,7 @@ HRESULT CConsoleMinecraftApp::CloseXuiScenes(int iPad, bool forceUsePad /*= fals } Minecraft *pMinecraft = Minecraft::GetInstance(); - if(pMinecraft != NULL && pMinecraft->localgameModes[iPad] != NULL ) + if(pMinecraft != nullptr && pMinecraft->localgameModes[iPad] != nullptr ) { TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; @@ -2132,7 +2132,7 @@ HRESULT CConsoleMinecraftApp::RemoveBackScene(int iPad) } } - XuiSceneSetBackScene(hBack, NULL); + XuiSceneSetBackScene(hBack, nullptr); XuiDestroyObject( hBack ); } } @@ -2163,7 +2163,7 @@ HRESULT CConsoleMinecraftApp::NavigateToHomeMenu() // 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()) { @@ -2179,11 +2179,11 @@ HRESULT CConsoleMinecraftApp::NavigateToHomeMenu() // need to stop the streaming audio - by playing streaming audio from the default texture pack now pMinecraft->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(); } @@ -2193,7 +2193,7 @@ HRESULT CConsoleMinecraftApp::NavigateToHomeMenu() g_NetworkManager.ForceFriendsSessionRefresh(); - hr = NavigateToScene(XUSER_INDEX_ANY,eUIScene_MainMenu,NULL); + hr = NavigateToScene(XUSER_INDEX_ANY,eUIScene_MainMenu,nullptr); return hr; } @@ -2217,7 +2217,7 @@ void CConsoleMinecraftApp::SetChatTextDisplayed(int iPad, bool bVal) void CConsoleMinecraftApp::ReloadChatScene(int iPad, bool bJoining /*= false*/, bool bForce /*= false*/) { - if(m_hFirstChatScene[iPad] == NULL || m_hCurrentChatScene[iPad] == NULL) return; + if(m_hFirstChatScene[iPad] == nullptr || m_hCurrentChatScene[iPad] == nullptr) return; // Re-create the chat scene so it is the correct size. It starts without any visible lines. BOOL chatSceneVisible = FALSE; @@ -2236,7 +2236,7 @@ void CConsoleMinecraftApp::ReloadChatScene(int iPad, bool bJoining /*= false*/, { if( m_hFirstChatScene[iPad] != m_hCurrentChatScene[iPad] ) XuiSceneNavigateBack(m_hCurrentChatScene[iPad], m_hFirstChatScene[iPad],iPad); m_hCurrentChatScene[iPad] = m_hFirstChatScene[iPad]; - app.NavigateToScene(iPad,eUIComponent_Chat,NULL,true); + app.NavigateToScene(iPad,eUIComponent_Chat,nullptr,true); XuiElementSetShow( m_hCurrentChatScene[iPad], chatSceneVisible); } @@ -2298,7 +2298,7 @@ void CConsoleMinecraftApp::ReloadChatScene(int iPad, bool bJoining /*= false*/, void CConsoleMinecraftApp::ReloadHudScene(int iPad, bool bJoining /*= false*/, bool bForce /*= false*/) { - if(m_hFirstHudScene[iPad] == NULL || m_hCurrentHudScene[iPad] == NULL) return; + if(m_hFirstHudScene[iPad] == nullptr || m_hCurrentHudScene[iPad] == nullptr) return; // Re-create the hud scene so it is the correct size. It starts without any visible lines. BOOL hudSceneVisible = FALSE; @@ -2317,7 +2317,7 @@ void CConsoleMinecraftApp::ReloadHudScene(int iPad, bool bJoining /*= false*/, b { if( m_hFirstHudScene[iPad] != m_hCurrentHudScene[iPad] ) XuiSceneNavigateBack(m_hCurrentHudScene[iPad], m_hFirstHudScene[iPad],iPad); m_hCurrentHudScene[iPad] = m_hFirstHudScene[iPad]; - app.NavigateToScene(iPad,eUIScene_HUD,NULL,true); + app.NavigateToScene(iPad,eUIScene_HUD,nullptr,true); XuiElementSetShow( m_hCurrentHudScene[iPad], hudSceneVisible); } @@ -2333,7 +2333,7 @@ void CConsoleMinecraftApp::AdjustSplitscreenScene(HXUIOBJ hScene,D3DXVECTOR3 *pv XuiElementGetPosition(hScene,pvOriginalPosition); vec=*pvOriginalPosition; - if( pMinecraft->localplayers[iPad] != NULL ) + if( pMinecraft->localplayers[iPad] != nullptr ) { switch( pMinecraft->localplayers[iPad]->m_iScreenSection) { @@ -2382,7 +2382,7 @@ void CConsoleMinecraftApp::AdjustSplitscreenScene(HXUIOBJ hScene,D3DXVECTOR3 *pv vec=*pvOriginalPosition; - if( pMinecraft->localplayers[iPad] != NULL ) + if( pMinecraft->localplayers[iPad] != nullptr ) { switch( pMinecraft->localplayers[iPad]->m_iScreenSection) { @@ -2449,7 +2449,7 @@ HRESULT CConsoleMinecraftApp::AdjustSplitscreenScene_PlayerChanged(HXUIOBJ hScen // 4J Stu - Return S_FALSE to inidicate that the scene has been closed return S_FALSE; } - else if ( pMinecraft->localplayers[iPad] != NULL ) + else if ( pMinecraft->localplayers[iPad] != nullptr ) { // we need to reposition the scenes since the players will have moved around @@ -2510,7 +2510,7 @@ HRESULT CConsoleMinecraftApp::AdjustSplitscreenScene_PlayerChanged(HXUIOBJ hScen // 4J Stu - Return S_FALSE to inidicate that the scene has been closed return S_FALSE; } - else if ( pMinecraft->localplayers[iPad] != NULL ) + else if ( pMinecraft->localplayers[iPad] != nullptr ) { // we need to reposition the scenes since the players will have moved around @@ -2560,7 +2560,7 @@ HRESULT CConsoleMinecraftApp::AdjustSplitscreenScene_PlayerChanged(HXUIOBJ hScen void CConsoleMinecraftApp::StoreLaunchData() { - LD_DEMO* pDemoData = NULL; + LD_DEMO* pDemoData = nullptr; DWORD dwStatus = XGetLaunchDataSize( &m_dwLaunchDataSize ); @@ -2578,7 +2578,7 @@ void CConsoleMinecraftApp::StoreLaunchData() void CConsoleMinecraftApp::ExitGame() { - if(m_pLaunchData!=NULL) + if(m_pLaunchData!=nullptr) { LD_DEMO* pDemoData = (LD_DEMO*)( m_pLaunchData ); XSetLaunchData( pDemoData, m_dwLaunchDataSize ); @@ -2605,7 +2605,7 @@ void CConsoleMinecraftApp::FatalLoadError(void) memset(&MessageBoxOverlap, 0, sizeof(MessageBoxOverlap)); - //HANDLE messageBoxThread = CreateThread(NULL, 0, &CMinecraftApp::ShowFatalLoadMessageBoxThreadProc, &MessageBoxOverlap, 0, NULL); + //HANDLE messageBoxThread = CreateThread(nullptr, 0, &CMinecraftApp::ShowFatalLoadMessageBoxThreadProc, &MessageBoxOverlap, 0, nullptr); // //WaitForSingleObjectEx(messageBoxThread, // handle to object // 20000, // time-out interval @@ -2775,7 +2775,7 @@ int CConsoleMinecraftApp::LoadLocalTMSFile(WCHAR *wchTMSFile) if(iTMSFileIndex!=-1) { // can we find the tms file in our xzp? - if(TMSFileA[iTMSFileIndex].pbData==NULL) // if we haven't already loaded it + if(TMSFileA[iTMSFileIndex].pbData==nullptr) // if we haven't already loaded it { swprintf(szResourceLocator, LOCATOR_SIZE, L"%ls#TMSFiles/%ls",m_wchTMSXZP, wchTMSFile); @@ -2793,10 +2793,10 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) { if((eType==eTMSFileType_All) ||(eType==TMSFileA[i].eTMSType)) { - if(TMSFileA[i].pbData!=NULL) + if(TMSFileA[i].pbData!=nullptr) { XuiFree(TMSFileA[i].pbData); - TMSFileA[i].pbData=NULL; + TMSFileA[i].pbData=nullptr; TMSFileA[i].uiSize=0; } } @@ -2807,148 +2807,148 @@ void CConsoleMinecraftApp::FreeLocalTMSFiles(eTMSFileType eType) TMS_FILE CConsoleMinecraftApp::TMSFileA[TMS_COUNT] = { // skin packs - { L"SP1", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SP2", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SP3", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SP4", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SP5", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SP6", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SPF", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SPB", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SPC", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SPZ", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SPM", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SPI", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"SPG", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"SP1", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SP2", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SP3", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SP4", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SP5", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SP6", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SPF", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SPB", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SPC", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SPZ", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SPM", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SPI", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"SPG", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, //themes - { L"ThSt", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"ThIr", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"ThGo", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"ThDi", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, - { L"ThAw", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0}, + { L"ThSt", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"ThIr", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"ThGo", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"ThDi", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, + { L"ThAw", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0}, //gamerpics - { L"GPAn", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPCo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPEn", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPFo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPTo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPBA", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPFa", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPME", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPMF", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPMM", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPSE", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPAn", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPCo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPEn", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPFo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPTo", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPBA", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPFa", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPME", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPMF", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPMM", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPSE", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPOr", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPMi", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPMB", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPBr", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPOr", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPMi", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPMB", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPBr", eFileExtensionType_PNG , eTMSFileType_MinecraftStore, nullptr, 0, 0}, - { L"GPM1", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPM2", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0}, - { L"GPM3", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0}, + { L"GPM1", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPM2", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0}, + { L"GPM3", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0}, //avatar items - { L"AH_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0008", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AH_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AH_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0008", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AH_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AT_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0008", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0014", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0015", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0016", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0017", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0018", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0019", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0020", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0021", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0022", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0023", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0024", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0025", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AT_0026", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AT_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0008", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0014", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0015", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0016", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0017", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0018", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0019", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0020", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0021", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0022", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0023", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0024", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0025", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AT_0026", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0014", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0015", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0016", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0017", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0018", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0002", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0003", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0004", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0005", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0006", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0007", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0009", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0010", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0011", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0012", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0013", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0014", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0015", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0016", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0017", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0018", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AP_0019", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0020", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0021", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0022", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0023", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0024", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0025", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0026", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0027", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0028", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0029", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0030", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0031", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0032", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"AP_0033", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, + { L"AP_0019", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0020", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0021", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0022", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0023", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0024", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0025", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0026", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0027", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0028", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0029", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0030", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0031", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0032", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"AP_0033", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, - { L"AA_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0 , 0 }, + { L"AA_0001", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0 , 0 }, // Mash-up Packs - { L"MPMA", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"MPMA", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 1024 }, - { L"MPSR", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"MPSR", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 1025 }, - { L"MPHA", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"MPHA", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 1026 }, + { L"MPMA", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"MPMA", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 1024 }, + { L"MPSR", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"MPSR", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 1025 }, + { L"MPHA", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"MPHA", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 1026 }, // Texture Packs - { L"TP01", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"TP01", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2049 }, - { L"TP02", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"TP02", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2053 }, - { L"TP04", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"TP04", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2051 }, - { L"TP05", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"TP05", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2054 }, - { L"TP06", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"TP06", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2050 }, - { L"TP07", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, NULL, 0, 0 }, - { L"TP07", eFileExtensionType_DAT, eTMSFileType_TexturePack, NULL, 0, 2055 }, + { L"TP01", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"TP01", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2049 }, + { L"TP02", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"TP02", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2053 }, + { L"TP04", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"TP04", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2051 }, + { L"TP05", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"TP05", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2054 }, + { L"TP06", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"TP06", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2050 }, + { L"TP07", eFileExtensionType_PNG, eTMSFileType_MinecraftStore, nullptr, 0, 0 }, + { L"TP07", eFileExtensionType_DAT, eTMSFileType_TexturePack, nullptr, 0, 2055 }, }; diff --git a/Minecraft.Client/Xbox/Xbox_App.h b/Minecraft.Client/Xbox/Xbox_App.h index 79ee28f97..86dbc2874 100644 --- a/Minecraft.Client/Xbox/Xbox_App.h +++ b/Minecraft.Client/Xbox/Xbox_App.h @@ -133,12 +133,12 @@ public: WCHAR *GetSceneName(EUIScene eScene, bool bAppendToName,bool bSplitscreenScene); - virtual HRESULT NavigateToScene(int iPad,EUIScene eScene, void *initData = NULL, bool forceUsePad = false, BOOL bStayVisible=FALSE, HXUIOBJ *phResultingScene=NULL); + virtual HRESULT NavigateToScene(int iPad,EUIScene eScene, void *initData = nullptr, bool forceUsePad = false, BOOL bStayVisible=FALSE, HXUIOBJ *phResultingScene=nullptr); virtual HRESULT NavigateBack(int iPad, bool forceUsePad = false,EUIScene eScene = eUIScene_COUNT); virtual HRESULT TutorialSceneNavigateBack(int iPad, bool forceUsePad = false); virtual HRESULT CloseXuiScenes(int iPad, bool forceUsePad = false); virtual HRESULT CloseAllPlayersXuiScenes(); - virtual HRESULT CloseXuiScenesAndNavigateToScene(int iPad,EUIScene eScene, void *initData=NULL, bool forceUsePad = false); + virtual HRESULT CloseXuiScenesAndNavigateToScene(int iPad,EUIScene eScene, void *initData=nullptr, bool forceUsePad = false); virtual HRESULT RemoveBackScene(int iPad); virtual HRESULT NavigateToHomeMenu(); D3DXVECTOR3 GetElementScreenPosition(HXUIOBJ hObj); diff --git a/Minecraft.Client/Xbox/Xbox_Minecraft.cpp b/Minecraft.Client/Xbox/Xbox_Minecraft.cpp index 04e4a8d5a..6606dacf0 100644 --- a/Minecraft.Client/Xbox/Xbox_Minecraft.cpp +++ b/Minecraft.Client/Xbox/Xbox_Minecraft.cpp @@ -285,7 +285,7 @@ HRESULT InitD3D( IDirect3DDevice9 **ppDevice, return pD3D->CreateDevice( 0, D3DDEVTYPE_HAL, - NULL, + nullptr, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES, pd3dPP, ppDevice ); @@ -399,7 +399,7 @@ int __cdecl main() } // Create an XAudio2 mastering voice (utilized by XHV2 when voice data is mixed to main speakers) - hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, NULL); + hr = g_pXAudio2->CreateMasteringVoice(&g_pXAudio2MasteringVoice, XAUDIO2_DEFAULT_CHANNELS, XAUDIO2_DEFAULT_SAMPLERATE, 0, 0, nullptr); if ( FAILED( hr ) ) { app.DebugPrintf( "Creating XAudio2 mastering voice failed (err = 0x%08x)!\n", hr ); @@ -671,7 +671,7 @@ int __cdecl main() else { MemSect(28); - pMinecraft->soundEngine->tick(NULL, 0.0f); + pMinecraft->soundEngine->tick(nullptr, 0.0f); MemSect(0); pMinecraft->textures->tick(true,false); IntCache::Reset(); diff --git a/Minecraft.Client/Xbox/Xbox_UIController.cpp b/Minecraft.Client/Xbox/Xbox_UIController.cpp index 51d91ca49..669b037ad 100644 --- a/Minecraft.Client/Xbox/Xbox_UIController.cpp +++ b/Minecraft.Client/Xbox/Xbox_UIController.cpp @@ -170,7 +170,7 @@ void ConsoleUIController::HandleDLCInstalled(int iPad) CustomMessage_DLCInstalled( &xuiMsg ); // The DLC message should only happen in the main menus, so it should go to the default xui scenes - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { @@ -188,7 +188,7 @@ void ConsoleUIController::HandleTMSDLCFileRetrieved(int iPad) XUIMessage xuiMsg; CustomMessage_TMS_DLCFileRetrieved( &xuiMsg ); - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { @@ -204,7 +204,7 @@ void ConsoleUIController::HandleTMSBanFileRetrieved(int iPad) { XUIMessage xuiMsg; CustomMessage_TMS_BanFileRetrieved( &xuiMsg ); - bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); if(bNotInGame) { @@ -319,7 +319,7 @@ C4JStorage::EMessageResult ConsoleUIController::RequestMessageBox(UINT uiTitle, return StorageManager.RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pStringTable, pwchFormatString, dwFocusButton); } -C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = NULL*/, LPVOID lpParam/* = NULL*/) +C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(UINT title/* = -1 */, UINT message/* = -1 */, int iPad/* = -1*/, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)/* = nullptr*/, LPVOID lpParam/* = nullptr*/) { // Default title / messages if (title == -1) @@ -337,5 +337,5 @@ C4JStorage::EMessageResult ConsoleUIController::RequestUGCMessageBox(UINT title/ UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - return ui.RequestMessageBox(title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false); + return ui.RequestMessageBox(title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), nullptr, 0, false); } \ No newline at end of file diff --git a/Minecraft.Client/Xbox/Xbox_UIController.h b/Minecraft.Client/Xbox/Xbox_UIController.h index 2b273ee52..cd4605965 100644 --- a/Minecraft.Client/Xbox/Xbox_UIController.h +++ b/Minecraft.Client/Xbox/Xbox_UIController.h @@ -11,7 +11,7 @@ public: virtual void StartReloadSkinThread(); virtual bool IsReloadingSkin(); virtual void CleanUpSkinReload(); - virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = NULL, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); + virtual bool NavigateToScene(int iPad, EUIScene scene, void *initData = nullptr, EUILayer layer = eUILayer_Scene, EUIGroup group = eUIGroup_PAD); virtual bool NavigateBack(int iPad, bool forceUsePad = false, EUIScene eScene = eUIScene_COUNT, EUILayer eLayer = eUILayer_COUNT); virtual void NavigateToHomeMenu(); virtual void CloseUIScenes(int iPad, bool forceIPad = false); @@ -71,9 +71,9 @@ public: virtual void SetWinUserIndex(unsigned int iPad); virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, - int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, CXuiStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0, bool bIsError = true); + int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=nullptr,LPVOID lpParam=nullptr, CXuiStringTable *pStringTable=nullptr, WCHAR *pwchFormatString=nullptr,DWORD dwFocusButton=0, bool bIsError = true); - C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL); + C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = nullptr, LPVOID lpParam = nullptr); }; extern ConsoleUIController ui; \ No newline at end of file diff --git a/Minecraft.Client/ZombieRenderer.cpp b/Minecraft.Client/ZombieRenderer.cpp index 9db758075..10d13b269 100644 --- a/Minecraft.Client/ZombieRenderer.cpp +++ b/Minecraft.Client/ZombieRenderer.cpp @@ -14,11 +14,11 @@ ZombieRenderer::ZombieRenderer() : HumanoidMobRenderer(new ZombieModel(), .5f, 1 defaultModel = humanoidModel; villagerModel = new VillagerZombieModel(); - defaultArmorParts1 = NULL; - defaultArmorParts2 = NULL; + defaultArmorParts1 = nullptr; + defaultArmorParts2 = nullptr; - villagerArmorParts1 = NULL; - villagerArmorParts2 = NULL; + villagerArmorParts1 = nullptr; + villagerArmorParts2 = nullptr; createArmorParts(); } diff --git a/Minecraft.Client/stubs.h b/Minecraft.Client/stubs.h index f4ae056f2..10ba2d053 100644 --- a/Minecraft.Client/stubs.h +++ b/Minecraft.Client/stubs.h @@ -170,15 +170,15 @@ class ZipFile { public: ZipFile(File *file) {} - InputStream *getInputStream(ZipEntry *entry) { return NULL; } - ZipEntry *getEntry(const wstring& name) {return NULL;} + InputStream *getInputStream(ZipEntry *entry) { return nullptr; } + ZipEntry *getEntry(const wstring& name) {return nullptr;} void close() {} }; class ImageIO { public: - static BufferedImage *read(InputStream *in) { return NULL; } + static BufferedImage *read(InputStream *in) { return nullptr; } }; class Keyboard diff --git a/Minecraft.World/AABB.cpp b/Minecraft.World/AABB.cpp index 6610bc27e..af0501b49 100644 --- a/Minecraft.World/AABB.cpp +++ b/Minecraft.World/AABB.cpp @@ -8,7 +8,7 @@ #include "HitResult.h" DWORD AABB::tlsIdx = 0; -AABB::ThreadStorage *AABB::tlsDefault = NULL; +AABB::ThreadStorage *AABB::tlsDefault = nullptr; AABB::ThreadStorage::ThreadStorage() { @@ -25,7 +25,7 @@ AABB::ThreadStorage::~ThreadStorage() void AABB::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == NULL ) + if(tlsDefault == nullptr ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -286,23 +286,23 @@ HitResult *AABB::clip(Vec3 *a, Vec3 *b) Vec3 *zh0 = a->clipZ(b, z0); Vec3 *zh1 = a->clipZ(b, z1); - if (!containsX(xh0)) xh0 = NULL; - if (!containsX(xh1)) xh1 = NULL; - if (!containsY(yh0)) yh0 = NULL; - if (!containsY(yh1)) yh1 = NULL; - if (!containsZ(zh0)) zh0 = NULL; - if (!containsZ(zh1)) zh1 = NULL; + if (!containsX(xh0)) xh0 = nullptr; + if (!containsX(xh1)) xh1 = nullptr; + if (!containsY(yh0)) yh0 = nullptr; + if (!containsY(yh1)) yh1 = nullptr; + if (!containsZ(zh0)) zh0 = nullptr; + if (!containsZ(zh1)) zh1 = nullptr; - Vec3 *closest = NULL; + Vec3 *closest = nullptr; - if (xh0 != NULL && (closest == NULL || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0; - if (xh1 != NULL && (closest == NULL || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1; - if (yh0 != NULL && (closest == NULL || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0; - if (yh1 != NULL && (closest == NULL || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1; - if (zh0 != NULL && (closest == NULL || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0; - if (zh1 != NULL && (closest == NULL || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1; + if (xh0 != nullptr && (closest == nullptr || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0; + if (xh1 != nullptr && (closest == nullptr || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1; + if (yh0 != nullptr && (closest == nullptr || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0; + if (yh1 != nullptr && (closest == nullptr || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1; + if (zh0 != nullptr && (closest == nullptr || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0; + if (zh1 != nullptr && (closest == nullptr || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1; - if (closest == NULL) return NULL; + if (closest == nullptr) return nullptr; int face = -1; @@ -319,19 +319,19 @@ HitResult *AABB::clip(Vec3 *a, Vec3 *b) bool AABB::containsX(Vec3 *v) { - if (v == NULL) return false; + if (v == nullptr) return false; return v->y >= y0 && v->y <= y1 && v->z >= z0 && v->z <= z1; } bool AABB::containsY(Vec3 *v) { - if (v == NULL) return false; + if (v == nullptr) return false; return v->x >= x0 && v->x <= x1 && v->z >= z0 && v->z <= z1; } bool AABB::containsZ(Vec3 *v) { - if (v == NULL) return false; + if (v == nullptr) return false; return v->x >= x0 && v->x <= x1 && v->y >= y0 && v->y <= y1; } diff --git a/Minecraft.World/AbstractContainerMenu.cpp b/Minecraft.World/AbstractContainerMenu.cpp index 2cbea246d..637d05a68 100644 --- a/Minecraft.World/AbstractContainerMenu.cpp +++ b/Minecraft.World/AbstractContainerMenu.cpp @@ -80,7 +80,7 @@ void AbstractContainerMenu::broadcastChanges() { // 4J Stu - Added 0 count check. There is a bug in the Java with anvils that means this broadcast // happens while we are in the middle of quickmoving, and before the slot properly gets set to null - expected = (current == NULL || current->count == 0) ? nullptr : current->copy(); + expected = (current == nullptr || current->count == 0) ? nullptr : current->copy(); lastSlots[i] = expected; m_bNeedsRendered = true; @@ -103,7 +103,7 @@ bool AbstractContainerMenu::needsRendered() shared_ptr expected = lastSlots.at(i); if (!ItemInstance::matches(expected, current)) { - expected = current == NULL ? nullptr : current->copy(); + expected = current == nullptr ? nullptr : current->copy(); lastSlots[i] = expected; needsRendered = true; } @@ -126,7 +126,7 @@ Slot *AbstractContainerMenu::getSlotFor(shared_ptr c, int index) return slot; } } - return NULL; + return nullptr; } Slot *AbstractContainerMenu::getSlot(int index) @@ -137,7 +137,7 @@ Slot *AbstractContainerMenu::getSlot(int index) shared_ptr AbstractContainerMenu::quickMoveStack(shared_ptr player, int slotIndex) { Slot *slot = slots.at(slotIndex); - if (slot != NULL) + if (slot != nullptr) { return slot->getItem(); } @@ -158,7 +158,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { resetQuickCraft(); } - else if (inventory->getCarried() == NULL) + else if (inventory->getCarried() == nullptr) { resetQuickCraft(); } @@ -180,7 +180,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { Slot *slot = slots.at(slotIndex); - if (slot != NULL && canItemQuickReplace(slot, inventory->getCarried(), true) && slot->mayPlace(inventory->getCarried()) && inventory->getCarried()->count > quickcraftSlots.size() && canDragTo(slot)) + if (slot != nullptr && canItemQuickReplace(slot, inventory->getCarried(), true) && slot->mayPlace(inventory->getCarried()) && inventory->getCarried()->count > quickcraftSlots.size() && canDragTo(slot)) { quickcraftSlots.insert(slot); } @@ -231,7 +231,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { if (slotIndex == SLOT_CLICKED_OUTSIDE) { - if (inventory->getCarried() != NULL) + if (inventory->getCarried() != nullptr) { if (slotIndex == SLOT_CLICKED_OUTSIDE) { @@ -253,10 +253,10 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { if (slotIndex < 0) return nullptr; Slot *slot = slots.at(slotIndex); - if(slot != NULL && slot->mayPickup(player)) + if(slot != nullptr && slot->mayPickup(player)) { shared_ptr piiClicked = quickMoveStack(player, slotIndex); - if (piiClicked != NULL) + if (piiClicked != nullptr) { int oldType = piiClicked->id; @@ -269,9 +269,9 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto // 4J Stu - Remove the reference to this before we start a recursive loop piiClicked = nullptr; - if (slot != NULL) + if (slot != nullptr) { - if (slot->getItem() != NULL && slot->getItem()->id == oldType) + if (slot->getItem() != nullptr && slot->getItem()->id == oldType) { if(looped) { @@ -293,19 +293,19 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto if (slotIndex < 0) return nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL) + if (slot != nullptr) { shared_ptr clicked = slot->getItem(); shared_ptr carried = inventory->getCarried(); - if (clicked != NULL) + if (clicked != nullptr) { clickedEntity = clicked->copy(); } - if (clicked == NULL) + if (clicked == nullptr) { - if (carried != NULL && slot->mayPlace(carried)) + if (carried != nullptr && slot->mayPlace(carried)) { int c = buttonNum == 0 ? carried->count : 1; if (c > slot->getMaxStackSize()) @@ -326,7 +326,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto else if (buttonNum == 1 && mayCombine(slot, carried)) { shared_ptr combined = slot->combine(carried); - if(combined != NULL) + if(combined != nullptr) { slot->set(combined); if(!player->abilities.instabuild) carried->remove(1); @@ -338,7 +338,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto } else if (slot->mayPickup(player)) { - if (carried == NULL) + if (carried == nullptr) { // pick up to empty hand int c = buttonNum == 0 ? clicked->count : (clicked->count + 1) / 2; @@ -412,7 +412,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto if (slot->mayPickup(player)) { shared_ptr current = inventory->getItem(buttonNum); - bool canMove = current == NULL || (slot->container == inventory && slot->mayPlace(current)); + bool canMove = current == nullptr || (slot->container == inventory && slot->mayPlace(current)); int freeSlot = -1; if (!canMove) @@ -426,7 +426,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto shared_ptr taking = slot->getItem(); inventory->setItem(buttonNum, taking); - if ((slot->container == inventory && slot->mayPlace(current)) || current == NULL) + if ((slot->container == inventory && slot->mayPlace(current)) || current == nullptr) { slot->remove(taking->count); slot->set(current); @@ -440,27 +440,27 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto slot->onTake(player, taking); } } - else if (!slot->hasItem() && current != NULL && slot->mayPlace(current)) + else if (!slot->hasItem() && current != nullptr && slot->mayPlace(current)) { inventory->setItem(buttonNum, nullptr); slot->set(current); } } } - else if (clickType == CLICK_CLONE && player->abilities.instabuild && inventory->getCarried() == NULL && slotIndex >= 0) + else if (clickType == CLICK_CLONE && player->abilities.instabuild && inventory->getCarried() == nullptr && slotIndex >= 0) { Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr copy = slot->getItem()->copy(); copy->count = copy->getMaxStackSize(); inventory->setCarried(copy); } } - else if (clickType == CLICK_THROW && inventory->getCarried() == NULL && slotIndex >= 0) + else if (clickType == CLICK_THROW && inventory->getCarried() == nullptr && slotIndex >= 0) { Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem() && slot->mayPickup(player)) + if (slot != nullptr && slot->hasItem() && slot->mayPickup(player)) { shared_ptr item = slot->remove(buttonNum == 0 ? 1 : slot->getItem()->count); slot->onTake(player, item); @@ -472,7 +472,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto Slot *slot = slots.at(slotIndex); shared_ptr carried = inventory->getCarried(); - if (carried != NULL && (slot == NULL || !slot->hasItem() || !slot->mayPickup(player))) + if (carried != nullptr && (slot == nullptr || !slot->hasItem() || !slot->mayPickup(player))) { int start = buttonNum == 0 ? 0 : slots.size() - 1; int step = buttonNum == 0 ? 1 : -1; @@ -514,7 +514,7 @@ bool AbstractContainerMenu::canTakeItemForPickAll(shared_ptr carri // 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative void AbstractContainerMenu::loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr player) { - while( clicked(slotIndex, buttonNum, CLICK_QUICK_MOVE, player, true) != NULL) + while( clicked(slotIndex, buttonNum, CLICK_QUICK_MOVE, player, true) != nullptr) { } } @@ -527,7 +527,7 @@ bool AbstractContainerMenu::mayCombine(Slot *slot, shared_ptr item void AbstractContainerMenu::removed(shared_ptr player) { shared_ptr inventory = player->inventory; - if (inventory->getCarried() != NULL) + if (inventory->getCarried() != nullptr) { player->drop(inventory->getCarried()); inventory->setCarried(nullptr); @@ -605,7 +605,7 @@ bool AbstractContainerMenu::moveItemStackTo(shared_ptr itemStack, Slot *slot = slots.at(destSlot); shared_ptr target = slot->getItem(); - if (target != NULL && target->id == itemStack->id && (!itemStack->isStackedByData() || itemStack->getAuxValue() == target->getAuxValue()) + if (target != nullptr && target->id == itemStack->id && (!itemStack->isStackedByData() || itemStack->getAuxValue() == target->getAuxValue()) && ItemInstance::tagMatches(itemStack, target) ) { int totalStack = target->count + itemStack->count; @@ -652,7 +652,7 @@ bool AbstractContainerMenu::moveItemStackTo(shared_ptr itemStack, Slot *slot = slots.at(destSlot); shared_ptr target = slot->getItem(); - if (target == NULL) + if (target == nullptr) { slot->set(itemStack->copy()); slot->setChanged(); @@ -707,9 +707,9 @@ void AbstractContainerMenu::resetQuickCraft() bool AbstractContainerMenu::canItemQuickReplace(Slot *slot, shared_ptr item, bool ignoreSize) { - bool canReplace = slot == NULL || !slot->hasItem(); + bool canReplace = slot == nullptr || !slot->hasItem(); - if (slot != NULL && slot->hasItem() && item != NULL && item->sameItem(slot->getItem()) && ItemInstance::tagMatches(slot->getItem(), item)) + if (slot != nullptr && slot->hasItem() && item != nullptr && item->sameItem(slot->getItem()) && ItemInstance::tagMatches(slot->getItem(), item)) { canReplace |= slot->getItem()->count + (ignoreSize ? 0 : item->count) <= item->getMaxStackSize(); } @@ -739,7 +739,7 @@ bool AbstractContainerMenu::canDragTo(Slot *slot) int AbstractContainerMenu::getRedstoneSignalFromContainer(shared_ptr container) { - if (container == NULL) return 0; + if (container == nullptr) return 0; int count = 0; float totalPct = 0; @@ -747,7 +747,7 @@ int AbstractContainerMenu::getRedstoneSignalFromContainer(shared_ptr { shared_ptr item = container->getItem(i); - if (item != NULL) + if (item != nullptr) { totalPct += item->count / static_cast(min(container->getMaxStackSize(), item->getMaxStackSize())); count++; diff --git a/Minecraft.World/Achievement.cpp b/Minecraft.World/Achievement.cpp index a0dfd5332..cd5a68df7 100644 --- a/Minecraft.World/Achievement.cpp +++ b/Minecraft.World/Achievement.cpp @@ -58,7 +58,7 @@ bool Achievement::isAchievement() wstring Achievement::getDescription() { - if (descFormatter != NULL) + if (descFormatter != nullptr) { return descFormatter->format(desc); } diff --git a/Minecraft.World/Achievements.cpp b/Minecraft.World/Achievements.cpp index a3d33cbd8..1b00acc00 100644 --- a/Minecraft.World/Achievements.cpp +++ b/Minecraft.World/Achievements.cpp @@ -17,79 +17,79 @@ int Achievements::yMax = 0; vector *Achievements::achievements = new vector; -Achievement *Achievements::openInventory = NULL; -Achievement *Achievements::mineWood = NULL; -Achievement *Achievements::buildWorkbench = NULL; -Achievement *Achievements::buildPickaxe = NULL; -Achievement *Achievements::buildFurnace = NULL; -Achievement *Achievements::acquireIron = NULL; -Achievement *Achievements::buildHoe = NULL; -Achievement *Achievements::makeBread = NULL; -Achievement *Achievements::bakeCake = NULL; -Achievement *Achievements::buildBetterPickaxe = NULL; -Achievement *Achievements::cookFish = NULL; -Achievement *Achievements::onARail = NULL; -Achievement *Achievements::buildSword = NULL; -Achievement *Achievements::killEnemy = NULL; -Achievement *Achievements::killCow = NULL; -Achievement *Achievements::flyPig = NULL; +Achievement *Achievements::openInventory = nullptr; +Achievement *Achievements::mineWood = nullptr; +Achievement *Achievements::buildWorkbench = nullptr; +Achievement *Achievements::buildPickaxe = nullptr; +Achievement *Achievements::buildFurnace = nullptr; +Achievement *Achievements::acquireIron = nullptr; +Achievement *Achievements::buildHoe = nullptr; +Achievement *Achievements::makeBread = nullptr; +Achievement *Achievements::bakeCake = nullptr; +Achievement *Achievements::buildBetterPickaxe = nullptr; +Achievement *Achievements::cookFish = nullptr; +Achievement *Achievements::onARail = nullptr; +Achievement *Achievements::buildSword = nullptr; +Achievement *Achievements::killEnemy = nullptr; +Achievement *Achievements::killCow = nullptr; +Achievement *Achievements::flyPig = nullptr; -Achievement *Achievements::snipeSkeleton = NULL; -Achievement *Achievements::diamonds = NULL; -//Achievement *Achievements::portal = NULL; -Achievement *Achievements::ghast = NULL; -Achievement *Achievements::blazeRod = NULL; -Achievement *Achievements::potion = NULL; -Achievement *Achievements::theEnd = NULL; -Achievement *Achievements::winGame = NULL; -Achievement *Achievements::enchantments = NULL; -//Achievement *Achievements::overkill = NULL; -//Achievement *Achievements::bookcase = NULL; +Achievement *Achievements::snipeSkeleton = nullptr; +Achievement *Achievements::diamonds = nullptr; +//Achievement *Achievements::portal = nullptr; +Achievement *Achievements::ghast = nullptr; +Achievement *Achievements::blazeRod = nullptr; +Achievement *Achievements::potion = nullptr; +Achievement *Achievements::theEnd = nullptr; +Achievement *Achievements::winGame = nullptr; +Achievement *Achievements::enchantments = nullptr; +//Achievement *Achievements::overkill = nullptr; +//Achievement *Achievements::bookcase = nullptr; // 4J : WESTY : Added new acheivements. -Achievement *Achievements::leaderOfThePack = NULL; -Achievement *Achievements::MOARTools = NULL; -Achievement *Achievements::dispenseWithThis = NULL; -Achievement *Achievements::InToTheNether = NULL; +Achievement *Achievements::leaderOfThePack = nullptr; +Achievement *Achievements::MOARTools = nullptr; +Achievement *Achievements::dispenseWithThis = nullptr; +Achievement *Achievements::InToTheNether = nullptr; // 4J : WESTY : Added other awards. -Achievement *Achievements::socialPost = NULL; -Achievement *Achievements::eatPorkChop = NULL; -Achievement *Achievements::play100Days = NULL; -Achievement *Achievements::arrowKillCreeper = NULL; -Achievement *Achievements::mine100Blocks = NULL; -Achievement *Achievements::kill10Creepers = NULL; +Achievement *Achievements::socialPost = nullptr; +Achievement *Achievements::eatPorkChop = nullptr; +Achievement *Achievements::play100Days = nullptr; +Achievement *Achievements::arrowKillCreeper = nullptr; +Achievement *Achievements::mine100Blocks = nullptr; +Achievement *Achievements::kill10Creepers = nullptr; #ifdef _EXTENDED_ACHIEVEMENTS -Achievement *Achievements::overkill = NULL; // Restored old achivements. -Achievement *Achievements::bookcase = NULL; // Restored old achivements. +Achievement *Achievements::overkill = nullptr; // Restored old achivements. +Achievement *Achievements::bookcase = nullptr; // Restored old achivements. // 4J-JEV: New Achievements for Orbis. -Achievement *Achievements::adventuringTime = NULL; -Achievement *Achievements::repopulation = NULL; -//Achievement *Achievements::porkChop = NULL; -Achievement *Achievements::diamondsToYou = NULL; -//Achievement *Achievements::passingTheTime = NULL; -//Achievement *Achievements::archer = NULL; -Achievement *Achievements::theHaggler = NULL; -Achievement *Achievements::potPlanter = NULL; -Achievement *Achievements::itsASign = NULL; -Achievement *Achievements::ironBelly = NULL; -Achievement *Achievements::haveAShearfulDay = NULL; -Achievement *Achievements::rainbowCollection = NULL; -Achievement *Achievements::stayinFrosty = NULL; -Achievement *Achievements::chestfulOfCobblestone = NULL; -Achievement *Achievements::renewableEnergy = NULL; -Achievement *Achievements::musicToMyEars = NULL; -Achievement *Achievements::bodyGuard = NULL; -Achievement *Achievements::ironMan = NULL; -Achievement *Achievements::zombieDoctor = NULL; -Achievement *Achievements::lionTamer = NULL; +Achievement *Achievements::adventuringTime = nullptr; +Achievement *Achievements::repopulation = nullptr; +//Achievement *Achievements::porkChop = nullptr; +Achievement *Achievements::diamondsToYou = nullptr; +//Achievement *Achievements::passingTheTime = nullptr; +//Achievement *Achievements::archer = nullptr; +Achievement *Achievements::theHaggler = nullptr; +Achievement *Achievements::potPlanter = nullptr; +Achievement *Achievements::itsASign = nullptr; +Achievement *Achievements::ironBelly = nullptr; +Achievement *Achievements::haveAShearfulDay = nullptr; +Achievement *Achievements::rainbowCollection = nullptr; +Achievement *Achievements::stayinFrosty = nullptr; +Achievement *Achievements::chestfulOfCobblestone = nullptr; +Achievement *Achievements::renewableEnergy = nullptr; +Achievement *Achievements::musicToMyEars = nullptr; +Achievement *Achievements::bodyGuard = nullptr; +Achievement *Achievements::ironMan = nullptr; +Achievement *Achievements::zombieDoctor = nullptr; +Achievement *Achievements::lionTamer = nullptr; #endif void Achievements::staticCtor() { - Achievements::openInventory = (new Achievement(eAward_TakingInventory, L"openInventory", 0, 0, Item::book, NULL))->setAwardLocallyOnly()->postConstruct(); + Achievements::openInventory = (new Achievement(eAward_TakingInventory, L"openInventory", 0, 0, Item::book, nullptr))->setAwardLocallyOnly()->postConstruct(); Achievements::mineWood = (new Achievement(eAward_GettingWood, L"mineWood", 2, 1, Tile::treeTrunk, (Achievement *) openInventory))->postConstruct(); Achievements::buildWorkbench = (new Achievement(eAward_Benchmarking, L"buildWorkBench", 4, -1, Tile::workBench, (Achievement *) mineWood))->postConstruct(); Achievements::buildPickaxe = (new Achievement(eAward_TimeToMine, L"buildPickaxe", 4, 2, Item::pickAxe_wood, (Achievement *) buildWorkbench))->postConstruct(); @@ -152,26 +152,26 @@ void Achievements::staticCtor() Achievements::overkill = (new Achievement(eAward_overkill, L"overkill", -4,1, Item::sword_diamond, (Achievement *)enchantments) )->setGolden()->postConstruct(); Achievements::bookcase = (new Achievement(eAward_bookcase, L"bookcase", -3,6, Tile::bookshelf, (Achievement *)enchantments) )->postConstruct(); - Achievements::adventuringTime = (new Achievement(eAward_adventuringTime, L"adventuringTime", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); - Achievements::repopulation = (new Achievement(eAward_repopulation, L"repopulation", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::adventuringTime = (new Achievement(eAward_adventuringTime, L"adventuringTime", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); + Achievements::repopulation = (new Achievement(eAward_repopulation, L"repopulation", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); //Achievements::porkChoop // // // // // // - Achievements::diamondsToYou = (new Achievement(eAward_diamondsToYou, L"diamondsToYou", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - //Achievements::passingTheTime = (new Achievement(eAward_play100Days, L"passingTheTime", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - //Achievements::archer = (new Achievement(eAward_arrowKillCreeper, L"archer", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::theHaggler = (new Achievement(eAward_theHaggler, L"theHaggler", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); - Achievements::potPlanter = (new Achievement(eAward_potPlanter, L"potPlanter", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); - Achievements::itsASign = (new Achievement(eAward_itsASign, L"itsASign", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); - Achievements::ironBelly = (new Achievement(eAward_ironBelly, L"ironBelly", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::haveAShearfulDay = (new Achievement(eAward_haveAShearfulDay, L"haveAShearfulDay", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::rainbowCollection = (new Achievement(eAward_rainbowCollection, L"rainbowCollection", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); - Achievements::stayinFrosty = (new Achievement(eAward_stayinFrosty, L"stayingFrosty", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::chestfulOfCobblestone = (new Achievement(eAward_chestfulOfCobblestone, L"chestfulOfCobblestone", 0,0, Tile::bookshelf, (Achievement*) NULL) )->setAwardLocallyOnly()->postConstruct(); - Achievements::renewableEnergy = (new Achievement(eAward_renewableEnergy, L"renewableEnergy", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::musicToMyEars = (new Achievement(eAward_musicToMyEars, L"musicToMyEars", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::bodyGuard = (new Achievement(eAward_bodyGuard, L"bodyGuard", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::ironMan = (new Achievement(eAward_ironMan, L"ironMan", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::zombieDoctor = (new Achievement(eAward_zombieDoctor, L"zombieDoctor", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); - Achievements::lionTamer = (new Achievement(eAward_lionTamer, L"lionTamer", 0,0, Tile::bookshelf, (Achievement*) NULL) )->postConstruct(); + Achievements::diamondsToYou = (new Achievement(eAward_diamondsToYou, L"diamondsToYou", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + //Achievements::passingTheTime = (new Achievement(eAward_play100Days, L"passingTheTime", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + //Achievements::archer = (new Achievement(eAward_arrowKillCreeper, L"archer", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::theHaggler = (new Achievement(eAward_theHaggler, L"theHaggler", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); + Achievements::potPlanter = (new Achievement(eAward_potPlanter, L"potPlanter", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); + Achievements::itsASign = (new Achievement(eAward_itsASign, L"itsASign", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); + Achievements::ironBelly = (new Achievement(eAward_ironBelly, L"ironBelly", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::haveAShearfulDay = (new Achievement(eAward_haveAShearfulDay, L"haveAShearfulDay", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::rainbowCollection = (new Achievement(eAward_rainbowCollection, L"rainbowCollection", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); + Achievements::stayinFrosty = (new Achievement(eAward_stayinFrosty, L"stayingFrosty", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::chestfulOfCobblestone = (new Achievement(eAward_chestfulOfCobblestone, L"chestfulOfCobblestone", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->setAwardLocallyOnly()->postConstruct(); + Achievements::renewableEnergy = (new Achievement(eAward_renewableEnergy, L"renewableEnergy", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::musicToMyEars = (new Achievement(eAward_musicToMyEars, L"musicToMyEars", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::bodyGuard = (new Achievement(eAward_bodyGuard, L"bodyGuard", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::ironMan = (new Achievement(eAward_ironMan, L"ironMan", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::zombieDoctor = (new Achievement(eAward_zombieDoctor, L"zombieDoctor", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); + Achievements::lionTamer = (new Achievement(eAward_lionTamer, L"lionTamer", 0,0, Tile::bookshelf, (Achievement*) nullptr) )->postConstruct(); #endif } diff --git a/Minecraft.World/AddMobPacket.cpp b/Minecraft.World/AddMobPacket.cpp index d224b2931..d5ccfe084 100644 --- a/Minecraft.World/AddMobPacket.cpp +++ b/Minecraft.World/AddMobPacket.cpp @@ -17,7 +17,7 @@ AddMobPacket::AddMobPacket() yRot = 0; xRot = 0; entityData = nullptr; - unpack = NULL; + unpack = nullptr; } AddMobPacket::~AddMobPacket() @@ -61,7 +61,7 @@ AddMobPacket::AddMobPacket(shared_ptr mob, int yRotp, int xRotp, i // printf("%d: New add mob rot %d\n",id,yRot); entityData = mob->getEntityData(); - unpack = NULL; + unpack = nullptr; } void AddMobPacket::read(DataInputStream *dis) //throws IOException @@ -118,11 +118,11 @@ void AddMobPacket::handle(PacketListener *listener) int AddMobPacket::getEstimatedSize() { int size = 11; - if( entityData != NULL ) + if( entityData != nullptr ) { size += entityData->getSizeInBytes(); } - else if( unpack != NULL ) + else if( unpack != nullptr ) { // 4J Stu - This is an incoming value which we aren't currently analysing //size += unpack->get @@ -132,7 +132,7 @@ int AddMobPacket::getEstimatedSize() vector > *AddMobPacket::getUnpackedData() { - if (unpack == NULL) + if (unpack == nullptr) { unpack = entityData->getAll(); } diff --git a/Minecraft.World/AddPlayerPacket.cpp b/Minecraft.World/AddPlayerPacket.cpp index 6b3e26365..fbee1fc52 100644 --- a/Minecraft.World/AddPlayerPacket.cpp +++ b/Minecraft.World/AddPlayerPacket.cpp @@ -24,12 +24,12 @@ AddPlayerPacket::AddPlayerPacket() m_capeId = 0; m_uiGamePrivileges = 0; entityData = nullptr; - unpack = NULL; + unpack = nullptr; } AddPlayerPacket::~AddPlayerPacket() { - if(unpack != NULL) delete unpack; + if(unpack != nullptr) delete unpack; } AddPlayerPacket::AddPlayerPacket(shared_ptr player, PlayerUID xuid, PlayerUID OnlineXuid,int xp, int yp, int zp, int yRotp, int xRotp, int yHeadRotp) @@ -51,7 +51,7 @@ AddPlayerPacket::AddPlayerPacket(shared_ptr player, PlayerUID xuid, Play //printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot); shared_ptr itemInstance = player->inventory->getSelected(); - carriedItem = itemInstance == NULL ? 0 : itemInstance->id; + carriedItem = itemInstance == nullptr ? 0 : itemInstance->id; this->xuid = xuid; this->OnlineXuid = OnlineXuid; @@ -61,7 +61,7 @@ AddPlayerPacket::AddPlayerPacket(shared_ptr player, PlayerUID xuid, Play m_uiGamePrivileges = player->getAllPlayerGamePrivileges(); entityData = player->getEntityData(); - unpack = NULL; + unpack = nullptr; } void AddPlayerPacket::read(DataInputStream *dis) //throws IOException @@ -119,11 +119,11 @@ int AddPlayerPacket::getEstimatedSize() { int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) + sizeof(byte); - if( entityData != NULL ) + if( entityData != nullptr ) { iSize += entityData->getSizeInBytes(); } - else if( unpack != NULL ) + else if( unpack != nullptr ) { // 4J Stu - This is an incoming value which we aren't currently analysing //iSize += unpack->get @@ -134,7 +134,7 @@ int AddPlayerPacket::getEstimatedSize() vector > *AddPlayerPacket::getUnpackedData() { - if (unpack == NULL) + if (unpack == nullptr) { unpack = entityData->getAll(); } diff --git a/Minecraft.World/AgableMob.cpp b/Minecraft.World/AgableMob.cpp index 307aa767f..892a14e56 100644 --- a/Minecraft.World/AgableMob.cpp +++ b/Minecraft.World/AgableMob.cpp @@ -17,7 +17,7 @@ bool AgableMob::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != NULL && item->id == Item::spawnEgg_Id) + if (item != nullptr && item->id == Item::spawnEgg_Id) { if (!level->isClientSide) { @@ -27,10 +27,10 @@ bool AgableMob::mobInteract(shared_ptr player) int error; shared_ptr result = SpawnEggItem::canSpawn(item->getAuxValue(), level, &error); - if (result != NULL) + if (result != nullptr) { shared_ptr offspring = getBreedOffspring(dynamic_pointer_cast(shared_from_this())); - if (offspring != NULL) + if (offspring != nullptr) { offspring->setAge(BABY_START_AGE); offspring->moveTo(x, y, z, 0, 0); diff --git a/Minecraft.World/Animal.cpp b/Minecraft.World/Animal.cpp index 77048d06d..bd9bc3fad 100644 --- a/Minecraft.World/Animal.cpp +++ b/Minecraft.World/Animal.cpp @@ -78,7 +78,7 @@ void Animal::checkHurtTarget(shared_ptr target, float d) } shared_ptr p = dynamic_pointer_cast(target); - if (p->getSelectedItem() == NULL || !isFood(p->getSelectedItem())) + if (p->getSelectedItem() == nullptr || !isFood(p->getSelectedItem())) { attackTarget = nullptr; } @@ -97,7 +97,7 @@ void Animal::checkHurtTarget(shared_ptr target, float d) } else if (getInLoveValue() > 0 && a->getInLoveValue() > 0) { - if (a->attackTarget == NULL) a->attackTarget = shared_from_this(); + if (a->attackTarget == nullptr) a->attackTarget = shared_from_this(); if (a->attackTarget == shared_from_this() && d < 3.5) { @@ -134,9 +134,9 @@ void Animal::breedWith(shared_ptr target) target->loveTime = 0; target->setInLoveValue(0); - // 4J - we have offspring of NULL returned when we have hit our limits of spawning any particular type of animal. In these cases try and do everything we can apart from actually + // 4J - we have offspring of nullptr returned when we have hit our limits of spawning any particular type of animal. In these cases try and do everything we can apart from actually // spawning the entity. - if (offspring != NULL) + if (offspring != nullptr) { // Only want to set the age to this +ve value if something is actually spawned, as during this period the animal will attempt to follow offspring and ignore players. setAge(5 * 60 * 20); @@ -169,7 +169,7 @@ float Animal::getWalkTargetValue(int x, int y, int z) bool Animal::hurt(DamageSource *dmgSource, float dmg) { if (isInvulnerable()) return false; - if (dynamic_cast(dmgSource) != NULL) + if (dynamic_cast(dmgSource) != nullptr) { shared_ptr source = dmgSource->getDirectEntity(); @@ -179,12 +179,12 @@ bool Animal::hurt(DamageSource *dmgSource, float dmg) return false; } - if ( (source != NULL) && source->instanceof(eTYPE_ARROW) ) + if ( (source != nullptr) && source->instanceof(eTYPE_ARROW) ) { shared_ptr arrow = dynamic_pointer_cast(source); // 4J: Check that the arrow's owner can attack animals (dispenser arrows are not owned) - if (arrow->owner != NULL && arrow->owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(arrow->owner)->isAllowedToAttackAnimals() ) + if (arrow->owner != nullptr && arrow->owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(arrow->owner)->isAllowedToAttackAnimals() ) { return false; } @@ -196,7 +196,7 @@ bool Animal::hurt(DamageSource *dmgSource, float dmg) if (!useNewAi()) { AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); - if (speed->getModifier(eModifierId_MOB_FLEEING) == NULL) + if (speed->getModifier(eModifierId_MOB_FLEEING) == nullptr) { speed->addModifier(new AttributeModifier(*Animal::SPEED_MODIFIER_FLEEING)); } @@ -255,7 +255,7 @@ shared_ptr Animal::findAttackTarget() setDespawnProtected(); shared_ptr p = dynamic_pointer_cast(it); - if (p->getSelectedItem() != NULL && this->isFood(p->getSelectedItem())) + if (p->getSelectedItem() != nullptr && this->isFood(p->getSelectedItem())) { delete players; return p; @@ -317,7 +317,7 @@ bool Animal::isFood(shared_ptr itemInstance) bool Animal::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != NULL && isFood(item) && getAge() == 0 && getInLoveValue() <= 0) + if (item != nullptr && isFood(item) && getAge() == 0 && getInLoveValue() <= 0) { if (!player->abilities.instabuild) { diff --git a/Minecraft.World/AnvilMenu.cpp b/Minecraft.World/AnvilMenu.cpp index 83d381425..de3315544 100644 --- a/Minecraft.World/AnvilMenu.cpp +++ b/Minecraft.World/AnvilMenu.cpp @@ -55,7 +55,7 @@ void AnvilMenu::createResult() if (DEBUG_COST) app.DebugPrintf("----"); - if (input == NULL) + if (input == nullptr) { resultSlots->setItem(0, nullptr); cost = 0; @@ -68,15 +68,15 @@ void AnvilMenu::createResult() unordered_map *enchantments = EnchantmentHelper::getEnchantments(result); bool usingBook = false; - tax += input->getBaseRepairCost() + (addition == NULL ? 0 : addition->getBaseRepairCost()); + tax += input->getBaseRepairCost() + (addition == nullptr ? 0 : addition->getBaseRepairCost()); if (DEBUG_COST) { - app.DebugPrintf("Starting with base repair tax of %d (%d + %d)\n", tax, input->getBaseRepairCost(), (addition == NULL ? 0 : addition->getBaseRepairCost())); + app.DebugPrintf("Starting with base repair tax of %d (%d + %d)\n", tax, input->getBaseRepairCost(), (addition == nullptr ? 0 : addition->getBaseRepairCost())); } repairItemCountCost = 0; - if (addition != NULL) + if (addition != nullptr) { usingBook = addition->id == Item::enchantedBook_Id && Item::enchantedBook->getEnchantments(addition)->size() > 0; @@ -290,10 +290,10 @@ void AnvilMenu::createResult() result = nullptr; } - if (result != NULL) + if (result != nullptr) { int baseCost = result->getBaseRepairCost(); - if (addition != NULL && baseCost < addition->getBaseRepairCost()) baseCost = addition->getBaseRepairCost(); + if (addition != nullptr && baseCost < addition->getBaseRepairCost()) baseCost = addition->getBaseRepairCost(); if (result->hasCustomHoverName()) baseCost -= 9; if (baseCost < 0) baseCost = 0; baseCost += 2; @@ -344,7 +344,7 @@ void AnvilMenu::removed(shared_ptr player) for (int i = 0; i < repairSlots->getContainerSize(); i++) { shared_ptr item = repairSlots->removeItemNoUpdate(i); - if (item != NULL) + if (item != nullptr) { player->drop(item); } @@ -362,7 +362,7 @@ shared_ptr AnvilMenu::quickMoveStack(shared_ptr player, in { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/AnvilTile.cpp b/Minecraft.World/AnvilTile.cpp index 8789cb7c4..5d186c285 100644 --- a/Minecraft.World/AnvilTile.cpp +++ b/Minecraft.World/AnvilTile.cpp @@ -21,7 +21,7 @@ AnvilTile::AnvilTile(int id) : HeavyTile(id, Material::heavyMetal, isSolidRender { part = PART_BASE; setLightBlock(0); - icons = NULL; + icons = nullptr; } bool AnvilTile::isCubeShaped() diff --git a/Minecraft.World/ArmorDyeRecipe.cpp b/Minecraft.World/ArmorDyeRecipe.cpp index c55cbc592..d3abcc1cc 100644 --- a/Minecraft.World/ArmorDyeRecipe.cpp +++ b/Minecraft.World/ArmorDyeRecipe.cpp @@ -13,12 +13,12 @@ bool ArmorDyeRecipe::matches(shared_ptr craftSlots, Level *le for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == NULL) continue; + if (item == nullptr) continue; ArmorItem *armor = dynamic_cast(item->getItem()); if (armor) { - if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL) + if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == nullptr) { target = item; } @@ -37,7 +37,7 @@ bool ArmorDyeRecipe::matches(shared_ptr craftSlots, Level *le } } - return target != NULL && !dyes.empty(); + return target != nullptr && !dyes.empty(); } shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptr craftSlots) @@ -46,19 +46,19 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrgetContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == NULL) continue; + if (item == nullptr) continue; armor = dynamic_cast(item->getItem()); if (armor) { - if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == NULL) + if (armor->getMaterial() == ArmorItem::ArmorMaterial::CLOTH && target == nullptr) { target = item->copy(); target->count = 1; @@ -104,7 +104,7 @@ shared_ptr ArmorDyeRecipe::assembleDyedArmor(shared_ptrgetAuxValue(); TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24; diff --git a/Minecraft.World/ArmorItem.cpp b/Minecraft.World/ArmorItem.cpp index 114b200b9..93d58cdd7 100644 --- a/Minecraft.World/ArmorItem.cpp +++ b/Minecraft.World/ArmorItem.cpp @@ -170,9 +170,9 @@ int ArmorItem::getColor(shared_ptr item) if (armorType != ArmorMaterial::CLOTH) return -1; CompoundTag *tag = item->getTag(); - if (tag == NULL) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR ); + if (tag == nullptr) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR ); CompoundTag *display = tag->getCompound(L"display"); - if (display == NULL) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR ); + if (display == nullptr) return Minecraft::GetInstance()->getColourTable()->getColor( DEFAULT_LEATHER_COLOR ); if (display->contains(L"color")) { @@ -197,7 +197,7 @@ void ArmorItem::clearColor(shared_ptr item) { if (armorType != ArmorMaterial::CLOTH) return; CompoundTag *tag = item->getTag(); - if (tag == NULL) return; + if (tag == nullptr) return; CompoundTag *display = tag->getCompound(L"display"); if (display->contains(L"color")) display->remove(L"color"); } @@ -215,7 +215,7 @@ void ArmorItem::setColor(shared_ptr item, int color) CompoundTag *tag = item->getTag(); - if (tag == NULL) + if (tag == nullptr) { tag = new CompoundTag(); item->setTag(tag); @@ -262,5 +262,5 @@ Icon *ArmorItem::getEmptyIcon(int slot) return Item::boots_diamond->iconEmpty; } - return NULL; + return nullptr; } \ No newline at end of file diff --git a/Minecraft.World/ArmorSlot.cpp b/Minecraft.World/ArmorSlot.cpp index 7707635a5..2e85fed31 100644 --- a/Minecraft.World/ArmorSlot.cpp +++ b/Minecraft.World/ArmorSlot.cpp @@ -19,11 +19,11 @@ int ArmorSlot::getMaxStackSize() const bool ArmorSlot::mayPlace(shared_ptr item) { - if (item == NULL) + if (item == nullptr) { return false; } - if ( dynamic_cast( item->getItem() ) != NULL) + if ( dynamic_cast( item->getItem() ) != nullptr) { return dynamic_cast( item->getItem() )->slot == slotNum; } @@ -43,7 +43,7 @@ Icon *ArmorSlot::getNoItemIcon() //bool ArmorSlot::mayCombine(shared_ptr item) //{ // shared_ptr thisItemI = getItem(); -// if(thisItemI == NULL || item == NULL) return false; +// if(thisItemI == nullptr || item == nullptr) return false; // // ArmorItem *thisItem = (ArmorItem *)thisItemI->getItem(); // bool thisIsDyableArmor = thisItem->getMaterial() == ArmorItem::ArmorMaterial::CLOTH; @@ -53,7 +53,7 @@ Icon *ArmorSlot::getNoItemIcon() // //shared_ptr ArmorSlot::combine(shared_ptr item) //{ -// shared_ptr craftSlots = shared_ptr( new CraftingContainer(NULL, 2, 2) ); +// shared_ptr craftSlots = shared_ptr( new CraftingContainer(nullptr, 2, 2) ); // craftSlots->setItem(0, item); // craftSlots->setItem(1, getItem()); // Armour item needs to go second // shared_ptr result = ArmorDyeRecipe::assembleDyedArmor(craftSlots); diff --git a/Minecraft.World/ArrayWithLength.h b/Minecraft.World/ArrayWithLength.h index e22724c6a..ab491aa80 100644 --- a/Minecraft.World/ArrayWithLength.h +++ b/Minecraft.World/ArrayWithLength.h @@ -10,7 +10,7 @@ template class arrayWithLength public: T *data; unsigned int length; - arrayWithLength() { data = NULL; length = 0; } + arrayWithLength() { data = nullptr; length = 0; } arrayWithLength(unsigned int elements, bool bClearArray=true) { assert(elements!=0); data = new T[elements]; if(bClearArray){ memset( data,0,sizeof(T)*elements); } this->length = elements; } // 4J Stu Added this ctor so I static init arrays in the Item derivation tree @@ -24,7 +24,7 @@ public: T *temp = new T[elements]; memset( temp,0,sizeof(T)*elements); - if( data != NULL ) + if( data != nullptr ) { std::copy( data, data+length, temp ); @@ -45,7 +45,7 @@ template class array2DWithLength public: _parrayWithLength *data; unsigned int length; - array2DWithLength() { data = NULL; length = 0; } + array2DWithLength() { data = nullptr; length = 0; } array2DWithLength(unsigned int dimA, unsigned int dimB) { data = new _parrayWithLength[dimA]; diff --git a/Minecraft.World/Arrow.cpp b/Minecraft.World/Arrow.cpp index e6ee4b9cc..4c5d9ae3b 100644 --- a/Minecraft.World/Arrow.cpp +++ b/Minecraft.World/Arrow.cpp @@ -197,7 +197,7 @@ void Arrow::tick() { Tile::tiles[t]->updateShape(level, xTile, yTile, zTile); AABB *aabb = Tile::tiles[t]->getAABB(level, xTile, yTile, zTile); - if (aabb != NULL && aabb->contains(Vec3::newTemp(x, y, z))) + if (aabb != nullptr && aabb->contains(Vec3::newTemp(x, y, z))) { inGround = true; } @@ -242,7 +242,7 @@ void Arrow::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != NULL) + if (res != nullptr) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -256,7 +256,7 @@ void Arrow::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != NULL) + if (p != nullptr) { double dd = from->distanceTo(p->pos); if (dd < nearest || nearest == 0) @@ -268,33 +268,33 @@ void Arrow::tick() } } - if (hitEntity != NULL) + if (hitEntity != nullptr) { delete res; res = new HitResult(hitEntity); } - if ( (res != NULL) && (res->entity != NULL) && res->entity->instanceof(eTYPE_PLAYER)) + if ( (res != nullptr) && (res->entity != nullptr) && res->entity->instanceof(eTYPE_PLAYER)) { shared_ptr player = dynamic_pointer_cast(res->entity); // 4J: Check for owner being null - if ( player->abilities.invulnerable || ((owner != NULL) && (owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(owner)->canHarmPlayer(player)))) + if ( player->abilities.invulnerable || ((owner != nullptr) && (owner->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(owner)->canHarmPlayer(player)))) { - res = NULL; + res = nullptr; } } - if (res != NULL) + if (res != nullptr) { - if (res->entity != NULL) + if (res->entity != nullptr) { float pow = Mth::sqrt(xd * xd + yd * yd + zd * zd); int dmg = (int) Mth::ceil(static_cast(pow * baseDamage)); if(isCritArrow()) dmg += random->nextInt(dmg / 2 + 2); - DamageSource *damageSource = NULL; - if (owner == NULL) + DamageSource *damageSource = nullptr; + if (owner == nullptr) { damageSource = DamageSource::arrow(dynamic_pointer_cast(shared_from_this()), shared_from_this()); } @@ -331,19 +331,19 @@ void Arrow::tick() } } - if (owner != NULL) + if (owner != nullptr) { ThornsEnchantment::doThornsAfterAttack(owner, mob, random); } - if (owner != NULL && res->entity != owner && owner->GetType() == eTYPE_SERVERPLAYER) + if (owner != nullptr && res->entity != owner && owner->GetType() == eTYPE_SERVERPLAYER) { dynamic_pointer_cast(owner)->connection->send( shared_ptr( new GameEventPacket(GameEventPacket::SUCCESSFUL_BOW_HIT, 0)) ); } } // 4J : WESTY : For award, need to track if creeper was killed by arrow from the player. - if (owner != NULL && owner->instanceof(eTYPE_PLAYER) // arrow owner is a player + if (owner != nullptr && owner->instanceof(eTYPE_PLAYER) // arrow owner is a player && !res->entity->isAlive() // target is now dead && (res->entity->GetType() == eTYPE_CREEPER)) // target is a creeper diff --git a/Minecraft.World/AttributeModifier.cpp b/Minecraft.World/AttributeModifier.cpp index 6c45c4ac6..170902893 100644 --- a/Minecraft.World/AttributeModifier.cpp +++ b/Minecraft.World/AttributeModifier.cpp @@ -61,7 +61,7 @@ AttributeModifier *AttributeModifier::setSerialize(bool serialize) bool AttributeModifier::equals(AttributeModifier *modifier) { if (this == modifier) return true; - if (modifier == NULL) return false; //|| getClass() != o.getClass()) return false; + if (modifier == nullptr) return false; //|| getClass() != o.getClass()) return false; if (id != modifier->id) return false; diff --git a/Minecraft.World/AvoidPlayerGoal.cpp b/Minecraft.World/AvoidPlayerGoal.cpp index 53aebe89f..f9c6641a9 100644 --- a/Minecraft.World/AvoidPlayerGoal.cpp +++ b/Minecraft.World/AvoidPlayerGoal.cpp @@ -33,12 +33,12 @@ AvoidPlayerGoal::AvoidPlayerGoal(PathfinderMob *mob, const type_info& avoidType, entitySelector = new AvoidPlayerGoalEntitySelector(this); toAvoid = weak_ptr(); - path = NULL; + path = nullptr; } AvoidPlayerGoal::~AvoidPlayerGoal() { - if(path != NULL) delete path; + if(path != nullptr) delete path; delete entitySelector; } @@ -47,9 +47,9 @@ bool AvoidPlayerGoal::canUse() if (avoidType == typeid(Player)) { shared_ptr tamableAnimal = dynamic_pointer_cast(mob->shared_from_this()); - if (tamableAnimal != NULL && tamableAnimal->isTame()) return false; + if (tamableAnimal != nullptr && tamableAnimal->isTame()) return false; toAvoid = weak_ptr(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist)); - if (toAvoid.lock() == NULL) return false; + if (toAvoid.lock() == nullptr) return false; } else { @@ -64,24 +64,24 @@ bool AvoidPlayerGoal::canUse() } Vec3 *pos = RandomPos::getPosAvoid(dynamic_pointer_cast(mob->shared_from_this()), 16, 7, Vec3::newTemp(toAvoid.lock()->x, toAvoid.lock()->y, toAvoid.lock()->z)); - if (pos == NULL) return false; + if (pos == nullptr) return false; if (toAvoid.lock()->distanceToSqr(pos->x, pos->y, pos->z) < toAvoid.lock()->distanceToSqr(mob->shared_from_this())) return false; delete path; path = pathNav->createPath(pos->x, pos->y, pos->z); - if (path == NULL) return false; + if (path == nullptr) return false; if (!path->endsInXZ(pos)) return false; return true; } bool AvoidPlayerGoal::canContinueToUse() { - return toAvoid.lock() != NULL && !pathNav->isDone(); + return toAvoid.lock() != nullptr && !pathNav->isDone(); } void AvoidPlayerGoal::start() { pathNav->moveTo(path, walkSpeedModifier); - path = NULL; + path = nullptr; } void AvoidPlayerGoal::stop() diff --git a/Minecraft.World/AwardStatPacket.cpp b/Minecraft.World/AwardStatPacket.cpp index 43328794c..07888541f 100644 --- a/Minecraft.World/AwardStatPacket.cpp +++ b/Minecraft.World/AwardStatPacket.cpp @@ -8,7 +8,7 @@ AwardStatPacket::AwardStatPacket() { - this->m_paramData.data = NULL; + this->m_paramData.data = nullptr; this->m_paramData.length = 0; } @@ -28,17 +28,17 @@ AwardStatPacket::AwardStatPacket(int statId, byteArray paramData) AwardStatPacket::~AwardStatPacket() { - if (m_paramData.data != NULL) + if (m_paramData.data != nullptr) { delete [] m_paramData.data; - m_paramData.data = NULL; + m_paramData.data = nullptr; } } void AwardStatPacket::handle(PacketListener *listener) { listener->handleAwardStat(shared_from_this()); - m_paramData.data = NULL; + m_paramData.data = nullptr; } void AwardStatPacket::read(DataInputStream *dis) //throws IOException diff --git a/Minecraft.World/BaseAttributeMap.cpp b/Minecraft.World/BaseAttributeMap.cpp index 8fb1b1f16..151448b52 100644 --- a/Minecraft.World/BaseAttributeMap.cpp +++ b/Minecraft.World/BaseAttributeMap.cpp @@ -24,7 +24,7 @@ AttributeInstance *BaseAttributeMap::getInstance(eATTRIBUTE_ID id) } else { - return NULL; + return nullptr; } } @@ -50,7 +50,7 @@ void BaseAttributeMap::removeItemModifiers(shared_ptr item) AttributeInstance* attribute = getInstance(it.first); AttributeModifier* modifier = it.second; - if (attribute != NULL) + if (attribute != nullptr) { attribute->removeModifier(modifier); } @@ -72,7 +72,7 @@ void BaseAttributeMap::addItemModifiers(shared_ptr item) AttributeInstance* attribute = getInstance(it.first); AttributeModifier* modifier = it.second; - if (attribute != NULL) + if (attribute != nullptr) { attribute->removeModifier(modifier); attribute->addModifier(new AttributeModifier(*modifier)); diff --git a/Minecraft.World/BaseEntityTile.cpp b/Minecraft.World/BaseEntityTile.cpp index 2edfbf92d..7dc06f771 100644 --- a/Minecraft.World/BaseEntityTile.cpp +++ b/Minecraft.World/BaseEntityTile.cpp @@ -25,7 +25,7 @@ bool BaseEntityTile::triggerEvent(Level *level, int x, int y, int z, int b0, int { Tile::triggerEvent(level, x, y, z, b0, b1); shared_ptr te = level->getTileEntity(x, y, z); - if (te != NULL) + if (te != nullptr) { return te->triggerEvent(b0, b1); } diff --git a/Minecraft.World/BaseMobSpawner.cpp b/Minecraft.World/BaseMobSpawner.cpp index 743427dae..b01aeb09c 100644 --- a/Minecraft.World/BaseMobSpawner.cpp +++ b/Minecraft.World/BaseMobSpawner.cpp @@ -8,10 +8,10 @@ BaseMobSpawner::BaseMobSpawner() { - spawnPotentials = NULL; + spawnPotentials = nullptr; spawnDelay = 20; entityId = L"Pig"; - nextSpawnData = NULL; + nextSpawnData = nullptr; spin = oSpin = 0.0; minSpawnDelay = SharedConstants::TICKS_PER_SECOND * 10; @@ -37,7 +37,7 @@ BaseMobSpawner::~BaseMobSpawner() wstring BaseMobSpawner::getEntityId() { - if (getNextSpawnData() == NULL) + if (getNextSpawnData() == nullptr) { if (entityId.compare(L"Minecart") == 0) { @@ -58,7 +58,7 @@ void BaseMobSpawner::setEntityId(const wstring &entityId) bool BaseMobSpawner::isNearPlayer() { - return getLevel()->getNearestPlayer(getX() + 0.5, getY() + 0.5, getZ() + 0.5, requiredPlayerRange) != NULL; + return getLevel()->getNearestPlayer(getX() + 0.5, getY() + 0.5, getZ() + 0.5, requiredPlayerRange) != nullptr; } void BaseMobSpawner::tick() @@ -95,7 +95,7 @@ void BaseMobSpawner::tick() for (int c = 0; c < spawnCount; c++) { shared_ptr entity = EntityIO::newEntity(getEntityId(), getLevel()); - if (entity == NULL) return; + if (entity == nullptr) return; int nearBy = getLevel()->getEntitiesOfClass( typeid(entity.get()), AABB::newTemp(getX(), getY(), getZ(), getX() + 1, getY() + 1, getZ() + 1)->grow(spawnRange * 2, 4, spawnRange * 2))->size(); if (nearBy >= maxNearbyEntities) @@ -111,12 +111,12 @@ void BaseMobSpawner::tick() entity->moveTo(xp, yp, zp, getLevel()->random->nextFloat() * 360, 0); - if (mob == NULL || mob->canSpawn()) + if (mob == nullptr || mob->canSpawn()) { loadDataAndAddEntity(entity); getLevel()->levelEvent(LevelEvent::PARTICLES_MOBTILE_SPAWN, getX(), getY(), getZ(), 0); - if (mob != NULL) + if (mob != nullptr) { mob->spawnAnim(); } @@ -131,7 +131,7 @@ void BaseMobSpawner::tick() shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entity) { - if (getNextSpawnData() != NULL) + if (getNextSpawnData() != nullptr) { CompoundTag *data = new CompoundTag(); entity->save(data); @@ -147,7 +147,7 @@ shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entit } entity->load(data); - if (entity->level != NULL) entity->level->addEntity(entity); + if (entity->level != nullptr) entity->level->addEntity(entity); // add mounts shared_ptr rider = entity; @@ -155,7 +155,7 @@ shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entit { CompoundTag *ridingTag = data->getCompound(Entity::RIDING_TAG); shared_ptr mount = EntityIO::newEntity(ridingTag->getString(L"id"), entity->level); - if (mount != NULL) + if (mount != nullptr) { CompoundTag *mountData = new CompoundTag(); mount->save(mountData); @@ -172,7 +172,7 @@ shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entit mount->load(mountData); mount->moveTo(rider->x, rider->y, rider->z, rider->yRot, rider->xRot); - if (entity->level != NULL) entity->level->addEntity(mount); + if (entity->level != nullptr) entity->level->addEntity(mount); rider->ride(mount); } rider = mount; @@ -180,9 +180,9 @@ shared_ptr BaseMobSpawner::loadDataAndAddEntity(shared_ptr entit } } - else if (entity->instanceof(eTYPE_LIVINGENTITY) && entity->level != NULL) + else if (entity->instanceof(eTYPE_LIVINGENTITY) && entity->level != nullptr) { - dynamic_pointer_cast( entity )->finalizeMobSpawn(NULL); + dynamic_pointer_cast( entity )->finalizeMobSpawn(nullptr); getLevel()->addEntity(entity); } @@ -200,7 +200,7 @@ void BaseMobSpawner::delay() spawnDelay = minSpawnDelay + getLevel()->random->nextInt(maxSpawnDelay - minSpawnDelay); } - if ( (spawnPotentials != NULL) && (spawnPotentials->size() > 0) ) + if ( (spawnPotentials != nullptr) && (spawnPotentials->size() > 0) ) { setNextSpawnData( static_cast(WeighedRandom::getRandomItem((Random *)getLevel()->random, (vector *)spawnPotentials)) ); } @@ -225,7 +225,7 @@ void BaseMobSpawner::load(CompoundTag *tag) } else { - spawnPotentials = NULL; + spawnPotentials = nullptr; } if (tag->contains(L"SpawnData")) @@ -234,7 +234,7 @@ void BaseMobSpawner::load(CompoundTag *tag) } else { - setNextSpawnData(NULL); + setNextSpawnData(nullptr); } if (tag->contains(L"MinSpawnDelay")) @@ -252,7 +252,7 @@ void BaseMobSpawner::load(CompoundTag *tag) if (tag->contains(L"SpawnRange")) spawnRange = tag->getShort(L"SpawnRange"); - if (getLevel() != NULL && getLevel()->isClientSide) + if (getLevel() != nullptr && getLevel()->isClientSide) { displayEntity = nullptr; } @@ -269,12 +269,12 @@ void BaseMobSpawner::save(CompoundTag *tag) tag->putShort(L"RequiredPlayerRange", static_cast(requiredPlayerRange)); tag->putShort(L"SpawnRange", static_cast(spawnRange)); - if (getNextSpawnData() != NULL) + if (getNextSpawnData() != nullptr) { tag->putCompound(L"SpawnData", static_cast(getNextSpawnData()->tag->copy())); } - if (getNextSpawnData() != NULL || (spawnPotentials != NULL && spawnPotentials->size() > 0)) + if (getNextSpawnData() != nullptr || (spawnPotentials != nullptr && spawnPotentials->size() > 0)) { ListTag *list = new ListTag(); @@ -296,9 +296,9 @@ void BaseMobSpawner::save(CompoundTag *tag) shared_ptr BaseMobSpawner::getDisplayEntity() { - if (displayEntity == NULL) + if (displayEntity == nullptr) { - shared_ptr e = EntityIO::newEntity(getEntityId(), NULL); + shared_ptr e = EntityIO::newEntity(getEntityId(), nullptr); e = loadDataAndAddEntity(e); displayEntity = e; } @@ -333,7 +333,7 @@ BaseMobSpawner::SpawnData::SpawnData(CompoundTag *base) : WeighedRandomItem(base if (_type.compare(L"Minecart") == 0) { - if (tag != NULL) + if (tag != nullptr) { switch (tag->getInt(L"Type")) { @@ -362,7 +362,7 @@ BaseMobSpawner::SpawnData::SpawnData(CompoundTag *tag, wstring _type) : WeighedR { if (_type.compare(L"Minecart") == 0) { - if (tag != NULL) + if (tag != nullptr) { switch (tag->getInt(L"Type")) { diff --git a/Minecraft.World/BasePressurePlateTile.cpp b/Minecraft.World/BasePressurePlateTile.cpp index 128a4216a..cd4c821c4 100644 --- a/Minecraft.World/BasePressurePlateTile.cpp +++ b/Minecraft.World/BasePressurePlateTile.cpp @@ -43,7 +43,7 @@ int BasePressurePlateTile::getTickDelay(Level *level) AABB *BasePressurePlateTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool BasePressurePlateTile::isSolidRender(bool isServerLevel) diff --git a/Minecraft.World/BaseRailTile.cpp b/Minecraft.World/BaseRailTile.cpp index c08c2860e..be14a2643 100644 --- a/Minecraft.World/BaseRailTile.cpp +++ b/Minecraft.World/BaseRailTile.cpp @@ -102,7 +102,7 @@ void BaseRailTile::Rail::removeSoftConnections() for (unsigned int i = 0; i < connections.size(); i++) { Rail *rail = getRail(connections[i]); - if (rail == NULL || !rail->connectsTo(this)) + if (rail == nullptr || !rail->connectsTo(this)) { delete connections[i]; connections.erase(connections.begin()+i); @@ -130,11 +130,11 @@ bool BaseRailTile::Rail::hasRail(int x, int y, int z) BaseRailTile::Rail *BaseRailTile::Rail::getRail(TilePos *p) { - if(!m_bValidRail) return NULL; + if(!m_bValidRail) return nullptr; if (isRail(level, p->x, p->y, p->z)) return new Rail(level, p->x, p->y, p->z); if (isRail(level, p->x, p->y + 1, p->z)) return new Rail(level, p->x, p->y + 1, p->z); if (isRail(level, p->x, p->y - 1, p->z)) return new Rail(level, p->x, p->y - 1, p->z); - return NULL; + return nullptr; } @@ -253,7 +253,7 @@ bool BaseRailTile::Rail::hasNeighborRail(int x, int y, int z) if(!m_bValidRail) return false; TilePos tp(x,y,z); Rail *neighbor = getRail( &tp ); - if (neighbor == NULL) return false; + if (neighbor == nullptr) return false; neighbor->removeSoftConnections(); bool retval = neighbor->canConnectTo(this); delete neighbor; @@ -331,7 +331,7 @@ void BaseRailTile::Rail::place(bool hasSignal, bool first) for ( auto& it : connections ) { Rail *neighbor = getRail(it); - if (neighbor == NULL) continue; + if (neighbor == nullptr) continue; neighbor->removeSoftConnections(); if (neighbor->canConnectTo(this)) @@ -359,7 +359,7 @@ BaseRailTile::BaseRailTile(int id, bool usesDataBit) : Tile(id, Material::decora this->usesDataBit = usesDataBit; setShape(0, 0, 0, 1, 2 / 16.0f, 1); - iconTurn = NULL; + iconTurn = nullptr; } bool BaseRailTile::isUsesDataBit() @@ -369,7 +369,7 @@ bool BaseRailTile::isUsesDataBit() AABB *BaseRailTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool BaseRailTile::blocksLight() diff --git a/Minecraft.World/BasicTree.cpp b/Minecraft.World/BasicTree.cpp index f98b4dcb0..4bf8ade4e 100644 --- a/Minecraft.World/BasicTree.cpp +++ b/Minecraft.World/BasicTree.cpp @@ -34,7 +34,7 @@ BasicTree::BasicTree(bool doUpdate) : Feature(doUpdate) trunkWidth = 1; heightVariance = 12; foliageHeight = 4; - foliageCoords = NULL; + foliageCoords = nullptr; foliageCoordsLength = 0; } @@ -126,7 +126,7 @@ void BasicTree::prepare() for( int i = clusterCount; i < clustersPerY * height; i++ ) { delete [] tempFoliageCoords[i]; - tempFoliageCoords[i] = NULL; + tempFoliageCoords[i] = nullptr; } // 4J - original code for above is the following, it isn't obvious to me why it is doing a copy of the array, so let's not for now // foliageCoords = new int[clusterCount][4]; @@ -460,7 +460,7 @@ bool BasicTree::checkLocation() int endPosition[] = { origin[0], origin[1] + height - 1, origin[2] }; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(startPosition[0], startPosition[1], startPosition[2], endPosition[0], endPosition[1], endPosition[2]); diff --git a/Minecraft.World/BasicTypeContainers.cpp b/Minecraft.World/BasicTypeContainers.cpp index 9ecc865c6..ba2359d88 100644 --- a/Minecraft.World/BasicTypeContainers.cpp +++ b/Minecraft.World/BasicTypeContainers.cpp @@ -18,5 +18,5 @@ const double Double::MIN_NORMAL = DBL_MIN; int Integer::parseInt(wstring &str, int radix /* = 10*/) { - return wcstol( str.c_str(), NULL, radix ); + return wcstol( str.c_str(), nullptr, radix ); } \ No newline at end of file diff --git a/Minecraft.World/Bat.cpp b/Minecraft.World/Bat.cpp index dbb003026..462fef57d 100644 --- a/Minecraft.World/Bat.cpp +++ b/Minecraft.World/Bat.cpp @@ -15,7 +15,7 @@ Bat::Bat(Level *level) : AmbientCreature(level) registerAttributes(); setHealth(getMaxHealth()); - targetPosition = NULL; + targetPosition = nullptr; setSize(.5f, .9f); setResting(true); @@ -141,7 +141,7 @@ void Bat::newServerAiStep() yHeadRot = random->nextInt(360); } - if (level->getNearestPlayer(shared_from_this(), 4.0f) != NULL) + if (level->getNearestPlayer(shared_from_this(), 4.0f) != nullptr) { setResting(false); level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast(x), static_cast(y), static_cast(z), 0); @@ -151,12 +151,12 @@ void Bat::newServerAiStep() else { - if (targetPosition != NULL && (!level->isEmptyTile(targetPosition->x, targetPosition->y, targetPosition->z) || targetPosition->y < 1)) + if (targetPosition != nullptr && (!level->isEmptyTile(targetPosition->x, targetPosition->y, targetPosition->z) || targetPosition->y < 1)) { delete targetPosition; - targetPosition = NULL; + targetPosition = nullptr; } - if (targetPosition == NULL || random->nextInt(30) == 0 || targetPosition->distSqr(static_cast(x), static_cast(y), static_cast(z)) < 4) + if (targetPosition == nullptr || random->nextInt(30) == 0 || targetPosition->distSqr(static_cast(x), static_cast(y), static_cast(z)) < 4) { delete targetPosition; targetPosition = new Pos(static_cast(x) + random->nextInt(7) - random->nextInt(7), static_cast(y) + random->nextInt(6) - 2, static_cast(z) + random->nextInt(7) - random->nextInt(7)); diff --git a/Minecraft.World/BeaconMenu.cpp b/Minecraft.World/BeaconMenu.cpp index 62908b4f4..0d7e54b46 100644 --- a/Minecraft.World/BeaconMenu.cpp +++ b/Minecraft.World/BeaconMenu.cpp @@ -60,7 +60,7 @@ shared_ptr BeaconMenu::quickMoveStack(shared_ptr player, i { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -127,7 +127,7 @@ BeaconMenu::PaymentSlot::PaymentSlot(shared_ptr container, int slot, bool BeaconMenu::PaymentSlot::mayPlace(shared_ptr item) { - if (item != NULL) + if (item != nullptr) { return (item->id == Item::emerald_Id || item->id == Item::diamond_Id || item->id == Item::goldIngot_Id || item->id == Item::ironIngot_Id); } diff --git a/Minecraft.World/BeaconTile.cpp b/Minecraft.World/BeaconTile.cpp index f002cbe29..998f15e85 100644 --- a/Minecraft.World/BeaconTile.cpp +++ b/Minecraft.World/BeaconTile.cpp @@ -19,7 +19,7 @@ bool BeaconTile::use(Level *level, int x, int y, int z, shared_ptr playe if (level->isClientSide) return true; shared_ptr beacon = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (beacon != NULL) player->openBeacon(beacon); + if (beacon != nullptr) player->openBeacon(beacon); return true; } diff --git a/Minecraft.World/BeaconTileEntity.cpp b/Minecraft.World/BeaconTileEntity.cpp index 17f64723f..10e74eee1 100644 --- a/Minecraft.World/BeaconTileEntity.cpp +++ b/Minecraft.World/BeaconTileEntity.cpp @@ -28,7 +28,7 @@ void BeaconTileEntity::staticCtor() { for(unsigned int effect = 0; effect < BEACON_EFFECTS_EFFECTS; ++effect) { - BEACON_EFFECTS[tier][effect] = NULL; + BEACON_EFFECTS[tier][effect] = nullptr; } } BEACON_EFFECTS[0][0] = MobEffect::movementSpeed; @@ -213,7 +213,7 @@ void BeaconTileEntity::setPrimaryPower(int primaryPower) for(unsigned int e = 0; e < BEACON_EFFECTS_EFFECTS; ++e) { MobEffect *effect = BEACON_EFFECTS[tier][e]; - if(effect == NULL) break; + if(effect == nullptr) break; if (effect->id == primaryPower) { @@ -236,7 +236,7 @@ void BeaconTileEntity::setSecondaryPower(int secondaryPower) for(unsigned int e = 0; e < BEACON_EFFECTS_EFFECTS; ++e) { MobEffect *effect = BEACON_EFFECTS[tier][e]; - if(effect == NULL) break; + if(effect == nullptr) break; if (effect->id == secondaryPower) { @@ -295,7 +295,7 @@ shared_ptr BeaconTileEntity::getItem(unsigned int slot) shared_ptr BeaconTileEntity::removeItem(unsigned int slot, int count) { - if (slot == 0 && paymentItem != NULL) + if (slot == 0 && paymentItem != nullptr) { if (count >= paymentItem->count) { @@ -314,7 +314,7 @@ shared_ptr BeaconTileEntity::removeItem(unsigned int slot, int cou shared_ptr BeaconTileEntity::removeItemNoUpdate(int slot) { - if (slot == 0 && paymentItem != NULL) + if (slot == 0 && paymentItem != nullptr) { shared_ptr returnItem = paymentItem; paymentItem = nullptr; diff --git a/Minecraft.World/BedTile.cpp b/Minecraft.World/BedTile.cpp index 039943bdc..5597f7409 100644 --- a/Minecraft.World/BedTile.cpp +++ b/Minecraft.World/BedTile.cpp @@ -16,9 +16,9 @@ BedTile::BedTile(int id) : DirectionalTile(id, Material::cloth, isSolidRender()) { setShape(); - iconEnd = NULL; - iconSide = NULL; - iconTop = NULL; + iconEnd = nullptr; + iconSide = nullptr; + iconTop = nullptr; } // 4J Added override @@ -120,7 +120,7 @@ bool BedTile::use(Level *level, int x, int y, int z, shared_ptr player, } } - if (sleepingPlayer == NULL) + if (sleepingPlayer == nullptr) { setOccupied(level, x, y, z, false); } @@ -309,7 +309,7 @@ Pos *BedTile::findStandUpPosition(Level *level, int x, int y, int z, int skipCou } } - return NULL; + return nullptr; } void BedTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus) diff --git a/Minecraft.World/BegGoal.cpp b/Minecraft.World/BegGoal.cpp index 975539282..3f059b66e 100644 --- a/Minecraft.World/BegGoal.cpp +++ b/Minecraft.World/BegGoal.cpp @@ -20,14 +20,14 @@ BegGoal::BegGoal(Wolf *wolf, float lookDistance) bool BegGoal::canUse() { player = weak_ptr(level->getNearestPlayer(wolf->shared_from_this(), lookDistance)); - if (player.lock() == NULL) return false; + if (player.lock() == nullptr) return false; wolf->setDespawnProtected(); return playerHoldingInteresting(player.lock()); } bool BegGoal::canContinueToUse() { - if (player.lock() == NULL || !player.lock()->isAlive()) return false; + if (player.lock() == nullptr || !player.lock()->isAlive()) return false; if (wolf->distanceToSqr(player.lock()) > lookDistance * lookDistance) return false; wolf->setDespawnProtected(); return lookTime > 0 && playerHoldingInteresting(player.lock()); @@ -54,7 +54,7 @@ void BegGoal::tick() bool BegGoal::playerHoldingInteresting(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item == NULL) return false; + if (item == nullptr) return false; if (!wolf->isTame() && item->id == Item::bone_Id) return true; return wolf->isFood(item); } \ No newline at end of file diff --git a/Minecraft.World/BinaryHeap.cpp b/Minecraft.World/BinaryHeap.cpp index 3a3d1c1e6..4fc5ce455 100644 --- a/Minecraft.World/BinaryHeap.cpp +++ b/Minecraft.World/BinaryHeap.cpp @@ -58,7 +58,7 @@ Node *BinaryHeap::pop() { Node *popped = heap[0]; heap[0] = heap[--sizeVar]; - heap[sizeVar] = NULL; + heap[sizeVar] = nullptr; if (sizeVar > 0) downHeap(0); popped->heapIdx=-1; return popped; @@ -68,7 +68,7 @@ void BinaryHeap::remove(Node *node) { // This is what node.heapIdx is for. heap[node->heapIdx] = heap[--sizeVar]; - heap[sizeVar] = NULL; + heap[sizeVar] = nullptr; if (sizeVar > node->heapIdx) { if (heap[node->heapIdx]->f < node->f) @@ -145,7 +145,7 @@ void BinaryHeap::downHeap(int idx) if (rightIdx >= sizeVar) { // Only need to compare with left. - rightNode = NULL; + rightNode = nullptr; rightCost = Float::POSITIVE_INFINITY; } else diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index f8ac2107d..66265765e 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -13,34 +13,34 @@ //public static final Biome[] biomes = new Biome[256]; Biome *Biome::biomes[256]; -Biome *Biome::ocean = NULL; -Biome *Biome::plains = NULL; -Biome *Biome::desert = NULL; +Biome *Biome::ocean = nullptr; +Biome *Biome::plains = nullptr; +Biome *Biome::desert = nullptr; -Biome *Biome::extremeHills = NULL; -Biome *Biome::forest = NULL; -Biome *Biome::taiga = NULL; +Biome *Biome::extremeHills = nullptr; +Biome *Biome::forest = nullptr; +Biome *Biome::taiga = nullptr; -Biome *Biome::swampland = NULL; -Biome *Biome::river = NULL; +Biome *Biome::swampland = nullptr; +Biome *Biome::river = nullptr; -Biome *Biome::hell = NULL; -Biome *Biome::sky = NULL; +Biome *Biome::hell = nullptr; +Biome *Biome::sky = nullptr; -Biome *Biome::frozenOcean = NULL; -Biome *Biome::frozenRiver = NULL; -Biome *Biome::iceFlats = NULL; -Biome *Biome::iceMountains = NULL; -Biome *Biome::mushroomIsland = NULL; -Biome *Biome::mushroomIslandShore = NULL; -Biome *Biome::beaches = NULL; -Biome *Biome::desertHills = NULL; -Biome *Biome::forestHills = NULL; -Biome *Biome::taigaHills = NULL; -Biome *Biome::smallerExtremeHills = NULL; +Biome *Biome::frozenOcean = nullptr; +Biome *Biome::frozenRiver = nullptr; +Biome *Biome::iceFlats = nullptr; +Biome *Biome::iceMountains = nullptr; +Biome *Biome::mushroomIsland = nullptr; +Biome *Biome::mushroomIslandShore = nullptr; +Biome *Biome::beaches = nullptr; +Biome *Biome::desertHills = nullptr; +Biome *Biome::forestHills = nullptr; +Biome *Biome::taigaHills = nullptr; +Biome *Biome::smallerExtremeHills = nullptr; -Biome *Biome::jungle = NULL; -Biome *Biome::jungleHills = NULL; +Biome *Biome::jungle = nullptr; +Biome *Biome::jungleHills = nullptr; void Biome::staticCtor() @@ -95,7 +95,7 @@ Biome::Biome(int id) : id(id) temperature = 0.5f; downfall = 0.5f; //waterColor = 0xffffff; // 4J Stu - Not used - decorator = NULL; + decorator = nullptr; m_grassColor = eMinecraftColour_NOT_SET; m_foliageColor = eMinecraftColour_NOT_SET; @@ -132,7 +132,7 @@ Biome::Biome(int id) : id(id) Biome::~Biome() { - if(decorator != NULL) delete decorator; + if(decorator != nullptr) delete decorator; } BiomeDecorator *Biome::createDecorator() @@ -228,7 +228,7 @@ vector *Biome::getMobs(MobCategory *category) if (category == MobCategory::creature_wolf) return &friendlies_wolf; if (category == MobCategory::creature_mushroomcow) return &friendlies_mushroomcow; if (category == MobCategory::ambient) return &ambientFriendlies; - return NULL; + return nullptr; } bool Biome::hasSnow() diff --git a/Minecraft.World/BiomeCache.cpp b/Minecraft.World/BiomeCache.cpp index f5469c595..78384c371 100644 --- a/Minecraft.World/BiomeCache.cpp +++ b/Minecraft.World/BiomeCache.cpp @@ -10,7 +10,7 @@ BiomeCache::Block::Block(int x, int z, BiomeCache *parent) // temps = floatArray(ZONE_SIZE * ZONE_SIZE, false); // MGH - added "no clear" flag to arrayWithLength // downfall = floatArray(ZONE_SIZE * ZONE_SIZE, false); // biomes = BiomeArray(ZONE_SIZE * ZONE_SIZE, false); - biomeIndices = byteArray(ZONE_SIZE * ZONE_SIZE, false); + biomeIndices = byteArray(static_cast(ZONE_SIZE * ZONE_SIZE), false); lastUse = 0; this->x = x; @@ -87,7 +87,7 @@ BiomeCache::Block *BiomeCache::getBlockAt(int x, int z) z >>= ZONE_SIZE_BITS; __int64 slot = (static_cast<__int64>(x) & 0xffffffffl) | ((static_cast<__int64>(z) & 0xffffffffl) << 32l); auto it = cached.find(slot); - Block *block = NULL; + Block *block = nullptr; if (it == cached.end()) { MemSect(48); diff --git a/Minecraft.World/BiomeDecorator.cpp b/Minecraft.World/BiomeDecorator.cpp index a3cbf546c..add156e88 100644 --- a/Minecraft.World/BiomeDecorator.cpp +++ b/Minecraft.World/BiomeDecorator.cpp @@ -9,8 +9,8 @@ BiomeDecorator::BiomeDecorator(Biome *biome) _init(); // 4J inits - level = NULL; - random = NULL; + level = nullptr; + random = nullptr; xo = 0; zo = 0; @@ -19,7 +19,7 @@ BiomeDecorator::BiomeDecorator(Biome *biome) void BiomeDecorator::decorate(Level *level, Random *random, int xo, int zo) { - if (this->level != NULL) + if (this->level != nullptr) { app.DebugPrintf("BiomeDecorator::decorate - Already decorating!!\n"); #ifndef _CONTENT_PACKAGE @@ -34,8 +34,8 @@ void BiomeDecorator::decorate(Level *level, Random *random, int xo, int zo) decorate(); - this->level = NULL; - this->random = NULL; + this->level = nullptr; + this->random = nullptr; } @@ -164,7 +164,7 @@ void BiomeDecorator::decorate() // 4J Stu - For some reason this was created each time round in the loop // I assume there is a case where deadBushCount could be 0 - DeadBushFeature *deadBushFeature = NULL; + DeadBushFeature *deadBushFeature = nullptr; if(deadBushCount > 0) deadBushFeature = new DeadBushFeature(Tile::deadBush_Id); for (int i = 0; i < deadBushCount; i++) { @@ -174,7 +174,7 @@ void BiomeDecorator::decorate() //new DeadBushFeature(Tile::deadBush_Id)->place(level, random, x, y, z); deadBushFeature->place(level, random, x, y, z); } - if(deadBushFeature != NULL)delete deadBushFeature; + if(deadBushFeature != nullptr)delete deadBushFeature; for (int i = 0; i < waterlilyCount; i++) { diff --git a/Minecraft.World/BiomeOverrideLayer.cpp b/Minecraft.World/BiomeOverrideLayer.cpp index a44295dc2..846057408 100644 --- a/Minecraft.World/BiomeOverrideLayer.cpp +++ b/Minecraft.World/BiomeOverrideLayer.cpp @@ -11,14 +11,14 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) #ifdef _UNICODE wstring path = L"GAME:\\GameRules\\biomemap.bin"; - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #else #ifdef _WINDOWS64 string path = "GameRules\\biomemap.bin"; #else string path = "GAME:\\GameRules\\biomemap.bin"; #endif - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #endif if( file == INVALID_HANDLE_VALUE ) { @@ -35,14 +35,14 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) __debugbreak(); // TODO DWORD bytesRead,dwFileSize = 0; #else - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); + DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); #endif if(dwFileSize > m_biomeOverride.length) { app.DebugPrintf("Biomemap binary is too large!!\n"); __debugbreak(); } - BOOL bSuccess = ReadFile(file,m_biomeOverride.data,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(file,m_biomeOverride.data,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { diff --git a/Minecraft.World/BiomeSource.cpp b/Minecraft.World/BiomeSource.cpp index d2454f4a6..885ea6320 100644 --- a/Minecraft.World/BiomeSource.cpp +++ b/Minecraft.World/BiomeSource.cpp @@ -87,10 +87,10 @@ floatArray BiomeSource::getDownfallBlock(int x, int z, int w, int h) const void BiomeSource::getDownfallBlock(floatArray &downfalls, int x, int z, int w, int h) const { IntCache::releaseAll(); - //if (downfalls == NULL || downfalls->length < w * h) - if (downfalls.data == NULL || downfalls.length < w * h) + //if (downfalls == nullptr || downfalls->length < w * h) + if (downfalls.data == nullptr || downfalls.length < w * h) { - if(downfalls.data != NULL) delete [] downfalls.data; + if(downfalls.data != nullptr) delete [] downfalls.data; downfalls = floatArray(w * h); } @@ -132,9 +132,9 @@ void BiomeSource::getTemperatureBlock(floatArray& temperatures, int x, int z, in { IntCache::releaseAll(); //if (temperatures == null || temperatures.length < w * h) { - if (temperatures.data == NULL || temperatures.length < w * h) + if (temperatures.data == nullptr || temperatures.length < w * h) { - if( temperatures.data != NULL ) delete [] temperatures.data; + if( temperatures.data != nullptr ) delete [] temperatures.data; temperatures = floatArray(w * h); } @@ -170,9 +170,9 @@ void BiomeSource::getRawBiomeBlock(BiomeArray &biomes, int x, int z, int w, int { IntCache::releaseAll(); //if (biomes == null || biomes.length < w * h) - if (biomes.data == NULL || biomes.length < w * h) + if (biomes.data == nullptr || biomes.length < w * h) { - if(biomes.data != NULL) delete [] biomes.data; + if(biomes.data != nullptr) delete [] biomes.data; biomes = BiomeArray(w * h); } @@ -181,7 +181,7 @@ void BiomeSource::getRawBiomeBlock(BiomeArray &biomes, int x, int z, int w, int { biomes[i] = Biome::biomes[result[i]]; #ifndef _CONTENT_PACKAGE - if(biomes[i] == NULL) + if(biomes[i] == nullptr) { app.DebugPrintf("Tried to assign null biome %d\n", result[i]); __debugbreak(); @@ -208,9 +208,9 @@ void BiomeSource::getBiomeBlock(BiomeArray& biomes, int x, int z, int w, int h, { IntCache::releaseAll(); //if (biomes == null || biomes.length < w * h) - if (biomes.data == NULL || biomes.length < w * h) + if (biomes.data == nullptr || biomes.length < w * h) { - if(biomes.data != NULL) delete [] biomes.data; + if(biomes.data != nullptr) delete [] biomes.data; biomes = BiomeArray(w * h); } @@ -248,9 +248,9 @@ void BiomeSource::getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int { IntCache::releaseAll(); //if (biomes == null || biomes.length < w * h) - if (biomeIndices.data == NULL || biomeIndices.length < w * h) + if (biomeIndices.data == nullptr || biomeIndices.length < w * h) { - if(biomeIndices.data != NULL) delete [] biomeIndices.data; + if(biomeIndices.data != nullptr) delete [] biomeIndices.data; biomeIndices = byteArray(w * h); } @@ -341,7 +341,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *rand int w = x1 - x0 + 1; int h = z1 - z0 + 1; intArray biomes = layer->getArea(x0, z0, w, h); - TilePos *res = NULL; + TilePos *res = nullptr; int found = 0; int biomesCount = w*h; for (unsigned int i = 0; i < biomesCount; i++) @@ -351,7 +351,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *rand Biome *b = Biome::biomes[biomes[i]]; if (b == toFind) { - if (res == NULL || random->nextInt(found + 1) == 0) + if (res == nullptr || random->nextInt(found + 1) == 0) { res = new TilePos(xx, 0, zz); found++; @@ -380,7 +380,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, vector allowed, Ra int h = z1 - z0 + 1; MemSect(50); intArray biomes = layer->getArea(x0, z0, w, h); - TilePos *res = NULL; + TilePos *res = nullptr; int found = 0; for (unsigned int i = 0; i < w * h; i++) { @@ -389,7 +389,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, vector allowed, Ra Biome *b = Biome::biomes[biomes[i]]; if (find(allowed.begin(), allowed.end(), b) != allowed.end()) { - if (res == NULL || random->nextInt(found + 1) == 0) + if (res == nullptr || random->nextInt(found + 1) == 0) { delete res; res = new TilePos(xx, 0, zz); diff --git a/Minecraft.World/BirchFeature.cpp b/Minecraft.World/BirchFeature.cpp index d7a57514d..3c423564a 100644 --- a/Minecraft.World/BirchFeature.cpp +++ b/Minecraft.World/BirchFeature.cpp @@ -42,7 +42,7 @@ bool BirchFeature::place(Level *level, Random *random, int x, int y, int z) if ((belowTile != Tile::grass_Id && belowTile != Tile::dirt_Id) || y >= Level::maxBuildHeight - treeHeight - 1) return false; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); int radius = 3; diff --git a/Minecraft.World/Blaze.cpp b/Minecraft.World/Blaze.cpp index 652aa673b..de74fc758 100644 --- a/Minecraft.World/Blaze.cpp +++ b/Minecraft.World/Blaze.cpp @@ -87,7 +87,7 @@ void Blaze::aiStep() allowedHeightOffset = .5f + static_cast(random->nextGaussian()) * 3; } - if (getAttackTarget() != NULL && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset)) + if (getAttackTarget() != nullptr && (getAttackTarget()->y + getAttackTarget()->getHeadHeight()) > (y + getHeadHeight() + allowedHeightOffset)) { yd = yd + (.3f - yd) * .3f; } diff --git a/Minecraft.World/BlockReplacements.cpp b/Minecraft.World/BlockReplacements.cpp index ac31b3d2e..f60d9e2af 100644 --- a/Minecraft.World/BlockReplacements.cpp +++ b/Minecraft.World/BlockReplacements.cpp @@ -9,7 +9,7 @@ void BlockReplacements::staticCtor() for (int i = 0; i < 256; i++) { byte b = static_cast(i); - if (b != 0 && Tile::tiles[b & 0xff] == NULL) + if (b != 0 && Tile::tiles[b & 0xff] == nullptr) { b = 0; } diff --git a/Minecraft.World/Boat.cpp b/Minecraft.World/Boat.cpp index 1811c2094..a470936ab 100644 --- a/Minecraft.World/Boat.cpp +++ b/Minecraft.World/Boat.cpp @@ -97,7 +97,7 @@ bool Boat::hurt(DamageSource *source, float hurtDamage) // 4J-JEV: Fix for #88212, // Untrusted players shouldn't be able to damage minecarts or boats. - if (dynamic_cast(source) != NULL) + if (dynamic_cast(source) != nullptr) { shared_ptr attacker = source->getDirectEntity(); @@ -113,18 +113,18 @@ bool Boat::hurt(DamageSource *source, float hurtDamage) // 4J Stu - If someone is riding in this, then it can tick multiple times which causes the damage to // decrease too quickly. So just make the damage a bit higher to start with for similar behaviour // to an unridden one. Only do this change if the riding player is attacking it. - if( rider.lock() != NULL && rider.lock() == source->getEntity() ) hurtDamage += 1; + if( rider.lock() != nullptr && rider.lock() == source->getEntity() ) hurtDamage += 1; setDamage(getDamage() + hurtDamage * 10); markHurt(); // 4J Stu - Brought froward from 12w36 to fix #46611 - TU5: Gameplay: Minecarts and boat requires more hits than one to be destroyed in creative mode // 4J-PB - Fix for XB1 #175735 - [CRASH] [Multi-Plat]: Code: Gameplay: Placing a boat on harmful surfaces causes the game to crash - bool creativePlayer = (source->getEntity() != NULL) && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast(source->getEntity())->abilities.instabuild; + bool creativePlayer = (source->getEntity() != nullptr) && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast(source->getEntity())->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { - if (rider.lock() != NULL) rider.lock()->ride( shared_from_this() ); + if (rider.lock() != nullptr) rider.lock()->ride( shared_from_this() ); if (!creativePlayer) spawnAtLocation(Item::boat_Id, 1, 0); remove(); } @@ -318,7 +318,7 @@ void Boat::tick() } - if ( rider.lock() != NULL && rider.lock()->instanceof(eTYPE_LIVINGENTITY) ) + if ( rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr livingRider = dynamic_pointer_cast(rider.lock()); double forward = livingRider->yya; @@ -438,7 +438,7 @@ void Boat::tick() } - if (rider.lock() != NULL) + if (rider.lock() != nullptr) { if (rider.lock()->removed) rider = weak_ptr(); } @@ -446,7 +446,7 @@ void Boat::tick() void Boat::positionRider() { - if (rider.lock() == NULL) return; + if (rider.lock() == nullptr) return; double xa = cos(yRot * PI / 180) * 0.4; double za = sin(yRot * PI / 180) * 0.4; @@ -475,7 +475,7 @@ wstring Boat::getName() bool Boat::interact(shared_ptr player) { - if ( (rider.lock() != NULL) && rider.lock()->instanceof(eTYPE_PLAYER) && (rider.lock() != player) ) return true; + if ( (rider.lock() != nullptr) && rider.lock()->instanceof(eTYPE_PLAYER) && (rider.lock() != player) ) return true; if (!level->isClientSide) { // 4J HEG - Fixed issue with player not being able to dismount boat (issue #4446) diff --git a/Minecraft.World/BoatItem.cpp b/Minecraft.World/BoatItem.cpp index d2bb75b5b..379e5e448 100644 --- a/Minecraft.World/BoatItem.cpp +++ b/Minecraft.World/BoatItem.cpp @@ -39,7 +39,7 @@ bool BoatItem::TestUse(shared_ptr itemInstance, Level *level, shar double range = 5; Vec3 *to = from->add(xa * range, ya * range, za * range); HitResult *hr = level->clip(from, to, true); - if (hr == NULL) return false; + if (hr == nullptr) return false; if (hr->type == HitResult::TILE) { @@ -74,7 +74,7 @@ shared_ptr BoatItem::use(shared_ptr itemInstance, Le double range = 5; Vec3 *to = from->add(xa * range, ya * range, za * range); HitResult *hr = level->clip(from, to, true); - if (hr == NULL) return itemInstance; + if (hr == nullptr) return itemInstance; // check entity collision Vec3 *b = player->getViewVector(a); diff --git a/Minecraft.World/BonusChestFeature.cpp b/Minecraft.World/BonusChestFeature.cpp index 6d083f547..cd33e60ae 100644 --- a/Minecraft.World/BonusChestFeature.cpp +++ b/Minecraft.World/BonusChestFeature.cpp @@ -59,7 +59,7 @@ bool BonusChestFeature::place(Level *level, Random *random, int x, int y, int z, { level->setTileAndData(x2, y2, z2, Tile::chest_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr chest = dynamic_pointer_cast(level->getTileEntity(x2, y2, z2)); - if (chest != NULL) + if (chest != nullptr) { WeighedTreasure::addChestItems(random, treasureList, chest, numRolls); chest->isBonusChest = true; // 4J added diff --git a/Minecraft.World/BottleItem.cpp b/Minecraft.World/BottleItem.cpp index 7a666752d..57fb95cdf 100644 --- a/Minecraft.World/BottleItem.cpp +++ b/Minecraft.World/BottleItem.cpp @@ -18,7 +18,7 @@ Icon *BottleItem::getIcon(int auxValue) shared_ptr BottleItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == NULL) return itemInstance; + if (hr == nullptr) return itemInstance; if (hr->type == HitResult::TILE) { @@ -63,7 +63,7 @@ shared_ptr BottleItem::use(shared_ptr itemInstance, bool BottleItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == NULL) return false; + if (hr == nullptr) return false; if (hr->type == HitResult::TILE) { diff --git a/Minecraft.World/BoundingBox.cpp b/Minecraft.World/BoundingBox.cpp index 74dba470f..e93158f2d 100644 --- a/Minecraft.World/BoundingBox.cpp +++ b/Minecraft.World/BoundingBox.cpp @@ -115,7 +115,7 @@ BoundingBox *BoundingBox::getIntersection(BoundingBox *other) { if (!intersects(other)) { - return NULL; + return nullptr; } BoundingBox *result = new BoundingBox(); result->x0 = Math::_max(x0, other->x0); diff --git a/Minecraft.World/BowItem.cpp b/Minecraft.World/BowItem.cpp index ef55a8a5c..b2ef08c9e 100644 --- a/Minecraft.World/BowItem.cpp +++ b/Minecraft.World/BowItem.cpp @@ -15,7 +15,7 @@ BowItem::BowItem(int id) : Item( id ) maxStackSize = 1; setMaxDamage(384); - icons = NULL; + icons = nullptr; } void BowItem::releaseUsing(shared_ptr itemInstance, Level *level, shared_ptr player, int durationLeft) diff --git a/Minecraft.World/BreedGoal.cpp b/Minecraft.World/BreedGoal.cpp index 1c46fd90f..11840388c 100644 --- a/Minecraft.World/BreedGoal.cpp +++ b/Minecraft.World/BreedGoal.cpp @@ -25,12 +25,12 @@ bool BreedGoal::canUse() { if (!animal->isInLove()) return false; partner = weak_ptr(getFreePartner()); - return partner.lock() != NULL; + return partner.lock() != nullptr; } bool BreedGoal::canContinueToUse() { - return partner.lock() != NULL && partner.lock()->isAlive() && partner.lock()->isInLove() && loveTime < 20 * 3; + return partner.lock() != nullptr && partner.lock()->isAlive() && partner.lock()->isInLove() && loveTime < 20 * 3; } void BreedGoal::stop() @@ -74,21 +74,21 @@ void BreedGoal::breed() shared_ptr offspring = animal->getBreedOffspring(partner.lock()); animal->setDespawnProtected(); partner.lock()->setDespawnProtected(); - if (offspring == NULL) + if (offspring == nullptr) { - // This will be NULL if we've hit our limits for spawning any particular type of animal... reset things as normally as we can, without actually producing any offspring + // This will be nullptr if we've hit our limits for spawning any particular type of animal... reset things as normally as we can, without actually producing any offspring animal->resetLove(); partner.lock()->resetLove(); return; } shared_ptr loveCause = animal->getLoveCause(); - if (loveCause == NULL && partner.lock()->getLoveCause() != NULL) + if (loveCause == nullptr && partner.lock()->getLoveCause() != nullptr) { loveCause = partner.lock()->getLoveCause(); } - if (loveCause != NULL) + if (loveCause != nullptr) { // Record mob bred stat. loveCause->awardStat(GenericStats::breedEntity(offspring->GetType()),GenericStats::param_breedEntity(offspring->GetType())); diff --git a/Minecraft.World/BrewingStandMenu.cpp b/Minecraft.World/BrewingStandMenu.cpp index 4f9e2ac34..2200f47c3 100644 --- a/Minecraft.World/BrewingStandMenu.cpp +++ b/Minecraft.World/BrewingStandMenu.cpp @@ -69,7 +69,7 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla Slot *PotionSlot2 = slots.at(BOTTLE_SLOT_START+1); Slot *PotionSlot3 = slots.at(BOTTLE_SLOT_START+2); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -199,7 +199,7 @@ bool BrewingStandMenu::PotionSlot::mayCombine(shared_ptr second) bool BrewingStandMenu::PotionSlot::mayPlaceItem(shared_ptr item) { - return item != NULL && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id); + return item != nullptr && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id); } @@ -210,7 +210,7 @@ BrewingStandMenu::IngredientsSlot::IngredientsSlot(shared_ptr contain bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr item) { - if (item != NULL) + if (item != nullptr) { if (PotionBrewing::SIMPLIFIED_BREWING) { diff --git a/Minecraft.World/BrewingStandTile.cpp b/Minecraft.World/BrewingStandTile.cpp index afb324ce0..afdf839aa 100644 --- a/Minecraft.World/BrewingStandTile.cpp +++ b/Minecraft.World/BrewingStandTile.cpp @@ -10,7 +10,7 @@ BrewingStandTile::BrewingStandTile(int id) : BaseEntityTile(id, Material::metal, isSolidRender()) { random = new Random(); - iconBase = NULL; + iconBase = nullptr; } BrewingStandTile::~BrewingStandTile() @@ -60,7 +60,7 @@ bool BrewingStandTile::use(Level *level, int x, int y, int z, shared_ptr return true; } shared_ptr brewingStand = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (brewingStand != NULL) player->openBrewingStand(brewingStand); + if (brewingStand != nullptr) player->openBrewingStand(brewingStand); return true; } @@ -86,13 +86,13 @@ void BrewingStandTile::animateTick(Level *level, int xt, int yt, int zt, Random void BrewingStandTile::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != NULL && ( dynamic_pointer_cast(tileEntity) != NULL) ) + if (tileEntity != nullptr && ( dynamic_pointer_cast(tileEntity) != nullptr) ) { shared_ptr container = dynamic_pointer_cast(tileEntity); for (int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != NULL) + if (item != nullptr) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; diff --git a/Minecraft.World/BrewingStandTileEntity.cpp b/Minecraft.World/BrewingStandTileEntity.cpp index 2c535a0e7..825149816 100644 --- a/Minecraft.World/BrewingStandTileEntity.cpp +++ b/Minecraft.World/BrewingStandTileEntity.cpp @@ -96,7 +96,7 @@ int BrewingStandTileEntity::getBrewTime() bool BrewingStandTileEntity::isBrewable() { - if (items[INGREDIENT_SLOT] == NULL || items[INGREDIENT_SLOT]->count <= 0) + if (items[INGREDIENT_SLOT] == nullptr || items[INGREDIENT_SLOT]->count <= 0) { return false; } @@ -111,7 +111,7 @@ bool BrewingStandTileEntity::isBrewable() bool oneResult = false; for (int dest = 0; dest < 3; dest++) { - if (items[dest] != NULL && items[dest]->id == Item::potion_Id) + if (items[dest] != nullptr && items[dest]->id == Item::potion_Id) { int currentBrew = items[dest]->getAuxValue(); int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) ); @@ -129,7 +129,7 @@ bool BrewingStandTileEntity::isBrewable() // TODO - find out whether actually checking pointers to MobEffectInstance classes for equality // is of any use bool equals = false; - if( ( currentEffects != NULL ) && ( newEffects != NULL ) ) + if( ( currentEffects != nullptr ) && ( newEffects != nullptr ) ) { if( currentEffects->size() == newEffects->size() ) { @@ -141,7 +141,7 @@ bool BrewingStandTileEntity::isBrewable() } if ((currentBrew > 0 && currentEffects == newEffects) || - (currentEffects != NULL && (equals || newEffects == NULL))) + (currentEffects != nullptr && (equals || newEffects == nullptr))) { } else if (currentBrew != newBrew) @@ -166,7 +166,7 @@ bool BrewingStandTileEntity::isBrewable() bool oneResult = false; for (int dest = 0; dest < 3; dest++) { - if (items[dest] != NULL && items[dest]->id == Item::potion_Id) + if (items[dest] != nullptr && items[dest]->id == Item::potion_Id) { int currentBrew = items[dest]->getAuxValue(); int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) ); @@ -176,7 +176,7 @@ bool BrewingStandTileEntity::isBrewable() break; } } - else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id) + else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id) { oneResult = true; break; @@ -199,7 +199,7 @@ void BrewingStandTileEntity::doBrew() { for (int dest = 0; dest < 3; dest++) { - if (items[dest] != NULL && items[dest]->id == Item::potion_Id) + if (items[dest] != nullptr && items[dest]->id == Item::potion_Id) { int currentBrew = items[dest]->getAuxValue(); int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) ); @@ -211,7 +211,7 @@ void BrewingStandTileEntity::doBrew() // TODO - find out whether actually checking pointers to MobEffectInstance classes for equality // is of any use bool equals = false; - if( ( currentEffects != NULL ) && ( newEffects != NULL ) ) + if( ( currentEffects != nullptr ) && ( newEffects != nullptr ) ) { if( currentEffects->size() == newEffects->size() ) { @@ -223,7 +223,7 @@ void BrewingStandTileEntity::doBrew() } if ((currentBrew > 0 && currentEffects == newEffects) || - (currentEffects != NULL && (equals || newEffects == NULL))) + (currentEffects != nullptr && (equals || newEffects == nullptr))) { if (!PotionItem::isThrowable(currentBrew) && PotionItem::isThrowable(newBrew)) { @@ -246,13 +246,13 @@ void BrewingStandTileEntity::doBrew() for (int dest = 0; dest < 3; dest++) { - if (items[dest] != NULL && items[dest]->id == Item::potion_Id) + if (items[dest] != nullptr && items[dest]->id == Item::potion_Id) { int currentBrew = items[dest]->getAuxValue(); int newBrew = NORMALISE_POTION_AUXVAL( applyIngredient(currentBrew, ingredient) ); items[dest]->setAuxValue(newBrew); } - else if (isWater && items[dest] != NULL && items[dest]->id == Item::glassBottle_Id) + else if (isWater && items[dest] != nullptr && items[dest]->id == Item::glassBottle_Id) { items[dest] = shared_ptr(new ItemInstance(Item::potion)); } @@ -275,7 +275,7 @@ void BrewingStandTileEntity::doBrew() int BrewingStandTileEntity::applyIngredient(int currentBrew, shared_ptr ingredient) { - if (ingredient == NULL) + if (ingredient == nullptr) { return currentBrew; } @@ -327,7 +327,7 @@ void BrewingStandTileEntity::save(CompoundTag *base) for (int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i)); @@ -354,7 +354,7 @@ shared_ptr BrewingStandTileEntity::removeItem(unsigned int slot, i // option on the ingredients slot // Fix for #65373 - TU8: Content: UI: Command "Take Half" in the Brewing Stand interface doesn't work as intended. - if (slot >= 0 && slot < items.length && items[slot] != NULL) + if (slot >= 0 && slot < items.length && items[slot] != nullptr) { if (items[slot]->count <= count) { @@ -445,7 +445,7 @@ int BrewingStandTileEntity::getPotionBits() int newCount = 0; for (int potion = 0; potion < 3; potion++) { - if (items[potion] != NULL) + if (items[potion] != nullptr) { newCount |= (1 << potion); } @@ -485,7 +485,7 @@ shared_ptr BrewingStandTileEntity::clone() for (unsigned int i = 0; i < items.length; i++) { - if (items.data[i] != NULL) + if (items.data[i] != nullptr) { result->items.data[i] = ItemInstance::clone(items.data[i]); } diff --git a/Minecraft.World/BucketItem.cpp b/Minecraft.World/BucketItem.cpp index a3bd7bee1..b7553c26b 100644 --- a/Minecraft.World/BucketItem.cpp +++ b/Minecraft.World/BucketItem.cpp @@ -28,7 +28,7 @@ bool BucketItem::TestUse(shared_ptr itemInstance, Level *level, sh { bool pickLiquid = content == 0; HitResult *hr = getPlayerPOVHitResult(level, player, pickLiquid); - if (hr == NULL) return false; + if (hr == nullptr) return false; if (hr->type == HitResult::TILE) { @@ -105,7 +105,7 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, bool pickLiquid = content == 0; HitResult *hr = getPlayerPOVHitResult(level, player, pickLiquid); - if (hr == NULL) return itemInstance; + if (hr == nullptr) return itemInstance; if (hr->type == HitResult::TILE) { @@ -117,7 +117,7 @@ shared_ptr BucketItem::use(shared_ptr itemInstance, { app.DebugPrintf("!!!!!!!!!!! Can't place that here\n"); shared_ptr servPlayer = dynamic_pointer_cast(player); - if( servPlayer != NULL ) + if( servPlayer != nullptr ) { app.DebugPrintf("Sending ChatPacket::e_ChatCannotPlaceLava to player\n"); servPlayer->connection->send( shared_ptr( new ChatPacket(L"", ChatPacket::e_ChatCannotPlaceLava ) ) ); diff --git a/Minecraft.World/Bush.cpp b/Minecraft.World/Bush.cpp index 6f8e8d913..5575c837f 100644 --- a/Minecraft.World/Bush.cpp +++ b/Minecraft.World/Bush.cpp @@ -63,7 +63,7 @@ bool Bush::canSurvive(Level *level, int x, int y, int z) AABB *Bush::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool Bush::blocksLight() diff --git a/Minecraft.World/ButtonTile.cpp b/Minecraft.World/ButtonTile.cpp index f3387e20b..b05d597d1 100644 --- a/Minecraft.World/ButtonTile.cpp +++ b/Minecraft.World/ButtonTile.cpp @@ -21,7 +21,7 @@ Icon *ButtonTile::getTexture(int face, int data) AABB *ButtonTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } int ButtonTile::getTickDelay(Level *level) diff --git a/Minecraft.World/ByteArrayInputStream.cpp b/Minecraft.World/ByteArrayInputStream.cpp index 394bda14a..9a40b29a7 100644 --- a/Minecraft.World/ByteArrayInputStream.cpp +++ b/Minecraft.World/ByteArrayInputStream.cpp @@ -114,5 +114,5 @@ __int64 ByteArrayInputStream::skip(__int64 n) ByteArrayInputStream::~ByteArrayInputStream() { - if(buf.data != NULL) delete [] buf.data; + if(buf.data != nullptr) delete [] buf.data; } \ No newline at end of file diff --git a/Minecraft.World/ByteArrayOutputStream.cpp b/Minecraft.World/ByteArrayOutputStream.cpp index afb8c719a..a9f36e04a 100644 --- a/Minecraft.World/ByteArrayOutputStream.cpp +++ b/Minecraft.World/ByteArrayOutputStream.cpp @@ -20,7 +20,7 @@ ByteArrayOutputStream::ByteArrayOutputStream(unsigned int size) ByteArrayOutputStream::~ByteArrayOutputStream() { - if (buf.data != NULL) + if (buf.data != nullptr) delete[] buf.data; } diff --git a/Minecraft.World/ByteArrayTag.h b/Minecraft.World/ByteArrayTag.h index ce701fdbf..1d3e38755 100644 --- a/Minecraft.World/ByteArrayTag.h +++ b/Minecraft.World/ByteArrayTag.h @@ -41,7 +41,7 @@ public: if (Tag::equals(obj)) { ByteArrayTag *o = static_cast(obj); - return ((data.data == NULL && o->data.data == NULL) || (data.data != NULL && data.length == o->data.length && memcmp(data.data, o->data.data, data.length) == 0) ); + return ((data.data == nullptr && o->data.data == nullptr) || (data.data != nullptr && data.length == o->data.length && memcmp(data.data, o->data.data, data.length) == 0) ); } return false; } diff --git a/Minecraft.World/C4JThread.cpp b/Minecraft.World/C4JThread.cpp index 0582abb8f..81aa010be 100644 --- a/Minecraft.World/C4JThread.cpp +++ b/Minecraft.World/C4JThread.cpp @@ -21,7 +21,7 @@ CRITICAL_SECTION C4JThread::ms_threadListCS; #ifdef _XBOX_ONE // 4J Stu - On XboxOne the main thread is not the one that does all the static init, so we have to set this up later -C4JThread *C4JThread::m_mainThread = NULL; +C4JThread *C4JThread::m_mainThread = nullptr; void C4JThread::StaticInit() { @@ -109,12 +109,12 @@ C4JThread::C4JThread( C4JThreadStartFunc* startFunc, void* param, const char* th CPU = SCE_KERNEL_CPU_MASK_USER_1; } - m_threadID = sceKernelCreateThread(m_threadName, entryPoint, g_DefaultPriority, m_stackSize, 0, CPU, NULL); + m_threadID = sceKernelCreateThread(m_threadName, entryPoint, g_DefaultPriority, m_stackSize, 0, CPU, nullptr); app.DebugPrintf("***************************** start thread %s **************************\n", m_threadName); #else m_threadID = 0; m_threadHandle = 0; - m_threadHandle = CreateThread(NULL, m_stackSize, entryPoint, this, CREATE_SUSPENDED, &m_threadID); + m_threadHandle = CreateThread(nullptr, m_stackSize, entryPoint, this, CREATE_SUSPENDED, &m_threadID); #endif EnterCriticalSection(&ms_threadListCS); ms_threadList.push_back(this); @@ -128,8 +128,8 @@ C4JThread::C4JThread( const char* mainThreadName) user_registerthread(); #endif - m_startFunc = NULL; - m_threadParam = NULL; + m_startFunc = nullptr; + m_threadParam = nullptr; m_stackSize = 0; #ifdef __PS3__ @@ -178,7 +178,7 @@ C4JThread::~C4JThread() #endif #if defined __ORBIS__ - scePthreadJoin(m_threadID, NULL); + scePthreadJoin(m_threadID, nullptr); #endif EnterCriticalSection(&ms_threadListCS); @@ -212,7 +212,7 @@ void * C4JThread::entryPoint(void *param) pThread->m_exitCode = (*pThread->m_startFunc)(pThread->m_threadParam); pThread->m_completionFlag->Set(); pThread->m_isRunning = false; - scePthreadExit(NULL); + scePthreadExit(nullptr); } #elif defined __PSVITA__ struct StrArg { @@ -233,7 +233,7 @@ SceInt32 C4JThread::entryPoint(SceSize argSize, void *pArgBlock) PSVitaTLSStorage::RemoveThread(pThread->m_threadID); user_removethread(); - sceKernelExitDeleteThread(NULL); + sceKernelExitDeleteThread(nullptr); return pThread->m_exitCode; } @@ -270,7 +270,7 @@ void C4JThread::Run() scePthreadAttrDestroy(&m_threadAttr); #elif defined __PSVITA__ StrArg strArg = {this}; -// m_threadID = sceKernelCreateThread(m_threadName, entryPoint, m_priority, m_stackSize, 0, m_CPUMask, NULL); +// m_threadID = sceKernelCreateThread(m_threadName, entryPoint, m_priority, m_stackSize, 0, m_CPUMask, nullptr); sceKernelStartThread( m_threadID, sizeof(strArg), &strArg); #else ResumeThread(m_threadHandle); @@ -450,7 +450,7 @@ C4JThread* C4JThread::getCurrentThread() LeaveCriticalSection(&ms_threadListCS); - return NULL; + return nullptr; } bool C4JThread::isMainThread() @@ -480,12 +480,12 @@ C4JThread::Event::Event(EMode mode/* = e_modeAutoClear*/) #elif defined __ORBIS__ char name[1] = {0}; - sceKernelCreateEventFlag( &m_event, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); + sceKernelCreateEventFlag( &m_event, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); #elif defined __PSVITA__ char name[1] = {0}; - m_event = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); + m_event = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); #else - m_event = CreateEvent( NULL, (m_mode == e_modeManualClear), FALSE, NULL ); + m_event = CreateEvent( nullptr, (m_mode == e_modeManualClear), FALSE, nullptr ); #endif //__PS3__ } @@ -554,7 +554,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) SceKernelUseconds *pTimeoutMicrosecs; if( timeoutMs == INFINITE ) { - pTimeoutMicrosecs = NULL; + pTimeoutMicrosecs = nullptr; } else { @@ -566,7 +566,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) { waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_PAT; } - int err = sceKernelWaitEventFlag(m_event, 1, waitMode, NULL, pTimeoutMicrosecs); + int err = sceKernelWaitEventFlag(m_event, 1, waitMode, nullptr, pTimeoutMicrosecs); switch(err) { case SCE_OK: return WAIT_OBJECT_0; @@ -579,7 +579,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) SceUInt32 *pTimeoutMicrosecs; if( timeoutMs == INFINITE ) { - pTimeoutMicrosecs = NULL; + pTimeoutMicrosecs = nullptr; } else { @@ -591,7 +591,7 @@ DWORD C4JThread::Event::WaitForSignal( int timeoutMs ) { waitMode |= SCE_KERNEL_EVF_WAITMODE_CLEAR_ALL; } - int err = sceKernelWaitEventFlag(m_event, 1, waitMode, NULL, pTimeoutMicrosecs); + int err = sceKernelWaitEventFlag(m_event, 1, waitMode, nullptr, pTimeoutMicrosecs); switch(err) { case SCE_OK: return WAIT_OBJECT_0; @@ -623,15 +623,15 @@ C4JThread::EventArray::EventArray( int size, EMode mode/* = e_modeAutoClear*/) assert(err == CELL_OK); #elif defined __ORBIS__ char name[1] = {0}; - sceKernelCreateEventFlag( &m_events, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); + sceKernelCreateEventFlag( &m_events, name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); #elif defined __PSVITA__ char name[1] = {0}; - m_events = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, NULL); + m_events = sceKernelCreateEventFlag( name, SCE_KERNEL_EVF_ATTR_TH_FIFO | SCE_KERNEL_EVF_ATTR_MULTI, 0, nullptr); #else m_events = new HANDLE[size]; for(int i=0;i forceEntity) // 4J added forceData, forceEntity param diff --git a/Minecraft.World/CauldronTile.cpp b/Minecraft.World/CauldronTile.cpp index f7a8d0445..599a9353e 100644 --- a/Minecraft.World/CauldronTile.cpp +++ b/Minecraft.World/CauldronTile.cpp @@ -13,9 +13,9 @@ const wstring CauldronTile::TEXTURE_BOTTOM = L"cauldron_bottom"; CauldronTile::CauldronTile(int id) : Tile(id, Material::metal, isSolidRender()) { - iconInner = NULL; - iconTop = NULL; - iconBottom = NULL; + iconInner = nullptr; + iconTop = nullptr; + iconBottom = nullptr; } Icon *CauldronTile::getTexture(int face, int data) @@ -43,7 +43,7 @@ Icon *CauldronTile::getTexture(const wstring &name) { if (name.compare(TEXTURE_INSIDE) == 0) return Tile::cauldron->iconInner; if (name.compare(TEXTURE_BOTTOM) == 0) return Tile::cauldron->iconBottom; - return NULL; + return nullptr; } void CauldronTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) @@ -93,7 +93,7 @@ bool CauldronTile::use(Level *level, int x, int y, int z, shared_ptr pla } shared_ptr item = player->inventory->getSelected(); - if (item == NULL) + if (item == nullptr) { return true; } diff --git a/Minecraft.World/CaveFeature.cpp b/Minecraft.World/CaveFeature.cpp index c460d8634..cf83e8a3f 100644 --- a/Minecraft.World/CaveFeature.cpp +++ b/Minecraft.World/CaveFeature.cpp @@ -35,7 +35,7 @@ bool CaveFeature::place(Level *level, Random *random, int x, int y, int z) double hr = (Mth::sin(d / 16.0f * PI) * radius + 1) * ss + 1; // 4J Stu Added to stop cave features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects((xx - r / 2), (yy - hr / 2), (zz - r / 2), (xx + r / 2), (yy + hr / 2), (zz + r / 2)); diff --git a/Minecraft.World/ChestTile.cpp b/Minecraft.World/ChestTile.cpp index 06e57d7d2..a81497215 100644 --- a/Minecraft.World/ChestTile.cpp +++ b/Minecraft.World/ChestTile.cpp @@ -208,18 +208,18 @@ void ChestTile::neighborChanged(Level *level, int x, int y, int z, int type) { BaseEntityTile::neighborChanged(level, x, y, z, type); shared_ptr(cte) = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (cte != NULL) cte->clearCache(); + if (cte != nullptr) cte->clearCache(); } void ChestTile::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container != NULL ) + if (container != nullptr ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != NULL) + if (item != nullptr) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -272,7 +272,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player } shared_ptr container = getContainer(level, x, y, z); - if (container != NULL) + if (container != nullptr) { player->openContainer(container); } @@ -283,7 +283,7 @@ bool ChestTile::use(Level *level, int x, int y, int z, shared_ptr player shared_ptr ChestTile::getContainer(Level *level, int x, int y, int z) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container == NULL) return nullptr; + if (container == nullptr) return nullptr; if (level->isSolidBlockingTile(x, y + 1, z)) return nullptr; if (isCatSittingOnChest(level,x, y, z)) return nullptr; diff --git a/Minecraft.World/ChestTileEntity.cpp b/Minecraft.World/ChestTileEntity.cpp index bdffb05cc..966eb5bb5 100644 --- a/Minecraft.World/ChestTileEntity.cpp +++ b/Minecraft.World/ChestTileEntity.cpp @@ -65,7 +65,7 @@ shared_ptr ChestTileEntity::getItem(unsigned int slot) shared_ptr ChestTileEntity::removeItem(unsigned int slot, int count) { - if (items->data[slot] != NULL) + if (items->data[slot] != nullptr) { if (items->data[slot]->count <= count) { @@ -91,7 +91,7 @@ shared_ptr ChestTileEntity::removeItem(unsigned int slot, int coun shared_ptr ChestTileEntity::removeItemNoUpdate(int slot) { - if (items->data[slot] != NULL) + if (items->data[slot] != nullptr) { shared_ptr item = items->data[slot]; items->data[slot] = nullptr; @@ -103,7 +103,7 @@ shared_ptr ChestTileEntity::removeItemNoUpdate(int slot) void ChestTileEntity::setItem(unsigned int slot, shared_ptr item) { items->data[slot] = item; - if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); this->setChanged(); } @@ -154,7 +154,7 @@ void ChestTileEntity::save(CompoundTag *base) for (unsigned int i = 0; i < items->length; i++) { - if (items->data[i] != NULL) + if (items->data[i] != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i)); @@ -244,16 +244,16 @@ void ChestTileEntity::checkNeighbors() } shared_ptr cteThis = dynamic_pointer_cast(shared_from_this()); - if (n.lock() != NULL) n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH); - if (s.lock() != NULL) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH); - if (e.lock() != NULL) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST); - if (w.lock() != NULL) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST); + if (n.lock() != nullptr) n.lock()->heyImYourNeighbor(cteThis, Direction::SOUTH); + if (s.lock() != nullptr) s.lock()->heyImYourNeighbor(cteThis, Direction::NORTH); + if (e.lock() != nullptr) e.lock()->heyImYourNeighbor(cteThis, Direction::WEST); + if (w.lock() != nullptr) w.lock()->heyImYourNeighbor(cteThis, Direction::EAST); } bool ChestTileEntity::isSameChest(int x, int y, int z) { Tile *tile = Tile::tiles[level->getTile(x, y, z)]; - if (tile == NULL || !(dynamic_cast(tile) != NULL)) return false; + if (tile == nullptr || !(dynamic_cast(tile) != nullptr)) return false; return static_cast(tile)->type == getType(); } @@ -283,7 +283,7 @@ void ChestTileEntity::tick() shared_ptr container = containerMenu->getContainer(); shared_ptr thisContainer = dynamic_pointer_cast(shared_from_this()); shared_ptr compoundContainer = dynamic_pointer_cast(container); - if ((container == thisContainer) || (compoundContainer != NULL && compoundContainer->contains(thisContainer))) + if ((container == thisContainer) || (compoundContainer != nullptr && compoundContainer->contains(thisContainer))) { openCount++; } @@ -298,12 +298,12 @@ void ChestTileEntity::tick() float speed = 0.10f; if (openCount > 0 && openness == 0) { - if (n.lock() == NULL && w.lock() == NULL) + if (n.lock() == nullptr && w.lock() == nullptr) { double xc = x + 0.5; double zc = z + 0.5; - if (s.lock() != NULL) zc += 0.5; - if (e.lock() != NULL) xc += 0.5; + if (s.lock() != nullptr) zc += 0.5; + if (e.lock() != nullptr) xc += 0.5; // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_OPEN, 0.2f, level->random->nextFloat() * 0.1f + 0.9f); @@ -323,12 +323,12 @@ void ChestTileEntity::tick() { // Fix for #64546 - Customer Encountered: TU7: Chests placed by the Player are closing too fast. //openness = 0; - if (n.lock() == NULL && w.lock() == NULL) + if (n.lock() == nullptr && w.lock() == nullptr) { double xc = x + 0.5; double zc = z + 0.5; - if (s.lock() != NULL) zc += 0.5; - if (e.lock() != NULL) xc += 0.5; + if (s.lock() != nullptr) zc += 0.5; + if (e.lock() != nullptr) xc += 0.5; // 4J-PB - Seems the chest open volume is much louder than other sounds from user reports. We'll tone it down a bit level->playSound(xc, y + 0.5, zc, eSoundType_RANDOM_CHEST_CLOSE, 0.2f, level->random->nextFloat() * 0.1f + 0.9f); @@ -366,7 +366,7 @@ void ChestTileEntity::startOpen() void ChestTileEntity::stopOpen() { - if (getTile() == NULL || !( dynamic_cast( getTile() ) != NULL)) return; + if (getTile() == nullptr || !( dynamic_cast( getTile() ) != nullptr)) return; openCount--; level->tileEvent(x, y, z, getTile()->id, ChestTile::EVENT_SET_OPEN_COUNT, openCount); level->updateNeighborsAt(x, y, z, getTile()->id); @@ -389,7 +389,7 @@ int ChestTileEntity::getType() { if (type == -1) { - if (level != NULL && dynamic_cast( getTile() ) != NULL) + if (level != nullptr && dynamic_cast( getTile() ) != nullptr) { type = static_cast(getTile())->type; } @@ -410,7 +410,7 @@ shared_ptr ChestTileEntity::clone() for (unsigned int i = 0; i < items->length; i++) { - if (items->data[i] != NULL) + if (items->data[i] != nullptr) { result->items->data[i] = ItemInstance::clone(items->data[i]); } diff --git a/Minecraft.World/ChunkSource.h b/Minecraft.World/ChunkSource.h index c537651c0..37b0ecc33 100644 --- a/Minecraft.World/ChunkSource.h +++ b/Minecraft.World/ChunkSource.h @@ -73,7 +73,7 @@ public: virtual bool tick() = 0; virtual bool shouldSave() = 0; - virtual LevelChunk **getCache() { return NULL; } // 4J added + virtual LevelChunk **getCache() { return nullptr; } // 4J added virtual void dataReceived(int x, int z) {} // 4J added /** diff --git a/Minecraft.World/ClientSideMerchant.cpp b/Minecraft.World/ClientSideMerchant.cpp index ba1793007..1b54580b8 100644 --- a/Minecraft.World/ClientSideMerchant.cpp +++ b/Minecraft.World/ClientSideMerchant.cpp @@ -7,8 +7,8 @@ ClientSideMerchant::ClientSideMerchant(shared_ptr source, const wstring { this->source = source; // 4J Stu - Need to do this after creating as a shared_ptr - container = NULL; //new MerchantContainer(source, this); - currentOffers = NULL; + container = nullptr; //new MerchantContainer(source, this); + currentOffers = nullptr; m_name = name; } diff --git a/Minecraft.World/ClockItem.cpp b/Minecraft.World/ClockItem.cpp index afe0544d2..83b8e7a4d 100644 --- a/Minecraft.World/ClockItem.cpp +++ b/Minecraft.World/ClockItem.cpp @@ -12,7 +12,7 @@ const wstring ClockItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"clockP0",L"cl ClockItem::ClockItem(int id) : Item(id) { - icons = NULL; + icons = nullptr; } // 4J Added so that we can override the icon id used to calculate the texture UV's for each player @@ -21,7 +21,7 @@ Icon *ClockItem::getIcon(int auxValue) Icon *icon = Item::getIcon(auxValue); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->player != NULL && auxValue == 0 ) + if( pMinecraft->player != nullptr && auxValue == 0 ) { icon = icons[pMinecraft->player->GetXboxPad()]; } diff --git a/Minecraft.World/ColoredTileItem.cpp b/Minecraft.World/ColoredTileItem.cpp index 37ea4c63b..f659d7a5f 100644 --- a/Minecraft.World/ColoredTileItem.cpp +++ b/Minecraft.World/ColoredTileItem.cpp @@ -15,7 +15,7 @@ ColoredTileItem::ColoredTileItem(int id, bool stackedByData) : TileItem(id) ColoredTileItem::~ColoredTileItem() { - if(descriptionPostfixes.data != NULL) delete [] descriptionPostfixes.data; + if(descriptionPostfixes.data != nullptr) delete [] descriptionPostfixes.data; } int ColoredTileItem::getColor(shared_ptr item, int spriteLayer) @@ -35,7 +35,7 @@ int ColoredTileItem::getLevelDataForAuxValue(int auxValue) ColoredTileItem *ColoredTileItem::setDescriptionPostfixes(intArray descriptionPostfixes) { - if(this->descriptionPostfixes.data != NULL) delete this->descriptionPostfixes.data; + if(this->descriptionPostfixes.data != nullptr) delete this->descriptionPostfixes.data; this->descriptionPostfixes = intArray(descriptionPostfixes.length); for(unsigned int i = 0; i < descriptionPostfixes.length; ++i ) { @@ -47,7 +47,7 @@ ColoredTileItem *ColoredTileItem::setDescriptionPostfixes(intArray descriptionPo unsigned int ColoredTileItem::getDescriptionId(shared_ptr instance) { - if (descriptionPostfixes.data == NULL) + if (descriptionPostfixes.data == nullptr) { return TileItem::getDescriptionId(instance); } diff --git a/Minecraft.World/CombatEntry.cpp b/Minecraft.World/CombatEntry.cpp index 903d95bbe..5fe2e6d32 100644 --- a/Minecraft.World/CombatEntry.cpp +++ b/Minecraft.World/CombatEntry.cpp @@ -6,8 +6,8 @@ CombatEntry::CombatEntry(DamageSource *source, int time, float health, float damage, CombatTracker::eLOCATION location, float fallDistance) { - this->source = NULL; - if(source != NULL) + this->source = nullptr; + if(source != nullptr) { // 4J: this might actually be a derived damage source so use copy func this->source = source->copy(); @@ -61,7 +61,7 @@ CombatTracker::eLOCATION CombatEntry::getLocation() wstring CombatEntry::getAttackerName() { - return getSource()->getEntity() == NULL ? L"" : getSource()->getEntity()->getNetworkName(); + return getSource()->getEntity() == nullptr ? L"" : getSource()->getEntity()->getNetworkName(); } float CombatEntry::getFallDistance() diff --git a/Minecraft.World/CombatTracker.cpp b/Minecraft.World/CombatTracker.cpp index 2d35913c3..7fe8316fb 100644 --- a/Minecraft.World/CombatTracker.cpp +++ b/Minecraft.World/CombatTracker.cpp @@ -67,7 +67,7 @@ shared_ptr CombatTracker::getDeathMessagePacket() shared_ptr killingEntity = killingBlow->getSource()->getEntity(); - if (knockOffEntry != NULL && killingBlow->getSource()->equals(DamageSource::fall)) + if (knockOffEntry != nullptr && killingBlow->getSource()->equals(DamageSource::fall)) { shared_ptr attackerEntity = knockOffEntry->getSource()->getEntity(); @@ -93,11 +93,11 @@ shared_ptr CombatTracker::getDeathMessagePacket() result = shared_ptr(new ChatPacket(mob->getNetworkName(), message)); } - else if (attackerEntity != NULL && (killingEntity == NULL || attackerEntity != killingEntity)) + else if (attackerEntity != nullptr && (killingEntity == nullptr || attackerEntity != killingEntity)) { shared_ptr attackerItem = attackerEntity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(attackerEntity)->getCarriedItem() : nullptr; - if (attackerItem != NULL && attackerItem->hasCustomHoverName()) + if (attackerItem != nullptr && attackerItem->hasCustomHoverName()) { result = shared_ptr(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssistItem, attackerEntity->GetType(), attackerEntity->getNetworkName(), attackerItem->getHoverName())); } @@ -106,10 +106,10 @@ shared_ptr CombatTracker::getDeathMessagePacket() result = shared_ptr(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellAssist, attackerEntity->GetType(), attackerEntity->getNetworkName())); } } - else if (killingEntity != NULL) + else if (killingEntity != nullptr) { shared_ptr killerItem = killingEntity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(killingEntity)->getCarriedItem() : nullptr; - if (killerItem != NULL && killerItem->hasCustomHoverName()) + if (killerItem != nullptr && killerItem->hasCustomHoverName()) { result = shared_ptr(new ChatPacket(mob->getNetworkName(), ChatPacket::e_ChatDeathFellFinishItem, killingEntity->GetType(), killingEntity->getNetworkName(), killerItem->getHoverName())); } @@ -140,20 +140,20 @@ shared_ptr CombatTracker::getKiller() for ( CombatEntry *entry : entries ) { - if ( entry->getSource() != NULL && entry->getSource()->getEntity() != NULL && entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && (bestPlayer == NULL || entry->getDamage() > bestPlayerDamage)) + if ( entry->getSource() != nullptr && entry->getSource()->getEntity() != nullptr && entry->getSource()->getEntity()->instanceof(eTYPE_PLAYER) && (bestPlayer == nullptr || entry->getDamage() > bestPlayerDamage)) { bestPlayerDamage = entry->getDamage(); bestPlayer = dynamic_pointer_cast(entry->getSource()->getEntity()); } - if ( entry->getSource() != NULL && entry->getSource()->getEntity() != NULL && entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) && (bestMob == NULL || entry->getDamage() > bestMobDamage)) + if ( entry->getSource() != nullptr && entry->getSource()->getEntity() != nullptr && entry->getSource()->getEntity()->instanceof(eTYPE_LIVINGENTITY) && (bestMob == nullptr || entry->getDamage() > bestMobDamage)) { bestMobDamage = entry->getDamage(); bestMob = dynamic_pointer_cast(entry->getSource()->getEntity()); } } - if (bestPlayer != NULL && bestPlayerDamage >= bestMobDamage / 3) + if (bestPlayer != nullptr && bestPlayerDamage >= bestMobDamage / 3) { return bestPlayer; } @@ -165,20 +165,20 @@ shared_ptr CombatTracker::getKiller() CombatEntry *CombatTracker::getMostSignificantFall() { - CombatEntry *result = NULL; - CombatEntry *alternative = NULL; + CombatEntry *result = nullptr; + CombatEntry *alternative = nullptr; int altDamage = 0; float bestFall = 0; for (int i = 0; i < entries.size(); i++) { CombatEntry *entry = entries.at(i); - CombatEntry *previous = i > 0 ? entries.at(i - 1) : NULL; + CombatEntry *previous = i > 0 ? entries.at(i - 1) : nullptr; bool isFall = entry->getSource()->equals(DamageSource::fall); bool isOutOfWorld = entry->getSource()->equals(DamageSource::outOfWorld); - if ((isFall || isOutOfWorld) && (entry->getFallDistance() > 0) && (result == NULL || entry->getFallDistance() > bestFall)) + if ((isFall || isOutOfWorld) && (entry->getFallDistance() > 0) && (result == nullptr || entry->getFallDistance() > bestFall)) { if (i > 0) { @@ -191,23 +191,23 @@ CombatEntry *CombatTracker::getMostSignificantFall() bestFall = entry->getFallDistance(); } - if (entry->getLocation() != eLocation_GENERIC && (alternative == NULL || entry->getDamage() > altDamage)) + if (entry->getLocation() != eLocation_GENERIC && (alternative == nullptr || entry->getDamage() > altDamage)) { alternative = entry; } } - if (bestFall > 5 && result != NULL) + if (bestFall > 5 && result != nullptr) { return result; } - else if (altDamage > 5 && alternative != NULL) + else if (altDamage > 5 && alternative != nullptr) { return alternative; } else { - return NULL; + return nullptr; } } diff --git a/Minecraft.World/Command.cpp b/Minecraft.World/Command.cpp index bf546f6ea..2ec6853ca 100644 --- a/Minecraft.World/Command.cpp +++ b/Minecraft.World/Command.cpp @@ -24,7 +24,7 @@ void Command::logAdminAction(shared_ptr source, ChatPacket::EChat void Command::logAdminAction(shared_ptr source, int type, ChatPacket::EChatPacketMessage messageType, const wstring& message, int customData, const wstring& additionalMessage) { - if (logger != NULL) + if (logger != nullptr) { logger->logAdminCommand(source, type, messageType, message, customData, additionalMessage); } @@ -39,7 +39,7 @@ shared_ptr Command::getPlayer(PlayerUID playerId) { shared_ptr player = MinecraftServer::getInstance()->getPlayers()->getPlayer(playerId); - if (player == NULL) + if (player == nullptr) { return nullptr; } diff --git a/Minecraft.World/CommandBlock.cpp b/Minecraft.World/CommandBlock.cpp index e1b6b8dd3..1810ef132 100644 --- a/Minecraft.World/CommandBlock.cpp +++ b/Minecraft.World/CommandBlock.cpp @@ -38,7 +38,7 @@ void CommandBlock::tick(Level *level, int x, int y, int z, Random *random) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != NULL && dynamic_pointer_cast( tileEntity ) != NULL) + if (tileEntity != nullptr && dynamic_pointer_cast( tileEntity ) != nullptr) { shared_ptr commandBlock = dynamic_pointer_cast( tileEntity ); commandBlock->setSuccessCount(commandBlock->performCommand(level)); @@ -55,7 +55,7 @@ bool CommandBlock::use(Level *level, int x, int y, int z, shared_ptr pla { shared_ptr amce = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (amce != NULL) + if (amce != nullptr) { player->openTextEdit(amce); } @@ -72,7 +72,7 @@ int CommandBlock::getAnalogOutputSignal(Level *level, int x, int y, int z, int d { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != NULL && dynamic_pointer_cast( tileEntity ) != NULL) + if (tileEntity != nullptr && dynamic_pointer_cast( tileEntity ) != nullptr) { return dynamic_pointer_cast( tileEntity )->getSuccessCount(); } diff --git a/Minecraft.World/CommandBlockEntity.cpp b/Minecraft.World/CommandBlockEntity.cpp index 1c518f4fd..b81f8e46b 100644 --- a/Minecraft.World/CommandBlockEntity.cpp +++ b/Minecraft.World/CommandBlockEntity.cpp @@ -32,7 +32,7 @@ int CommandBlockEntity::performCommand(Level *level) } MinecraftServer *instance = MinecraftServer::getInstance(); - if (instance != NULL && instance->isCommandBlockEnabled()) + if (instance != nullptr && instance->isCommandBlockEnabled()) { CommandDispatcher *commandDispatcher = instance->getCommandDispatcher(); return commandDispatcher->performCommand(dynamic_pointer_cast(shared_from_this()), command, byteArray() ); diff --git a/Minecraft.World/CommonStats.cpp b/Minecraft.World/CommonStats.cpp index abef92aa5..5ad0e35b1 100644 --- a/Minecraft.World/CommonStats.cpp +++ b/Minecraft.World/CommonStats.cpp @@ -50,26 +50,26 @@ Stat* CommonStats::get_killsNetherZombiePigman() { return Stats::killsNetherZomb Stat *CommonStats::get_breedEntity(eINSTANCEOF mobType) { if (mobType == eTYPE_COW) return GenericStats::repopulation(); - else return NULL; + else return nullptr; } Stat *CommonStats::get_tamedEntity(eINSTANCEOF mobType) { if (mobType == eTYPE_OCELOT) return GenericStats::lionTamer(); else if (mobType == eTYPE_WOLF) return Stats::befriendsWolf; - else return NULL; + else return nullptr; } Stat *CommonStats::get_craftedEntity(eINSTANCEOF mobType) { if (mobType == eTYPE_VILLAGERGOLEM) return GenericStats::bodyGuard(); - else return NULL; + else return nullptr; } Stat *CommonStats::get_shearedEntity(eINSTANCEOF mobType) { if (mobType == eTYPE_SHEEP) return GenericStats::haveAShearfulDay(); - else return NULL; + else return nullptr; } Stat *CommonStats::get_totalBlocksMined() { return Stats::totalBlocksMined; } @@ -81,7 +81,7 @@ Stat* CommonStats::get_blocksPlaced(int blockId) #if (defined _EXTENDED_ACHIEVEMENTS) && (!defined _XBOX_ONE) return Stats::blocksPlaced[blockId]; #else - return NULL; + return nullptr; #endif } @@ -97,7 +97,7 @@ Stat *CommonStats::get_itemsCollected(int itemId, int itemAux) #endif if (itemId != Item::emerald_Id) return Stats::itemsCollected[itemId]; - else return NULL; + else return nullptr; } Stat *CommonStats::get_itemsCrafted(int itemId) { return Stats::itemsCrafted[itemId]; } @@ -111,7 +111,7 @@ Stat *CommonStats::get_itemsUsed(int itemId) if (itemId == Item::porkChop_cooked_Id) return Stats::blocksPlaced[itemId]; #endif - return NULL; + return nullptr; } Stat *CommonStats::get_itemsBought(int itemId) @@ -121,7 +121,7 @@ Stat *CommonStats::get_itemsBought(int itemId) // StatArray for Items Bought. if (itemId == Item::emerald_Id) return Stats::itemsCollected[itemId]; - else return NULL; + else return nullptr; } Stat *CommonStats::get_killsEnderdragon() { return Stats::killsEnderdragon; } @@ -133,7 +133,7 @@ Stat *CommonStats::get_enteredBiome(int biomeId) #if (defined _EXTENDED_ACHIEVEMENTS) && (!defined _XBOX_ONE) return Stats::biomesVisisted[biomeId]; #else - return NULL; + return nullptr; #endif } @@ -171,7 +171,7 @@ Stat *CommonStats::get_achievement(eAward achievementId) #ifndef _XBOX case eAward_snipeSkeleton: return (Stat *) Achievements::snipeSkeleton; case eAward_diamonds: return (Stat *) Achievements::diamonds; - case eAward_portal: return (Stat *) NULL; // TODO + case eAward_portal: return (Stat *) nullptr; // TODO case eAward_ghast: return (Stat *) Achievements::ghast; case eAward_blazeRod: return (Stat *) Achievements::blazeRod; case eAward_potion: return (Stat *) Achievements::potion; @@ -205,7 +205,7 @@ Stat *CommonStats::get_achievement(eAward achievementId) case eAward_lionTamer: return (Stat *) Achievements::lionTamer; #endif - default: return (Stat *) NULL; + default: return (Stat *) nullptr; } } @@ -286,7 +286,7 @@ byteArray CommonStats::getParam_noArgs() byteArray CommonStats::makeParam(int count) { - byteArray out( sizeof(int) ); + byteArray out( static_cast(sizeof(int)) ); memcpy(out.data,&count,sizeof(int)); return out; } diff --git a/Minecraft.World/ComparatorTile.cpp b/Minecraft.World/ComparatorTile.cpp index f611424d2..197a936cc 100644 --- a/Minecraft.World/ComparatorTile.cpp +++ b/Minecraft.World/ComparatorTile.cpp @@ -235,7 +235,7 @@ bool ComparatorTile::triggerEvent(Level *level, int x, int y, int z, int b0, int { DiodeTile::triggerEvent(level, x, y, z, b0, b1); shared_ptr te = level->getTileEntity(x, y, z); - if (te != NULL) + if (te != nullptr) { return te->triggerEvent(b0, b1); } diff --git a/Minecraft.World/CompassItem.cpp b/Minecraft.World/CompassItem.cpp index 57ad65d04..99d18ed08 100644 --- a/Minecraft.World/CompassItem.cpp +++ b/Minecraft.World/CompassItem.cpp @@ -12,7 +12,7 @@ const wstring CompassItem::TEXTURE_PLAYER_ICON[XUSER_MAX_COUNT] = {L"compassP0", CompassItem::CompassItem(int id) : Item(id) { - icons = NULL; + icons = nullptr; } // 4J Added so that we can override the icon id used to calculate the texture UV's for each player @@ -22,7 +22,7 @@ Icon *CompassItem::getIcon(int auxValue) Icon *icon = Item::getIcon(auxValue); Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->player != NULL && auxValue == 0 ) + if( pMinecraft->player != nullptr && auxValue == 0 ) { icon = icons[pMinecraft->player->GetXboxPad()]; } diff --git a/Minecraft.World/CompoundContainer.cpp b/Minecraft.World/CompoundContainer.cpp index 39da0e58f..50bfcc34d 100644 --- a/Minecraft.World/CompoundContainer.cpp +++ b/Minecraft.World/CompoundContainer.cpp @@ -6,8 +6,8 @@ CompoundContainer::CompoundContainer(int name, shared_ptr c1, shared_ptr c2) { this->name = name; - if (c1 == NULL) c1 = c2; - if (c2 == NULL) c2 = c1; + if (c1 == nullptr) c1 = c2; + if (c2 == nullptr) c2 = c1; this->c1 = c1; this->c2 = c2; } diff --git a/Minecraft.World/CompoundTag.h b/Minecraft.World/CompoundTag.h index e08706449..1822224e7 100644 --- a/Minecraft.World/CompoundTag.h +++ b/Minecraft.World/CompoundTag.h @@ -130,7 +130,7 @@ public: { auto it = tags.find(name); if(it != tags.end()) return it->second; - return NULL; + return nullptr; } bool contains(const wstring &name) diff --git a/Minecraft.World/CompressedTileStorage.cpp b/Minecraft.World/CompressedTileStorage.cpp index 8a999a0a6..c2c9037ee 100644 --- a/Minecraft.World/CompressedTileStorage.cpp +++ b/Minecraft.World/CompressedTileStorage.cpp @@ -23,11 +23,11 @@ CRITICAL_SECTION CompressedTileStorage::cs_write; #ifdef PSVITA_PRECOMPUTED_TABLE // AP - this will create a precomputed table to speed up getData -static int *CompressedTile_StorageIndexTable = NULL; +static int *CompressedTile_StorageIndexTable = nullptr; void CompressedTileStorage_InitTable() { - if( CompressedTile_StorageIndexTable == NULL ) + if( CompressedTile_StorageIndexTable == nullptr ) { CompressedTile_StorageIndexTable = (int*) malloc(sizeof(int) * 64); for(int j = 0;j < 64;j += 1 ) @@ -41,7 +41,7 @@ void CompressedTileStorage_InitTable() CompressedTileStorage::CompressedTileStorage() { - indicesAndData = NULL; + indicesAndData = nullptr; allocatedSize = 0; #ifdef PSVITA_PRECOMPUTED_TABLE @@ -60,7 +60,7 @@ CompressedTileStorage::CompressedTileStorage(CompressedTileStorage *copyFrom) } else { - indicesAndData = NULL; + indicesAndData = nullptr; } LeaveCriticalSection(&cs_write); @@ -71,7 +71,7 @@ CompressedTileStorage::CompressedTileStorage(CompressedTileStorage *copyFrom) CompressedTileStorage::CompressedTileStorage(byteArray initFrom, unsigned int initOffset) { - indicesAndData = NULL; + indicesAndData = nullptr; allocatedSize = 0; // We need 32768 bytes for a fully uncompressed chunk, plus 1024 for the index. Rounding up to nearest 4096 bytes for allocation @@ -117,7 +117,7 @@ bool CompressedTileStorage::isCompressed() CompressedTileStorage::CompressedTileStorage(bool isEmpty) { - indicesAndData = NULL; + indicesAndData = nullptr; allocatedSize = 0; // Empty and already compressed, so we only need 1K. Rounding up to nearest 4096 bytes for allocation @@ -423,7 +423,7 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) ucMappings[j] = 255; } - unsigned char *repacked = NULL; + unsigned char *repacked = nullptr; int bitspertile = 1 << indexTypeNew; // will be 1, 2 or 4 (from index values of 0, 1, 2) int tiletypecount = 1 << bitspertile; // will be 2, 4 or 16 (from index values of 0, 1, 2) @@ -806,7 +806,7 @@ void CompressedTileStorage::tick() int freeIndex = ( deleteQueueIndex + 1 ) % 3; // printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); - unsigned char *toFree = NULL; + unsigned char *toFree = nullptr; do { toFree = deleteQueue[freeIndex].Pop(); @@ -887,7 +887,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) { unsigned short indexType = blockIndices[i] & INDEX_TYPE_MASK; - unsigned char *unpacked_data = NULL; + unsigned char *unpacked_data = nullptr; unsigned char *packed_data; // First task is to find out what type of storage each block needs. Need to unpack each where required. @@ -1050,7 +1050,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) { memToAlloc += 1024; // For the indices unsigned char *newIndicesAndData = static_cast(XPhysicalAlloc(memToAlloc, MAXULONG_PTR, 4096, PAGE_READWRITE));//(unsigned char *)malloc( memToAlloc ); - if( newIndicesAndData == NULL ) + if( newIndicesAndData == nullptr ) { DWORD lastError = GetLastError(); #ifndef _DURANGO @@ -1111,9 +1111,9 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) // If we're not done, then we actually need to recompress this block. First of all decompress from its current format. if( !done ) { - unsigned char *unpacked_data = NULL; - unsigned char *tile_types = NULL; - unsigned char *packed_data = NULL; + unsigned char *unpacked_data = nullptr; + unsigned char *tile_types = nullptr; + unsigned char *packed_data = nullptr; if( indexTypeOld == INDEX_TYPE_0_OR_8_BIT ) { if( blockIndices[i] & INDEX_TYPE_0_BIT_FLAG ) @@ -1159,7 +1159,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) } #endif - unsigned char *repacked = NULL; + unsigned char *repacked = nullptr; if( indexTypeNew == INDEX_TYPE_0_OR_8_BIT ) { diff --git a/Minecraft.World/Connection.cpp b/Minecraft.World/Connection.cpp index 807ef1d98..962624b87 100644 --- a/Minecraft.World/Connection.cpp +++ b/Minecraft.World/Connection.cpp @@ -61,17 +61,17 @@ Connection::~Connection() // These should all have been destroyed in close() but no harm in checking again delete byteArrayDos; - byteArrayDos = NULL; + byteArrayDos = nullptr; delete baos; - baos = NULL; + baos = nullptr; if( bufferedDos ) { bufferedDos->deleteChildStream(); delete bufferedDos; - bufferedDos = NULL; + bufferedDos = nullptr; } delete dis; - dis = NULL; + dis = nullptr; } Connection::Connection(Socket *socket, const wstring& id, PacketListener *packetListener) // throws IOException @@ -185,7 +185,7 @@ bool Connection::writeTick() bool didSomething = false; // 4J Stu - If the connection is closed and the output stream has been deleted - if(bufferedDos==NULL || byteArrayDos==NULL) + if(bufferedDos==nullptr || byteArrayDos==nullptr) return didSomething; // try { @@ -318,14 +318,14 @@ bool Connection::readTick() bool didSomething = false; // 4J Stu - If the connection has closed and the input stream has been deleted - if(dis==NULL) + if(dis==nullptr) return didSomething; //try { shared_ptr packet = Packet::readPacket(dis, packetListener->isServerPacketListener()); - if (packet != NULL) + if (packet != nullptr) { readSizes[packet->getId()] += packet->getEstimatedSize() + 1; EnterCriticalSection(&incoming_cs); @@ -377,8 +377,8 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) disconnectReason = reason;//va_arg( input, const wstring ); vector objs = vector(); - void *i = NULL; - while (i != NULL) + void *i = nullptr; + while (i != nullptr) { i = va_arg( input, void* ); objs.push_back(i); @@ -390,7 +390,7 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) } else { - disconnectReasonObjects = NULL; + disconnectReasonObjects = nullptr; } // int count = 0, sum = 0, i = first; @@ -407,7 +407,7 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) // return( sum ? (sum / count) : 0 ); -// CreateThread(NULL, 0, runClose, this, 0, &closeThreadID); +// CreateThread(nullptr, 0, runClose, this, 0, &closeThreadID); running = false; @@ -419,24 +419,24 @@ void Connection::close(DisconnectPacket::eDisconnectReason reason, ...) writeThread->WaitForCompletion(INFINITE); delete dis; - dis = NULL; + dis = nullptr; if( bufferedDos ) { bufferedDos->close(); bufferedDos->deleteChildStream(); delete bufferedDos; - bufferedDos = NULL; + bufferedDos = nullptr; } if( byteArrayDos ) { byteArrayDos->close(); delete byteArrayDos; - byteArrayDos = NULL; + byteArrayDos = nullptr; } if( socket ) { socket->close(packetListener->isServerPacketListener()); - socket = NULL; + socket = nullptr; } } @@ -552,7 +552,7 @@ void Connection::sendAndQuit() close(DisconnectPacket::eDisconnect_Closed); } #else - CreateThread(NULL, 0, runSendAndQuit, this, 0, &saqThreadID); + CreateThread(nullptr, 0, runSendAndQuit, this, 0, &saqThreadID); #endif } @@ -567,7 +567,7 @@ int Connection::runRead(void* lpParam) ShutdownManager::HasStarted(ShutdownManager::eConnectionReadThreads); Connection *con = static_cast(lpParam); - if (con == NULL) + if (con == nullptr) { #ifdef __PS3__ ShutdownManager::HasFinished(ShutdownManager::eConnectionReadThreads); @@ -617,7 +617,7 @@ int Connection::runWrite(void* lpParam) ShutdownManager::HasStarted(ShutdownManager::eConnectionWriteThreads); Connection *con = dynamic_cast(static_cast(lpParam)); - if (con == NULL) + if (con == nullptr) { ShutdownManager::HasFinished(ShutdownManager::eConnectionWriteThreads); return 0; @@ -644,8 +644,8 @@ int Connection::runWrite(void* lpParam) // TODO - 4J Stu - 1.8.2 changes these sleeps to 2L, but not sure whether we should do that as well waitResult = con->m_hWakeWriteThread->WaitForSignal(100L); - if (con->bufferedDos != NULL) con->bufferedDos->flush(); - //if (con->byteArrayDos != NULL) con->byteArrayDos->flush(); + if (con->bufferedDos != nullptr) con->bufferedDos->flush(); + //if (con->byteArrayDos != nullptr) con->byteArrayDos->flush(); } @@ -662,7 +662,7 @@ int Connection::runClose(void* lpParam) { Connection *con = dynamic_cast(static_cast(lpParam)); - if (con == NULL) return 0; + if (con == nullptr) return 0; //try { @@ -686,7 +686,7 @@ int Connection::runSendAndQuit(void* lpParam) Connection *con = dynamic_cast(static_cast(lpParam)); // printf("Con:0x%x runSendAndQuit\n",con); - if (con == NULL) return 0; + if (con == nullptr) return 0; //try { diff --git a/Minecraft.World/ConsoleSaveFile.h b/Minecraft.World/ConsoleSaveFile.h index 39c1ec89c..0f7c451ee 100644 --- a/Minecraft.World/ConsoleSaveFile.h +++ b/Minecraft.World/ConsoleSaveFile.h @@ -23,7 +23,7 @@ public: virtual void Flush(bool autosave, bool updateThumbnail = true) = 0; #ifndef _CONTENT_PACKAGE - virtual void DebugFlushToFile(void *compressedData = NULL, unsigned int compressedDataSize = 0) = 0; + virtual void DebugFlushToFile(void *compressedData = nullptr, unsigned int compressedDataSize = 0) = 0; #endif virtual unsigned int getSizeOnDisk() = 0; virtual wstring getFilename() = 0; @@ -53,5 +53,5 @@ public: virtual void ConvertRegionFile(File sourceFile) = 0; virtual void ConvertToLocalPlatform() = 0; - virtual void *getWritePointer(FileEntry *file) { return NULL; } + virtual void *getWritePointer(FileEntry *file) { return nullptr; } }; diff --git a/Minecraft.World/ConsoleSaveFileConverter.cpp b/Minecraft.World/ConsoleSaveFileConverter.cpp index 21de3cbea..f7d8d0ee1 100644 --- a/Minecraft.World/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/ConsoleSaveFileConverter.cpp @@ -84,7 +84,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleS vector *playerFiles = sourceSave->getFilesWithPrefix( DirectoryLevelStorage::getPlayerDir() ); #endif - if(playerFiles != NULL) + if(playerFiles != nullptr) { for(int fileIdx = 0; fileIdx < playerFiles->size();fileIdx++) { diff --git a/Minecraft.World/ConsoleSaveFileInputStream.cpp b/Minecraft.World/ConsoleSaveFileInputStream.cpp index 93d49956f..db9979189 100644 --- a/Minecraft.World/ConsoleSaveFileInputStream.cpp +++ b/Minecraft.World/ConsoleSaveFileInputStream.cpp @@ -9,7 +9,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile m_saveFile = saveFile; m_file = m_saveFile->createFile( file ); - m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); } ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile, FileEntry *file) @@ -17,7 +17,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile m_saveFile = saveFile; m_file = file; - m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); } //Reads a byte of data from this input stream. This method blocks if no input is yet available. @@ -119,7 +119,7 @@ int ConsoleSaveFileInputStream::read(byteArray b, unsigned int offset, unsigned //If this stream has an associated channel then the channel is closed as well. void ConsoleSaveFileInputStream::close() { - if( m_saveFile != NULL ) + if( m_saveFile != nullptr ) { BOOL result = m_saveFile->closeHandle( m_file ); @@ -129,6 +129,6 @@ void ConsoleSaveFileInputStream::close() } // Stop the dtor from trying to close it again - m_saveFile = NULL; + m_saveFile = nullptr; } } diff --git a/Minecraft.World/ConsoleSaveFileOriginal.cpp b/Minecraft.World/ConsoleSaveFileOriginal.cpp index f2bd522fb..182f85908 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/ConsoleSaveFileOriginal.cpp @@ -22,14 +22,14 @@ #endif unsigned int ConsoleSaveFileOriginal::pagesCommitted = 0; -void *ConsoleSaveFileOriginal::pvHeap = NULL; +void *ConsoleSaveFileOriginal::pvHeap = nullptr; -ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData /*= NULL*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) +ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData /*= nullptr*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) { InitializeCriticalSectionAndSpinCount(&m_lock,5120); // One time initialise of static stuff required for our storage - if( pvHeap == NULL ) + if( pvHeap == nullptr ) { // Reserve a chunk of 64MB of virtual address space for our saves, using 64KB pages. // We'll only be committing these as required to grow the storage we need, which will @@ -38,7 +38,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID // AP - The Vita doesn't have virtual memory so a pretend system has been implemented in PSVitaStubs.cpp. // All access to the memory must be done via the access function as the pointer returned from VirtualAlloc // can't be used directly. - pvHeap = VirtualAlloc(NULL, MAX_PAGE_COUNT * CSF_PAGE_SIZE, RESERVE_ALLOCATION, PAGE_READWRITE ); + pvHeap = VirtualAlloc(nullptr, MAX_PAGE_COUNT * CSF_PAGE_SIZE, RESERVE_ALLOCATION, PAGE_READWRITE ); } pvSaveMem = pvHeap; @@ -49,13 +49,13 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID // Load a save from the game rules bool bLevelGenBaseSave = false; LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); - if( pvSaveData == NULL && levelGen != NULL && levelGen->requiresBaseSave()) + if( pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) { pvSaveData = levelGen->getBaseSaveData(fileSize); if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true; } - if( pvSaveData == NULL || fileSize == 0) + if( pvSaveData == nullptr || fileSize == 0) fileSize = StorageManager.GetSaveSize(); if( forceCleanSave ) @@ -75,7 +75,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID unsigned int pagesRequired = ( heapSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == NULL ) + if( pvRet == nullptr ) { #ifndef _CONTENT_PACKAGE // Out of physical memory @@ -87,7 +87,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID if( fileSize > 0) { bool AllocData = false; - if(pvSaveData != NULL) + if(pvSaveData != nullptr) { #ifdef __PSVITA__ // AP - use this to access the virtual memory @@ -181,7 +181,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID { unsigned int pagesRequired = ( desiredSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == NULL ) + if( pvRet == nullptr ) { // Out of physical memory __debugbreak(); @@ -214,9 +214,9 @@ ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal() pagesCommitted = 0; // Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway #if defined _XBOX - app.GetSaveThumbnail(NULL,NULL); + app.GetSaveThumbnail(nullptr,nullptr); #elif defined __PS3__ - app.GetSaveThumbnail(NULL,NULL, NULL,NULL); + app.GetSaveThumbnail(nullptr,nullptr, nullptr,nullptr); #endif DeleteCriticalSection(&m_lock); @@ -235,7 +235,7 @@ FileEntry *ConsoleSaveFileOriginal::createFile( const ConsoleSavePath &fileName void ConsoleSaveFileOriginal::deleteFile( FileEntry *file ) { - if( file == NULL ) return; + if( file == nullptr ) return; LockSaveAccess(); @@ -339,8 +339,8 @@ void ConsoleSaveFileOriginal::PrepareForWrite( FileEntry *file, DWORD nNumberOfB BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) { - assert( pvSaveMem != NULL ); - if( pvSaveMem == NULL ) + assert( pvSaveMem != nullptr ); + if( pvSaveMem == nullptr ) { return 0; } @@ -376,8 +376,8 @@ BOOL ConsoleSaveFileOriginal::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) { - assert( pvSaveMem != NULL ); - if( pvSaveMem == NULL ) + assert( pvSaveMem != nullptr ); + if( pvSaveMem == nullptr ) { return 0; } @@ -414,8 +414,8 @@ BOOL ConsoleSaveFileOriginal::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWr BOOL ConsoleSaveFileOriginal::readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) { DWORD actualBytesToRead; - assert( pvSaveMem != NULL ); - if( pvSaveMem == NULL ) + assert( pvSaveMem != nullptr ); + if( pvSaveMem == nullptr ) { return 0; } @@ -489,7 +489,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt { unsigned int pagesRequired = ( desiredSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == NULL ) + if( pvRet == nullptr ) { // Out of physical memory __debugbreak(); @@ -676,12 +676,12 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) #ifdef __PSVITA__ // AP - make sure we always allocate just what is needed so it will only SAVE what is needed. // If we don't do this the StorageManager will save a file of uncompressed size unnecessarily. - compData = NULL; + compData = nullptr; #endif - // If we failed to allocate then compData will be NULL + // If we failed to allocate then compData will be nullptr // Pre-calculate the compressed data size so that we can attempt to allocate a smaller buffer - if(compData == NULL) + if(compData == nullptr) { // Length should be 0 here so that the compression call knows that we want to know the length back compLength = 0; @@ -692,9 +692,9 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) QueryPerformanceCounter( &qwTime ); #ifdef __PSVITA__ // AP - get the compressed size via the access function. This uses a special RLE format - VirtualCompress(NULL,&compLength,pvSaveMem,fileSize); + VirtualCompress(nullptr,&compLength,pvSaveMem,fileSize); #else - Compression::getCompression()->Compress(NULL,&compLength,pvSaveMem,fileSize); + Compression::getCompression()->Compress(nullptr,&compLength,pvSaveMem,fileSize); #endif QueryPerformanceCounter( &qwNewTime ); @@ -713,7 +713,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) } #endif - if(compData != NULL) + if(compData != nullptr) { // No compression on PS3 - see comment above #ifndef __PS3__ @@ -743,10 +743,10 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) app.DebugPrintf("Save data compressed from %d to %d\n", fileSize, compLength); #endif - PBYTE pbThumbnailData=NULL; + PBYTE pbThumbnailData=nullptr; DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=NULL; + PBYTE pbDataSaveImage=nullptr; DWORD dwDataSizeSaveImage=0; #if ( defined _XBOX || defined _DURANGO || defined _WINDOWS64 ) @@ -760,7 +760,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) __int64 seed = 0; bool hasSeed = false; - if(MinecraftServer::getInstance()!= NULL && MinecraftServer::getInstance()->levels[0]!=NULL) + if(MinecraftServer::getInstance()!= nullptr && MinecraftServer::getInstance()->levels[0]!=nullptr) { seed = MinecraftServer::getInstance()->levels[0]->getLevelData()->getSeed(); hasSeed = true; @@ -827,7 +827,7 @@ int ConsoleSaveFileOriginal::SaveSaveDataCallback(LPVOID lpParam,bool bRes) #endif #ifndef _CONTENT_PACKAGE -void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, unsigned int compressedDataSize /*= 0*/) +void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= nullptr*/, unsigned int compressedDataSize /*= 0*/) { LockSaveAccess(); @@ -867,16 +867,16 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + wstring(fileName) ); #endif #ifndef __PSVITA__ - HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL); + HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, nullptr); #endif - if(compressedData != NULL && compressedDataSize > 0) + if(compressedData != nullptr && compressedDataSize > 0) { #ifdef __PSVITA__ // AP - Use the access function to save - VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, NULL); + VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, nullptr); #else - WriteFile( hSaveFile,compressedData,compressedDataSize,&numberOfBytesWritten,NULL); + WriteFile( hSaveFile,compressedData,compressedDataSize,&numberOfBytesWritten,nullptr); #endif assert(numberOfBytesWritten == compressedDataSize); } @@ -884,9 +884,9 @@ void ConsoleSaveFileOriginal::DebugFlushToFile(void *compressedData /*= NULL*/, { #ifdef __PSVITA__ // AP - Use the access function to save - VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, NULL); + VirtualWriteFile( lpFileName, compressedData, compressedDataSize, &numberOfBytesWritten, nullptr); #else - WriteFile(hSaveFile,pvSaveMem,fileSize,&numberOfBytesWritten,NULL); + WriteFile(hSaveFile,pvSaveMem,fileSize,&numberOfBytesWritten,nullptr); #endif assert(numberOfBytesWritten == fileSize); } @@ -917,7 +917,7 @@ vector *ConsoleSaveFileOriginal::getFilesWithPrefix(const wstring & vector *ConsoleSaveFileOriginal::getRegionFilesByDimension(unsigned int dimensionIndex) { - return NULL; + return nullptr; } #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) diff --git a/Minecraft.World/ConsoleSaveFileOriginal.h b/Minecraft.World/ConsoleSaveFileOriginal.h index fd35aa1da..9c91fafcf 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/ConsoleSaveFileOriginal.h @@ -35,7 +35,7 @@ public: #if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) static int SaveSaveDataCallback(LPVOID lpParam,bool bRes); #endif - ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); + ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData = nullptr, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); virtual ~ConsoleSaveFileOriginal(); // 4J Stu - Initial implementation is intended to have a similar interface to the standard Xbox file access functions @@ -56,7 +56,7 @@ public: virtual void Flush(bool autosave, bool updateThumbnail = true); #ifndef _CONTENT_PACKAGE - virtual void DebugFlushToFile(void *compressedData = NULL, unsigned int compressedDataSize = 0); + virtual void DebugFlushToFile(void *compressedData = nullptr, unsigned int compressedDataSize = 0); #endif virtual unsigned int getSizeOnDisk(); diff --git a/Minecraft.World/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/ConsoleSaveFileOutputStream.cpp index 27b46df08..c4812a734 100644 --- a/Minecraft.World/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/ConsoleSaveFileOutputStream.cpp @@ -19,7 +19,7 @@ ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFi m_file = m_saveFile->createFile(file); - m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); } ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFile, FileEntry *file) @@ -28,7 +28,7 @@ ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFi m_file = file; - m_saveFile->setFilePointer( m_file, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); } //Writes the specified byte to this file output stream. Implements the write method of OutputStream. @@ -115,7 +115,7 @@ void ConsoleSaveFileOutputStream::write(byteArray b, unsigned int offset, unsign //If this stream has an associated channel then the channel is closed as well. void ConsoleSaveFileOutputStream::close() { - if( m_saveFile != NULL ) + if( m_saveFile != nullptr ) { BOOL result = m_saveFile->closeHandle( m_file ); @@ -125,6 +125,6 @@ void ConsoleSaveFileOutputStream::close() } // Stop the dtor from trying to close it again - m_saveFile = NULL; + m_saveFile = nullptr; } } diff --git a/Minecraft.World/ContainerMenu.cpp b/Minecraft.World/ContainerMenu.cpp index 83c2db2ec..3dcae136e 100644 --- a/Minecraft.World/ContainerMenu.cpp +++ b/Minecraft.World/ContainerMenu.cpp @@ -46,7 +46,7 @@ shared_ptr ContainerMenu::quickMoveStack(shared_ptr player { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -97,7 +97,7 @@ shared_ptr ContainerMenu::clicked(int slotIndex, int buttonNum, in #ifdef _EXTENDED_ACHIEVEMENTS shared_ptr localPlayer = dynamic_pointer_cast(player); - if (localPlayer != NULL) // 4J-JEV: For "Chestful o'Cobblestone" achievement. + if (localPlayer != nullptr) // 4J-JEV: For "Chestful o'Cobblestone" achievement. { int cobblecount = 0; for (int i = 0; i < container->getContainerSize(); i++) diff --git a/Minecraft.World/ContainerSetContentPacket.cpp b/Minecraft.World/ContainerSetContentPacket.cpp index 079ed59e2..ae76e0f05 100644 --- a/Minecraft.World/ContainerSetContentPacket.cpp +++ b/Minecraft.World/ContainerSetContentPacket.cpp @@ -24,7 +24,7 @@ ContainerSetContentPacket::ContainerSetContentPacket(int containerId, vector item = newItems->at(i); - items[i] = item == NULL ? nullptr : item->copy(); + items[i] = item == nullptr ? nullptr : item->copy(); } } diff --git a/Minecraft.World/ContainerSetSlotPacket.cpp b/Minecraft.World/ContainerSetSlotPacket.cpp index 42892f3cc..6a0382442 100644 --- a/Minecraft.World/ContainerSetSlotPacket.cpp +++ b/Minecraft.World/ContainerSetSlotPacket.cpp @@ -22,7 +22,7 @@ ContainerSetSlotPacket::ContainerSetSlotPacket(int containerId, int slot, shared { this->containerId = containerId; this->slot = slot; - this->item = item == NULL ? item : item->copy(); + this->item = item == nullptr ? item : item->copy(); } void ContainerSetSlotPacket::handle(PacketListener *listener) diff --git a/Minecraft.World/ControlledByPlayerGoal.cpp b/Minecraft.World/ControlledByPlayerGoal.cpp index ecda01b35..3069293d6 100644 --- a/Minecraft.World/ControlledByPlayerGoal.cpp +++ b/Minecraft.World/ControlledByPlayerGoal.cpp @@ -36,7 +36,7 @@ void ControlledByPlayerGoal::stop() bool ControlledByPlayerGoal::canUse() { - return mob->isAlive() && mob->rider.lock() != NULL && mob->rider.lock()->instanceof(eTYPE_PLAYER) && (boosting || mob->canBeControlledByRider()); + return mob->isAlive() && mob->rider.lock() != nullptr && mob->rider.lock()->instanceof(eTYPE_PLAYER) && (boosting || mob->canBeControlledByRider()); } void ControlledByPlayerGoal::tick() @@ -117,7 +117,7 @@ void ControlledByPlayerGoal::tick() { shared_ptr carriedItem = player->getCarriedItem(); - if (carriedItem != NULL && carriedItem->id == Item::carrotOnAStick_Id) + if (carriedItem != nullptr && carriedItem->id == Item::carrotOnAStick_Id) { carriedItem->hurtAndBreak(1, player); @@ -135,7 +135,7 @@ void ControlledByPlayerGoal::tick() bool ControlledByPlayerGoal::isNoJumpTile(int tile) { - return Tile::tiles[tile] != NULL && (Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_STAIRS || (dynamic_cast(Tile::tiles[tile]) != NULL) ); + return Tile::tiles[tile] != nullptr && (Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_STAIRS || (dynamic_cast(Tile::tiles[tile]) != nullptr) ); } bool ControlledByPlayerGoal::isBoosting() diff --git a/Minecraft.World/Cow.cpp b/Minecraft.World/Cow.cpp index 05e701027..d80c16a2e 100644 --- a/Minecraft.World/Cow.cpp +++ b/Minecraft.World/Cow.cpp @@ -106,7 +106,7 @@ void Cow::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) bool Cow::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != NULL && item->id == Item::bucket_empty->id && !player->abilities.instabuild) + if (item != nullptr && item->id == Item::bucket_empty->id && !player->abilities.instabuild) { player->awardStat(GenericStats::cowsMilked(),GenericStats::param_cowsMilked()); diff --git a/Minecraft.World/CraftingContainer.cpp b/Minecraft.World/CraftingContainer.cpp index 47a11eb49..3ec1b0394 100644 --- a/Minecraft.World/CraftingContainer.cpp +++ b/Minecraft.World/CraftingContainer.cpp @@ -58,7 +58,7 @@ bool CraftingContainer::hasCustomName() shared_ptr CraftingContainer::removeItemNoUpdate(int slot) { - if ((*items)[slot] != NULL) + if ((*items)[slot] != nullptr) { shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; @@ -69,7 +69,7 @@ shared_ptr CraftingContainer::removeItemNoUpdate(int slot) shared_ptr CraftingContainer::removeItem(unsigned int slot, int count) { - if ((*items)[slot] != NULL) + if ((*items)[slot] != nullptr) { if ((*items)[slot]->count <= count) { diff --git a/Minecraft.World/CraftingMenu.cpp b/Minecraft.World/CraftingMenu.cpp index c104bbec8..a510e8691 100644 --- a/Minecraft.World/CraftingMenu.cpp +++ b/Minecraft.World/CraftingMenu.cpp @@ -64,7 +64,7 @@ void CraftingMenu::removed(shared_ptr player) for (int i = 0; i < 9; i++) { shared_ptr item = craftSlots->removeItemNoUpdate(i); - if (item != NULL) + if (item != nullptr) { player->drop(item); } @@ -82,7 +82,7 @@ shared_ptr CraftingMenu::quickMoveStack(shared_ptr player, { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/Creeper.cpp b/Minecraft.World/Creeper.cpp index 15d84f409..0cd6b5344 100644 --- a/Minecraft.World/Creeper.cpp +++ b/Minecraft.World/Creeper.cpp @@ -64,7 +64,7 @@ bool Creeper::useNewAi() int Creeper::getMaxFallDistance() { - if (getTarget() == NULL) return 3; + if (getTarget() == nullptr) return 3; // As long as they survive the fall they should try. return 3 + static_cast(getHealth() - 1); } @@ -142,13 +142,13 @@ void Creeper::die(DamageSource *source) { Monster::die(source); - if ( source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_SKELETON) ) + if ( source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_SKELETON) ) { int recordId = Item::record_01_Id + random->nextInt(Item::record_12_Id - Item::record_01_Id + 1); spawnAtLocation(recordId, 1); } - if ( source->getDirectEntity() != NULL && source->getDirectEntity()->instanceof(eTYPE_ARROW) && source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER) ) + if ( source->getDirectEntity() != nullptr && source->getDirectEntity()->instanceof(eTYPE_ARROW) && source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER) ) { shared_ptr player = dynamic_pointer_cast(source->getEntity()); player->awardStat(GenericStats::archer(), GenericStats::param_archer()); diff --git a/Minecraft.World/CropTile.cpp b/Minecraft.World/CropTile.cpp index a339d3e3c..39753caea 100644 --- a/Minecraft.World/CropTile.cpp +++ b/Minecraft.World/CropTile.cpp @@ -9,7 +9,7 @@ CropTile::CropTile(int id) : Bush(id) { setTicking(true); updateDefaultShape(); - icons = NULL; + icons = nullptr; setDestroyTime(0.0f); setSoundType(SOUND_GRASS); diff --git a/Minecraft.World/CustomLevelSource.cpp b/Minecraft.World/CustomLevelSource.cpp index df3877441..35a5de99d 100644 --- a/Minecraft.World/CustomLevelSource.cpp +++ b/Minecraft.World/CustomLevelSource.cpp @@ -30,7 +30,7 @@ CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateSt string path = "GAME:\\GameRules\\heightmap.bin"; #endif #endif - HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { app.FatalLoadError(); @@ -44,14 +44,14 @@ CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateSt __debugbreak(); // TODO DWORD bytesRead,dwFileSize = 0; #else - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); + DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); #endif if(dwFileSize > m_heightmapOverride.length) { app.DebugPrintf("Heightmap binary is too large!!\n"); __debugbreak(); } - BOOL bSuccess = ReadFile(file,m_heightmapOverride.data,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(file,m_heightmapOverride.data,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { @@ -72,7 +72,7 @@ CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateSt string waterHeightPath = "GAME:\\GameRules\\waterheight.bin"; #endif #endif - file = CreateFile(waterHeightPath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + file = CreateFile(waterHeightPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if( file == INVALID_HANDLE_VALUE ) { DWORD error = GetLastError(); @@ -86,14 +86,14 @@ CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateSt __debugbreak(); // TODO DWORD bytesRead,dwFileSize = 0; #else - DWORD bytesRead,dwFileSize = GetFileSize(file,NULL); + DWORD bytesRead,dwFileSize = GetFileSize(file,nullptr); #endif if(dwFileSize > m_waterheightOverride.length) { app.DebugPrintf("waterheight binary is too large!!\n"); __debugbreak(); } - BOOL bSuccess = ReadFile(file,m_waterheightOverride.data,dwFileSize,&bytesRead,NULL); + BOOL bSuccess = ReadFile(file,m_waterheightOverride.data,dwFileSize,&bytesRead,nullptr); if(bSuccess==FALSE) { @@ -270,7 +270,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi byte material = b->material; LevelGenerationOptions *lgo = app.getLevelGenerationOptions(); - if(lgo != NULL) + if(lgo != nullptr) { lgo->getBiomeOverride(b->id,material,top); } @@ -313,7 +313,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi { top = b->topMaterial; material = b->material; - if(lgo != NULL) + if(lgo != nullptr) { lgo->getBiomeOverride(b->id,material,top); } @@ -357,7 +357,7 @@ LevelChunk *CustomLevelSource::create(int x, int z) #ifdef _OVERRIDE_HEIGHTMAP return getChunk(x,z); #else - return NULL; + return nullptr; #endif } @@ -411,7 +411,7 @@ LevelChunk *CustomLevelSource::getChunk(int xOffs, int zOffs) return levelChunk; #else - return NULL; + return nullptr; #endif } @@ -622,9 +622,9 @@ vector *CustomLevelSource::getMobsAt(MobCategory *mobCa { #ifdef _OVERRIDE_HEIGHTMAP Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == nullptr) { - return NULL; + return nullptr; } if (mobCategory == MobCategory::monster && scatteredFeature->isSwamphut(x, y, z)) { @@ -632,19 +632,19 @@ vector *CustomLevelSource::getMobsAt(MobCategory *mobCa } return biome->getMobs(mobCategory); #else - return NULL; + return nullptr; #endif } TilePos *CustomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { #ifdef _OVERRIDE_HEIGHTMAP - if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != NULL) + if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != nullptr) { return strongholdFeature->getNearestGeneratedFeature(level, x, y, z); } #endif - return NULL; + return nullptr; } void CustomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) @@ -652,10 +652,10 @@ void CustomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) if (generateStructures) { #ifdef _OVERRIDE_HEIGHTMAP - mineShaftFeature->apply(this, level, chunkX, chunkZ, NULL); - villageFeature->apply(this, level, chunkX, chunkZ, NULL); - strongholdFeature->apply(this, level, chunkX, chunkZ, NULL); - scatteredFeature->apply(this, level, chunkX, chunkZ, NULL); + mineShaftFeature->apply(this, level, chunkX, chunkZ, byteArray()); + villageFeature->apply(this, level, chunkX, chunkZ, byteArray()); + strongholdFeature->apply(this, level, chunkX, chunkZ, byteArray()); + scatteredFeature->apply(this, level, chunkX, chunkZ, byteArray()); #endif } } \ No newline at end of file diff --git a/Minecraft.World/CustomPayloadPacket.cpp b/Minecraft.World/CustomPayloadPacket.cpp index 81ec45766..46fde5aaf 100644 --- a/Minecraft.World/CustomPayloadPacket.cpp +++ b/Minecraft.World/CustomPayloadPacket.cpp @@ -23,7 +23,7 @@ CustomPayloadPacket::CustomPayloadPacket(const wstring &identifier, byteArray da this->identifier = identifier; this->data = data; - if (data.data != NULL) + if (data.data != nullptr) { length = data.length; @@ -45,7 +45,7 @@ void CustomPayloadPacket::read(DataInputStream *dis) if (length > 0 && length < Short::MAX_VALUE) { - if(data.data != NULL) + if(data.data != nullptr) { delete [] data.data; } @@ -58,7 +58,7 @@ void CustomPayloadPacket::write(DataOutputStream *dos) { writeUtf(identifier, dos); dos->writeShort(static_cast(length)); - if (data.data != NULL) + if (data.data != nullptr) { dos->write(data); } diff --git a/Minecraft.World/DamageEnchantment.cpp b/Minecraft.World/DamageEnchantment.cpp index ce5a7c1f9..4ca8c9a6b 100644 --- a/Minecraft.World/DamageEnchantment.cpp +++ b/Minecraft.World/DamageEnchantment.cpp @@ -51,7 +51,7 @@ int DamageEnchantment::getDescriptionId() bool DamageEnchantment::isCompatibleWith(Enchantment *other) const { - return dynamic_cast(other) == NULL; + return dynamic_cast(other) == nullptr; } bool DamageEnchantment::canEnchant(shared_ptr item) diff --git a/Minecraft.World/DamageSource.cpp b/Minecraft.World/DamageSource.cpp index 1ed1c65fe..43e236bf4 100644 --- a/Minecraft.World/DamageSource.cpp +++ b/Minecraft.World/DamageSource.cpp @@ -40,7 +40,7 @@ DamageSource *DamageSource::arrow(shared_ptr arrow, shared_ptr ow DamageSource *DamageSource::fireball(shared_ptr fireball, shared_ptr owner) { - if (owner == NULL) + if (owner == nullptr) { return (new IndirectEntityDamageSource(ChatPacket::e_ChatDeathOnFire, ChatPacket::e_ChatDeathOnFire, fireball, fireball))->setIsFire()->setProjectile(); } @@ -64,7 +64,7 @@ DamageSource *DamageSource::thorns(shared_ptr source) DamageSource *DamageSource::explosion(Explosion *explosion) { - if ( (explosion != NULL) && (explosion->getSourceMob() != NULL) ) + if ( (explosion != nullptr) && (explosion->getSourceMob() != nullptr) ) { return (new EntityDamageSource(ChatPacket::e_ChatDeathExplosionPlayer, ChatPacket::e_ChatDeathExplosionPlayer, explosion->getSourceMob()))->setScalesWithDifficulty()->setExplosion(); } @@ -191,7 +191,7 @@ DamageSource *DamageSource::setMagic() shared_ptr DamageSource::getDeathMessagePacket(shared_ptr player) { shared_ptr source = player->getKillCredit(); - if(source != NULL) + if(source != nullptr) { return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgWithItemId != ChatPacket::e_ChatCustom ? m_msgWithItemId : m_msgId, source->GetType(), source->getNetworkName() ) ); } diff --git a/Minecraft.World/DataLayer.cpp b/Minecraft.World/DataLayer.cpp index 81e9ddc2e..f3916320a 100644 --- a/Minecraft.World/DataLayer.cpp +++ b/Minecraft.World/DataLayer.cpp @@ -49,7 +49,7 @@ void DataLayer::set(int x, int y, int z, int val) bool DataLayer::isValid() { - return data.data != NULL; + return data.data != nullptr; } void DataLayer::setAll(int br) diff --git a/Minecraft.World/DaylightDetectorTileEntity.cpp b/Minecraft.World/DaylightDetectorTileEntity.cpp index 8f57b0040..2b72f3c9e 100644 --- a/Minecraft.World/DaylightDetectorTileEntity.cpp +++ b/Minecraft.World/DaylightDetectorTileEntity.cpp @@ -9,10 +9,10 @@ DaylightDetectorTileEntity::DaylightDetectorTileEntity() void DaylightDetectorTileEntity::tick() { - if (level != NULL && !level->isClientSide && (level->getGameTime() % SharedConstants::TICKS_PER_SECOND) == 0) + if (level != nullptr && !level->isClientSide && (level->getGameTime() % SharedConstants::TICKS_PER_SECOND) == 0) { tile = getTile(); - if (tile != NULL && dynamic_cast(tile) != NULL) + if (tile != nullptr && dynamic_cast(tile) != nullptr) { static_cast(tile)->updateSignalStrength(level, x, y, z); } diff --git a/Minecraft.World/DeadBushTile.cpp b/Minecraft.World/DeadBushTile.cpp index 33fdfe6c0..06bd41ee0 100644 --- a/Minecraft.World/DeadBushTile.cpp +++ b/Minecraft.World/DeadBushTile.cpp @@ -29,7 +29,7 @@ int DeadBushTile::getResource(int data, Random *random, int playerBonusLevel) void DeadBushTile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) { - if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears_Id) + if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears_Id) { player->awardStat( GenericStats::blocksMined(id), diff --git a/Minecraft.World/DefendVillageTargetGoal.cpp b/Minecraft.World/DefendVillageTargetGoal.cpp index 6ed6af53d..201738a38 100644 --- a/Minecraft.World/DefendVillageTargetGoal.cpp +++ b/Minecraft.World/DefendVillageTargetGoal.cpp @@ -12,7 +12,7 @@ DefendVillageTargetGoal::DefendVillageTargetGoal(VillagerGolem *golem) : TargetG bool DefendVillageTargetGoal::canUse() { shared_ptr village = golem->getVillage(); - if (village == NULL) return false; + if (village == nullptr) return false; potentialTarget = weak_ptr(village->getClosestAggressor(dynamic_pointer_cast(golem->shared_from_this()))); shared_ptr potTarget = potentialTarget.lock(); if (!canAttack(potTarget, false)) diff --git a/Minecraft.World/DetectorRailTile.cpp b/Minecraft.World/DetectorRailTile.cpp index 16265ceb8..ce35a5926 100644 --- a/Minecraft.World/DetectorRailTile.cpp +++ b/Minecraft.World/DetectorRailTile.cpp @@ -12,7 +12,7 @@ DetectorRailTile::DetectorRailTile(int id) : BaseRailTile(id, true) { setTicking(true); - icons = NULL; + icons = nullptr; } int DetectorRailTile::getTickDelay(Level *level) diff --git a/Minecraft.World/Dimension.cpp b/Minecraft.World/Dimension.cpp index 75e225b3c..57f1dbb32 100644 --- a/Minecraft.World/Dimension.cpp +++ b/Minecraft.World/Dimension.cpp @@ -70,7 +70,7 @@ Dimension::~Dimension() { delete[] brightnessRamp; - if(biomeSource != NULL) + if(biomeSource != nullptr) delete biomeSource; } @@ -161,7 +161,7 @@ float *Dimension::getSunriseColor(float td, float a) return sunriseCol; } - return NULL; + return nullptr; } Vec3 *Dimension::getFogColor(float td, float a) const @@ -192,7 +192,7 @@ Dimension *Dimension::getNew(int id) if (id == 0) return new NormalDimension(); if (id == 1) return new TheEndDimension(); - return NULL; + return nullptr; } float Dimension::getCloudHeight() @@ -207,7 +207,7 @@ bool Dimension::hasGround() Pos *Dimension::getSpawnPos() { - return NULL; + return nullptr; } int Dimension::getSpawnYPosition() diff --git a/Minecraft.World/DiodeTile.cpp b/Minecraft.World/DiodeTile.cpp index e5bbfede1..b40a5af53 100644 --- a/Minecraft.World/DiodeTile.cpp +++ b/Minecraft.World/DiodeTile.cpp @@ -299,7 +299,7 @@ bool DiodeTile::isSolidRender(bool isServerLevel) bool DiodeTile::isAlternateInput(int tile) { Tile *tt = Tile::tiles[tile]; - return tt != NULL && tt->isSignalSource(); + return tt != nullptr && tt->isSignalSource(); } int DiodeTile::getOutputSignal(LevelSource *level, int x, int y, int z, int data) diff --git a/Minecraft.World/DirectoryLevelStorage.cpp b/Minecraft.World/DirectoryLevelStorage.cpp index 73c841e0f..f6231530c 100644 --- a/Minecraft.World/DirectoryLevelStorage.cpp +++ b/Minecraft.World/DirectoryLevelStorage.cpp @@ -217,13 +217,13 @@ ChunkStorage *DirectoryLevelStorage::createChunkStorage(Dimension *dimension) { // 4J Jev, removed try/catch. - if (dynamic_cast(dimension) != NULL) + if (dynamic_cast(dimension) != nullptr) { File dir2 = File(dir, LevelStorage::NETHER_FOLDER); //dir2.mkdirs(); // 4J Removed return new OldChunkStorage(dir2, true); } - if (dynamic_cast(dimension) != NULL) + if (dynamic_cast(dimension) != nullptr) { File dir2 = File(dir, LevelStorage::ENDER_FOLDER); //dir2.mkdirs(); // 4J Removed @@ -270,7 +270,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() else #endif { - getSaveFile()->setFilePointer(fileEntry,0,NULL, FILE_BEGIN); + getSaveFile()->setFilePointer(fileEntry,0,nullptr, FILE_BEGIN); #ifdef _LARGE_WORLDS byteArray data(fileEntry->getFileSize()); @@ -344,7 +344,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() return ret; } - return NULL; + return nullptr; } void DirectoryLevelStorage::saveLevelData(LevelData *levelData, vector > *players) @@ -432,7 +432,7 @@ void DirectoryLevelStorage::save(shared_ptr player) CompoundTag *DirectoryLevelStorage::load(shared_ptr player) { CompoundTag *tag = loadPlayerDataTag( player->getXuid() ); - if (tag != NULL) + if (tag != nullptr) { player->load(tag); } @@ -464,7 +464,7 @@ CompoundTag *DirectoryLevelStorage::loadPlayerDataTag(PlayerUID xuid) ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(m_saveFile, realFile); return NbtIo::readCompressed(&fis); } - return NULL; + return nullptr; } // 4J Added function @@ -478,7 +478,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles() vector *playerFiles = m_saveFile->getFilesWithPrefix( playerDir.getName() ); #endif - if( playerFiles != NULL ) + if( playerFiles != nullptr ) { #ifndef _FINAL_BUILD if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<createFile(file); - m_saveFile->setFilePointer(fileEntry,0,NULL, FILE_BEGIN); + m_saveFile->setFilePointer(fileEntry,0,nullptr, FILE_BEGIN); #ifdef _LARGE_WORLDS ByteArrayOutputStream baos; diff --git a/Minecraft.World/DirectoryLevelStorageSource.cpp b/Minecraft.World/DirectoryLevelStorageSource.cpp index e229232b1..232d4d443 100644 --- a/Minecraft.World/DirectoryLevelStorageSource.cpp +++ b/Minecraft.World/DirectoryLevelStorageSource.cpp @@ -32,7 +32,7 @@ vector *DirectoryLevelStorageSource::getLevelList() wstring levelId = wstring(L"World").append( std::to_wstring( (i+1) ) ); LevelData *levelData = getDataTagFor(saveFile, levelId); - if (levelData != NULL) + if (levelData != nullptr) { levels->push_back(new LevelSummary(levelId, L"", levelData->getLastPlayed(), levelData->getSizeOnDisk(), levelData.getGameType(), false, levelData->isHardcore())); } @@ -59,7 +59,7 @@ LevelData *DirectoryLevelStorageSource::getDataTagFor(ConsoleSaveFile *saveFile, return ret; } - return NULL; + return nullptr; } void DirectoryLevelStorageSource::renameLevel(const wstring& levelId, const wstring& newLevelName) diff --git a/Minecraft.World/DispenserTile.cpp b/Minecraft.World/DispenserTile.cpp index 2e141948b..abbb67d41 100644 --- a/Minecraft.World/DispenserTile.cpp +++ b/Minecraft.World/DispenserTile.cpp @@ -18,9 +18,9 @@ DispenserTile::DispenserTile(int id) : BaseEntityTile(id, Material::stone) { random = new Random(); - iconTop = NULL; - iconFront = NULL; - iconFrontVertical = NULL; + iconTop = nullptr; + iconFront = nullptr; + iconFrontVertical = nullptr; } int DispenserTile::getTickDelay(Level *level) @@ -115,7 +115,7 @@ void DispenserTile::dispenseFrom(Level *level, int x, int y, int z) { BlockSourceImpl source(level, x, y, z); shared_ptr trap = dynamic_pointer_cast( source.getEntity() ); - if (trap == NULL) return; + if (trap == nullptr) return; int slot = trap->getRandomSlot(); if (slot < 0) @@ -186,12 +186,12 @@ void DispenserTile::setPlacedBy(Level *level, int x, int y, int z, shared_ptr
  • container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container != NULL ) + if (container != nullptr ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != NULL) + if (item != nullptr) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; diff --git a/Minecraft.World/DispenserTileEntity.cpp b/Minecraft.World/DispenserTileEntity.cpp index 2a00f4cd5..9129ea5cd 100644 --- a/Minecraft.World/DispenserTileEntity.cpp +++ b/Minecraft.World/DispenserTileEntity.cpp @@ -35,7 +35,7 @@ shared_ptr DispenserTileEntity::getItem(unsigned int slot) shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int count) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { if (items[slot]->count <= count) { @@ -61,7 +61,7 @@ shared_ptr DispenserTileEntity::removeItem(unsigned int slot, int shared_ptr DispenserTileEntity::removeItemNoUpdate(int slot) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -73,7 +73,7 @@ shared_ptr DispenserTileEntity::removeItemNoUpdate(int slot) // 4J-PB added for spawn eggs not being useable due to limits, so add them in again void DispenserTileEntity::AddItemBack(shared_ptritem, unsigned int slot) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { // just increment the count of the items if(item->id==items[slot]->id) @@ -85,7 +85,7 @@ void DispenserTileEntity::AddItemBack(shared_ptritem, unsigned int else { items[slot] = item; - if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); setChanged(); } } @@ -99,10 +99,10 @@ bool DispenserTileEntity::removeProjectile(int itemId) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL && items[i]->id == itemId) + if (items[i] != nullptr && items[i]->id == itemId) { shared_ptr removedItem = removeItem(i, 1); - return removedItem != NULL; + return removedItem != nullptr; } } return false; @@ -114,7 +114,7 @@ int DispenserTileEntity::getRandomSlot() int replaceOdds = 1; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL && random->nextInt(replaceOdds++) == 0) + if (items[i] != nullptr && random->nextInt(replaceOdds++) == 0) { replaceSlot = i; } @@ -126,7 +126,7 @@ int DispenserTileEntity::getRandomSlot() void DispenserTileEntity::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); setChanged(); } @@ -134,7 +134,7 @@ int DispenserTileEntity::addItem(shared_ptr item) { for (int i = 0; i < items.length; i++) { - if (items[i] == NULL || items[i]->id == 0) + if (items[i] == nullptr || items[i]->id == 0) { setItem(i, item); return i; @@ -186,7 +186,7 @@ void DispenserTileEntity::save(CompoundTag *base) for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i)); @@ -236,7 +236,7 @@ shared_ptr DispenserTileEntity::clone() for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { result->items[i] = ItemInstance::clone(items[i]); } diff --git a/Minecraft.World/DoorInteractGoal.cpp b/Minecraft.World/DoorInteractGoal.cpp index fc4a9a68e..458057448 100644 --- a/Minecraft.World/DoorInteractGoal.cpp +++ b/Minecraft.World/DoorInteractGoal.cpp @@ -9,7 +9,7 @@ DoorInteractGoal::DoorInteractGoal(Mob *mob) { doorX = doorY = doorZ = 0; - doorTile = NULL; + doorTile = nullptr; passed = false; doorOpenDirX = doorOpenDirZ = 0.0f; @@ -21,7 +21,7 @@ bool DoorInteractGoal::canUse() if (!mob->horizontalCollision) return false; PathNavigation *pathNav = mob->getNavigation(); Path *path = pathNav->getPath(); - if (path == NULL || path->isDone() || !pathNav->canOpenDoors()) return false; + if (path == nullptr || path->isDone() || !pathNav->canOpenDoors()) return false; for (int i = 0; i < min(path->getIndex() + 2, path->getSize()); ++i) { @@ -31,7 +31,7 @@ bool DoorInteractGoal::canUse() doorZ = n->z; if (mob->distanceToSqr(doorX, mob->y, doorZ) > 1.5 * 1.5) continue; doorTile = getDoorTile(doorX, doorY, doorZ); - if (doorTile == NULL) continue; + if (doorTile == nullptr) continue; return true; } @@ -39,7 +39,7 @@ bool DoorInteractGoal::canUse() doorY = Mth::floor(mob->y + 1); doorZ = Mth::floor(mob->z); doorTile = getDoorTile(doorX, doorY, doorZ); - return doorTile != NULL; + return doorTile != nullptr; } bool DoorInteractGoal::canContinueToUse() @@ -68,6 +68,6 @@ void DoorInteractGoal::tick() DoorTile *DoorInteractGoal::getDoorTile(int x, int y, int z) { int tileId = mob->level->getTile(x, y, z); - if (tileId != Tile::door_wood_Id) return NULL; + if (tileId != Tile::door_wood_Id) return nullptr; return static_cast(Tile::tiles[tileId]); } \ No newline at end of file diff --git a/Minecraft.World/DropperTile.cpp b/Minecraft.World/DropperTile.cpp index a28228c98..098b6338a 100644 --- a/Minecraft.World/DropperTile.cpp +++ b/Minecraft.World/DropperTile.cpp @@ -34,7 +34,7 @@ void DropperTile::dispenseFrom(Level *level, int x, int y, int z) { BlockSourceImpl source(level, x, y, z); shared_ptr trap = dynamic_pointer_cast( source.getEntity() ); - if (trap == NULL) return; + if (trap == nullptr) return; int slot = trap->getRandomSlot(); if (slot < 0) @@ -48,11 +48,11 @@ void DropperTile::dispenseFrom(Level *level, int x, int y, int z) shared_ptr into = HopperTileEntity::getContainerAt(level, x + Facing::STEP_X[face], y + Facing::STEP_Y[face], z + Facing::STEP_Z[face]); shared_ptr remaining = nullptr; - if (into != NULL) + if (into != nullptr) { remaining = HopperTileEntity::addItem(into.get(), item->copy()->remove(1), Facing::OPPOSITE_FACING[face]); - if (remaining == NULL) + if (remaining == nullptr) { remaining = item->copy(); if (--remaining->count == 0) remaining = nullptr; @@ -66,7 +66,7 @@ void DropperTile::dispenseFrom(Level *level, int x, int y, int z) else { remaining = DISPENSE_BEHAVIOUR->dispense(&source, item); - if (remaining != NULL && remaining->count == 0) remaining = nullptr; + if (remaining != nullptr && remaining->count == 0) remaining = nullptr; } trap->setItem(slot, remaining); diff --git a/Minecraft.World/DurangoStats.cpp b/Minecraft.World/DurangoStats.cpp index 7ec808bc6..7302d9edc 100644 --- a/Minecraft.World/DurangoStats.cpp +++ b/Minecraft.World/DurangoStats.cpp @@ -267,11 +267,11 @@ byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptrGetType(); - if ( (mobEType == eTYPE_SPIDER) && (mob->rider.lock() != NULL) && (mob->rider.lock()->GetType() == eTYPE_SKELETON) && mob->rider.lock()->isAlive() ) + if ( (mobEType == eTYPE_SPIDER) && (mob->rider.lock() != nullptr) && (mob->rider.lock()->GetType() == eTYPE_SKELETON) && mob->rider.lock()->isAlive() ) { mob_networking_id = SPIDER_JOCKEY_ID; // Spider jockey only a concept for leaderboards. } - else if ( (mobEType == eTYPE_SKELETON) && (mob->riding != NULL) && (mob->riding->GetType() == eTYPE_SPIDER) && mob->riding->isAlive() ) + else if ( (mobEType == eTYPE_SKELETON) && (mob->riding != nullptr) && (mob->riding->GetType() == eTYPE_SPIDER) && mob->riding->isAlive() ) { mob_networking_id = SPIDER_JOCKEY_ID; // Spider jockey only a concept for leaderboards. } @@ -303,7 +303,7 @@ byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptrgetItem()->id : 0), + (item != nullptr ? item->getItem()->id : 0), mob->distanceTo(player->x, player->y, player->z), 0/*not needed*/ }; @@ -729,7 +729,7 @@ Stat *DurangoStats::get_stat(int i) default: assert(false); break; } - return NULL; + return nullptr; } Stat* DurangoStats::get_walkOneM() @@ -833,7 +833,7 @@ Stat* DurangoStats::get_itemsCrafted(int itemId) case Item::diamond_Id: case Item::redStone_Id: case Item::emerald_Id: - return NULL; + return nullptr; case Item::dye_powder_Id: default: @@ -890,7 +890,7 @@ Stat* DurangoStats::get_achievement(eAward achievementId) } // Other achievements awarded through more detailed generic events. - return NULL; + return nullptr; } byteArray DurangoStats::getParam_walkOneM(int distance) @@ -1130,7 +1130,7 @@ LPCWSTR DurangoStats::getUserId(int iPad) void DurangoStats::playerSessionStart(PlayerUID uid, shared_ptr plr) { - if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) + if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) { //wprintf(uid.toString().c_str()); @@ -1164,7 +1164,7 @@ void DurangoStats::playerSessionStart(int iPad) void DurangoStats::playerSessionPause(int iPad) { shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; - if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) + if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) { PlayerUID puid; ProfileManager.GetXUID(iPad, &puid, true); @@ -1187,7 +1187,7 @@ void DurangoStats::playerSessionPause(int iPad) void DurangoStats::playerSessionResume(int iPad) { shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; - if (plr != NULL && plr->level != NULL && plr->level->getLevelData() != NULL) + if (plr != nullptr && plr->level != nullptr && plr->level->getLevelData() != nullptr) { PlayerUID puid; ProfileManager.GetXUID(iPad, &puid, true); @@ -1214,7 +1214,7 @@ void DurangoStats::playerSessionResume(int iPad) void DurangoStats::playerSessionEnd(int iPad) { shared_ptr plr = Minecraft::GetInstance()->localplayers[iPad]; - if (plr != NULL) + if (plr != nullptr) { DurangoStats::getInstance()->travel->flush(plr); } diff --git a/Minecraft.World/DyePowderItem.cpp b/Minecraft.World/DyePowderItem.cpp index 81faf63fc..3392da982 100644 --- a/Minecraft.World/DyePowderItem.cpp +++ b/Minecraft.World/DyePowderItem.cpp @@ -18,7 +18,7 @@ DyePowderItem::DyePowderItem(int id) : Item( id ) { setStackedByData(true); setMaxDamage(0); - icons = NULL; + icons = nullptr; } const unsigned int DyePowderItem::COLOR_DESCS[] = @@ -306,9 +306,9 @@ void DyePowderItem::addGrowthParticles(Level *level, int x, int y, int z, int co { int id = level->getTile(x, y, z); if (count == 0) count = 15; - Tile *tile = id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : NULL; + Tile *tile = id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : nullptr; - if (tile == NULL) return; + if (tile == nullptr) return; tile->updateShape(level, x, y, z); for (int i = 0; i < count; i++) @@ -322,7 +322,7 @@ void DyePowderItem::addGrowthParticles(Level *level, int x, int y, int z, int co bool DyePowderItem::interactEnemy(shared_ptr itemInstance, shared_ptr player, shared_ptr mob) { - if (dynamic_pointer_cast( mob ) != NULL) + if (dynamic_pointer_cast( mob ) != nullptr) { shared_ptr sheep = dynamic_pointer_cast(mob); // convert to tile-based color value (0 is white instead of black) diff --git a/Minecraft.World/EnchantItemCommand.cpp b/Minecraft.World/EnchantItemCommand.cpp index 7ec57563c..dec0bf8e4 100644 --- a/Minecraft.World/EnchantItemCommand.cpp +++ b/Minecraft.World/EnchantItemCommand.cpp @@ -28,15 +28,15 @@ void EnchantItemCommand::execute(shared_ptr source, byteArray com shared_ptr player = getPlayer(uid); - if(player == NULL) return; + if(player == nullptr) return; shared_ptr selectedItem = player->getSelectedItem(); - if(selectedItem == NULL) return; + if(selectedItem == nullptr) return; Enchantment *e = Enchantment::enchantments[enchantmentId]; - if(e == NULL) return; + if(e == nullptr) return; if(!e->canEnchant(selectedItem)) return; if(enchantmentLevel < e->getMinLevel()) enchantmentLevel = e->getMinLevel(); @@ -45,13 +45,13 @@ void EnchantItemCommand::execute(shared_ptr source, byteArray com if (selectedItem->hasTag()) { ListTag *enchantmentTags = selectedItem->getEnchantmentTags(); - if (enchantmentTags != NULL) + if (enchantmentTags != nullptr) { for (int i = 0; i < enchantmentTags->size(); i++) { int type = enchantmentTags->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); - if (Enchantment::enchantments[type] != NULL) + if (Enchantment::enchantments[type] != nullptr) { Enchantment *other = Enchantment::enchantments[type]; if (!other->isCompatibleWith(e)) @@ -72,7 +72,7 @@ void EnchantItemCommand::execute(shared_ptr source, byteArray com shared_ptr EnchantItemCommand::preparePacket(shared_ptr player, int enchantmentId, int enchantmentLevel) { - if(player == NULL) return nullptr; + if(player == nullptr) return nullptr; ByteArrayOutputStream baos; DataOutputStream dos(&baos); diff --git a/Minecraft.World/EnchantedBookItem.cpp b/Minecraft.World/EnchantedBookItem.cpp index 590c8bda6..65153c00b 100644 --- a/Minecraft.World/EnchantedBookItem.cpp +++ b/Minecraft.World/EnchantedBookItem.cpp @@ -35,7 +35,7 @@ const Rarity *EnchantedBookItem::getRarity(shared_ptr itemInstance ListTag *EnchantedBookItem::getEnchantments(shared_ptr item) { - if (item->tag == NULL || !item->tag->contains((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str())) + if (item->tag == nullptr || !item->tag->contains((wchar_t *)TAG_STORED_ENCHANTMENTS.c_str())) { return new ListTag(); } @@ -49,7 +49,7 @@ void EnchantedBookItem::appendHoverText(shared_ptr itemInstance, s ListTag *list = getEnchantments(itemInstance); - if (list != NULL) + if (list != nullptr) { wstring unformatted = L""; for (int i = 0; i < list->size(); i++) @@ -57,7 +57,7 @@ void EnchantedBookItem::appendHoverText(shared_ptr itemInstance, s int type = list->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); int level = list->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL); - if (Enchantment::enchantments[type] != NULL) + if (Enchantment::enchantments[type] != nullptr) { lines->push_back(Enchantment::enchantments[type]->getFullname(level)); } diff --git a/Minecraft.World/Enchantment.cpp b/Minecraft.World/Enchantment.cpp index ae638b27e..c2f981a61 100644 --- a/Minecraft.World/Enchantment.cpp +++ b/Minecraft.World/Enchantment.cpp @@ -7,34 +7,34 @@ EnchantmentArray Enchantment::enchantments = EnchantmentArray( 256 ); vector Enchantment::validEnchantments; -Enchantment *Enchantment::allDamageProtection = NULL; -Enchantment *Enchantment::fireProtection = NULL; -Enchantment *Enchantment::fallProtection = NULL; -Enchantment *Enchantment::explosionProtection = NULL; -Enchantment *Enchantment::projectileProtection = NULL; -Enchantment *Enchantment::drownProtection = NULL; -Enchantment *Enchantment::waterWorker = NULL; -Enchantment *Enchantment::thorns = NULL; +Enchantment *Enchantment::allDamageProtection = nullptr; +Enchantment *Enchantment::fireProtection = nullptr; +Enchantment *Enchantment::fallProtection = nullptr; +Enchantment *Enchantment::explosionProtection = nullptr; +Enchantment *Enchantment::projectileProtection = nullptr; +Enchantment *Enchantment::drownProtection = nullptr; +Enchantment *Enchantment::waterWorker = nullptr; +Enchantment *Enchantment::thorns = nullptr; // weapon -Enchantment *Enchantment::damageBonus = NULL; -Enchantment *Enchantment::damageBonusUndead = NULL; -Enchantment *Enchantment::damageBonusArthropods = NULL; -Enchantment *Enchantment::knockback = NULL; -Enchantment *Enchantment::fireAspect = NULL; -Enchantment *Enchantment::lootBonus = NULL; +Enchantment *Enchantment::damageBonus = nullptr; +Enchantment *Enchantment::damageBonusUndead = nullptr; +Enchantment *Enchantment::damageBonusArthropods = nullptr; +Enchantment *Enchantment::knockback = nullptr; +Enchantment *Enchantment::fireAspect = nullptr; +Enchantment *Enchantment::lootBonus = nullptr; // digger -Enchantment *Enchantment::diggingBonus = NULL; -Enchantment *Enchantment::untouching = NULL; -Enchantment *Enchantment::digDurability = NULL; -Enchantment *Enchantment::resourceBonus = NULL; +Enchantment *Enchantment::diggingBonus = nullptr; +Enchantment *Enchantment::untouching = nullptr; +Enchantment *Enchantment::digDurability = nullptr; +Enchantment *Enchantment::resourceBonus = nullptr; // bows -Enchantment *Enchantment::arrowBonus = NULL; -Enchantment *Enchantment::arrowKnockback = NULL; -Enchantment *Enchantment::arrowFire = NULL; -Enchantment *Enchantment::arrowInfinite = NULL; +Enchantment *Enchantment::arrowBonus = nullptr; +Enchantment *Enchantment::arrowKnockback = nullptr; +Enchantment *Enchantment::arrowFire = nullptr; +Enchantment *Enchantment::arrowInfinite = nullptr; void Enchantment::staticCtor() { @@ -70,7 +70,7 @@ void Enchantment::staticCtor() for(unsigned int i = 0; i < 256; ++i) { Enchantment *enchantment = enchantments[i]; - if (enchantment != NULL) + if (enchantment != nullptr) { validEnchantments.push_back(enchantment); } @@ -79,7 +79,7 @@ void Enchantment::staticCtor() void Enchantment::_init(int id) { - if (enchantments[id] != NULL) + if (enchantments[id] != nullptr) { app.DebugPrintf("Duplicate enchantment id!"); #ifndef _CONTENT_PACKAGE diff --git a/Minecraft.World/EnchantmentCategory.cpp b/Minecraft.World/EnchantmentCategory.cpp index b7460f58e..b1c951eee 100644 --- a/Minecraft.World/EnchantmentCategory.cpp +++ b/Minecraft.World/EnchantmentCategory.cpp @@ -16,7 +16,7 @@ bool EnchantmentCategory::canEnchant(Item *item) const { if (this == all) return true; - if (dynamic_cast( item ) != NULL) + if (dynamic_cast( item ) != nullptr) { if (this == armor) return true; ArmorItem *ai = static_cast(item); @@ -26,15 +26,15 @@ bool EnchantmentCategory::canEnchant(Item *item) const if (ai->slot == ArmorItem::SLOT_FEET) return this == armor_feet; return false; } - else if (dynamic_cast(item) != NULL) + else if (dynamic_cast(item) != nullptr) { return this == weapon; } - else if (dynamic_cast(item) != NULL) + else if (dynamic_cast(item) != nullptr) { return this == digger; } - else if (dynamic_cast(item) != NULL) + else if (dynamic_cast(item) != nullptr) { return this == bow; } diff --git a/Minecraft.World/EnchantmentHelper.cpp b/Minecraft.World/EnchantmentHelper.cpp index 8f4f4ed19..995670c83 100644 --- a/Minecraft.World/EnchantmentHelper.cpp +++ b/Minecraft.World/EnchantmentHelper.cpp @@ -11,12 +11,12 @@ Random EnchantmentHelper::random; int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, shared_ptr piece) { - if (piece == NULL) + if (piece == nullptr) { return 0; } ListTag *enchantmentTags = piece->getEnchantmentTags(); - if (enchantmentTags == NULL) + if (enchantmentTags == nullptr) { return 0; } @@ -38,7 +38,7 @@ unordered_map *EnchantmentHelper::getEnchantments(shared_ptr *result = new unordered_map(); ListTag *list = item->id == Item::enchantedBook_Id ? Item::enchantedBook->getEnchantments(item) : item->getEnchantmentTags(); - if (list != NULL) + if (list != nullptr) { for (int i = 0; i < list->size(); i++) { @@ -88,7 +88,7 @@ void EnchantmentHelper::setEnchantments(unordered_map *enchantments, s int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, ItemInstanceArray inventory) { - if (inventory.data == NULL) return 0; + if (inventory.data == nullptr) return 0; int bestLevel = 0; //for (ItemInstance piece : inventory) for(unsigned int i = 0; i < inventory.length; ++i) @@ -104,12 +104,12 @@ int EnchantmentHelper::getEnchantmentLevel(int enchantmentId, ItemInstanceArray void EnchantmentHelper::runIterationOnItem(EnchantmentIterationMethod &method, shared_ptr piece) { - if (piece == NULL) + if (piece == nullptr) { return; } ListTag *enchantmentTags = piece->getEnchantmentTags(); - if (enchantmentTags == NULL) + if (enchantmentTags == nullptr) { return; } @@ -118,7 +118,7 @@ void EnchantmentHelper::runIterationOnItem(EnchantmentIterationMethod &method, s int type = enchantmentTags->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_ID); int level = enchantmentTags->get(i)->getShort((wchar_t *)ItemInstance::TAG_ENCH_LEVEL); - if (Enchantment::enchantments[type] != NULL) + if (Enchantment::enchantments[type] != nullptr) { method.doEnchantment(Enchantment::enchantments[type], level); } @@ -245,7 +245,7 @@ shared_ptr EnchantmentHelper::getRandomItemWith(Enchantment *encha for(unsigned int i = 0; i < items.length; ++i) { shared_ptr item = items[i]; - if (item != NULL && getEnchantmentLevel(enchantment->id, item) > 0) + if (item != nullptr && getEnchantmentLevel(enchantment->id, item) > 0) { return item; } @@ -338,7 +338,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand if (itemBonus <= 0) { - return NULL; + return nullptr; } // 4J Stu - Update function to 1.3 version for TU7 itemBonus /= 2; @@ -354,7 +354,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand realValue = 1; } - vector *results = NULL; + vector *results = nullptr; unordered_map *availableEnchantments = getAvailableEnchantmentResults(realValue, itemInstance); if (availableEnchantments && !availableEnchantments->empty()) @@ -433,7 +433,7 @@ vector *EnchantmentHelper::selectEnchantment(Random *rand unordered_map *EnchantmentHelper::getAvailableEnchantmentResults(int value, shared_ptr itemInstance) { Item *item = itemInstance->getItem(); - unordered_map *results = NULL; + unordered_map *results = nullptr; bool isBook = itemInstance->id == Item::book_Id; @@ -441,7 +441,7 @@ unordered_map *EnchantmentHelper::getAvailableEnchan for(unsigned int i = 0; i < Enchantment::enchantments.length; ++i) { Enchantment *e = Enchantment::enchantments[i]; - if (e == NULL) + if (e == nullptr) { continue; } @@ -456,7 +456,7 @@ unordered_map *EnchantmentHelper::getAvailableEnchan { if (value >= e->getMinCost(level) && value <= e->getMaxCost(level)) { - if (results == NULL) + if (results == nullptr) { results = new unordered_map(); } diff --git a/Minecraft.World/EnchantmentMenu.cpp b/Minecraft.World/EnchantmentMenu.cpp index fa769bf9c..08c51c3d0 100644 --- a/Minecraft.World/EnchantmentMenu.cpp +++ b/Minecraft.World/EnchantmentMenu.cpp @@ -81,7 +81,7 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr { shared_ptr item = enchantSlots->getItem(0); - if (item == NULL || !item->isEnchantable()) + if (item == nullptr || !item->isEnchantable()) { for (int i = 0; i < 3; i++) { @@ -153,14 +153,14 @@ void EnchantmentMenu::slotsChanged() // 4J used to take a shared_ptr bool EnchantmentMenu::clickMenuButton(shared_ptr player, int i) { shared_ptr item = enchantSlots->getItem(0); - if (costs[i] > 0 && item != NULL && (player->experienceLevel >= costs[i] || player->abilities.instabuild) ) + if (costs[i] > 0 && item != nullptr && (player->experienceLevel >= costs[i] || player->abilities.instabuild) ) { if (!level->isClientSide) { bool isBook = item->id == Item::book_Id; vector *newEnchantment = EnchantmentHelper::selectEnchantment(&random, item, costs[i]); - if (newEnchantment != NULL) + if (newEnchantment != nullptr) { player->giveExperienceLevels(-costs[i]); if (isBook) item->id = Item::enchantedBook_Id; @@ -200,7 +200,7 @@ void EnchantmentMenu::removed(shared_ptr player) if (level->isClientSide) return; shared_ptr item = enchantSlots->removeItemNoUpdate(0); - if (item != NULL) + if (item != nullptr) { player->drop(item); } @@ -219,7 +219,7 @@ shared_ptr EnchantmentMenu::quickMoveStack(shared_ptr play Slot *slot = slots.at(slotIndex); Slot *IngredientSlot = slots.at(INGREDIENT_SLOT); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/EnchantmentTableEntity.cpp b/Minecraft.World/EnchantmentTableEntity.cpp index 0b722680b..3e5924d22 100644 --- a/Minecraft.World/EnchantmentTableEntity.cpp +++ b/Minecraft.World/EnchantmentTableEntity.cpp @@ -46,7 +46,7 @@ void EnchantmentTableEntity::tick() oRot = rot; shared_ptr player = level->getNearestPlayer(x + 0.5f, y + 0.5f, z + 0.5f, 3); - if (player != NULL) + if (player != nullptr) { double xd = player->x - (x + 0.5f); double zd = player->z - (z + 0.5f); diff --git a/Minecraft.World/EnchantmentTableTile.cpp b/Minecraft.World/EnchantmentTableTile.cpp index d50fe5f5e..8e777ea11 100644 --- a/Minecraft.World/EnchantmentTableTile.cpp +++ b/Minecraft.World/EnchantmentTableTile.cpp @@ -14,8 +14,8 @@ EnchantmentTableTile::EnchantmentTableTile(int id) : BaseEntityTile(id, Material updateDefaultShape(); setLightBlock(0); - iconTop = NULL; - iconBottom = NULL; + iconTop = nullptr; + iconBottom = nullptr; } // 4J Added override diff --git a/Minecraft.World/EnderChestTile.cpp b/Minecraft.World/EnderChestTile.cpp index ef3c2046d..464c04823 100644 --- a/Minecraft.World/EnderChestTile.cpp +++ b/Minecraft.World/EnderChestTile.cpp @@ -65,7 +65,7 @@ bool EnderChestTile::use(Level *level, int x, int y, int z, shared_ptr p { shared_ptr container = player->getEnderChestInventory(); shared_ptr enderChest = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (container == NULL || enderChest == NULL) return true; + if (container == nullptr || enderChest == nullptr) return true; if (level->isSolidBlockingTile(x, y + 1, z)) return true; diff --git a/Minecraft.World/EnderCrystal.cpp b/Minecraft.World/EnderCrystal.cpp index 5e7a9edbd..40a82c3b4 100644 --- a/Minecraft.World/EnderCrystal.cpp +++ b/Minecraft.World/EnderCrystal.cpp @@ -93,7 +93,7 @@ bool EnderCrystal::hurt(DamageSource *source, float damage) if (isInvulnerable()) return false; // 4J-PB - if the owner of the source is the enderdragon, then ignore it (where the dragon's fireball hits an endercrystal) - if ( source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_ENDERDRAGON) ) + if ( source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_ENDERDRAGON) ) { return false; } diff --git a/Minecraft.World/EnderDragon.cpp b/Minecraft.World/EnderDragon.cpp index 608f0cd59..9a97b765a 100644 --- a/Minecraft.World/EnderDragon.cpp +++ b/Minecraft.World/EnderDragon.cpp @@ -78,7 +78,7 @@ void EnderDragon::_init() m_nodes = new NodeArray(24); openSet = new BinaryHeap(); - m_currentPath = NULL; + m_currentPath = nullptr; } EnderDragon::EnderDragon(Level *level) : Mob(level) @@ -121,16 +121,16 @@ void EnderDragon::AddParts() EnderDragon::~EnderDragon() { - if(m_nodes->data != NULL) + if(m_nodes->data != nullptr) { for(unsigned int i = 0; i < m_nodes->length; ++i) { - if(m_nodes->data[i]!=NULL) delete m_nodes->data[i]; + if(m_nodes->data[i]!=nullptr) delete m_nodes->data[i]; } delete [] m_nodes->data; } delete openSet; - if( m_currentPath != NULL ) delete m_currentPath; + if( m_currentPath != nullptr ) delete m_currentPath; } void EnderDragon::registerAttributes() @@ -383,7 +383,7 @@ void EnderDragon::aiStep() attackTarget = level->getNearestPlayer( shared_from_this(), SITTING_ATTACK_VIEW_RANGE, SITTING_ATTACK_Y_VIEW_RANGE ); ++m_actionTicks; - if( attackTarget != NULL ) + if( attackTarget != nullptr ) { if(m_actionTicks > SITTING_SCANNING_IDLE_TICKS/4) { @@ -464,7 +464,7 @@ void EnderDragon::aiStep() } else if( getSynchedAction() == e_EnderdragonAction_Sitting_Scanning ) { - if( attackTarget != NULL) + if( attackTarget != nullptr) { Vec3 *aim = Vec3::newTemp((attackTarget->x - x), 0, (attackTarget->z - z))->normalize(); Vec3 *dir = Vec3::newTemp(sin(yRot * PI / 180), 0, -cos(yRot * PI / 180))->normalize(); @@ -519,7 +519,7 @@ void EnderDragon::aiStep() // double xTargetO = xTarget; // double yTargetO = yTarget; // double zTargetO = zTarget; - if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != NULL && m_currentPath != NULL && m_currentPath->isDone()) + if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != nullptr && m_currentPath != nullptr && m_currentPath->isDone()) { xTarget = attackTarget->x; zTarget = attackTarget->z; @@ -715,7 +715,7 @@ void EnderDragon::aiStep() if (!level->isClientSide) { double maxDist = 64.0f; - if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != NULL && attackTarget->distanceToSqr(shared_from_this()) < maxDist * maxDist) + if (getSynchedAction() == e_EnderdragonAction_StrafePlayer && attackTarget != nullptr && attackTarget->distanceToSqr(shared_from_this()) < maxDist * maxDist) { if (this->canSee(attackTarget)) { @@ -747,7 +747,7 @@ void EnderDragon::aiStep() m_fireballCharge = 0; app.DebugPrintf("Finding new target due to having fired a fireball\n"); - if( m_currentPath != NULL ) + if( m_currentPath != nullptr ) { while(!m_currentPath->isDone()) { @@ -778,13 +778,13 @@ void EnderDragon::aiStep() void EnderDragon::checkCrystals() { - if (nearestCrystal != NULL) + if (nearestCrystal != nullptr) { if (nearestCrystal->removed) { if (!level->isClientSide) { - hurt(head, DamageSource::explosion(NULL), 10); + hurt(head, DamageSource::explosion(nullptr), 10); } nearestCrystal = nullptr; @@ -888,13 +888,13 @@ void EnderDragon::findNewTarget() case e_EnderdragonAction_Takeoff: case e_EnderdragonAction_HoldingPattern: { - if(!newTarget && m_currentPath != NULL && m_currentPath->isDone()) + if(!newTarget && m_currentPath != nullptr && m_currentPath->isDone()) { // Distance is 64, which is the radius of the circle int eggHeight = max(level->seaLevel + 5, level->getTopSolidBlock(PODIUM_X_POS,PODIUM_Z_POS)); //level->getHeightmap(4,4); playerNearestToEgg = level->getNearestPlayer(PODIUM_X_POS, eggHeight, PODIUM_Z_POS, 64.0); double dist = 64.0f; - if(playerNearestToEgg != NULL) + if(playerNearestToEgg != nullptr) { dist = playerNearestToEgg->distanceToSqr(PODIUM_X_POS, eggHeight, PODIUM_Z_POS); dist /= (8*8*8); @@ -909,7 +909,7 @@ void EnderDragon::findNewTarget() #endif } // More likely to strafe a player if they are close to the egg, or there are not many crystals remaining - else if( playerNearestToEgg != NULL && (random->nextInt( abs(dist) + 2 ) == 0 || random->nextInt( m_remainingCrystalsCount + 2 ) == 0) ) + else if( playerNearestToEgg != nullptr && (random->nextInt( abs(dist) + 2 ) == 0 || random->nextInt( m_remainingCrystalsCount + 2 ) == 0) ) { setSynchedAction(e_EnderdragonAction_StrafePlayer); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES @@ -921,7 +921,7 @@ void EnderDragon::findNewTarget() break; case e_EnderdragonAction_StrafePlayer: // Always return to the holding pattern after strafing - if(m_currentPath == NULL || (m_currentPath->isDone() && newTarget) ) + if(m_currentPath == nullptr || (m_currentPath->isDone() && newTarget) ) { setSynchedAction(e_EnderdragonAction_HoldingPattern); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES @@ -949,7 +949,7 @@ void EnderDragon::findNewTarget() newTarget = false; //if (random->nextInt(2) == 0 && level->players.size() > 0) - if(getSynchedAction() == e_EnderdragonAction_StrafePlayer && playerNearestToEgg != NULL) + if(getSynchedAction() == e_EnderdragonAction_StrafePlayer && playerNearestToEgg != nullptr) { attackTarget = playerNearestToEgg; strafeAttackTarget(); @@ -957,7 +957,7 @@ void EnderDragon::findNewTarget() else if(getSynchedAction() == e_EnderdragonAction_LandingApproach) { // Generate a new path if we don't currently have one - if( m_currentPath == NULL || m_currentPath->isDone() ) + if( m_currentPath == nullptr || m_currentPath->isDone() ) { int currentNodeIndex = findClosestNode(); @@ -966,7 +966,7 @@ void EnderDragon::findNewTarget() playerNearestToEgg = level->getNearestPlayer(PODIUM_X_POS, eggHeight, PODIUM_Z_POS, 128.0); int targetNodeIndex = 0 ; - if(playerNearestToEgg != NULL) + if(playerNearestToEgg != nullptr) { Vec3 *aim = Vec3::newTemp(playerNearestToEgg->x, 0, playerNearestToEgg->z)->normalize(); //app.DebugPrintf("Final marker node near (%f,%d,%f)\n", -aim->x*40,105,-aim->z*40 ); @@ -978,18 +978,18 @@ void EnderDragon::findNewTarget() } Node finalNode(PODIUM_X_POS, eggHeight, PODIUM_Z_POS); - if(m_currentPath != NULL) delete m_currentPath; + if(m_currentPath != nullptr) delete m_currentPath; m_currentPath = findPath(currentNodeIndex,targetNodeIndex, &finalNode); // Always skip the first node (as that's where we are already) - if(m_currentPath != NULL) m_currentPath->next(); + if(m_currentPath != nullptr) m_currentPath->next(); } m_actionTicks = 0; navigateToNextPathNode(); - if(m_currentPath != NULL && m_currentPath->isDone()) + if(m_currentPath != nullptr && m_currentPath->isDone()) { setSynchedAction(e_EnderdragonAction_Landing); #if PRINT_DRAGON_STATE_CHANGE_MESSAGES @@ -1007,7 +1007,7 @@ void EnderDragon::findNewTarget() { // Default is e_EnderdragonAction_HoldingPattern // Generate a new path if we don't currently have one - if(m_currentPath == NULL || m_currentPath->isDone() ) + if(m_currentPath == nullptr || m_currentPath->isDone() ) { int currentNodeIndex = findClosestNode(); int targetNodeIndex = currentNodeIndex; @@ -1044,11 +1044,11 @@ void EnderDragon::findNewTarget() if(targetNodeIndex < 0) targetNodeIndex += 12; } - if(m_currentPath != NULL) delete m_currentPath; + if(m_currentPath != nullptr) delete m_currentPath; m_currentPath = findPath(currentNodeIndex,targetNodeIndex); // Always skip the first node (as that's where we are already) - if(m_currentPath != NULL) m_currentPath->next(); + if(m_currentPath != nullptr) m_currentPath->next(); } navigateToNextPathNode(); @@ -1125,9 +1125,9 @@ bool EnderDragon::hurt(shared_ptr MultiEntityMobPart, Damage //xTarget = x + ss1 * 5 + (random->nextFloat() - 0.5f) * 2; //yTarget = y + random->nextFloat() * 3 + 1; //zTarget = z - cc1 * 5 + (random->nextFloat() - 0.5f) * 2; - //attackTarget = NULL; + //attackTarget = nullptr; - if ( source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER) || source->isExplosion() ) + if ( source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER) || source->isExplosion() ) { int healthBefore = getHealth(); reallyHurt(source, damage); @@ -1142,7 +1142,7 @@ bool EnderDragon::hurt(shared_ptr MultiEntityMobPart, Damage if( setSynchedAction(e_EnderdragonAction_LandingApproach) ) { - if( m_currentPath != NULL ) + if( m_currentPath != nullptr ) { while(!m_currentPath->isDone()) { @@ -1227,7 +1227,7 @@ void EnderDragon::tickDeath() if (dragonDeathTime == 200 && !level->isClientSide) { - //level->levelEvent(NULL, LevelEvent::ENDERDRAGON_KILLED, (int) x, (int) y, (int) z, 0); + //level->levelEvent(nullptr, LevelEvent::ENDERDRAGON_KILLED, (int) x, (int) y, (int) z, 0); int xpCount = 2000; while (xpCount > 0) @@ -1477,7 +1477,7 @@ void EnderDragon::handleCrystalDestroyed(DamageSource *source) { if(setSynchedAction(e_EnderdragonAction_LandingApproach)) { - if( m_currentPath != NULL ) + if( m_currentPath != nullptr ) { while(!m_currentPath->isDone()) { @@ -1490,7 +1490,7 @@ void EnderDragon::handleCrystalDestroyed(DamageSource *source) #endif } } - else if(source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER)) + else if(source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER)) { if(setSynchedAction(e_EnderdragonAction_StrafePlayer)) { @@ -1521,10 +1521,10 @@ void EnderDragon::strafeAttackTarget() Node finalNode(finalXTarget, finalYTarget, finalZTarget); - if(m_currentPath != NULL) delete m_currentPath; + if(m_currentPath != nullptr) delete m_currentPath; m_currentPath = findPath(currentNodeIndex,targetNodeIndex, &finalNode); - if(m_currentPath != NULL) + if(m_currentPath != nullptr) { // Always skip the first node (as that's where we are already) m_currentPath->next(); @@ -1535,7 +1535,7 @@ void EnderDragon::strafeAttackTarget() void EnderDragon::navigateToNextPathNode() { - if(m_currentPath != NULL && !m_currentPath->isDone()) + if(m_currentPath != nullptr && !m_currentPath->isDone()) { Vec3 *curr = m_currentPath->currentPos(); @@ -1563,7 +1563,7 @@ void EnderDragon::navigateToNextPathNode() int EnderDragon::findClosestNode() { // Setup all the nodes on the first time this is called - if(m_nodes->data[0] == NULL) + if(m_nodes->data[0] == nullptr) { // Path nodes for navigation // 0 - 11 are the outer ring at 60 blocks from centre @@ -1650,7 +1650,7 @@ int EnderDragon::findClosestNode(double tX, double tY, double tZ) } for(unsigned int i = startIndex; i < 24; ++i) { - if( m_nodes->data[i] != NULL ) + if( m_nodes->data[i] != nullptr ) { float dist = m_nodes->data[i]->distanceTo(currentPos); if(dist < closestDist) @@ -1665,7 +1665,7 @@ int EnderDragon::findClosestNode(double tX, double tY, double tZ) } // 4J Stu - A* taken from PathFinder and modified -Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = NULL */) +Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = nullptr */) { for(unsigned int i = 0; i < 24; ++i) { @@ -1674,7 +1674,7 @@ Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = N n->f = 0; n->g = 0; n->h = 0; - n->cameFrom = NULL; + n->cameFrom = nullptr; n->heapIdx = -1; } @@ -1704,7 +1704,7 @@ Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = N if (x->equals(to)) { app.DebugPrintf("Found path from %d to %d\n", startIndex, endIndex); - if(finalNode != NULL) + if(finalNode != nullptr) { finalNode->cameFrom = to; to = finalNode; @@ -1756,9 +1756,9 @@ Path *EnderDragon::findPath(int startIndex, int endIndex, Node *finalNode /* = N } } - if (closest == from) return NULL; + if (closest == from) return nullptr; app.DebugPrintf("Failed to find path from %d to %d\n", startIndex, endIndex); - if(finalNode != NULL) + if(finalNode != nullptr) { finalNode->cameFrom = closest; closest = finalNode; @@ -1771,7 +1771,7 @@ Path *EnderDragon::reconstruct_path(Node *from, Node *to) { int count = 1; Node *n = to; - while (n->cameFrom != NULL) + while (n->cameFrom != nullptr) { count++; n = n->cameFrom; @@ -1780,7 +1780,7 @@ Path *EnderDragon::reconstruct_path(Node *from, Node *to) NodeArray nodes = NodeArray(count); n = to; nodes.data[--count] = n; - while (n->cameFrom != NULL) + while (n->cameFrom != nullptr) { n = n->cameFrom; nodes.data[--count] = n; @@ -1923,7 +1923,7 @@ double EnderDragon::getHeadPartYRotDiff(int partIndex, doubleArray bodyPos, doub Vec3 *EnderDragon::getHeadLookVector(float a) { - Vec3 *result = NULL; + Vec3 *result = nullptr; if( getSynchedAction() == e_EnderdragonAction_Landing || getSynchedAction() == e_EnderdragonAction_Takeoff ) { diff --git a/Minecraft.World/EnderDragon.h b/Minecraft.World/EnderDragon.h index a13ecaa26..9f39767eb 100644 --- a/Minecraft.World/EnderDragon.h +++ b/Minecraft.World/EnderDragon.h @@ -163,7 +163,7 @@ private: EEnderdragonAction getSynchedAction(); int findClosestNode(double tX, double tY, double tZ); int findClosestNode(); - Path *findPath(int startIndex, int endIndex, Node *finalNode = NULL); + Path *findPath(int startIndex, int endIndex, Node *finalNode = nullptr); Path *reconstruct_path(Node *from, Node *to); void strafeAttackTarget(); diff --git a/Minecraft.World/EnderEyeItem.cpp b/Minecraft.World/EnderEyeItem.cpp index a0c3dad37..80e5fe984 100644 --- a/Minecraft.World/EnderEyeItem.cpp +++ b/Minecraft.World/EnderEyeItem.cpp @@ -136,7 +136,7 @@ bool EnderEyeItem::useOn(shared_ptr instance, shared_ptr p bool EnderEyeItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, false); - if (hr != NULL && hr->type == HitResult::TILE) + if (hr != nullptr && hr->type == HitResult::TILE) { int tile = level->getTile(hr->x, hr->y, hr->z); delete hr; @@ -145,7 +145,7 @@ bool EnderEyeItem::TestUse(shared_ptr itemInstance, Level *level, return false; } } - else if( hr != NULL ) + else if( hr != nullptr ) { delete hr; } @@ -177,7 +177,7 @@ bool EnderEyeItem::TestUse(shared_ptr itemInstance, Level *level, } // TilePos *nearestMapFeature = level->findNearestMapFeature(LargeFeature::STRONGHOLD, (int) player->x, (int) player->y, (int) player->z); -// if (nearestMapFeature != NULL) +// if (nearestMapFeature != nullptr) // { // delete nearestMapFeature; // return true; @@ -189,7 +189,7 @@ bool EnderEyeItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr EnderEyeItem::use(shared_ptr instance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, false); - if (hr != NULL && hr->type == HitResult::TILE) + if (hr != nullptr && hr->type == HitResult::TILE) { int tile = level->getTile(hr->x, hr->y, hr->z); delete hr; @@ -198,7 +198,7 @@ shared_ptr EnderEyeItem::use(shared_ptr instance, Le return instance; } } - else if( hr != NULL ) + else if( hr != nullptr ) { delete hr; } diff --git a/Minecraft.World/EnderMan.cpp b/Minecraft.World/EnderMan.cpp index d21f62d76..e12318187 100644 --- a/Minecraft.World/EnderMan.cpp +++ b/Minecraft.World/EnderMan.cpp @@ -96,7 +96,7 @@ shared_ptr EnderMan::findAttackTarget() #endif shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 64); - if (player != NULL) + if (player != nullptr) { if (isLookingAtMe(player)) { @@ -120,7 +120,7 @@ shared_ptr EnderMan::findAttackTarget() bool EnderMan::isLookingAtMe(shared_ptr player) { shared_ptr helmet = player->inventory->armor[3]; - if (helmet != NULL && helmet->id == Tile::pumpkin_Id) return false; + if (helmet != nullptr && helmet->id == Tile::pumpkin_Id) return false; Vec3 *look = player->getViewVector(1)->normalize(); Vec3 *dir = Vec3::newTemp(x - player->x, (bb->y0 + bbHeight / 2) - (player->y + player->getHeadHeight()), z - player->z); @@ -143,7 +143,7 @@ void EnderMan::aiStep() AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); speed->removeModifier(SPEED_MODIFIER_ATTACKING); - if (attackTarget != NULL) + if (attackTarget != nullptr) { speed->addModifier(new AttributeModifier(*SPEED_MODIFIER_ATTACKING)); } @@ -226,14 +226,14 @@ void EnderMan::aiStep() } jumping = false; - if (attackTarget != NULL) + if (attackTarget != nullptr) { lookAt(attackTarget, 100, 100); } if (!level->isClientSide && isAlive()) { - if (attackTarget != NULL) + if (attackTarget != nullptr) { if ( attackTarget->instanceof(eTYPE_PLAYER) && isLookingAtMe(dynamic_pointer_cast(attackTarget))) { @@ -408,12 +408,12 @@ bool EnderMan::hurt(DamageSource *source, float damage) if (isInvulnerable()) return false; setCreepy(true); - if ( dynamic_cast(source) != NULL && source->getEntity()->instanceof(eTYPE_PLAYER)) + if ( dynamic_cast(source) != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER)) { aggroedByPlayer = true; } - if (dynamic_cast(source) != NULL) + if (dynamic_cast(source) != nullptr) { aggroedByPlayer = false; for (int i = 0; i < 64; i++) diff --git a/Minecraft.World/EnderpearlItem.cpp b/Minecraft.World/EnderpearlItem.cpp index e1ed693b2..4bf641f71 100644 --- a/Minecraft.World/EnderpearlItem.cpp +++ b/Minecraft.World/EnderpearlItem.cpp @@ -19,7 +19,7 @@ shared_ptr EnderpearlItem::use(shared_ptr instance, { // 4J-PB - Not sure why this was disabled for creative mode, so commenting out //if (player->abilities.instabuild) return instance; - if (player->riding != NULL) return instance; + if (player->riding != nullptr) return instance; if (!player->abilities.instabuild) { instance->count--; diff --git a/Minecraft.World/Enemy.cpp b/Minecraft.World/Enemy.cpp index b9aa3e20a..5dd548466 100644 --- a/Minecraft.World/Enemy.cpp +++ b/Minecraft.World/Enemy.cpp @@ -5,5 +5,5 @@ EntitySelector *Enemy::ENEMY_SELECTOR = new Enemy::EnemyEntitySelector(); bool Enemy::EnemyEntitySelector::matches(shared_ptr entity) const { - return (entity != NULL) && entity->instanceof(eTYPE_ENEMY); + return (entity != nullptr) && entity->instanceof(eTYPE_ENEMY); } \ No newline at end of file diff --git a/Minecraft.World/Entity.cpp b/Minecraft.World/Entity.cpp index 6a8107302..acb439b20 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -41,7 +41,7 @@ int Entity::extraWanderCount = 0; int Entity::getSmallId() { unsigned int *puiUsedFlags = entityIdUsedFlags; - unsigned int *puiRemovedFlags = NULL; + unsigned int *puiRemovedFlags = nullptr; // If we are the server (we should be, if we are allocating small Ids), then check with the server if there are any small Ids which are // still in the ServerPlayer's vectors of entities to be removed - these are used to gather up a set of entities into one network packet @@ -260,7 +260,7 @@ void Entity::_init(bool useSmallId, Level *level) riding = nullptr; forcedLoading = false; - //level = NULL; // Level is assigned to in the original c_tor code + //level = nullptr; // Level is assigned to in the original c_tor code xo = yo = zo = 0.0; x = y = z = 0.0; xd = yd = zd = 0.0; @@ -355,7 +355,7 @@ Entity::Entity(Level *level, bool useSmallId) // 4J - added useSmallId parameter // resetPos(); setPos(0, 0, 0); - if (level != NULL) + if (level != nullptr) { dimension = level->dimension->id; } @@ -398,7 +398,7 @@ return entityId; void Entity::resetPos() { - if (level == NULL) return; + if (level == nullptr) return; shared_ptr sharedThis = shared_from_this(); while (true && y > 0) @@ -510,7 +510,7 @@ void Entity::baseTick() // 4J Stu - Not needed //util.Timer.push("entityBaseTick"); - if (riding != NULL && riding->removed) + if (riding != nullptr && riding->removed) { riding = nullptr; } @@ -533,7 +533,7 @@ void Entity::baseTick() { if (server->isNetherEnabled()) { - if (riding == NULL) + if (riding == nullptr) { if (portalTime++ >= waitTime) { @@ -883,7 +883,7 @@ void Entity::move(double xa, double ya, double za, bool noEntityCubes) // 4J - double zm = z - zo; - if (makeStepSound() && !isPlayerSneaking && riding == NULL) + if (makeStepSound() && !isPlayerSneaking && riding == nullptr) { int xt = Mth::floor(x); int yt = Mth::floor(y - 0.2f - heightOffset); @@ -1029,7 +1029,7 @@ void Entity::checkFallDamage(double ya, bool onGround) AABB *Entity::getCollideBox() { - return NULL; + return nullptr; } void Entity::burn(int dmg) @@ -1047,7 +1047,7 @@ bool Entity::isFireImmune() void Entity::causeFallDamage(float distance) { - if (rider.lock() != NULL) rider.lock()->causeFallDamage(distance); + if (rider.lock() != nullptr) rider.lock()->causeFallDamage(distance); } @@ -1348,7 +1348,7 @@ bool Entity::saveAsMount(CompoundTag *entityTag) bool Entity::save(CompoundTag *entityTag) { wstring id = getEncodeId(); - if (removed || id.empty() || (rider.lock() != NULL) ) + if (removed || id.empty() || (rider.lock() != nullptr) ) { return false; } @@ -1376,7 +1376,7 @@ void Entity::saveWithoutId(CompoundTag *entityTag) addAdditonalSaveData(entityTag); - if (riding != NULL) + if (riding != nullptr) { CompoundTag *ridingTag = new CompoundTag(RIDING_TAG); if (riding->saveAsMount(ridingTag)) @@ -1556,7 +1556,7 @@ bool Entity::interact(shared_ptr player) AABB *Entity::getCollideAgainstBox(shared_ptr entity) { - return NULL; + return nullptr; } void Entity::rideTick() @@ -1569,7 +1569,7 @@ void Entity::rideTick() xd = yd = zd = 0; tick(); - if (riding == NULL) return; + if (riding == nullptr) return; // Sets riders old&new position to it's mount's old&new position (plus the ride y-seperatation). riding->positionRider(); @@ -1605,7 +1605,7 @@ void Entity::rideTick() void Entity::positionRider() { shared_ptr lockedRider = rider.lock(); - if( lockedRider == NULL) + if( lockedRider == nullptr) { return; } @@ -1627,9 +1627,9 @@ void Entity::ride(shared_ptr e) xRideRotA = 0; yRideRotA = 0; - if (e == NULL) + if (e == nullptr) { - if (riding != NULL) + if (riding != nullptr) { // 4J Stu - Position should already be updated before the SetEntityLinkPacket comes in if(!level->isClientSide) moveTo(riding->x, riding->bb->y0 + riding->bbHeight, riding->z, yRot, xRot); @@ -1638,7 +1638,7 @@ void Entity::ride(shared_ptr e) riding = nullptr; return; } - if (riding != NULL) + if (riding != nullptr) { riding->rider = weak_ptr(); } @@ -1677,7 +1677,7 @@ float Entity::getPickRadius() Vec3 *Entity::getLookAngle() { - return NULL; + return nullptr; } void Entity::handleInsidePortal() @@ -1721,7 +1721,7 @@ void Entity::animateHurt() ItemInstanceArray Entity::getEquipmentSlots() // ItemInstance[] { - return ItemInstanceArray(); // Default ctor creates NULL internal array + return ItemInstanceArray(); // Default ctor creates nullptr internal array } // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game @@ -1736,7 +1736,7 @@ bool Entity::isOnFire() bool Entity::isRiding() { - return riding != NULL; + return riding != nullptr; } bool Entity::isSneaking() @@ -1937,7 +1937,7 @@ wstring Entity::getAName() vector > *Entity::getSubEntities() { - return NULL; + return nullptr; } bool Entity::is(shared_ptr other) @@ -2023,7 +2023,7 @@ void Entity::changeDimension(int i) server->getPlayers()->repositionAcrossDimension(shared_from_this(), lastDimension, oldLevel, newLevel); shared_ptr newEntity = EntityIO::newEntity(EntityIO::getEncodeId(shared_from_this()), newLevel); - if (newEntity != NULL) + if (newEntity != nullptr) { newEntity->restoreFrom(shared_from_this(), true); diff --git a/Minecraft.World/EntityDamageSource.cpp b/Minecraft.World/EntityDamageSource.cpp index 22237bf18..8ff9e328a 100644 --- a/Minecraft.World/EntityDamageSource.cpp +++ b/Minecraft.World/EntityDamageSource.cpp @@ -23,7 +23,7 @@ shared_ptr EntityDamageSource::getEntity() shared_ptr EntityDamageSource::getDeathMessagePacket(shared_ptr player) { - shared_ptr held = (entity != NULL) && entity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; + shared_ptr held = (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; wstring additional = L""; if (entity->instanceof(eTYPE_SERVERPLAYER)) @@ -39,7 +39,7 @@ shared_ptr EntityDamageSource::getDeathMessagePacket(shared_ptrhasCustomHoverName()) + if ( (held != nullptr) && held->hasCustomHoverName()) { return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgWithItemId, entity->GetType(), additional, held->getHoverName() ) ); } @@ -51,7 +51,7 @@ shared_ptr EntityDamageSource::getDeathMessagePacket(shared_ptrinstanceof(eTYPE_LIVINGENTITY) && !entity->instanceof(eTYPE_PLAYER); + return (entity != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) && !entity->instanceof(eTYPE_PLAYER); } // 4J: Copy function diff --git a/Minecraft.World/EntityHorse.cpp b/Minecraft.World/EntityHorse.cpp index 9636c9892..03a70f92b 100644 --- a/Minecraft.World/EntityHorse.cpp +++ b/Minecraft.World/EntityHorse.cpp @@ -259,7 +259,7 @@ int EntityHorse::getArmorType() int EntityHorse::getArmorTypeForItem(shared_ptr armorItem) { - if (armorItem == NULL) + if (armorItem == nullptr) { return ARMOR_NONE; } @@ -350,7 +350,7 @@ bool EntityHorse::hurt(DamageSource *damagesource, float dmg) if (isTamed()) { shared_ptr entity = damagesource->getDirectEntity(); - if (entity != NULL && entity->instanceof(eTYPE_PLAYER)) + if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { shared_ptr attacker = dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerName()); @@ -358,7 +358,7 @@ bool EntityHorse::hurt(DamageSource *damagesource, float dmg) } shared_ptr attacker = damagesource->getEntity(); - if (rider.lock() != NULL && (rider.lock() == (attacker) )) + if (rider.lock() != nullptr && (rider.lock() == (attacker) )) { return false; } @@ -375,7 +375,7 @@ int EntityHorse::getArmorValue() bool EntityHorse::isPushable() { - return rider.lock() == NULL; + return rider.lock() == nullptr; } // TODO: [EB]: Explain why this is being done - what side effect does getBiome have? @@ -424,7 +424,7 @@ void EntityHorse::causeFallDamage(float fallDistance) hurt(DamageSource::fall, dmg); - if (rider.lock() != NULL) + if (rider.lock() != nullptr) { rider.lock()->hurt(DamageSource::fall, dmg); } @@ -458,7 +458,7 @@ void EntityHorse::createInventory() shared_ptr old = inventory; inventory = shared_ptr( new AnimalChest(L"HorseChest", getInventorySize()) ); inventory->setCustomName(getAName()); - if (old != NULL) + if (old != nullptr) { old->removeListener(this); @@ -466,7 +466,7 @@ void EntityHorse::createInventory() for (int slot = 0; slot < max; slot++) { shared_ptr item = old->getItem(slot); - if (item != NULL) + if (item != nullptr) { inventory->setItem(slot, item->copy()); } @@ -481,7 +481,7 @@ void EntityHorse::updateEquipment() { if (level && !level->isClientSide) { - setSaddled(inventory->getItem(INV_SLOT_SADDLE) != NULL); + setSaddled(inventory->getItem(INV_SLOT_SADDLE) != nullptr); if (canWearArmor()) { setArmorType(getArmorTypeForItem(inventory->getItem(INV_SLOT_ARMOR))); @@ -666,7 +666,7 @@ void EntityHorse::playStepSound(int xt, int yt, int zt, int t) if (!Tile::tiles[t]->material->isLiquid()) { int type = getType(); - if (rider.lock() != NULL && type != TYPE_DONKEY && type != TYPE_MULE) + if (rider.lock() != nullptr && type != TYPE_DONKEY && type != TYPE_MULE) { gallopSoundCounter++; if (gallopSoundCounter > 5 && gallopSoundCounter % 3 == 0) @@ -795,7 +795,7 @@ intArray EntityHorse::getLayeredTextureLayers() void EntityHorse::openInventory(shared_ptr player) { - if (!level->isClientSide && (rider.lock() == NULL || rider.lock() == player) && isTamed()) + if (!level->isClientSide && (rider.lock() == nullptr || rider.lock() == player) && isTamed()) { inventory->setCustomName(getAName()); player->openHorseInventory(dynamic_pointer_cast(shared_from_this()), inventory); @@ -806,7 +806,7 @@ bool EntityHorse::mobInteract(shared_ptr player) { shared_ptr itemstack = player->inventory->getSelected(); - if (itemstack != NULL && itemstack->id == Item::spawnEgg_Id) + if (itemstack != nullptr && itemstack->id == Item::spawnEgg_Id) { return Animal::mobInteract(player); } @@ -825,13 +825,13 @@ bool EntityHorse::mobInteract(shared_ptr player) return true; } - if (isRidable() && rider.lock() != NULL) + if (isRidable() && rider.lock() != nullptr) { return Animal::mobInteract(player); } // consumables - if (itemstack != NULL) + if (itemstack != nullptr) { bool itemUsed = false; @@ -944,7 +944,7 @@ bool EntityHorse::mobInteract(shared_ptr player) if (!isTamed() && !itemUsed) { - if (itemstack != NULL && itemstack->interactEnemy(player, dynamic_pointer_cast(shared_from_this()))) + if (itemstack != nullptr && itemstack->interactEnemy(player, dynamic_pointer_cast(shared_from_this()))) { return true; } @@ -985,11 +985,11 @@ bool EntityHorse::mobInteract(shared_ptr player) } } - if (isRidable() && rider.lock() == NULL) + if (isRidable() && rider.lock() == nullptr) { // for name tag items and such, we must call the item's interaction // method before riding - if (itemstack != NULL && itemstack->interactEnemy(player, dynamic_pointer_cast(shared_from_this()))) + if (itemstack != nullptr && itemstack->interactEnemy(player, dynamic_pointer_cast(shared_from_this()))) { return true; } @@ -1046,7 +1046,7 @@ bool EntityHorse::canWearBags() bool EntityHorse::isImmobile() { - if (rider.lock() != NULL && isSaddled()) + if (rider.lock() != nullptr && isSaddled()) { return true; } @@ -1127,7 +1127,7 @@ void EntityHorse::aiStep() heal(1); } - if (!isEating() && rider.lock() == NULL && random->nextInt(300) == 0) + if (!isEating() && rider.lock() == nullptr && random->nextInt(300) == 0) { if (level->getTile(Mth::floor(x), Mth::floor(y) - 1, Mth::floor(z)) == Tile::grass_Id) { @@ -1144,7 +1144,7 @@ void EntityHorse::aiStep() if (isBred() && !isAdult() && !isEating()) { shared_ptr mommy = getClosestMommy(shared_from_this(), 16); - if (mommy != NULL && distanceToSqr(mommy) > 4.0) + if (mommy != nullptr && distanceToSqr(mommy) > 4.0) { Path *pathentity = level->findPath(shared_from_this(), mommy, 16.0f, true, false, false, true); setPath(pathentity); @@ -1263,12 +1263,12 @@ void EntityHorse::openMouth() bool EntityHorse::isReadyForParenting() { - return rider.lock() == NULL && riding == NULL && isTamed() && isAdult() && !isSterile() && getHealth() >= getMaxHealth(); + return rider.lock() == nullptr && riding == nullptr && isTamed() && isAdult() && !isSterile() && getHealth() >= getMaxHealth(); } bool EntityHorse::renderName() { - return hasCustomName() && rider.lock() == NULL; + return hasCustomName() && rider.lock() == nullptr; } bool EntityHorse::rideableEntity() @@ -1320,12 +1320,12 @@ void EntityHorse::dropMyStuff() void EntityHorse::dropInventory(shared_ptr entity, shared_ptr animalchest) { - if (animalchest == NULL || level->isClientSide) return; + if (animalchest == nullptr || level->isClientSide) return; for (int i = 0; i < animalchest->getContainerSize(); i++) { shared_ptr itemstack = animalchest->getItem(i); - if (itemstack == NULL) + if (itemstack == nullptr) { continue; } @@ -1349,7 +1349,7 @@ void EntityHorse::travel(float xa, float ya) { // If the entity is not ridden by Player, then execute the normal // Entityliving code - if (rider.lock() == NULL || !isSaddled()) + if (rider.lock() == nullptr || !isSaddled()) { footSize = .5f; flyingSpeed = .02f; @@ -1455,7 +1455,7 @@ void EntityHorse::addAdditonalSaveData(CompoundTag *tag) { shared_ptr stack = inventory->getItem(i); - if (stack != NULL) + if (stack != nullptr) { CompoundTag *compoundTag = new CompoundTag(); @@ -1468,11 +1468,11 @@ void EntityHorse::addAdditonalSaveData(CompoundTag *tag) tag->put(L"Items", listTag); } - if (inventory->getItem(INV_SLOT_ARMOR) != NULL) + if (inventory->getItem(INV_SLOT_ARMOR) != nullptr) { tag->put(L"ArmorItem", inventory->getItem(INV_SLOT_ARMOR)->save(new CompoundTag(L"ArmorItem"))); } - if (inventory->getItem(INV_SLOT_SADDLE) != NULL) + if (inventory->getItem(INV_SLOT_SADDLE) != nullptr) { tag->put(L"SaddleItem", inventory->getItem(INV_SLOT_SADDLE)->save(new CompoundTag(L"SaddleItem"))); } @@ -1498,7 +1498,7 @@ void EntityHorse::readAdditionalSaveData(CompoundTag *tag) // 4J: This is for handling old save data, not needed on console /*AttributeInstance *oldSpeedAttribute = getAttributes()->getInstance(SharedMonsterAttributes::MOVEMENT_SPEED); - if (oldSpeedAttribute != NULL) + if (oldSpeedAttribute != nullptr) { getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(oldSpeedAttribute->getBaseValue() * 0.25f); }*/ @@ -1523,7 +1523,7 @@ void EntityHorse::readAdditionalSaveData(CompoundTag *tag) if (tag->contains(L"ArmorItem")) { shared_ptr armor = ItemInstance::fromTag(tag->getCompound(L"ArmorItem")); - if (armor != NULL && isHorseArmor(armor->id)) + if (armor != nullptr && isHorseArmor(armor->id)) { inventory->setItem(INV_SLOT_ARMOR, armor); } @@ -1532,7 +1532,7 @@ void EntityHorse::readAdditionalSaveData(CompoundTag *tag) if (tag->contains(L"SaddleItem")) { shared_ptr saddleItem = ItemInstance::fromTag(tag->getCompound(L"SaddleItem")); - if (saddleItem != NULL && saddleItem->id == Item::saddle_Id) + if (saddleItem != nullptr && saddleItem->id == Item::saddle_Id) { inventory->setItem(INV_SLOT_SADDLE, saddleItem); } @@ -1637,7 +1637,7 @@ MobGroupData *EntityHorse::finalizeMobSpawn(MobGroupData *groupData, int extraDa int type = 0; int variant = 0; - if ( dynamic_cast(groupData) != NULL ) + if ( dynamic_cast(groupData) != nullptr ) { type = static_cast(groupData)->horseType; variant = static_cast(groupData)->horseVariant & 0xff | (random->nextInt(MARKINGS) << 8); diff --git a/Minecraft.World/EntityIO.cpp b/Minecraft.World/EntityIO.cpp index 086015dc7..9c7c64d40 100644 --- a/Minecraft.World/EntityIO.cpp +++ b/Minecraft.World/EntityIO.cpp @@ -135,8 +135,8 @@ shared_ptr EntityIO::newEntity(const wstring& id, Level *level) if(it != idCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); - if( ( entity != NULL ) && entity->GetType() == eTYPE_ENDERDRAGON ) + if (create != nullptr) entity = shared_ptr(create(level)); + if( ( entity != nullptr ) && entity->GetType() == eTYPE_ENDERDRAGON ) { dynamic_pointer_cast(entity)->AddParts(); // 4J added to finalise creation } @@ -173,14 +173,14 @@ shared_ptr EntityIO::loadStatic(CompoundTag *tag, Level *level) if(it != idCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); - if( ( entity != NULL ) && entity->GetType() == eTYPE_ENDERDRAGON ) + if (create != nullptr) entity = shared_ptr(create(level)); + if( ( entity != nullptr ) && entity->GetType() == eTYPE_ENDERDRAGON ) { dynamic_pointer_cast(entity)->AddParts(); // 4J added to finalise creation } } - if (entity != NULL) + if (entity != nullptr) { entity->load(tag); } @@ -201,14 +201,14 @@ shared_ptr EntityIO::newById(int id, Level *level) if(it != numCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); - if( ( entity != NULL ) && entity->GetType() == eTYPE_ENDERDRAGON ) + if (create != nullptr) entity = shared_ptr(create(level)); + if( ( entity != nullptr ) && entity->GetType() == eTYPE_ENDERDRAGON ) { dynamic_pointer_cast(entity)->AddParts(); // 4J added to finalise creation } } - if (entity != NULL) + if (entity != nullptr) { } else @@ -229,8 +229,8 @@ shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) if(it2 != numCreateMap->end() ) { entityCreateFn create = it2->second; - if (create != NULL) entity = shared_ptr(create(level)); - if( ( entity != NULL ) && entity->GetType() == eTYPE_ENDERDRAGON ) + if (create != nullptr) entity = shared_ptr(create(level)); + if( ( entity != nullptr ) && entity->GetType() == eTYPE_ENDERDRAGON ) { dynamic_pointer_cast(entity)->AddParts(); // 4J added to finalise creation } diff --git a/Minecraft.World/EntityPos.cpp b/Minecraft.World/EntityPos.cpp index 38b505734..02f716edf 100644 --- a/Minecraft.World/EntityPos.cpp +++ b/Minecraft.World/EntityPos.cpp @@ -58,5 +58,5 @@ EntityPos *EntityPos::lerp(shared_ptr e, float f) { return new EntityPos(yrd, xrd); } - return NULL; + return nullptr; } \ No newline at end of file diff --git a/Minecraft.World/EntitySelector.cpp b/Minecraft.World/EntitySelector.cpp index 36c7bf88b..0f575c73b 100644 --- a/Minecraft.World/EntitySelector.cpp +++ b/Minecraft.World/EntitySelector.cpp @@ -12,7 +12,7 @@ bool AliveEntitySelector::matches(shared_ptr entity) const bool ContainerEntitySelector::matches(shared_ptr entity) const { - return (dynamic_pointer_cast(entity) != NULL) && entity->isAlive(); + return (dynamic_pointer_cast(entity) != nullptr) && entity->isAlive(); } MobCanWearArmourEntitySelector::MobCanWearArmourEntitySelector(shared_ptr item) @@ -27,7 +27,7 @@ bool MobCanWearArmourEntitySelector::matches(shared_ptr entity) const shared_ptr mob = dynamic_pointer_cast(entity); - if (mob->getCarried(Mob::getEquipmentSlotForItem(item)) != NULL) return false; + if (mob->getCarried(Mob::getEquipmentSlotForItem(item)) != nullptr) return false; if ( mob->instanceof(eTYPE_MOB) ) { diff --git a/Minecraft.World/ExperienceOrb.cpp b/Minecraft.World/ExperienceOrb.cpp index 9aad00086..cc4b12bc6 100644 --- a/Minecraft.World/ExperienceOrb.cpp +++ b/Minecraft.World/ExperienceOrb.cpp @@ -99,13 +99,13 @@ void ExperienceOrb::tick() // Usually exp orbs will get created at the same time so smoothen the lagspikes if (followingTime < tickCount - SharedConstants::TICKS_PER_SECOND + (entityId % 100)) { - if (followingPlayer == NULL || followingPlayer->distanceToSqr(shared_from_this()) > maxDist * maxDist) + if (followingPlayer == nullptr || followingPlayer->distanceToSqr(shared_from_this()) > maxDist * maxDist) { followingPlayer = level->getNearestPlayer(shared_from_this(), maxDist); } followingTime = tickCount; } - if (followingPlayer != NULL) + if (followingPlayer != nullptr) { double xdd = (followingPlayer->x - x) / maxDist; double ydd = (followingPlayer->y + followingPlayer->getHeadHeight() - y) / maxDist; diff --git a/Minecraft.World/Explosion.cpp b/Minecraft.World/Explosion.cpp index 3fc085bec..65e719e40 100644 --- a/Minecraft.World/Explosion.cpp +++ b/Minecraft.World/Explosion.cpp @@ -72,10 +72,10 @@ void Explosion::explode() if (t > 0) { Tile *tile = Tile::tiles[t]; - float resistance = source != NULL ? source->getTileExplosionResistance(this, level, xt, yt, zt, tile) : tile->getExplosionResistance(source); + float resistance = source != nullptr ? source->getTileExplosionResistance(this, level, xt, yt, zt, tile) : tile->getExplosionResistance(source); remainingPower -= (resistance + 0.3f) * stepSize; } - if (remainingPower > 0&& (source == NULL || source->shouldTileExplode(this, level, xt, yt, zt, t, remainingPower))) + if (remainingPower > 0&& (source == nullptr || source->shouldTileExplode(this, level, xt, yt, zt, t, remainingPower))) { toBlow.insert(TilePos(xt, yt, zt)); } @@ -163,7 +163,7 @@ void Explosion::explode() } -void Explosion::finalizeExplosion(bool generateParticles, vector *toBlowDirect/*=NULL*/) // 4J - added toBlowDirect parameter +void Explosion::finalizeExplosion(bool generateParticles, vector *toBlowDirect/*=nullptr*/) // 4J - added toBlowDirect parameter { level->playSound(x, y, z, eSoundType_RANDOM_EXPLODE, 4, (1 + (level->random->nextFloat() - level->random->nextFloat()) * 0.2f) * 0.7f); if (r < 2 || !destroyBlocks) @@ -262,7 +262,7 @@ void Explosion::finalizeExplosion(bool generateParticles, vector *toBlo } PIXEndNamedEvent(); - if( toBlowDirect == NULL ) delete toBlowArray; + if( toBlowDirect == nullptr ) delete toBlowArray; } Explosion::playerVec3Map *Explosion::getHitPlayers() @@ -281,7 +281,7 @@ Vec3 *Explosion::getHitPlayerKnockback( shared_ptr player ) shared_ptr Explosion::getSourceMob() { - if (source == NULL) return nullptr; + if (source == nullptr) return nullptr; if (source->instanceof(eTYPE_PRIMEDTNT)) return dynamic_pointer_cast(source)->getOwner(); if (source->instanceof(eTYPE_LIVINGENTITY)) return dynamic_pointer_cast(source); return nullptr; diff --git a/Minecraft.World/Explosion.h b/Minecraft.World/Explosion.h index 1fe1e57bb..7cefb44b4 100644 --- a/Minecraft.World/Explosion.h +++ b/Minecraft.World/Explosion.h @@ -36,7 +36,7 @@ public: void explode(); public: - void finalizeExplosion(bool generateParticles, vector *toBlowDirect = NULL); // 4J - added toBlow parameter + void finalizeExplosion(bool generateParticles, vector *toBlowDirect = nullptr); // 4J - added toBlow parameter playerVec3Map *getHitPlayers(); Vec3 *getHitPlayerKnockback( shared_ptr player ); shared_ptr getSourceMob(); diff --git a/Minecraft.World/FallingTile.cpp b/Minecraft.World/FallingTile.cpp index aec50d9be..cd951681d 100644 --- a/Minecraft.World/FallingTile.cpp +++ b/Minecraft.World/FallingTile.cpp @@ -24,7 +24,7 @@ void FallingTile::_init() hurtEntities = false; fallDamageMax = 40; fallDamageAmount = 2; - tileData = NULL; + tileData = nullptr; // 4J Added so that client-side falling tiles can fall through blocks // This fixes a bug on the host where the tile update from the server comes in before the client-side falling tile @@ -136,11 +136,11 @@ void FallingTile::tick() { hv->onLand(level, xt, yt, zt, data); } - if (tileData != NULL && Tile::tiles[tile]->isEntityTile()) + if (tileData != nullptr && Tile::tiles[tile]->isEntityTile()) { shared_ptr tileEntity = level->getTileEntity(xt, yt, zt); - if (tileEntity != NULL) + if (tileEntity != nullptr) { CompoundTag *swap = new CompoundTag(); tileEntity->save(swap); @@ -220,7 +220,7 @@ void FallingTile::addAdditonalSaveData(CompoundTag *tag) tag->putBoolean(L"HurtEntities", hurtEntities); tag->putFloat(L"FallHurtAmount", fallDamageAmount); tag->putInt(L"FallHurtMax", fallDamageMax); - if (tileData != NULL) tag->putCompound(L"TileEntityData", tileData); + if (tileData != nullptr) tag->putCompound(L"TileEntityData", tileData); } void FallingTile::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/FarmTile.cpp b/Minecraft.World/FarmTile.cpp index 6cbe40acd..39bf685f5 100644 --- a/Minecraft.World/FarmTile.cpp +++ b/Minecraft.World/FarmTile.cpp @@ -8,8 +8,8 @@ FarmTile::FarmTile(int id) : Tile(id, Material::dirt,isSolidRender()) { - iconWet = NULL; - iconDry = NULL; + iconWet = nullptr; + iconDry = nullptr; setTicking(true); updateDefaultShape(); diff --git a/Minecraft.World/FastNoise.cpp b/Minecraft.World/FastNoise.cpp index 65f8d7ecc..399c427fe 100644 --- a/Minecraft.World/FastNoise.cpp +++ b/Minecraft.World/FastNoise.cpp @@ -34,7 +34,7 @@ FastNoise::~FastNoise() doubleArray FastNoise::getRegion(doubleArray buffer, double x, double y, double z, int xSize, int ySize, int zSize, double xScale, double yScale, double zScale) { - if (buffer.data == NULL) buffer = doubleArray(xSize * ySize * zSize); + if (buffer.data == nullptr) buffer = doubleArray(xSize * ySize * zSize); else for (unsigned int i = 0; i < buffer.length; i++) buffer[i] = 0; diff --git a/Minecraft.World/FenceGateTile.cpp b/Minecraft.World/FenceGateTile.cpp index a8de450e1..bd1326a95 100644 --- a/Minecraft.World/FenceGateTile.cpp +++ b/Minecraft.World/FenceGateTile.cpp @@ -25,7 +25,7 @@ AABB *FenceGateTile::getAABB(Level *level, int x, int y, int z) int data = level->getData(x, y, z); if (isOpen(data)) { - return NULL; + return nullptr; } // 4J Brought forward change from 1.2.3 to fix hit box rotation if (data == Direction::NORTH || data == Direction::SOUTH) @@ -86,7 +86,7 @@ bool FenceGateTile::use(Level *level, int x, int y, int z, shared_ptr pl if (soundOnly) { // 4J - added - just do enough to play the sound - level->levelEvent(player, LevelEvent::SOUND_OPEN_DOOR, x, y, z, 0); // 4J - changed event to pass player rather than NULL as the source of the event so we can filter the broadcast properly + level->levelEvent(player, LevelEvent::SOUND_OPEN_DOOR, x, y, z, 0); // 4J - changed event to pass player rather than nullptr as the source of the event so we can filter the broadcast properly return false; } diff --git a/Minecraft.World/FenceTile.cpp b/Minecraft.World/FenceTile.cpp index 39f4aac1c..83c311676 100644 --- a/Minecraft.World/FenceTile.cpp +++ b/Minecraft.World/FenceTile.cpp @@ -122,7 +122,7 @@ bool FenceTile::connectsTo(LevelSource *level, int x, int y, int z) return true; } Tile *tileInstance = Tile::tiles[tile]; - if (tileInstance != NULL) + if (tileInstance != nullptr) { if (tileInstance->material->isSolidBlocking() && tileInstance->isCubeShaped()) { diff --git a/Minecraft.World/File.cpp b/Minecraft.World/File.cpp index ca13f228f..4b36169f5 100644 --- a/Minecraft.World/File.cpp +++ b/Minecraft.World/File.cpp @@ -24,7 +24,7 @@ File::File( const File &parent, const std::wstring& child ) } //Creates a new File instance by converting the given pathname string into an abstract pathname. -File::File( const wstring& pathname ) //: parent( NULL ) +File::File( const wstring& pathname ) //: parent( nullptr ) { // #ifndef _CONTENT_PACKAGE // char buf[256]; @@ -62,7 +62,7 @@ File::File( const wstring& pathname ) //: parent( NULL ) if( path.back().compare( pathRoot ) != 0 ) this->parent = new File( &path ); else - this->parent = NULL; + this->parent = nullptr; } */ } @@ -75,7 +75,7 @@ File::File( const std::wstring& parent, const std::wstring& child ) //: m_abstr //Creates a new File instance by converting the given path vector into an abstract pathname. /* -File::File( vector *path ) : parent( NULL ) +File::File( vector *path ) : parent( nullptr ) { m_abstractPathName = path->back(); path->pop_back(); @@ -86,7 +86,7 @@ if( path->size() > 0 ) if( path->back().compare( pathRoot ) != 0 ) this->parent = new File( path ); else -this->parent = NULL; +this->parent = nullptr; } } */ @@ -120,10 +120,10 @@ bool File::_delete() bool File::mkdir() const { #ifdef _UNICODE - return CreateDirectory( getPath().c_str(), NULL) != 0; + return CreateDirectory( getPath().c_str(), nullptr) != 0; #else - return CreateDirectory( wstringtofilename(getPath()), NULL) != 0; + return CreateDirectory( wstringtofilename(getPath()), nullptr) != 0; #endif } @@ -167,7 +167,7 @@ bool File::mkdirs() const #ifdef _UNICODE if( GetFileAttributes( pathToHere.c_str() ) == -1 ) { - DWORD result = CreateDirectory( pathToHere.c_str(), NULL); + DWORD result = CreateDirectory( pathToHere.c_str(), nullptr); if( result == 0 ) { // Failed to create @@ -177,7 +177,7 @@ bool File::mkdirs() const #else if( GetFileAttributes( wstringtofilename(pathToHere) ) == -1 ) { - DWORD result = CreateDirectory( wstringtofilename(pathToHere), NULL); + DWORD result = CreateDirectory( wstringtofilename(pathToHere), nullptr); if( result == 0 ) { // Failed to create @@ -321,7 +321,7 @@ std::vector *File::listFiles() const else sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); - bool exists = sceFiosDirectoryExistsSync( NULL, filePath ); + bool exists = sceFiosDirectoryExistsSync( nullptr, filePath ); if( !exists ) { app.DebugPrintf("\nsceFiosDirectoryExistsSync - Directory doesn't exist\n"); @@ -334,7 +334,7 @@ std::vector *File::listFiles() const SceFiosDH dh = SCE_FIOS_DH_INVALID; SceFiosBuffer buf; buf.length = 0; - SceFiosOp op = sceFiosDHOpen(NULL, &dh, filePath, buf); + SceFiosOp op = sceFiosDHOpen(nullptr, &dh, filePath, buf); int err = sceFiosOpWait(op); if( err != SCE_FIOS_OK ) @@ -346,24 +346,24 @@ std::vector *File::listFiles() const buf.set(pBuf, (size_t)size); sceFiosOpDelete( op ); - sceFiosDHClose(NULL, dh); + sceFiosDHClose(nullptr, dh); - err = sceFiosDHOpenSync(NULL, &dh, filePath, buf); + err = sceFiosDHOpenSync(nullptr, &dh, filePath, buf); if( err != SCE_FIOS_OK ) { app.DebugPrintf("\nsceFiosDHOpenSync = 0x%x\n",err); } SceFiosDirEntry entry; ZeroMemory(&entry, sizeof(SceFiosDirEntry)); - err = sceFiosDHReadSync(NULL, dh, &entry); + err = sceFiosDHReadSync(nullptr, dh, &entry); while( err == SCE_FIOS_OK) { vOutput->push_back( new File( *this, filenametowstring( entry.fullPath + entry.offsetToName ) ) ); ZeroMemory(&entry, sizeof(SceFiosDirEntry)); - err = sceFiosDHReadSync(NULL, dh, &entry); + err = sceFiosDHReadSync(nullptr, dh, &entry); }; - sceFiosDHClose(NULL, dh); + sceFiosDHClose(nullptr, dh); delete pBuf; #else @@ -418,7 +418,7 @@ std::vector *File::listFiles(FileFilter *filter) const { // TODO 4J Stu - Also need to check for I/O errors? if( !isDirectory() ) - return NULL; + return nullptr; std::vector *vOutput = new std::vector(); @@ -576,7 +576,7 @@ int64_t File::length() // check if the file exists first SceFiosStat statData; - if(sceFiosStatSync(NULL, filePath, &statData) != SCE_FIOS_OK) + if(sceFiosStatSync(nullptr, filePath, &statData) != SCE_FIOS_OK) { return 0; } @@ -660,7 +660,7 @@ const std::wstring File::getPath() const { /* wstring path; - if ( parent != NULL) + if ( parent != nullptr) path = parent->getPath(); else path = wstring(pathRoot); @@ -687,7 +687,7 @@ int File::hash_fnct(const File &k) { int hashCode = 0; - //if (k->parent != NULL) + //if (k->parent != nullptr) // hashCode = hash_fnct(k->getParent()); wchar_t *ref = (wchar_t *) k.m_abstractPathName.c_str(); diff --git a/Minecraft.World/FileHeader.cpp b/Minecraft.World/FileHeader.cpp index 01687628f..a7bdbc904 100644 --- a/Minecraft.World/FileHeader.cpp +++ b/Minecraft.World/FileHeader.cpp @@ -5,7 +5,7 @@ FileHeader::FileHeader() { - lastFile = NULL; + lastFile = nullptr; m_saveVersion = 0; // New saves should have an original version set to the latest version. This will be overridden when we load a save @@ -49,7 +49,7 @@ FileEntry *FileHeader::AddFile( const wstring &name, unsigned int length /* = 0 void FileHeader::RemoveFile( FileEntry *file ) { - if( file == NULL ) return; + if( file == nullptr ) return; AdjustStartOffsets(file, file->getFileSize(), true); @@ -364,13 +364,13 @@ bool FileHeader::fileExists( const wstring &name ) vector *FileHeader::getFilesWithPrefix(const wstring &prefix) { - vector *files = NULL; + vector *files = nullptr; for( unsigned int i = 0; i < fileTable.size(); ++i ) { if( wcsncmp( fileTable[i]->data.filename, prefix.c_str(), prefix.size() ) == 0 ) { - if( files == NULL ) + if( files == nullptr ) { files = new vector(); } @@ -479,7 +479,7 @@ wstring FileHeader::getPlayerDataFilenameForSave(const PlayerUID& pUID) vector *FileHeader::getValidPlayerDatFiles() { - vector *files = NULL; + vector *files = nullptr; // find filenames that match this pattern // P_5e7ff8372ea9_00000004_Mark_4J @@ -509,7 +509,7 @@ vector *FileHeader::getValidPlayerDatFiles() continue; // if we get here, it must be a valid filename - if( files == NULL ) + if( files == nullptr ) { files = new vector(); } @@ -524,21 +524,21 @@ vector *FileHeader::getValidPlayerDatFiles() vector *FileHeader::getDatFilesWithOnlineID(const PlayerUID& pUID) { if(pUID.isSignedIntoPSN() == false) - return NULL; + return nullptr; vector* datFiles = getValidPlayerDatFiles(); - if(datFiles == NULL) - return NULL; + if(datFiles == nullptr) + return nullptr; // we're looking for the online name from the pUID in these types of filenames - // P_5e7ff8372ea9_00000004_Mark_4J wchar_t onlineIDW[64]; mbstowcs(onlineIDW, pUID.getOnlineID(), 64); - vector *files = NULL; + vector *files = nullptr; int onlineIDSize = wcslen(onlineIDW); if(onlineIDSize == 0) - return NULL; + return nullptr; wcscat(onlineIDW, L".dat"); @@ -564,7 +564,7 @@ vector *FileHeader::getDatFilesWithOnlineID(const PlayerUID& pUID) { if(wcsncmp(&filenameOnly[onlineIDStart], onlineIDW, onlineIDSize) == 0) { - if( files == NULL ) + if( files == nullptr ) { files = new vector(); } @@ -582,8 +582,8 @@ vector *FileHeader::getDatFilesWithMacAndUserID(const PlayerUID& pU { vector* datFiles = getValidPlayerDatFiles(); - if(datFiles == NULL) - return NULL; + if(datFiles == nullptr) + return nullptr; // we're looking for the mac address and userIDfrom the pUID in these types of filenames - // P_5e7ff8372ea9_00000004_Mark_4J @@ -592,7 +592,7 @@ vector *FileHeader::getDatFilesWithMacAndUserID(const PlayerUID& pU const wchar_t* pMacStr = macStr.c_str(); const wchar_t* pUserStr = userStr.c_str(); - vector *files = NULL; + vector *files = nullptr; static const int macAddrStart = 2; // 2 characters into the filename static const int userIDStart = 15; // 15 characters into the filename @@ -609,7 +609,7 @@ vector *FileHeader::getDatFilesWithMacAndUserID(const PlayerUID& pU // check the userID matches if(wcsncmp(&filenameOnly[userIDStart], pUserStr, userStr.size()) == 0) { - if( files == NULL ) + if( files == nullptr ) { files = new vector(); } @@ -627,12 +627,12 @@ vector *FileHeader::getDatFilesWithPrimaryUser() { vector* datFiles = getValidPlayerDatFiles(); - if(datFiles == NULL) - return NULL; + if(datFiles == nullptr) + return nullptr; // we're just looking for filenames starting with "P_" in these types of filenames - // P_5e7ff8372ea9_00000004_Mark_4J - vector *files = NULL; + vector *files = nullptr; char tempStr[128]; for( unsigned int i = 0; i < datFiles->size(); ++i ) @@ -644,7 +644,7 @@ vector *FileHeader::getDatFilesWithPrimaryUser() // check for "P_" prefix if(wcsncmp(&filenameOnly[0], L"P_", 2) == 0) { - if( files == NULL ) + if( files == nullptr ) { files = new vector(); } diff --git a/Minecraft.World/FileInputStream.cpp b/Minecraft.World/FileInputStream.cpp index 7c0e844f0..a7714ae26 100644 --- a/Minecraft.World/FileInputStream.cpp +++ b/Minecraft.World/FileInputStream.cpp @@ -24,20 +24,20 @@ FileInputStream::FileInputStream(const File &file) file.getPath().c_str(), // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #else m_fileHandle = CreateFile( pchFilename, // file name GENERIC_READ, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it FILE_FLAG_SEQUENTIAL_SCAN, // file attributes - NULL // Unsupported + nullptr // Unsupported ); #endif @@ -68,7 +68,7 @@ int FileInputStream::read() &byteRead, // data buffer 1, // number of bytes to read &numberOfBytesRead, // number of bytes read - NULL // overlapped buffer + nullptr // overlapped buffer ); if( bSuccess==FALSE ) @@ -100,7 +100,7 @@ int FileInputStream::read(byteArray b) b.data, // data buffer b.length, // number of bytes to read &numberOfBytesRead, // number of bytes read - NULL // overlapped buffer + nullptr // overlapped buffer ); if( bSuccess==FALSE ) @@ -138,7 +138,7 @@ int FileInputStream::read(byteArray b, unsigned int offset, unsigned int length) &b[offset], // data buffer length, // number of bytes to read &numberOfBytesRead, // number of bytes read - NULL // overlapped buffer + nullptr // overlapped buffer ); if( bSuccess==FALSE ) diff --git a/Minecraft.World/FileOutputStream.cpp b/Minecraft.World/FileOutputStream.cpp index e554ccf59..58a0ecd96 100644 --- a/Minecraft.World/FileOutputStream.cpp +++ b/Minecraft.World/FileOutputStream.cpp @@ -24,20 +24,20 @@ FileOutputStream::FileOutputStream(const File &file) : m_fileHandle( INVALID_HAN file.getPath().c_str() , // file name GENERIC_WRITE, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_ALWAYS , // how to create FILE_ATTRIBUTE_NORMAL , // file attributes - NULL // Unsupported + nullptr // Unsupported ); #else m_fileHandle = CreateFile( wstringtofilename(file.getPath()) , // file name GENERIC_WRITE, // access mode 0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but... - NULL, // Unused + nullptr, // Unused OPEN_ALWAYS , // how to create FILE_ATTRIBUTE_NORMAL , // file attributes - NULL // Unsupported + nullptr // Unsupported ); #endif @@ -68,7 +68,7 @@ void FileOutputStream::write(unsigned int b) &value, // data buffer 1, // number of bytes to write &numberOfBytesWritten, // number of bytes written - NULL // overlapped buffer + nullptr // overlapped buffer ); if( result == 0 ) @@ -93,7 +93,7 @@ void FileOutputStream::write(byteArray b) &b.data, // data buffer b.length, // number of bytes to write &numberOfBytesWritten, // number of bytes written - NULL // overlapped buffer + nullptr // overlapped buffer ); if( result == 0 ) @@ -123,7 +123,7 @@ void FileOutputStream::write(byteArray b, unsigned int offset, unsigned int leng &b[offset], // data buffer length, // number of bytes to write &numberOfBytesWritten, // number of bytes written - NULL // overlapped buffer + nullptr // overlapped buffer ); if( result == 0 ) diff --git a/Minecraft.World/FireChargeItem.cpp b/Minecraft.World/FireChargeItem.cpp index 7a865ff5e..d3499cdc6 100644 --- a/Minecraft.World/FireChargeItem.cpp +++ b/Minecraft.World/FireChargeItem.cpp @@ -10,7 +10,7 @@ FireChargeItem::FireChargeItem(int id) : Item(id) { - m_dragonFireballIcon = NULL; + m_dragonFireballIcon = nullptr; } bool FireChargeItem::useOn(shared_ptr instance, shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) diff --git a/Minecraft.World/FireTile.cpp b/Minecraft.World/FireTile.cpp index dfb4b961c..49f859b51 100644 --- a/Minecraft.World/FireTile.cpp +++ b/Minecraft.World/FireTile.cpp @@ -24,7 +24,7 @@ FireTile::FireTile(int id) : Tile(id, Material::fire,isSolidRender()) burnOdds = new int[256]; memset( burnOdds,0,sizeof(int)*256); - icons = NULL; + icons = nullptr; setTicking(true); } @@ -64,7 +64,7 @@ void FireTile::setFlammable(int id, int flame, int burn) AABB *FireTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool FireTile::blocksLight() diff --git a/Minecraft.World/Fireball.cpp b/Minecraft.World/Fireball.cpp index 2bd740ad3..b520f436e 100644 --- a/Minecraft.World/Fireball.cpp +++ b/Minecraft.World/Fireball.cpp @@ -127,10 +127,10 @@ Fireball::Fireball(Level *level, shared_ptr mob, double xa, double void Fireball::tick() { // 4J-PB - Moved forward from 1.2.3 - //if (!level->isClientSide && (owner == NULL || owner->removed)) + //if (!level->isClientSide && (owner == nullptr || owner->removed)) if (!level->isClientSide) { - if((owner != NULL && owner->removed) || !level->hasChunkAt(static_cast(x), static_cast(y), static_cast(z))) + if((owner != nullptr && owner->removed) || !level->hasChunkAt(static_cast(x), static_cast(y), static_cast(z))) { app.DebugPrintf("Fireball removed - owner is null or removed is true for owner\n"); remove(); @@ -193,7 +193,7 @@ void Fireball::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != NULL) + if (res != nullptr) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -207,7 +207,7 @@ void Fireball::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != NULL) + if (p != nullptr) { double dd = from->distanceTo(p->pos); if (dd < nearest || nearest == 0) @@ -220,14 +220,14 @@ void Fireball::tick() } - if (hitEntity != NULL) + if (hitEntity != nullptr) { delete res; res = new HitResult(hitEntity); } MemSect(0); - if (res != NULL) + if (res != nullptr) { onHit(res); } @@ -343,10 +343,10 @@ bool Fireball::hurt(DamageSource *source, float damage) if (isInvulnerable()) return false; markHurt(); - if (source->getEntity() != NULL) + if (source->getEntity() != nullptr) { Vec3 *lookAngle = source->getEntity()->getLookAngle(); - if (lookAngle != NULL) + if (lookAngle != nullptr) { xd = lookAngle->x; yd = lookAngle->y; diff --git a/Minecraft.World/FireworksChargeItem.cpp b/Minecraft.World/FireworksChargeItem.cpp index d027c5542..8b12c98c4 100644 --- a/Minecraft.World/FireworksChargeItem.cpp +++ b/Minecraft.World/FireworksChargeItem.cpp @@ -21,7 +21,7 @@ int FireworksChargeItem::getColor(shared_ptr item, int spriteLayer if (spriteLayer == 1) { Tag *colorTag = getExplosionTagField(item, FireworksItem::TAG_E_COLORS); - if (colorTag != NULL) + if (colorTag != nullptr) { IntArrayTag *colors = static_cast(colorTag); if (colors->data.length == 1) @@ -58,12 +58,12 @@ Tag *FireworksChargeItem::getExplosionTagField(shared_ptr instance if (instance->hasTag()) { CompoundTag *explosion = instance->getTag()->getCompound(FireworksItem::TAG_EXPLOSION); - if (explosion != NULL) + if (explosion != nullptr) { return explosion->get(field); } } - return NULL; + return nullptr; } void FireworksChargeItem::appendHoverText(shared_ptr itemInstance, shared_ptr player, vector *lines, bool advanced) @@ -71,7 +71,7 @@ void FireworksChargeItem::appendHoverText(shared_ptr itemInstance, if (itemInstance->hasTag()) { CompoundTag *explosion = itemInstance->getTag()->getCompound(FireworksItem::TAG_EXPLOSION); - if (explosion != NULL) + if (explosion != nullptr) { appendHoverText(explosion, lines); } diff --git a/Minecraft.World/FireworksItem.cpp b/Minecraft.World/FireworksItem.cpp index f81b45889..c872bc407 100644 --- a/Minecraft.World/FireworksItem.cpp +++ b/Minecraft.World/FireworksItem.cpp @@ -46,7 +46,7 @@ void FireworksItem::appendHoverText(shared_ptr itemInstance, share return; } CompoundTag *fireTag = itemInstance->getTag()->getCompound(TAG_FIREWORKS); - if (fireTag == NULL) + if (fireTag == nullptr) { return; } @@ -56,7 +56,7 @@ void FireworksItem::appendHoverText(shared_ptr itemInstance, share } ListTag *explosions = (ListTag *) fireTag->getList(TAG_EXPLOSIONS); - if (explosions != NULL && explosions->size() > 0) + if (explosions != nullptr && explosions->size() > 0) { for (int i = 0; i < explosions->size(); i++) diff --git a/Minecraft.World/FireworksMenu.cpp b/Minecraft.World/FireworksMenu.cpp index 68c9e0f2b..92474e2de 100644 --- a/Minecraft.World/FireworksMenu.cpp +++ b/Minecraft.World/FireworksMenu.cpp @@ -61,7 +61,7 @@ void FireworksMenu::removed(shared_ptr player) for (int i = 0; i < 9; i++) { shared_ptr item = craftSlots->removeItemNoUpdate(i); - if (item != NULL) + if (item != nullptr) { player->drop(item); } @@ -77,7 +77,7 @@ shared_ptr FireworksMenu::quickMoveStack(shared_ptr player { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -145,6 +145,6 @@ bool FireworksMenu::canTakeItemForPickAll(shared_ptr carried, Slot bool FireworksMenu::isValidIngredient(shared_ptr item, int slotId) { - if(item == NULL || slotId == RESULT_SLOT) return true; + if(item == nullptr || slotId == RESULT_SLOT) return true; return FireworksRecipe::isValidIngredient(item, m_canMakeFireworks, m_canMakeCharge, m_canMakeFade); } \ No newline at end of file diff --git a/Minecraft.World/FireworksRecipe.cpp b/Minecraft.World/FireworksRecipe.cpp index 7bf631049..6c6d3d259 100644 --- a/Minecraft.World/FireworksRecipe.cpp +++ b/Minecraft.World/FireworksRecipe.cpp @@ -3,7 +3,7 @@ #include "FireworksRecipe.h" DWORD FireworksRecipe::tlsIdx = 0; -FireworksRecipe::ThreadStorage *FireworksRecipe::tlsDefault = NULL; +FireworksRecipe::ThreadStorage *FireworksRecipe::tlsDefault = nullptr; FireworksRecipe::ThreadStorage::ThreadStorage() { @@ -13,7 +13,7 @@ FireworksRecipe::ThreadStorage::ThreadStorage() void FireworksRecipe::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == NULL ) + if(tlsDefault == nullptr ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -59,7 +59,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == NULL) continue; + if (item == nullptr) continue; if (item->id == Item::gunpowder_Id) { @@ -134,7 +134,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == NULL || item->id != Item::fireworksCharge_Id) continue; + if (item == nullptr || item->id != Item::fireworksCharge_Id) continue; if (item->hasTag() && item->getTag()->contains(FireworksItem::TAG_EXPLOSION)) { @@ -165,7 +165,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == NULL) continue; + if (item == nullptr) continue; if (item->id == Item::dye_powder_Id) { @@ -195,10 +195,10 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l } else if (item->id == Item::skull_Id) { - type = FireworksItem::TYPE_CREEPER; + type = FireworksItem::TYPE_CREEPER; } } - intArray colorArray(colors.size()); + intArray colorArray(static_cast(colors.size())); for (int i = 0; i < colorArray.length; i++) { colorArray[i] = colors.at(i); @@ -221,7 +221,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == NULL) continue; + if (item == nullptr) continue; if (item->id == Item::dye_powder_Id) { @@ -230,18 +230,18 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l else if (item->id == Item::fireworksCharge_Id) { resultItem = item->copy(); - resultItem->count = 1; + resultItem->count = 1; } } - intArray colorArray(colors.size()); + intArray colorArray(static_cast(colors.size())); for (int i = 0; i < colorArray.length; i++) { colorArray[i] = colors.at(i); } - if (resultItem != NULL && resultItem->hasTag()) + if (resultItem != nullptr && resultItem->hasTag()) { CompoundTag *compound = resultItem->getTag()->getCompound(FireworksItem::TAG_EXPLOSION); - if (compound == NULL) + if (compound == nullptr) { delete colorArray.data; @@ -301,7 +301,7 @@ void FireworksRecipe::updatePossibleRecipes(shared_ptr craftS for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) { shared_ptr item = craftSlots->getItem(slot); - if (item == NULL) continue; + if (item == nullptr) continue; if (item->id == Item::gunpowder_Id) { diff --git a/Minecraft.World/FireworksRocketEntity.cpp b/Minecraft.World/FireworksRocketEntity.cpp index bd7410b29..d3897e4f0 100644 --- a/Minecraft.World/FireworksRocketEntity.cpp +++ b/Minecraft.World/FireworksRocketEntity.cpp @@ -15,7 +15,7 @@ FireworksRocketEntity::FireworksRocketEntity(Level *level) : Entity(level) void FireworksRocketEntity::defineSynchedData() { - entityData->defineNULL(DATA_ID_FIREWORKS_ITEM, NULL); + entityData->defineNULL(DATA_ID_FIREWORKS_ITEM, nullptr); } bool FireworksRocketEntity::shouldRenderAtSqrDistance(double distance) @@ -35,13 +35,13 @@ FireworksRocketEntity::FireworksRocketEntity(Level *level, double x, double y, d heightOffset = 0; int flightCount = 1; - if (sourceItem != NULL && sourceItem->hasTag()) + if (sourceItem != nullptr && sourceItem->hasTag()) { entityData->set(DATA_ID_FIREWORKS_ITEM, sourceItem); CompoundTag *tag = sourceItem->getTag(); CompoundTag *compound = tag->getCompound(FireworksItem::TAG_FIREWORKS); - if (compound != NULL) + if (compound != nullptr) { flightCount += compound->getByte(FireworksItem::TAG_FLIGHT); } @@ -120,8 +120,8 @@ void FireworksRocketEntity::handleEntityEvent(byte eventId) if (eventId == EntityEvent::FIREWORKS_EXPLODE && level->isClientSide) { shared_ptr sourceItem = entityData->getItemInstance(DATA_ID_FIREWORKS_ITEM); - CompoundTag *tag = NULL; - if (sourceItem != NULL && sourceItem->hasTag()) + CompoundTag *tag = nullptr; + if (sourceItem != nullptr && sourceItem->hasTag()) { tag = sourceItem->getTag()->getCompound(FireworksItem::TAG_FIREWORKS); } @@ -135,7 +135,7 @@ void FireworksRocketEntity::addAdditonalSaveData(CompoundTag *tag) tag->putInt(L"Life", life); tag->putInt(L"LifeTime", lifetime); shared_ptr itemInstance = entityData->getItemInstance(DATA_ID_FIREWORKS_ITEM); - if (itemInstance != NULL) + if (itemInstance != nullptr) { CompoundTag *itemTag = new CompoundTag(); itemInstance->save(itemTag); @@ -150,10 +150,10 @@ void FireworksRocketEntity::readAdditionalSaveData(CompoundTag *tag) lifetime = tag->getInt(L"LifeTime"); CompoundTag *itemTag = tag->getCompound(L"FireworksItem"); - if (itemTag != NULL) + if (itemTag != nullptr) { shared_ptr fromTag = ItemInstance::fromTag(itemTag); - if (fromTag != NULL) + if (fromTag != nullptr) { entityData->set(DATA_ID_FIREWORKS_ITEM, fromTag); } diff --git a/Minecraft.World/FishingHook.cpp b/Minecraft.World/FishingHook.cpp index 51f37c97d..e567e87b9 100644 --- a/Minecraft.World/FishingHook.cpp +++ b/Minecraft.World/FishingHook.cpp @@ -173,14 +173,14 @@ void FishingHook::tick() if (!level->isClientSide) { shared_ptr selectedItem = owner->getSelectedItem(); - if (owner->removed || !owner->isAlive() || selectedItem == NULL || selectedItem->getItem() != Item::fishingRod || distanceToSqr(owner) > 32 * 32) + if (owner->removed || !owner->isAlive() || selectedItem == nullptr || selectedItem->getItem() != Item::fishingRod || distanceToSqr(owner) > 32 * 32) { remove(); owner->fishing = nullptr; return; } - if (hookedIn != NULL) + if (hookedIn != nullptr) { if (hookedIn->removed) hookedIn = nullptr; else @@ -226,7 +226,7 @@ void FishingHook::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != NULL) + if (res != nullptr) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -241,7 +241,7 @@ void FishingHook::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != NULL) + if (p != nullptr) { double dd = from->distanceTo(p->pos); if (dd < nearest || nearest == 0) @@ -253,15 +253,15 @@ void FishingHook::tick() } } - if (hitEntity != NULL) + if (hitEntity != nullptr) { delete res; res = new HitResult(hitEntity); } - if (res != NULL) + if (res != nullptr) { - if (res->entity != NULL) + if (res->entity != nullptr) { // 4J Stu Move fix for : fix for #48587 - CRASH: Code: Gameplay: Hitting another player with the fishing bobber crashes the game. [Fishing pole, line] // Incorrect dynamic_pointer_cast used around the shared_from_this() @@ -405,7 +405,7 @@ int FishingHook::retrieve() if (level->isClientSide) return 0; int dmg = 0; - if (hookedIn != NULL) + if (hookedIn != nullptr) { double xa = owner->x - x; double ya = owner->y - y; @@ -445,5 +445,5 @@ int FishingHook::retrieve() void FishingHook::remove() { Entity::remove(); - if (owner != NULL) owner->fishing = nullptr; + if (owner != nullptr) owner->fishing = nullptr; } \ No newline at end of file diff --git a/Minecraft.World/FishingRodItem.cpp b/Minecraft.World/FishingRodItem.cpp index 883eb2ded..70becf39e 100644 --- a/Minecraft.World/FishingRodItem.cpp +++ b/Minecraft.World/FishingRodItem.cpp @@ -17,7 +17,7 @@ FishingRodItem::FishingRodItem(int id) : Item(id) { setMaxDamage(64); setMaxStackSize(1); - emptyIcon = NULL; + emptyIcon = nullptr; } bool FishingRodItem::isHandEquipped() @@ -32,7 +32,7 @@ bool FishingRodItem::isMirroredArt() shared_ptr FishingRodItem::use(shared_ptr instance, Level *level, shared_ptr player) { - if (player->fishing != NULL) + if (player->fishing != nullptr) { int dmg = player->fishing->retrieve(); instance->hurtAndBreak(dmg, player); diff --git a/Minecraft.World/FixedBiomeSource.cpp b/Minecraft.World/FixedBiomeSource.cpp index 257ec3db9..2657bdb44 100644 --- a/Minecraft.World/FixedBiomeSource.cpp +++ b/Minecraft.World/FixedBiomeSource.cpp @@ -26,9 +26,9 @@ float FixedBiomeSource::getTemperature(int x, int z) void FixedBiomeSource::getTemperatureBlock(floatArray& temperatures, int x, int z, int w, int h) const { - if (temperatures.data == NULL || temperatures.length < w * h) + if (temperatures.data == nullptr || temperatures.length < w * h) { - if(temperatures.data != NULL) delete [] temperatures.data; + if(temperatures.data != nullptr) delete [] temperatures.data; temperatures = floatArray(w * h); } @@ -52,9 +52,9 @@ void FixedBiomeSource::getTemperatureBlock(doubleArray& temperatures, int x, int void FixedBiomeSource::getDownfallBlock(floatArray &downfalls, int x, int z, int w, int h) const { - if (downfalls.data == NULL || downfalls.length < w * h) + if (downfalls.data == nullptr || downfalls.length < w * h) { - if(downfalls.data != NULL) delete [] downfalls.data; + if(downfalls.data != nullptr) delete [] downfalls.data; downfalls = floatArray(w * h); } Arrays::fill(downfalls, 0, w * h, downfall); @@ -74,9 +74,9 @@ float FixedBiomeSource::getDownfall(int x, int z) const void FixedBiomeSource::getDownfallBlock(doubleArray downfalls, int x, int z, int w, int h) { - if (downfalls.data == NULL || downfalls.length < w * h) + if (downfalls.data == nullptr || downfalls.length < w * h) { - if(downfalls.data != NULL) delete [] downfalls.data; + if(downfalls.data != nullptr) delete [] downfalls.data; downfalls = doubleArray(w * h); } Arrays::fill(downfalls, 0, w * h, (double) downfall); @@ -129,7 +129,7 @@ TilePos *FixedBiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random return new TilePos(x - r + random->nextInt(r * 2 + 1), 0, z - r + random->nextInt(r * 2 + 1)); } - return NULL; + return nullptr; } TilePos *FixedBiomeSource::findBiome(int x, int z, int r, vector allowed, Random *random) @@ -139,7 +139,7 @@ TilePos *FixedBiomeSource::findBiome(int x, int z, int r, vector allowe return new TilePos(x - r + random->nextInt(r * 2 + 1), 0, z - r + random->nextInt(r * 2 + 1)); } - return NULL; + return nullptr; } bool FixedBiomeSource::containsOnly(int x, int z, int r, Biome *allowed) diff --git a/Minecraft.World/FlatGeneratorInfo.cpp b/Minecraft.World/FlatGeneratorInfo.cpp index dfd4cb667..3dd54453d 100644 --- a/Minecraft.World/FlatGeneratorInfo.cpp +++ b/Minecraft.World/FlatGeneratorInfo.cpp @@ -114,7 +114,7 @@ wstring FlatGeneratorInfo::toString() FlatLayerInfo *FlatGeneratorInfo::getLayerFromString(const wstring &input, int yOffset) { - return NULL; + return nullptr; #if 0 std::vector parts = stringSplit(input, L'x'); @@ -135,7 +135,7 @@ FlatLayerInfo *FlatGeneratorInfo::getLayerFromString(const wstring &input, int y id = _fromString(parts[0]); if (parts.size() > 1) data = _from_String(parts[1]); - if (Tile::tiles[id] == NULL) + if (Tile::tiles[id] == nullptr) { id = 0; data = 0; @@ -151,7 +151,7 @@ FlatLayerInfo *FlatGeneratorInfo::getLayerFromString(const wstring &input, int y vector *FlatGeneratorInfo::getLayersFromString(const wstring &input) { - if (input.empty()) return NULL; + if (input.empty()) return nullptr; vector *result = new vector(); std::vector depths = stringSplit(input, L','); @@ -161,7 +161,7 @@ vector *FlatGeneratorInfo::getLayersFromString(const wstring &i for(auto& depth : depths) { FlatLayerInfo *layer = getLayerFromString(depth, yOffset); - if (layer == NULL) return NULL; + if (layer == nullptr) return nullptr; result->push_back(layer); yOffset += layer->getHeight(); } @@ -184,7 +184,7 @@ FlatGeneratorInfo *FlatGeneratorInfo::fromValue(const wstring &input) int index = parts.size() == 1 ? 0 : 1; vector *layers = getLayersFromString(parts[index++]); - if (layers == NULL || layers->isEmpty()) + if (layers == nullptr || layers->isEmpty()) { delete layers; return getDefault(); diff --git a/Minecraft.World/FlatLevelSource.cpp b/Minecraft.World/FlatLevelSource.cpp index 4713f43ef..ebc1d36c5 100644 --- a/Minecraft.World/FlatLevelSource.cpp +++ b/Minecraft.World/FlatLevelSource.cpp @@ -140,16 +140,16 @@ wstring FlatLevelSource::gatherStats() vector *FlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == nullptr) { - return NULL; + return nullptr; } return biome->getMobs(mobCategory); } TilePos *FlatLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return NULL; + return nullptr; } void FlatLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) diff --git a/Minecraft.World/FleeSunGoal.cpp b/Minecraft.World/FleeSunGoal.cpp index 353d1625b..bf1c04ad4 100644 --- a/Minecraft.World/FleeSunGoal.cpp +++ b/Minecraft.World/FleeSunGoal.cpp @@ -21,7 +21,7 @@ bool FleeSunGoal::canUse() if (!level->canSeeSky(Mth::floor(mob->x), static_cast(mob->bb->y0), Mth::floor(mob->z))) return false; Vec3 *pos = getHidePos(); - if (pos == NULL) return false; + if (pos == nullptr) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; @@ -48,5 +48,5 @@ Vec3 *FleeSunGoal::getHidePos() int zt = Mth::floor(mob->z + random->nextInt(20) - 10); if (!level->canSeeSky(xt, yt, zt) && mob->getWalkTargetValue(xt, yt, zt) < 0) return Vec3::newTemp(xt, yt, zt); } - return NULL; + return nullptr; } \ No newline at end of file diff --git a/Minecraft.World/FlowerFeature.cpp b/Minecraft.World/FlowerFeature.cpp index f24d61bfa..c5cd68c62 100644 --- a/Minecraft.World/FlowerFeature.cpp +++ b/Minecraft.World/FlowerFeature.cpp @@ -12,7 +12,7 @@ FlowerFeature::FlowerFeature(int tile) bool FlowerFeature::place(Level *level, Random *random, int x, int y, int z) { // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - 8, y - 4, z - 8, x + 8, y + 4, z + 8); diff --git a/Minecraft.World/FlowerPotTile.cpp b/Minecraft.World/FlowerPotTile.cpp index 4cdd529c4..57aa8b6d3 100644 --- a/Minecraft.World/FlowerPotTile.cpp +++ b/Minecraft.World/FlowerPotTile.cpp @@ -36,7 +36,7 @@ bool FlowerPotTile::isCubeShaped() bool FlowerPotTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly) { shared_ptr item = player->inventory->getSelected(); - if (item == NULL) return false; + if (item == nullptr) return false; if (level->getData(x, y, z) != 0) return false; int type = getTypeFromItem(item); @@ -62,7 +62,7 @@ int FlowerPotTile::cloneTileId(Level *level, int x, int y, int z) { shared_ptr item = getItemFromType(level->getData(x, y, z)); - if (item == NULL) + if (item == nullptr) { return Item::flowerPot_Id; } @@ -76,7 +76,7 @@ int FlowerPotTile::cloneTileData(Level *level, int x, int y, int z) { shared_ptr item = getItemFromType(level->getData(x, y, z)); - if (item == NULL) + if (item == nullptr) { return Item::flowerPot_Id; } @@ -113,7 +113,7 @@ void FlowerPotTile::spawnResources(Level *level, int x, int y, int z, int data, if (data > 0) { shared_ptr item = getItemFromType(data); - if (item != NULL) popResource(level, x, y, z, item); + if (item != nullptr) popResource(level, x, y, z, item); } } diff --git a/Minecraft.World/FollowOwnerGoal.cpp b/Minecraft.World/FollowOwnerGoal.cpp index 8565d7827..89ec46437 100644 --- a/Minecraft.World/FollowOwnerGoal.cpp +++ b/Minecraft.World/FollowOwnerGoal.cpp @@ -25,7 +25,7 @@ FollowOwnerGoal::FollowOwnerGoal(TamableAnimal *tamable, double speedModifier, f bool FollowOwnerGoal::canUse() { shared_ptr owner = dynamic_pointer_cast( tamable->getOwner() ); - if (owner == NULL) return false; + if (owner == nullptr) return false; if (tamable->isSitting()) return false; if (tamable->distanceToSqr(owner) < startDistance * startDistance) return false; this->owner = weak_ptr(owner); @@ -34,7 +34,7 @@ bool FollowOwnerGoal::canUse() bool FollowOwnerGoal::canContinueToUse() { - return owner.lock() != NULL && !navigation->isDone() && tamable->distanceToSqr(owner.lock()) > stopDistance * stopDistance && !tamable->isSitting(); + return owner.lock() != nullptr && !navigation->isDone() && tamable->distanceToSqr(owner.lock()) > stopDistance * stopDistance && !tamable->isSitting(); } void FollowOwnerGoal::start() diff --git a/Minecraft.World/FollowParentGoal.cpp b/Minecraft.World/FollowParentGoal.cpp index 8983590ab..d8f3bad9e 100644 --- a/Minecraft.World/FollowParentGoal.cpp +++ b/Minecraft.World/FollowParentGoal.cpp @@ -33,7 +33,7 @@ bool FollowParentGoal::canUse() } delete parents; - if (closest == NULL) return false; + if (closest == nullptr) return false; if (closestDistSqr < 3 * 3) return false; parent = weak_ptr(closest); return true; @@ -41,7 +41,7 @@ bool FollowParentGoal::canUse() bool FollowParentGoal::canContinueToUse() { - if (parent.lock() == NULL || !parent.lock()->isAlive()) return false; + if (parent.lock() == nullptr || !parent.lock()->isAlive()) return false; double distSqr = animal->distanceToSqr(parent.lock()); if (distSqr < 3 * 3 || distSqr > 16 * 16) return false; return true; diff --git a/Minecraft.World/FurnaceMenu.cpp b/Minecraft.World/FurnaceMenu.cpp index f67d63886..2bc2d2bd3 100644 --- a/Minecraft.World/FurnaceMenu.cpp +++ b/Minecraft.World/FurnaceMenu.cpp @@ -86,7 +86,7 @@ shared_ptr FurnaceMenu::quickMoveStack(shared_ptr player, bool charcoalUsed = furnace->wasCharcoalUsed(); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -112,7 +112,7 @@ shared_ptr FurnaceMenu::quickMoveStack(shared_ptr player, return nullptr; } } - else if (FurnaceRecipes::getInstance()->getResult(stack->getItem()->id) != NULL) + else if (FurnaceRecipes::getInstance()->getResult(stack->getItem()->id) != nullptr) { if (!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT + 1, false)) { diff --git a/Minecraft.World/FurnaceRecipes.cpp b/Minecraft.World/FurnaceRecipes.cpp index bed4e1b62..f0a4c770e 100644 --- a/Minecraft.World/FurnaceRecipes.cpp +++ b/Minecraft.World/FurnaceRecipes.cpp @@ -3,7 +3,7 @@ #include "Tile.h" #include "FurnaceRecipes.h" -FurnaceRecipes *FurnaceRecipes::instance = NULL; +FurnaceRecipes *FurnaceRecipes::instance = nullptr; void FurnaceRecipes::staticCtor() { @@ -63,7 +63,7 @@ ItemInstance *FurnaceRecipes::getResult(int itemId) { return it->second; } - return NULL; + return nullptr; } unordered_map *FurnaceRecipes::getRecipies() diff --git a/Minecraft.World/FurnaceTile.cpp b/Minecraft.World/FurnaceTile.cpp index 1393a325b..2d8fc9914 100644 --- a/Minecraft.World/FurnaceTile.cpp +++ b/Minecraft.World/FurnaceTile.cpp @@ -17,8 +17,8 @@ FurnaceTile::FurnaceTile(int id, bool lit) : BaseEntityTile(id, Material::stone) random = new Random(); this->lit = lit; - iconTop = NULL; - iconFront = NULL; + iconTop = nullptr; + iconFront = nullptr; } int FurnaceTile::getResource(int data, Random *random, int playerBonusLevel) @@ -117,7 +117,7 @@ bool FurnaceTile::use(Level *level, int x, int y, int z, shared_ptr play return true; } shared_ptr furnace = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (furnace != NULL ) player->openFurnace(furnace); + if (furnace != nullptr ) player->openFurnace(furnace); return true; } @@ -132,7 +132,7 @@ void FurnaceTile::setLit(bool lit, Level *level, int x, int y, int z) noDrop = false; level->setData(x, y, z, data, Tile::UPDATE_CLIENTS); - if( te != NULL ) + if( te != nullptr ) { te->clearRemoved(); level->setTileEntity(x, y, z, te); @@ -164,12 +164,12 @@ void FurnaceTile::onRemove(Level *level, int x, int y, int z, int id, int data) if (!noDrop) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if( container != NULL ) + if( container != nullptr ) { for (unsigned int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != NULL) + if (item != nullptr) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; diff --git a/Minecraft.World/FurnaceTileEntity.cpp b/Minecraft.World/FurnaceTileEntity.cpp index 70190f4ee..461670db2 100644 --- a/Minecraft.World/FurnaceTileEntity.cpp +++ b/Minecraft.World/FurnaceTileEntity.cpp @@ -53,7 +53,7 @@ shared_ptr FurnaceTileEntity::removeItem(unsigned int slot, int co { m_charcoalUsed = false; - if (items[slot] != NULL) + if (items[slot] != nullptr) { if (items[slot]->count <= count) { @@ -79,7 +79,7 @@ shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) { m_charcoalUsed = false; - if (items[slot] != NULL) + if (items[slot] != nullptr) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -92,7 +92,7 @@ shared_ptr FurnaceTileEntity::removeItemNoUpdate(int slot) void FurnaceTileEntity::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); } @@ -146,7 +146,7 @@ void FurnaceTileEntity::save(CompoundTag *base) for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i)); @@ -194,7 +194,7 @@ void FurnaceTileEntity::tick() litTime--; } - if ( level != NULL && !level->isClientSide) + if ( level != nullptr && !level->isClientSide) { if (litTime == 0 && canBurn()) { @@ -202,7 +202,7 @@ void FurnaceTileEntity::tick() if (litTime > 0) { changed = true; - if (items[SLOT_FUEL] != NULL) + if (items[SLOT_FUEL] != nullptr) { // 4J Added: Keep track of whether charcoal was used in production of current stack. if ( items[SLOT_FUEL]->getItem()->id == Item::coal_Id @@ -215,7 +215,7 @@ void FurnaceTileEntity::tick() if (items[SLOT_FUEL]->count == 0) { Item *remaining = items[SLOT_FUEL]->getItem()->getCraftingRemainingItem(); - items[SLOT_FUEL] = remaining != NULL ? shared_ptr(new ItemInstance(remaining)) : nullptr; + items[SLOT_FUEL] = remaining != nullptr ? shared_ptr(new ItemInstance(remaining)) : nullptr; } } } @@ -249,10 +249,10 @@ void FurnaceTileEntity::tick() bool FurnaceTileEntity::canBurn() { - if (items[SLOT_INPUT] == NULL) return false; + if (items[SLOT_INPUT] == nullptr) return false; const ItemInstance *burnResult = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id); - if (burnResult == NULL) return false; - if (items[SLOT_RESULT] == NULL) return true; + if (burnResult == nullptr) return false; + if (items[SLOT_RESULT] == nullptr) return true; if (!items[SLOT_RESULT]->sameItem_not_shared(burnResult)) return false; if (items[SLOT_RESULT]->count < getMaxStackSize() && items[SLOT_RESULT]->count < items[SLOT_RESULT]->getMaxStackSize()) return true; if (items[SLOT_RESULT]->count < burnResult->getMaxStackSize()) return true; @@ -265,7 +265,7 @@ void FurnaceTileEntity::burn() if (!canBurn()) return; const ItemInstance *result = FurnaceRecipes::getInstance()->getResult(items[SLOT_INPUT]->getItem()->id); - if (items[SLOT_RESULT] == NULL) items[SLOT_RESULT] = result->copy(); + if (items[SLOT_RESULT] == nullptr) items[SLOT_RESULT] = result->copy(); else if (items[SLOT_RESULT]->id == result->id) items[SLOT_RESULT]->count++; items[SLOT_INPUT]->count--; @@ -275,12 +275,12 @@ void FurnaceTileEntity::burn() int FurnaceTileEntity::getBurnDuration(shared_ptr itemInstance) { - if (itemInstance == NULL) return 0; + if (itemInstance == nullptr) return 0; int id = itemInstance->getItem()->id; Item *item = itemInstance->getItem(); - if (id < 256 && Tile::tiles[id] != NULL) + if (id < 256 && Tile::tiles[id] != nullptr) { Tile *tile = Tile::tiles[id]; @@ -405,7 +405,7 @@ shared_ptr FurnaceTileEntity::clone() for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { result->items[i] = ItemInstance::clone(items[i]); } diff --git a/Minecraft.World/GameCommandPacket.cpp b/Minecraft.World/GameCommandPacket.cpp index 2f74778fc..17c5316af 100644 --- a/Minecraft.World/GameCommandPacket.cpp +++ b/Minecraft.World/GameCommandPacket.cpp @@ -15,7 +15,7 @@ GameCommandPacket::GameCommandPacket(EGameCommand command, byteArray data) this->data = data; length = 0; - if (data.data != NULL) + if (data.data != nullptr) { length = data.length; @@ -42,7 +42,7 @@ void GameCommandPacket::read(DataInputStream *dis) if (length > 0 && length < Short::MAX_VALUE) { - if(data.data != NULL) + if(data.data != nullptr) { delete [] data.data; } @@ -55,7 +55,7 @@ void GameCommandPacket::write(DataOutputStream *dos) { dos->writeInt(command); dos->writeShort(static_cast(length)); - if (data.data != NULL) + if (data.data != nullptr) { dos->write(data); } diff --git a/Minecraft.World/GameModeCommand.cpp b/Minecraft.World/GameModeCommand.cpp index f8c1ffb6f..6e4cd858a 100644 --- a/Minecraft.World/GameModeCommand.cpp +++ b/Minecraft.World/GameModeCommand.cpp @@ -37,7 +37,7 @@ void GameModeCommand::execute(shared_ptr source, byteArray comman GameType *GameModeCommand::getModeForString(shared_ptr source, const wstring &name) { - return NULL; + return nullptr; //if (name.equalsIgnoreCase(GameType.SURVIVAL.getName()) || name.equalsIgnoreCase("s")) { // return GameType.SURVIVAL; //} else if (name.equalsIgnoreCase(GameType.CREATIVE.getName()) || name.equalsIgnoreCase("c")) { diff --git a/Minecraft.World/GenericStats.cpp b/Minecraft.World/GenericStats.cpp index 1fa901513..d97c182ac 100644 --- a/Minecraft.World/GenericStats.cpp +++ b/Minecraft.World/GenericStats.cpp @@ -4,161 +4,161 @@ #include "GenericStats.h" -GenericStats *GenericStats::instance = NULL; +GenericStats *GenericStats::instance = nullptr; Stat* GenericStats::get_walkOneM() { - return NULL; + return nullptr; } Stat* GenericStats::get_swimOneM() { - return NULL; + return nullptr; } Stat* GenericStats::get_fallOneM() { - return NULL; + return nullptr; } Stat* GenericStats::get_climbOneM() { - return NULL; + return nullptr; } Stat* GenericStats::get_minecartOneM() { - return NULL; + return nullptr; } Stat* GenericStats::get_boatOneM() { - return NULL; + return nullptr; } Stat* GenericStats::get_pigOneM() { - return NULL; + return nullptr; } Stat* GenericStats::get_portalsCreated() { - return NULL; + return nullptr; } Stat* GenericStats::get_cowsMilked() { - return NULL; + return nullptr; } Stat* GenericStats::get_netherLavaCollected() { - return NULL; + return nullptr; } Stat* GenericStats::get_killMob() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsZombie() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsSkeleton() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsCreeper() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsSpider() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsSpiderJockey() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsZombiePigman() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsSlime() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsGhast() { - return NULL; + return nullptr; } Stat* GenericStats::get_killsNetherZombiePigman() { - return NULL; + return nullptr; } Stat* GenericStats::get_breedEntity(eINSTANCEOF entityId) { - return NULL; + return nullptr; } Stat* GenericStats::get_tamedEntity(eINSTANCEOF entityId) { - return NULL; + return nullptr; } Stat* GenericStats::get_curedEntity(eINSTANCEOF entityId) { - return NULL; + return nullptr; } Stat* GenericStats::get_craftedEntity(eINSTANCEOF entityId) { - return NULL; + return nullptr; } Stat* GenericStats::get_shearedEntity(eINSTANCEOF entityId) { - return NULL; + return nullptr; } Stat* GenericStats::get_totalBlocksMined() { - return NULL; + return nullptr; } Stat* GenericStats::get_timePlayed() { - return NULL; + return nullptr; } Stat* GenericStats::get_blocksPlaced(int blockId) { - return NULL; + return nullptr; } Stat* GenericStats::get_blocksMined(int blockId) { - return NULL; + return nullptr; } Stat* GenericStats::get_itemsCollected(int itemId, int itemAux) { - return NULL; + return nullptr; } Stat* GenericStats::get_itemsCrafted(int itemId) { - return NULL; + return nullptr; } Stat* GenericStats::get_itemsSmelted(int itemId) @@ -168,37 +168,37 @@ Stat* GenericStats::get_itemsSmelted(int itemId) Stat* GenericStats::get_itemsUsed(int itemId) { - return NULL; + return nullptr; } Stat *GenericStats::get_itemsBought(int itemId) { - return NULL; + return nullptr; } Stat* GenericStats::get_killsEnderdragon() { - return NULL; + return nullptr; } Stat* GenericStats::get_completeTheEnd() { - return NULL; + return nullptr; } Stat* GenericStats::get_changedDimension(int from, int to) { - return NULL; + return nullptr; } Stat* GenericStats::get_enteredBiome(int biomeId) { - return NULL; + return nullptr; } Stat* GenericStats::get_achievement(eAward achievementId) { - return NULL; + return nullptr; } Stat* GenericStats::openInventory() @@ -286,7 +286,7 @@ Stat* GenericStats::snipeSkeleton() #ifndef _XBOX return instance->get_achievement( eAward_snipeSkeleton ); #else - return NULL; + return nullptr; #endif } @@ -295,7 +295,7 @@ Stat* GenericStats::diamonds() #ifndef _XBOX return instance->get_achievement( eAward_diamonds ); #else - return NULL; + return nullptr; #endif } @@ -304,7 +304,7 @@ Stat* GenericStats::ghast() #ifndef _XBOX return instance->get_achievement( eAward_ghast ); #else - return NULL; + return nullptr; #endif } @@ -313,7 +313,7 @@ Stat* GenericStats::blazeRod() #ifndef _XBOX return instance->get_achievement( eAward_blazeRod ); #else - return NULL; + return nullptr; #endif } @@ -322,7 +322,7 @@ Stat* GenericStats::potion() #ifndef _XBOX return instance->get_achievement( eAward_potion ); #else - return NULL; + return nullptr; #endif } @@ -331,7 +331,7 @@ Stat* GenericStats::theEnd() #ifndef _XBOX return instance->get_achievement( eAward_theEnd ); #else - return NULL; + return nullptr; #endif } @@ -340,7 +340,7 @@ Stat* GenericStats::winGame() #ifndef _XBOX return instance->get_achievement( eAward_winGame ); #else - return NULL; + return nullptr; #endif } @@ -349,7 +349,7 @@ Stat* GenericStats::enchantments() #ifndef _XBOX return instance->get_achievement( eAward_enchantments ); #else - return NULL; + return nullptr; #endif } @@ -358,7 +358,7 @@ Stat* GenericStats::overkill() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement( eAward_overkill ); #else - return NULL; + return nullptr; #endif } @@ -367,7 +367,7 @@ Stat* GenericStats::bookcase() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement( eAward_bookcase ); #else - return NULL; + return nullptr; #endif } @@ -426,7 +426,7 @@ Stat* GenericStats::adventuringTime() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_adventuringTime); #else - return NULL; + return nullptr; #endif } @@ -435,7 +435,7 @@ Stat* GenericStats::repopulation() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_repopulation); #else - return NULL; + return nullptr; #endif } @@ -444,7 +444,7 @@ Stat* GenericStats::porkChop() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_eatPorkChop); #else - return NULL; + return nullptr; #endif } @@ -453,7 +453,7 @@ Stat* GenericStats::diamondsToYou() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_diamondsToYou); #else - return NULL; + return nullptr; #endif } @@ -462,7 +462,7 @@ Stat* GenericStats::passingTheTime() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_play100Days); #else - return NULL; + return nullptr; #endif } @@ -471,7 +471,7 @@ Stat* GenericStats::archer() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_arrowKillCreeper); #else - return NULL; + return nullptr; #endif } @@ -480,7 +480,7 @@ Stat* GenericStats::theHaggler() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_theHaggler); #else - return NULL; + return nullptr; #endif } @@ -489,7 +489,7 @@ Stat* GenericStats::potPlanter() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_potPlanter); #else - return NULL; + return nullptr; #endif } @@ -498,7 +498,7 @@ Stat* GenericStats::itsASign() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_itsASign); #else - return NULL; + return nullptr; #endif } @@ -507,7 +507,7 @@ Stat* GenericStats::ironBelly() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_ironBelly); #else - return NULL; + return nullptr; #endif } @@ -516,7 +516,7 @@ Stat* GenericStats::haveAShearfulDay() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_haveAShearfulDay); #else - return NULL; + return nullptr; #endif } @@ -525,7 +525,7 @@ Stat* GenericStats::rainbowCollection() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_rainbowCollection); #else - return NULL; + return nullptr; #endif } @@ -534,7 +534,7 @@ Stat* GenericStats::stayinFrosty() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_stayinFrosty); #else - return NULL; + return nullptr; #endif } @@ -543,7 +543,7 @@ Stat* GenericStats::chestfulOfCobblestone() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_chestfulOfCobblestone); #else - return NULL; + return nullptr; #endif } @@ -552,7 +552,7 @@ Stat* GenericStats::renewableEnergy() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_renewableEnergy); #else - return NULL; + return nullptr; #endif } @@ -561,7 +561,7 @@ Stat* GenericStats::musicToMyEars() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_musicToMyEars); #else - return NULL; + return nullptr; #endif } @@ -570,7 +570,7 @@ Stat* GenericStats::bodyGuard() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_bodyGuard); #else - return NULL; + return nullptr; #endif } @@ -579,7 +579,7 @@ Stat* GenericStats::ironMan() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_ironMan); #else - return NULL; + return nullptr; #endif } @@ -588,7 +588,7 @@ Stat* GenericStats::zombieDoctor() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_zombieDoctor); #else - return NULL; + return nullptr; #endif } @@ -597,7 +597,7 @@ Stat* GenericStats::lionTamer() #ifdef _EXTENDED_ACHIEVEMENTS return instance->get_achievement(eAward_lionTamer); #else - return NULL; + return nullptr; #endif } @@ -835,7 +835,7 @@ byteArray GenericStats::param_itemsSmelted(int id, int aux, int count) byteArray GenericStats::param_itemsUsed(shared_ptr plr, shared_ptr itm) { - if ( (plr != NULL) && (itm != NULL) ) return instance->getParam_itemsUsed(plr, itm); + if ( (plr != nullptr) && (itm != nullptr) ) return instance->getParam_itemsUsed(plr, itm); else return instance->getParam_noArgs(); } @@ -846,7 +846,7 @@ byteArray GenericStats::param_itemsBought(int id, int aux, int count) byteArray GenericStats::param_mobKill(shared_ptr plr, shared_ptr mob, DamageSource *dmgSrc) { - if ( (plr != NULL) && (mob != NULL) ) return instance->getParam_mobKill(plr, mob, dmgSrc); + if ( (plr != nullptr) && (mob != nullptr) ) return instance->getParam_mobKill(plr, mob, dmgSrc); else return instance->getParam_noArgs(); } diff --git a/Minecraft.World/Ghast.cpp b/Minecraft.World/Ghast.cpp index dc70e9025..b016320f3 100644 --- a/Minecraft.World/Ghast.cpp +++ b/Minecraft.World/Ghast.cpp @@ -56,7 +56,7 @@ bool Ghast::hurt(DamageSource *source, float dmg) if (isInvulnerable()) return false; if (source->getMsgId() == ChatPacket::e_ChatDeathFireball) { - if ( (source->getEntity() != NULL) && source->getEntity()->instanceof(eTYPE_PLAYER) ) + if ( (source->getEntity() != nullptr) && source->getEntity()->instanceof(eTYPE_PLAYER) ) { // reflected fireball, kill the ghast FlyingMob::hurt(source, 1000); @@ -121,18 +121,18 @@ void Ghast::serverAiStep() } } - if (target != NULL && target->removed) target = nullptr; - if (target == NULL || retargetTime-- <= 0) + if (target != nullptr && target->removed) target = nullptr; + if (target == nullptr || retargetTime-- <= 0) { target = level->getNearestAttackablePlayer(shared_from_this(), 100); - if (target != NULL) + if (target != nullptr) { retargetTime = 20; } } double maxDist = 64.0f; - if (target != NULL && target->distanceToSqr(shared_from_this()) < maxDist * maxDist) + if (target != nullptr && target->distanceToSqr(shared_from_this()) < maxDist * maxDist) { double xdd = target->x - x; double ydd = (target->bb->y0 + target->bbHeight / 2) - (y + bbHeight / 2); diff --git a/Minecraft.World/GiveItemCommand.cpp b/Minecraft.World/GiveItemCommand.cpp index b3cbff4f1..e51332666 100644 --- a/Minecraft.World/GiveItemCommand.cpp +++ b/Minecraft.World/GiveItemCommand.cpp @@ -30,7 +30,7 @@ void GiveItemCommand::execute(shared_ptr source, byteArray comman bais.reset(); shared_ptr player = getPlayer(uid); - if(player != NULL && item > 0 && Item::items[item] != NULL) + if(player != nullptr && item > 0 && Item::items[item] != nullptr) { shared_ptr itemInstance = shared_ptr(new ItemInstance(item, amount, aux)); shared_ptr drop = player->drop(itemInstance); @@ -42,7 +42,7 @@ void GiveItemCommand::execute(shared_ptr source, byteArray comman shared_ptr GiveItemCommand::preparePacket(shared_ptr player, int item, int amount, int aux, const wstring &tag) { - if(player == NULL) return nullptr; + if(player == nullptr) return nullptr; ByteArrayOutputStream baos; DataOutputStream dos(&baos); diff --git a/Minecraft.World/GrassTile.cpp b/Minecraft.World/GrassTile.cpp index 68e7c2332..9be44d0eb 100644 --- a/Minecraft.World/GrassTile.cpp +++ b/Minecraft.World/GrassTile.cpp @@ -12,9 +12,9 @@ GrassTile::GrassTile(int id) : Tile(id, Material::grass) { - iconTop = NULL; - iconSnowSide = NULL; - iconSideOverlay = NULL; + iconTop = nullptr; + iconSnowSide = nullptr; + iconSideOverlay = nullptr; setTicking(true); } diff --git a/Minecraft.World/HangingEntity.cpp b/Minecraft.World/HangingEntity.cpp index 3d44b4260..67d531140 100644 --- a/Minecraft.World/HangingEntity.cpp +++ b/Minecraft.World/HangingEntity.cpp @@ -150,7 +150,7 @@ bool HangingEntity::survives() vector > *entities = level->getEntities(shared_from_this(), bb); - if (entities != NULL && entities->size() > 0) + if (entities != nullptr && entities->size() > 0) { for (auto& e : *entities) { @@ -184,11 +184,11 @@ bool HangingEntity::hurt(DamageSource *source, float damage) if (isInvulnerable()) return false; if (!removed && !level->isClientSide) { - if (dynamic_cast(source) != NULL) + if (dynamic_cast(source) != nullptr) { shared_ptr sourceEntity = source->getDirectEntity(); - if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(sourceEntity)->isAllowedToHurtEntity(shared_from_this()) ) + if ( (sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_PLAYER) && !dynamic_pointer_cast(sourceEntity)->isAllowedToHurtEntity(shared_from_this()) ) { return false; } @@ -199,12 +199,12 @@ bool HangingEntity::hurt(DamageSource *source, float damage) shared_ptr player = nullptr; shared_ptr e = source->getEntity(); - if ( (e!=NULL) && e->instanceof(eTYPE_PLAYER) ) // check if it's serverplayer or player + if ( (e!=nullptr) && e->instanceof(eTYPE_PLAYER) ) // check if it's serverplayer or player { player = dynamic_pointer_cast( e ); } - if (player != NULL && player->abilities.instabuild) + if (player != nullptr && player->abilities.instabuild) { return true; } diff --git a/Minecraft.World/HangingEntityItem.cpp b/Minecraft.World/HangingEntityItem.cpp index 9e4e9d5b6..75e9dcff5 100644 --- a/Minecraft.World/HangingEntityItem.cpp +++ b/Minecraft.World/HangingEntityItem.cpp @@ -35,7 +35,7 @@ bool HangingEntityItem::useOn(shared_ptr instance, shared_ptrmayUseItemAt(xt, yt, zt, face, instance)) return false; - if (entity != NULL && entity->survives()) + if (entity != nullptr && entity->survives()) { if (!level->isClientSide) { diff --git a/Minecraft.World/HatchetItem.cpp b/Minecraft.World/HatchetItem.cpp index 7fa204ca9..dd74a2ed9 100644 --- a/Minecraft.World/HatchetItem.cpp +++ b/Minecraft.World/HatchetItem.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.tile.h" #include "HatchetItem.h" -TileArray *HatchetItem::diggables = NULL; +TileArray *HatchetItem::diggables = nullptr; void HatchetItem::staticCtor() { @@ -25,7 +25,7 @@ HatchetItem::HatchetItem(int id, const Tier *tier) : DiggerItem (id, 3, tier, di // 4J - brought forward from 1.2.3 float HatchetItem::getDestroySpeed(shared_ptr itemInstance, Tile *tile) { - if (tile != NULL && (tile->material == Material::wood || tile->material == Material::plant || tile->material == Material::replaceable_plant)) + if (tile != nullptr && (tile->material == Material::wood || tile->material == Material::plant || tile->material == Material::replaceable_plant)) { return speed; } diff --git a/Minecraft.World/HellFlatLevelSource.cpp b/Minecraft.World/HellFlatLevelSource.cpp index 4c9a77077..305c45ce5 100644 --- a/Minecraft.World/HellFlatLevelSource.cpp +++ b/Minecraft.World/HellFlatLevelSource.cpp @@ -211,16 +211,16 @@ wstring HellFlatLevelSource::gatherStats() vector *HellFlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == nullptr) { - return NULL; + return nullptr; } return biome->getMobs(mobCategory); } TilePos *HellFlatLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return NULL; + return nullptr; } void HellFlatLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) diff --git a/Minecraft.World/HellRandomLevelSource.cpp b/Minecraft.World/HellRandomLevelSource.cpp index e92ad2776..06cdd831a 100644 --- a/Minecraft.World/HellRandomLevelSource.cpp +++ b/Minecraft.World/HellRandomLevelSource.cpp @@ -303,7 +303,7 @@ void HellRandomLevelSource::lightChunk(LevelChunk *lc) doubleArray HellRandomLevelSource::getHeights(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize) { - if (buffer.data == NULL) + if (buffer.data == nullptr) { buffer = doubleArray(xSize * ySize * zSize); } @@ -547,19 +547,19 @@ vector *HellRandomLevelSource::getMobsAt(MobCategory *m } Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == nullptr) { - return NULL; + return nullptr; } return biome->getMobs(mobCategory); } TilePos *HellRandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return NULL; + return nullptr; } void HellRandomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) { - netherBridgeFeature->apply(this, level, chunkX, chunkZ, NULL); + netherBridgeFeature->apply(this, level, chunkX, chunkZ, byteArray()); } \ No newline at end of file diff --git a/Minecraft.World/HopperMenu.cpp b/Minecraft.World/HopperMenu.cpp index afc700c3a..996651c65 100644 --- a/Minecraft.World/HopperMenu.cpp +++ b/Minecraft.World/HopperMenu.cpp @@ -35,7 +35,7 @@ shared_ptr HopperMenu::quickMoveStack(shared_ptr player, i { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/HopperTile.cpp b/Minecraft.World/HopperTile.cpp index 6e41aefc3..dadda9b0f 100644 --- a/Minecraft.World/HopperTile.cpp +++ b/Minecraft.World/HopperTile.cpp @@ -74,7 +74,7 @@ bool HopperTile::use(Level *level, int x, int y, int z, shared_ptr playe return true; } shared_ptr hopper = getHopper(level, x, y, z); - if (hopper != NULL) player->openHopper(hopper); + if (hopper != nullptr) player->openHopper(hopper); return true; } @@ -99,12 +99,12 @@ void HopperTile::checkPoweredState(Level *level, int x, int y, int z) void HopperTile::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr container = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (container != NULL) + if (container != nullptr) { for (int i = 0; i < container->getContainerSize(); i++) { shared_ptr item = container->getItem(i); - if (item != NULL) + if (item != nullptr) { float xo = random.nextFloat() * 0.8f + 0.1f; float yo = random.nextFloat() * 0.8f + 0.1f; @@ -197,7 +197,7 @@ Icon *HopperTile::getTexture(const wstring &name) { if (name.compare(TEXTURE_OUTSIDE) == 0) return Tile::hopper->hopperIcon; if (name.compare(TEXTURE_INSIDE) == 0) return Tile::hopper->hopperInnerIcon; - return NULL; + return nullptr; } wstring HopperTile::getTileItemIconName() diff --git a/Minecraft.World/HopperTileEntity.cpp b/Minecraft.World/HopperTileEntity.cpp index efb11bac8..3e0cbe86d 100644 --- a/Minecraft.World/HopperTileEntity.cpp +++ b/Minecraft.World/HopperTileEntity.cpp @@ -46,7 +46,7 @@ void HopperTileEntity::save(CompoundTag *base) for (int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i)); @@ -76,7 +76,7 @@ shared_ptr HopperTileEntity::getItem(unsigned int slot) shared_ptr HopperTileEntity::removeItem(unsigned int slot, int count) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { if (items[slot]->count <= count) { @@ -96,7 +96,7 @@ shared_ptr HopperTileEntity::removeItem(unsigned int slot, int cou shared_ptr HopperTileEntity::removeItemNoUpdate(int slot) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -108,7 +108,7 @@ shared_ptr HopperTileEntity::removeItemNoUpdate(int slot) void HopperTileEntity::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); } wstring HopperTileEntity::getName() @@ -158,7 +158,7 @@ bool HopperTileEntity::canPlaceItem(int slot, shared_ptr item) void HopperTileEntity::tick() { - if (level == NULL || level->isClientSide) return; + if (level == nullptr || level->isClientSide) return; cooldownTime--; @@ -171,7 +171,7 @@ void HopperTileEntity::tick() bool HopperTileEntity::tryMoveItems() { - if (level == NULL || level->isClientSide) return false; + if (level == nullptr || level->isClientSide) return false; if (!isOnCooldown() && HopperTile::isTurnedOn(getData())) { @@ -192,19 +192,19 @@ bool HopperTileEntity::tryMoveItems() bool HopperTileEntity::ejectItems() { shared_ptr container = getAttachedContainer(); - if (container == NULL) + if (container == nullptr) { return false; } for (int slot = 0; slot < getContainerSize(); slot++) { - if (getItem(slot) == NULL) continue; + if (getItem(slot) == nullptr) continue; shared_ptr original = getItem(slot)->copy(); shared_ptr result = addItem(container.get(), removeItem(slot, 1), Facing::OPPOSITE_FACING[HopperTile::getAttachedFace(getData())]); - if (result == NULL || result->count == 0) + if (result == nullptr || result->count == 0) { container->setChanged(); return true; @@ -222,12 +222,12 @@ bool HopperTileEntity::suckInItems(Hopper *hopper) { shared_ptr container = getSourceContainer(hopper); - if (container != NULL) + if (container != nullptr) { int face = Facing::DOWN; shared_ptr worldly = dynamic_pointer_cast(container); - if ( (worldly != NULL) && (face > -1) ) + if ( (worldly != nullptr) && (face > -1) ) { intArray slots = worldly->getSlotsForFace(face); @@ -249,7 +249,7 @@ bool HopperTileEntity::suckInItems(Hopper *hopper) { shared_ptr above = getItemAt(hopper->getLevel(), hopper->getLevelX(), hopper->getLevelY() + 1, hopper->getLevelZ()); - if (above != NULL) + if (above != nullptr) { return addItem(hopper, above); } @@ -262,12 +262,12 @@ bool HopperTileEntity::tryTakeInItemFromSlot(Hopper *hopper, Container *containe { shared_ptr item = container->getItem(slot); - if (item != NULL && canTakeItemFromContainer(container, item, slot, face)) + if (item != nullptr && canTakeItemFromContainer(container, item, slot, face)) { shared_ptr original = item->copy(); shared_ptr result = addItem(hopper, container->removeItem(slot, 1), -1); - if (result == NULL || result->count == 0) + if (result == nullptr || result->count == 0) { container->setChanged(); return true; @@ -284,12 +284,12 @@ bool HopperTileEntity::tryTakeInItemFromSlot(Hopper *hopper, Container *containe bool HopperTileEntity::addItem(Container *container, shared_ptr item) { bool changed = false; - if (item == NULL) return false; + if (item == nullptr) return false; shared_ptr copy = item->getItem()->copy(); shared_ptr result = addItem(container, copy, -1); - if (result == NULL || result->count == 0) + if (result == nullptr || result->count == 0) { changed = true; @@ -305,12 +305,12 @@ bool HopperTileEntity::addItem(Container *container, shared_ptr item shared_ptr HopperTileEntity::addItem(Container *container, shared_ptr item, int face) { - if (dynamic_cast( container ) != NULL && face > -1) + if (dynamic_cast( container ) != nullptr && face > -1) { WorldlyContainer *worldly = static_cast(container); intArray slots = worldly->getSlotsForFace(face); - for (int i = 0; i < slots.length && item != NULL && item->count > 0; i++) + for (int i = 0; i < slots.length && item != nullptr && item->count > 0; i++) { item = tryMoveInItem(container, item, slots[i], face); } @@ -318,13 +318,13 @@ shared_ptr HopperTileEntity::addItem(Container *container, shared_ else { int size = container->getContainerSize(); - for (int i = 0; i < size && item != NULL && item->count > 0; i++) + for (int i = 0; i < size && item != nullptr && item->count > 0; i++) { item = tryMoveInItem(container, item, i, face); } } - if (item != NULL && item->count == 0) + if (item != nullptr && item->count == 0) { item = nullptr; } @@ -335,13 +335,13 @@ shared_ptr HopperTileEntity::addItem(Container *container, shared_ bool HopperTileEntity::canPlaceItemInContainer(Container *container, shared_ptr item, int slot, int face) { if (!container->canPlaceItem(slot, item)) return false; - if ( dynamic_cast( container ) != NULL && !dynamic_cast( container )->canPlaceItemThroughFace(slot, item, face)) return false; + if ( dynamic_cast( container ) != nullptr && !dynamic_cast( container )->canPlaceItemThroughFace(slot, item, face)) return false; return true; } bool HopperTileEntity::canTakeItemFromContainer(Container *container, shared_ptr item, int slot, int face) { - if (dynamic_cast( container ) != NULL && !dynamic_cast( container )->canTakeItemThroughFace(slot, item, face)) return false; + if (dynamic_cast( container ) != nullptr && !dynamic_cast( container )->canTakeItemThroughFace(slot, item, face)) return false; return true; } @@ -352,7 +352,7 @@ shared_ptr HopperTileEntity::tryMoveInItem(Container *container, s if (canPlaceItemInContainer(container, item, slot, face)) { bool success = false; - if (current == NULL) + if (current == nullptr) { container->setItem(slot, item); item = nullptr; @@ -370,7 +370,7 @@ shared_ptr HopperTileEntity::tryMoveInItem(Container *container, s if (success) { HopperTileEntity *hopper = dynamic_cast(container); - if (hopper != NULL) + if (hopper != nullptr) { hopper->setCooldown(MOVE_ITEM_SPEED); container->setChanged(); @@ -420,25 +420,25 @@ shared_ptr HopperTileEntity::getContainerAt(Level *level, double x, d shared_ptr entity = level->getTileEntity(xt, yt, zt); result = dynamic_pointer_cast(entity); - if (result != NULL) + if (result != nullptr) { - if ( dynamic_pointer_cast(result) != NULL ) + if ( dynamic_pointer_cast(result) != nullptr ) { int id = level->getTile(xt, yt, zt); Tile *tile = Tile::tiles[id]; - if ( dynamic_cast( tile ) != NULL ) + if ( dynamic_cast( tile ) != nullptr ) { result = static_cast(tile)->getContainer(level, xt, yt, zt); } } } - if (result == NULL) + if (result == nullptr) { vector > *entities = level->getEntities(nullptr, AABB::newTemp(x, y, z, x + 1, y + 1, z + 1), EntitySelector::CONTAINER_ENTITY_SELECTOR); - if ( (entities != NULL) && (entities->size() > 0) ) + if ( (entities != nullptr) && (entities->size() > 0) ) { result = dynamic_pointer_cast( entities->at( level->random->nextInt(entities->size()) ) ); } @@ -496,7 +496,7 @@ shared_ptr HopperTileEntity::clone() result->cooldownTime = cooldownTime; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { result->items[i] = ItemInstance::clone(items[i]); } diff --git a/Minecraft.World/HorseInventoryMenu.cpp b/Minecraft.World/HorseInventoryMenu.cpp index 7dba791f8..467b3545d 100644 --- a/Minecraft.World/HorseInventoryMenu.cpp +++ b/Minecraft.World/HorseInventoryMenu.cpp @@ -75,7 +75,7 @@ shared_ptr HorseInventoryMenu::quickMoveStack(shared_ptr p { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/HtmlString.cpp b/Minecraft.World/HtmlString.cpp index ce25740ec..af6436718 100644 --- a/Minecraft.World/HtmlString.cpp +++ b/Minecraft.World/HtmlString.cpp @@ -38,7 +38,7 @@ wstring HtmlString::ToString() wstring HtmlString::Compose(vector *strings) { - if (strings == NULL) return L""; + if (strings == nullptr) return L""; std::wstringstream ss; diff --git a/Minecraft.World/HugeMushroomTile.cpp b/Minecraft.World/HugeMushroomTile.cpp index e96cfd1f1..8d3ef144d 100644 --- a/Minecraft.World/HugeMushroomTile.cpp +++ b/Minecraft.World/HugeMushroomTile.cpp @@ -9,9 +9,9 @@ const wstring HugeMushroomTile::TEXTURE_TYPE[] = {L"skin_brown", L"skin_red"}; HugeMushroomTile::HugeMushroomTile(int id, Material *material, int type) : Tile(id, material) { this->type = type; - icons = NULL; - iconStem = NULL; - iconInside = NULL; + icons = nullptr; + iconStem = nullptr; + iconInside = nullptr; } Icon *HugeMushroomTile::getTexture(int face, int data) diff --git a/Minecraft.World/HurtByTargetGoal.cpp b/Minecraft.World/HurtByTargetGoal.cpp index 076e5b6a5..e70f8628f 100644 --- a/Minecraft.World/HurtByTargetGoal.cpp +++ b/Minecraft.World/HurtByTargetGoal.cpp @@ -30,7 +30,7 @@ void HurtByTargetGoal::start() { shared_ptr other = dynamic_pointer_cast(it); if (this->mob->shared_from_this() == other) continue; - if (other->getTarget() != NULL) continue; + if (other->getTarget() != nullptr) continue; if (other->isAlliedTo(mob->getLastHurtByMob())) continue; // don't target allies other->setTarget(mob->getLastHurtByMob()); } diff --git a/Minecraft.World/IceTile.cpp b/Minecraft.World/IceTile.cpp index 938c098f9..60e162916 100644 --- a/Minecraft.World/IceTile.cpp +++ b/Minecraft.World/IceTile.cpp @@ -30,7 +30,7 @@ void IceTile::playerDestroy(Level *level, shared_ptr player, int x, int if (isSilkTouchable() && EnchantmentHelper::hasSilkTouch(player)) { shared_ptr item = getSilkTouchItemInstance(data); - if (item != NULL) + if (item != nullptr) { popResource(level, x, y, z, item); } diff --git a/Minecraft.World/IndirectEntityDamageSource.cpp b/Minecraft.World/IndirectEntityDamageSource.cpp index c2a67af5b..90c80f6bd 100644 --- a/Minecraft.World/IndirectEntityDamageSource.cpp +++ b/Minecraft.World/IndirectEntityDamageSource.cpp @@ -32,20 +32,20 @@ shared_ptr IndirectEntityDamageSource::getDeathMessagePacket(shared_ shared_ptr held = entity->instanceof(eTYPE_LIVINGENTITY) ? dynamic_pointer_cast(entity)->getCarriedItem() : nullptr; wstring additional = L""; int type; - if(owner != NULL) + if(owner != nullptr) { type = owner->GetType(); if(type == eTYPE_SERVERPLAYER) { shared_ptr sourcePlayer = dynamic_pointer_cast(owner); - if(sourcePlayer != NULL) additional = sourcePlayer->name; + if(sourcePlayer != nullptr) additional = sourcePlayer->name; } } else { type = entity->GetType(); } - if(held != NULL && held->hasCustomHoverName() ) + if(held != nullptr && held->hasCustomHoverName() ) { return shared_ptr( new ChatPacket(player->getNetworkName(), m_msgWithItemId, type, additional, held->getHoverName() ) ); } diff --git a/Minecraft.World/InputStream.cpp b/Minecraft.World/InputStream.cpp index e325db8a3..f31399cf5 100644 --- a/Minecraft.World/InputStream.cpp +++ b/Minecraft.World/InputStream.cpp @@ -7,5 +7,5 @@ InputStream *InputStream::getResourceAsStream(const wstring &fileName) { File file( fileName ); - return file.exists() ? new FileInputStream( file ) : NULL; + return file.exists() ? new FileInputStream( file ) : nullptr; } \ No newline at end of file diff --git a/Minecraft.World/IntArrayTag.h b/Minecraft.World/IntArrayTag.h index 482a5e1a5..61ca59d09 100644 --- a/Minecraft.World/IntArrayTag.h +++ b/Minecraft.World/IntArrayTag.h @@ -58,7 +58,7 @@ public: if (Tag::equals(obj)) { IntArrayTag *o = static_cast(obj); - return ((data.data == NULL && o->data.data == NULL) || (data.data != NULL && data.length == o->data.length && memcmp(data.data, o->data.data, data.length * sizeof(int)) == 0) ); + return ((data.data == nullptr && o->data.data == nullptr) || (data.data != nullptr && data.length == o->data.length && memcmp(data.data, o->data.data, data.length * sizeof(int)) == 0) ); } return false; } diff --git a/Minecraft.World/IntCache.cpp b/Minecraft.World/IntCache.cpp index d193285a5..7c8a94df2 100644 --- a/Minecraft.World/IntCache.cpp +++ b/Minecraft.World/IntCache.cpp @@ -50,7 +50,7 @@ intArray IntCache::allocate(int size) { if (tls->tcache.empty()) { - intArray result = intArray(TINY_CUTOFF, true); + intArray result = intArray(static_cast(TINY_CUTOFF), true); tls->tallocated.push_back(result); return result; } @@ -76,7 +76,7 @@ intArray IntCache::allocate(int size) tls->cache.clear(); tls->allocated.clear(); - intArray result = intArray(tls->maxSize, true); + intArray result = intArray(static_cast(tls->maxSize), true); tls->allocated.push_back(result); return result; } @@ -84,7 +84,7 @@ intArray IntCache::allocate(int size) { if (tls->cache.empty()) { - intArray result = intArray(tls->maxSize, true); + intArray result = intArray(static_cast(tls->maxSize), true); tls->allocated.push_back(result); return result; } diff --git a/Minecraft.World/Inventory.cpp b/Minecraft.World/Inventory.cpp index 6ce647b88..d50ff614e 100644 --- a/Minecraft.World/Inventory.cpp +++ b/Minecraft.World/Inventory.cpp @@ -69,7 +69,7 @@ int Inventory::getSlot(int tileId) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL && items[i]->id == tileId) return i; + if (items[i] != nullptr && items[i]->id == tileId) return i; } return -1; } @@ -78,7 +78,7 @@ int Inventory::getSlot(int tileId, int data) { for (int i = 0; i < items.length; i++) { - if (items[i] != NULL && items[i]->id == tileId && items[i]->getAuxValue() == data) return i; + if (items[i] != nullptr && items[i]->id == tileId && items[i]->getAuxValue() == data) return i; } return -1; } @@ -87,7 +87,7 @@ int Inventory::getSlotWithRemainingSpace(shared_ptr item) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL && items[i]->id == item->id && items[i]->isStackable() + if (items[i] != nullptr && items[i]->id == item->id && items[i]->isStackable() && items[i]->count < items[i]->getMaxStackSize() && items[i]->count < getMaxStackSize() && (!items[i]->isStackedByData() || items[i]->getAuxValue() == item->getAuxValue()) && ItemInstance::tagMatches(items[i], item)) @@ -102,7 +102,7 @@ int Inventory::getFreeSlot() { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] == NULL) return i; + if (items[i] == nullptr) return i; } return -1; } @@ -160,7 +160,7 @@ int Inventory::clearInventory(int id, int data) for (int i = 0; i < items.length; i++) { shared_ptr item = items[i]; - if (item == NULL) continue; + if (item == nullptr) continue; if (id > -1 && item->id != id) continue; if (data > -1 && item->getAuxValue() != data) continue; @@ -170,7 +170,7 @@ int Inventory::clearInventory(int id, int data) for (int i = 0; i < armor.length; i++) { shared_ptr item = armor[i]; - if (item == NULL) continue; + if (item == nullptr) continue; if (id > -1 && item->id != id) continue; if (data > -1 && item->getAuxValue() != data) continue; @@ -178,7 +178,7 @@ int Inventory::clearInventory(int id, int data) armor[i] = nullptr; } - if (carried != NULL) + if (carried != nullptr) { if (id > -1 && carried->id != id) return count; if (data > -1 && carried->getAuxValue() != data) return count; @@ -192,10 +192,10 @@ int Inventory::clearInventory(int id, int data) void Inventory::replaceSlot(Item *item, int data) { - if (item != NULL) + if (item != nullptr) { // It's too easy to accidentally pick block and lose enchanted items. - if (heldItem != NULL && heldItem->isEnchantable() && getSlot(heldItem->id, heldItem->getDamageValue()) == selected) + if (heldItem != nullptr && heldItem->isEnchantable() && getSlot(heldItem->id, heldItem->getDamageValue()) == selected) { return; } @@ -226,7 +226,7 @@ int Inventory::addResource(shared_ptr itemInstance) { int slot = getFreeSlot(); if (slot < 0) return count; - if (items[slot] == NULL) + if (items[slot] == nullptr) { items[slot] = ItemInstance::clone(itemInstance); player->handleCollectItem(itemInstance); @@ -237,7 +237,7 @@ int Inventory::addResource(shared_ptr itemInstance) int slot = getSlotWithRemainingSpace(itemInstance); if (slot < 0) slot = getFreeSlot(); if (slot < 0) return count; - if (items[slot] == NULL) + if (items[slot] == nullptr) { items[slot] = shared_ptr( new ItemInstance(type, 0, itemInstance->getAuxValue()) ); // 4J Stu - Brought forward from 1.2 @@ -272,7 +272,7 @@ void Inventory::tick() { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { items[i]->inventoryTick(player->level, player->shared_from_this(), i, selected == i); } @@ -299,12 +299,12 @@ bool Inventory::removeResource(int type,int iAuxVal) void Inventory::removeResources(shared_ptr item) { - if(item == NULL) return; + if(item == nullptr) return; int countToRemove = item->count; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL && items[i]->sameItemWithTags(item)) + if (items[i] != nullptr && items[i]->sameItemWithTags(item)) { int slotCount = items[i]->count; items[i]->count -= countToRemove; @@ -348,7 +348,7 @@ int Inventory::countResource(int type, int auxVal) int count = 0; for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL && items[i]->id == type && + if (items[i] != nullptr && items[i]->id == type && (auxVal == -1 || items[i]->getAuxValue() == auxVal)) count += items[i]->count; } @@ -364,7 +364,7 @@ void Inventory::swapSlots(int from, int to) bool Inventory::add(shared_ptr item) { - if (item == NULL) return false; + if (item == nullptr) return false; if (item->count == 0) return false; if (!item->isDamaged()) @@ -427,7 +427,7 @@ shared_ptr Inventory::removeItem(unsigned int slot, int count) slot -= items.length; } - if (pile[slot] != NULL) + if (pile[slot] != nullptr) { if (pile[slot]->count <= count) { @@ -454,7 +454,7 @@ shared_ptr Inventory::removeItemNoUpdate(int slot) slot -= items.length; } - if (pile[slot] != NULL) + if (pile[slot] != nullptr) { shared_ptr item = pile[slot]; pile[slot] = nullptr; @@ -466,7 +466,7 @@ shared_ptr Inventory::removeItemNoUpdate(int slot) void Inventory::setItem(unsigned int slot, shared_ptr item) { #ifdef _DEBUG - if(item!=NULL) + if(item!=nullptr) { wstring itemstring=item->toString(); app.DebugPrintf("Inventory::setItem - slot = %d,\t item = %d ",slot,item->id); @@ -474,7 +474,7 @@ void Inventory::setItem(unsigned int slot, shared_ptr item) app.DebugPrintf("\n"); } #else - if(item!=NULL) + if(item!=nullptr) { app.DebugPrintf("Inventory::setItem - slot = %d,\t item = %d, aux = %d\n",slot,item->id,item->getAuxValue()); } @@ -504,7 +504,7 @@ void Inventory::setItem(unsigned int slot, shared_ptr item) float Inventory::getDestroySpeed(Tile *tile) { float speed = 1.0f; - if (items[selected] != NULL) speed *= items[selected]->getDestroySpeed(tile); + if (items[selected] != nullptr) speed *= items[selected]->getDestroySpeed(tile); return speed; } @@ -512,7 +512,7 @@ ListTag *Inventory::save(ListTag *listTag) { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i)); @@ -522,7 +522,7 @@ ListTag *Inventory::save(ListTag *listTag) } for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != NULL) + if (armor[i] != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i + 100)); @@ -535,15 +535,15 @@ ListTag *Inventory::save(ListTag *listTag) void Inventory::load(ListTag *inventoryList) { - if( items.data != NULL) + if( items.data != nullptr) { delete[] items.data; - items.data = NULL; + items.data = nullptr; } - if( armor.data != NULL) + if( armor.data != nullptr) { delete[] armor.data; - armor.data = NULL; + armor.data = nullptr; } items = ItemInstanceArray( INVENTORY_SIZE ); @@ -553,7 +553,7 @@ void Inventory::load(ListTag *inventoryList) CompoundTag *tag = inventoryList->get(i); unsigned int slot = tag->getByte(L"Slot") & 0xff; shared_ptr item = shared_ptr( ItemInstance::fromTag(tag) ); - if (item != NULL) + if (item != nullptr) { if (slot >= 0 && slot < items.length) items[slot] = item; if (slot >= 100 && slot < armor.length + 100) armor[slot - 100] = item; @@ -614,7 +614,7 @@ bool Inventory::canDestroy(Tile *tile) if (tile->material->isAlwaysDestroyable()) return true; shared_ptr item = getItem(selected); - if (item != NULL) return item->canDestroySpecial(tile); + if (item != nullptr) return item->canDestroySpecial(tile); return false; } @@ -628,7 +628,7 @@ int Inventory::getArmorValue() int val = 0; for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != NULL && dynamic_cast( armor[i]->getItem() ) != NULL ) + if (armor[i] != nullptr && dynamic_cast( armor[i]->getItem() ) != nullptr ) { int baseProtection = dynamic_cast(armor[i]->getItem())->defense; @@ -647,7 +647,7 @@ void Inventory::hurtArmor(float dmg) } for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != NULL && dynamic_cast( armor[i]->getItem() ) != NULL ) + if (armor[i] != nullptr && dynamic_cast( armor[i]->getItem() ) != nullptr ) { armor[i]->hurtAndBreak( static_cast(dmg), dynamic_pointer_cast( player->shared_from_this() ) ); if (armor[i]->count == 0) @@ -662,7 +662,7 @@ void Inventory::dropAll() { for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { player->drop(items[i], true); items[i] = nullptr; @@ -670,7 +670,7 @@ void Inventory::dropAll() } for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != NULL) + if (armor[i] != nullptr) { player->drop(armor[i], true); armor[i] = nullptr; @@ -699,8 +699,8 @@ bool Inventory::isSame(shared_ptr copy) bool Inventory::isSame(shared_ptr a, shared_ptr b) { - if (a == NULL && b == NULL) return true; - if (a == NULL || b == NULL) return false; + if (a == nullptr && b == nullptr) return true; + if (a == nullptr || b == nullptr) return false; return a->id == b->id && a->count == b->count && a->getAuxValue() == b->getAuxValue(); } @@ -708,14 +708,14 @@ bool Inventory::isSame(shared_ptr a, shared_ptr b) shared_ptr Inventory::copy() { - shared_ptr copy = shared_ptr( new Inventory(NULL) ); + shared_ptr copy = shared_ptr( new Inventory(nullptr) ); for (unsigned int i = 0; i < items.length; i++) { - copy->items[i] = items[i] != NULL ? items[i]->copy() : nullptr; + copy->items[i] = items[i] != nullptr ? items[i]->copy() : nullptr; } for (unsigned int i = 0; i < armor.length; i++) { - copy->armor[i] = armor[i] != NULL ? armor[i]->copy() : nullptr; + copy->armor[i] = armor[i] != nullptr ? armor[i]->copy() : nullptr; } return copy; } @@ -742,11 +742,11 @@ bool Inventory::contains(shared_ptr itemInstance) { for (unsigned int i = 0; i < armor.length; i++) { - if (armor[i] != NULL && armor[i]->sameItem(itemInstance)) return true; + if (armor[i] != nullptr && armor[i]->sameItem(itemInstance)) return true; } for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL && items[i]->sameItem(itemInstance)) return true; + if (items[i] != nullptr && items[i]->sameItem(itemInstance)) return true; } return false; } @@ -782,15 +782,15 @@ void Inventory::replaceWith(shared_ptr other) int Inventory::countMatches(shared_ptr itemInstance) { - if(itemInstance == NULL) return 0; + if(itemInstance == nullptr) return 0; int count = 0; //for (unsigned int i = 0; i < armor.length; i++) //{ - // if (armor[i] != NULL && armor[i]->sameItem(itemInstance)) count += items[i]->count; + // if (armor[i] != nullptr && armor[i]->sameItem(itemInstance)) count += items[i]->count; //} for (unsigned int i = 0; i < items.length; i++) { - if (items[i] != NULL && items[i]->sameItemWithTags(itemInstance)) count += items[i]->count; + if (items[i] != nullptr && items[i]->sameItemWithTags(itemInstance)) count += items[i]->count; } return count; } diff --git a/Minecraft.World/InventoryMenu.cpp b/Minecraft.World/InventoryMenu.cpp index ae5d92696..2b0e9e80f 100644 --- a/Minecraft.World/InventoryMenu.cpp +++ b/Minecraft.World/InventoryMenu.cpp @@ -77,7 +77,7 @@ void InventoryMenu::removed(shared_ptr player) for (int i = 0; i < 4; i++) { shared_ptr item = craftSlots->removeItemNoUpdate(i); - if (item != NULL) + if (item != nullptr) { player->drop(item); craftSlots->setItem(i, nullptr); @@ -102,7 +102,7 @@ shared_ptr InventoryMenu::quickMoveStack(shared_ptr player Slot *BootsSlot = slots.at(ARMOR_SLOT_START+3); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -240,7 +240,7 @@ shared_ptr InventoryMenu::clicked(int slotIndex, int buttonNum, in for (int i = ARMOR_SLOT_START; i < ARMOR_SLOT_END; i++) { Slot *slot = slots.at(i); - if ( (slot==NULL) || (!slot->hasItem()) || (slot->getItem()->getItem()->id != ironItems[i-ARMOR_SLOT_START]) ) + if ( (slot==nullptr) || (!slot->hasItem()) || (slot->getItem()->getItem()->id != ironItems[i-ARMOR_SLOT_START]) ) { return out; } diff --git a/Minecraft.World/Item.cpp b/Minecraft.World/Item.cpp index 5b3838dbc..ffb310704 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -32,224 +32,224 @@ Random *Item::random = new Random(); ItemArray Item::items = ItemArray( ITEM_NUM_COUNT ); -Item *Item::shovel_iron = NULL; -Item *Item::pickAxe_iron = NULL; -Item *Item::hatchet_iron = NULL; -Item *Item::flintAndSteel = NULL; -Item *Item::apple = NULL; -BowItem *Item::bow = NULL; -Item *Item::arrow = NULL; -Item *Item::coal = NULL; -Item *Item::diamond = NULL; -Item *Item::ironIngot = NULL; -Item *Item::goldIngot = NULL; -Item *Item::sword_iron = NULL; +Item *Item::shovel_iron = nullptr; +Item *Item::pickAxe_iron = nullptr; +Item *Item::hatchet_iron = nullptr; +Item *Item::flintAndSteel = nullptr; +Item *Item::apple = nullptr; +BowItem *Item::bow = nullptr; +Item *Item::arrow = nullptr; +Item *Item::coal = nullptr; +Item *Item::diamond = nullptr; +Item *Item::ironIngot = nullptr; +Item *Item::goldIngot = nullptr; +Item *Item::sword_iron = nullptr; -Item *Item::sword_wood = NULL; -Item *Item::shovel_wood = NULL; -Item *Item::pickAxe_wood = NULL; -Item *Item::hatchet_wood = NULL; +Item *Item::sword_wood = nullptr; +Item *Item::shovel_wood = nullptr; +Item *Item::pickAxe_wood = nullptr; +Item *Item::hatchet_wood = nullptr; -Item *Item::sword_stone = NULL; -Item *Item::shovel_stone = NULL; -Item *Item::pickAxe_stone = NULL; -Item *Item::hatchet_stone = NULL; +Item *Item::sword_stone = nullptr; +Item *Item::shovel_stone = nullptr; +Item *Item::pickAxe_stone = nullptr; +Item *Item::hatchet_stone = nullptr; -Item *Item::sword_diamond = NULL; -Item *Item::shovel_diamond = NULL; -Item *Item::pickAxe_diamond = NULL; -Item *Item::hatchet_diamond = NULL; +Item *Item::sword_diamond = nullptr; +Item *Item::shovel_diamond = nullptr; +Item *Item::pickAxe_diamond = nullptr; +Item *Item::hatchet_diamond = nullptr; -Item *Item::stick = NULL; -Item *Item::bowl = NULL; -Item *Item::mushroomStew = NULL; +Item *Item::stick = nullptr; +Item *Item::bowl = nullptr; +Item *Item::mushroomStew = nullptr; -Item *Item::sword_gold = NULL; -Item *Item::shovel_gold = NULL; -Item *Item::pickAxe_gold = NULL; -Item *Item::hatchet_gold = NULL; +Item *Item::sword_gold = nullptr; +Item *Item::shovel_gold = nullptr; +Item *Item::pickAxe_gold = nullptr; +Item *Item::hatchet_gold = nullptr; -Item *Item::string = NULL; -Item *Item::feather = NULL; -Item *Item::gunpowder = NULL; +Item *Item::string = nullptr; +Item *Item::feather = nullptr; +Item *Item::gunpowder = nullptr; -Item *Item::hoe_wood = NULL; -Item *Item::hoe_stone = NULL; -Item *Item::hoe_iron = NULL; -Item *Item::hoe_diamond = NULL; -Item *Item::hoe_gold = NULL; +Item *Item::hoe_wood = nullptr; +Item *Item::hoe_stone = nullptr; +Item *Item::hoe_iron = nullptr; +Item *Item::hoe_diamond = nullptr; +Item *Item::hoe_gold = nullptr; -Item *Item::seeds_wheat = NULL; -Item *Item::wheat = NULL; -Item *Item::bread = NULL; +Item *Item::seeds_wheat = nullptr; +Item *Item::wheat = nullptr; +Item *Item::bread = nullptr; -ArmorItem *Item::helmet_leather = NULL; -ArmorItem *Item::chestplate_leather = NULL; -ArmorItem *Item::leggings_leather = NULL; -ArmorItem *Item::boots_leather = NULL; +ArmorItem *Item::helmet_leather = nullptr; +ArmorItem *Item::chestplate_leather = nullptr; +ArmorItem *Item::leggings_leather = nullptr; +ArmorItem *Item::boots_leather = nullptr; -ArmorItem *Item::helmet_chain = NULL; -ArmorItem *Item::chestplate_chain = NULL; -ArmorItem *Item::leggings_chain = NULL; -ArmorItem *Item::boots_chain = NULL; +ArmorItem *Item::helmet_chain = nullptr; +ArmorItem *Item::chestplate_chain = nullptr; +ArmorItem *Item::leggings_chain = nullptr; +ArmorItem *Item::boots_chain = nullptr; -ArmorItem *Item::helmet_iron = NULL; -ArmorItem *Item::chestplate_iron = NULL; -ArmorItem *Item::leggings_iron = NULL; -ArmorItem *Item::boots_iron = NULL; +ArmorItem *Item::helmet_iron = nullptr; +ArmorItem *Item::chestplate_iron = nullptr; +ArmorItem *Item::leggings_iron = nullptr; +ArmorItem *Item::boots_iron = nullptr; -ArmorItem *Item::helmet_diamond = NULL; -ArmorItem *Item::chestplate_diamond = NULL; -ArmorItem *Item::leggings_diamond = NULL; -ArmorItem *Item::boots_diamond = NULL; +ArmorItem *Item::helmet_diamond = nullptr; +ArmorItem *Item::chestplate_diamond = nullptr; +ArmorItem *Item::leggings_diamond = nullptr; +ArmorItem *Item::boots_diamond = nullptr; -ArmorItem *Item::helmet_gold = NULL; -ArmorItem *Item::chestplate_gold = NULL; -ArmorItem *Item::leggings_gold = NULL; -ArmorItem *Item::boots_gold = NULL; +ArmorItem *Item::helmet_gold = nullptr; +ArmorItem *Item::chestplate_gold = nullptr; +ArmorItem *Item::leggings_gold = nullptr; +ArmorItem *Item::boots_gold = nullptr; -Item *Item::flint = NULL; -Item *Item::porkChop_raw = NULL; -Item *Item::porkChop_cooked = NULL; -Item *Item::painting = NULL; +Item *Item::flint = nullptr; +Item *Item::porkChop_raw = nullptr; +Item *Item::porkChop_cooked = nullptr; +Item *Item::painting = nullptr; -Item *Item::apple_gold = NULL; +Item *Item::apple_gold = nullptr; -Item *Item::sign = NULL; -Item *Item::door_wood = NULL; +Item *Item::sign = nullptr; +Item *Item::door_wood = nullptr; -Item *Item::bucket_empty = NULL; -Item *Item::bucket_water = NULL; -Item *Item::bucket_lava = NULL; +Item *Item::bucket_empty = nullptr; +Item *Item::bucket_water = nullptr; +Item *Item::bucket_lava = nullptr; -Item *Item::minecart = NULL; -Item *Item::saddle = NULL; -Item *Item::door_iron = NULL; -Item *Item::redStone = NULL; -Item *Item::snowBall = NULL; +Item *Item::minecart = nullptr; +Item *Item::saddle = nullptr; +Item *Item::door_iron = nullptr; +Item *Item::redStone = nullptr; +Item *Item::snowBall = nullptr; -Item *Item::boat = NULL; +Item *Item::boat = nullptr; -Item *Item::leather = NULL; -Item *Item::bucket_milk = NULL; -Item *Item::brick = NULL; -Item *Item::clay = NULL; -Item *Item::reeds = NULL; -Item *Item::paper = NULL; -Item *Item::book = NULL; -Item *Item::slimeBall = NULL; -Item *Item::minecart_chest = NULL; -Item *Item::minecart_furnace = NULL; -Item *Item::egg = NULL; -Item *Item::compass = NULL; -FishingRodItem *Item::fishingRod = NULL; -Item *Item::clock = NULL; -Item *Item::yellowDust = NULL; -Item *Item::fish_raw = NULL; -Item *Item::fish_cooked = NULL; +Item *Item::leather = nullptr; +Item *Item::bucket_milk = nullptr; +Item *Item::brick = nullptr; +Item *Item::clay = nullptr; +Item *Item::reeds = nullptr; +Item *Item::paper = nullptr; +Item *Item::book = nullptr; +Item *Item::slimeBall = nullptr; +Item *Item::minecart_chest = nullptr; +Item *Item::minecart_furnace = nullptr; +Item *Item::egg = nullptr; +Item *Item::compass = nullptr; +FishingRodItem *Item::fishingRod = nullptr; +Item *Item::clock = nullptr; +Item *Item::yellowDust = nullptr; +Item *Item::fish_raw = nullptr; +Item *Item::fish_cooked = nullptr; -Item *Item::dye_powder = NULL; -Item *Item::bone = NULL; -Item *Item::sugar = NULL; -Item *Item::cake = NULL; +Item *Item::dye_powder = nullptr; +Item *Item::bone = nullptr; +Item *Item::sugar = nullptr; +Item *Item::cake = nullptr; -Item *Item::bed = NULL; +Item *Item::bed = nullptr; -Item *Item::repeater = NULL; -Item *Item::cookie = NULL; +Item *Item::repeater = nullptr; +Item *Item::cookie = nullptr; -MapItem *Item::map = NULL; +MapItem *Item::map = nullptr; -Item *Item::record_01 = NULL; -Item *Item::record_02 = NULL; -Item *Item::record_03 = NULL; -Item *Item::record_04 = NULL; -Item *Item::record_05 = NULL; -Item *Item::record_06 = NULL; -Item *Item::record_07 = NULL; -Item *Item::record_08 = NULL; -Item *Item::record_09 = NULL; -Item *Item::record_10 = NULL; -Item *Item::record_11 = NULL; -Item *Item::record_12 = NULL; +Item *Item::record_01 = nullptr; +Item *Item::record_02 = nullptr; +Item *Item::record_03 = nullptr; +Item *Item::record_04 = nullptr; +Item *Item::record_05 = nullptr; +Item *Item::record_06 = nullptr; +Item *Item::record_07 = nullptr; +Item *Item::record_08 = nullptr; +Item *Item::record_09 = nullptr; +Item *Item::record_10 = nullptr; +Item *Item::record_11 = nullptr; +Item *Item::record_12 = nullptr; -ShearsItem *Item::shears = NULL; +ShearsItem *Item::shears = nullptr; -Item *Item::melon = NULL; +Item *Item::melon = nullptr; -Item *Item::seeds_pumpkin = NULL; -Item *Item::seeds_melon = NULL; +Item *Item::seeds_pumpkin = nullptr; +Item *Item::seeds_melon = nullptr; -Item *Item::beef_raw = NULL; -Item *Item::beef_cooked = NULL; -Item *Item::chicken_raw = NULL; -Item *Item::chicken_cooked = NULL; -Item *Item::rotten_flesh = NULL; +Item *Item::beef_raw = nullptr; +Item *Item::beef_cooked = nullptr; +Item *Item::chicken_raw = nullptr; +Item *Item::chicken_cooked = nullptr; +Item *Item::rotten_flesh = nullptr; -Item *Item::enderPearl = NULL; +Item *Item::enderPearl = nullptr; -Item *Item::blazeRod = NULL; -Item *Item::ghastTear = NULL; -Item *Item::goldNugget = NULL; -Item *Item::netherwart_seeds = NULL; -PotionItem *Item::potion = NULL; -Item *Item::glassBottle = NULL; -Item *Item::spiderEye = NULL; -Item *Item::fermentedSpiderEye = NULL; -Item *Item::blazePowder = NULL; -Item *Item::magmaCream = NULL; -Item *Item::brewingStand = NULL; -Item *Item::cauldron = NULL; -Item *Item::eyeOfEnder = NULL; -Item *Item::speckledMelon = NULL; +Item *Item::blazeRod = nullptr; +Item *Item::ghastTear = nullptr; +Item *Item::goldNugget = nullptr; +Item *Item::netherwart_seeds = nullptr; +PotionItem *Item::potion = nullptr; +Item *Item::glassBottle = nullptr; +Item *Item::spiderEye = nullptr; +Item *Item::fermentedSpiderEye = nullptr; +Item *Item::blazePowder = nullptr; +Item *Item::magmaCream = nullptr; +Item *Item::brewingStand = nullptr; +Item *Item::cauldron = nullptr; +Item *Item::eyeOfEnder = nullptr; +Item *Item::speckledMelon = nullptr; -Item *Item::spawnEgg = NULL; +Item *Item::spawnEgg = nullptr; -Item *Item::expBottle = NULL; +Item *Item::expBottle = nullptr; // TU9 -Item *Item::fireball = NULL; -Item *Item::frame = NULL; +Item *Item::fireball = nullptr; +Item *Item::frame = nullptr; -Item *Item::skull = NULL; +Item *Item::skull = nullptr; // TU14 -//Item *Item::writingBook = NULL; -//Item *Item::writtenBook = NULL; +//Item *Item::writingBook = nullptr; +//Item *Item::writtenBook = nullptr; -Item *Item::emerald = NULL; +Item *Item::emerald = nullptr; -Item *Item::flowerPot = NULL; +Item *Item::flowerPot = nullptr; -Item *Item::carrots = NULL; -Item *Item::potato = NULL; -Item *Item::potatoBaked = NULL; -Item *Item::potatoPoisonous = NULL; +Item *Item::carrots = nullptr; +Item *Item::potato = nullptr; +Item *Item::potatoBaked = nullptr; +Item *Item::potatoPoisonous = nullptr; -EmptyMapItem *Item::emptyMap = NULL; +EmptyMapItem *Item::emptyMap = nullptr; -Item *Item::carrotGolden = NULL; +Item *Item::carrotGolden = nullptr; -Item *Item::carrotOnAStick = NULL; -Item *Item::netherStar = NULL; -Item *Item::pumpkinPie = NULL; -Item *Item::fireworks = NULL; -Item *Item::fireworksCharge = NULL; +Item *Item::carrotOnAStick = nullptr; +Item *Item::netherStar = nullptr; +Item *Item::pumpkinPie = nullptr; +Item *Item::fireworks = nullptr; +Item *Item::fireworksCharge = nullptr; -EnchantedBookItem *Item::enchantedBook = NULL; +EnchantedBookItem *Item::enchantedBook = nullptr; -Item *Item::comparator = NULL; -Item *Item::netherbrick = NULL; -Item *Item::netherQuartz = NULL; -Item *Item::minecart_tnt = NULL; -Item *Item::minecart_hopper = NULL; +Item *Item::comparator = nullptr; +Item *Item::netherbrick = nullptr; +Item *Item::netherQuartz = nullptr; +Item *Item::minecart_tnt = nullptr; +Item *Item::minecart_hopper = nullptr; -Item *Item::horseArmorMetal = NULL; -Item *Item::horseArmorGold = NULL; -Item *Item::horseArmorDiamond = NULL; -Item *Item::lead = NULL; -Item *Item::nameTag = NULL; +Item *Item::horseArmorMetal = nullptr; +Item *Item::horseArmorGold = nullptr; +Item *Item::horseArmorDiamond = nullptr; +Item *Item::lead = nullptr; +Item *Item::nameTag = nullptr; void Item::staticCtor() @@ -568,11 +568,11 @@ Item::Item(int id) : id( 256 + id ) { maxStackSize = Item::MAX_STACK_SIZE; maxDamage = 0; - icon = NULL; + icon = nullptr; m_handEquipped = false; m_isStackedByData = false; - craftingRemainingItem = NULL; + craftingRemainingItem = nullptr; potionBrewingFormula = L""; m_iMaterial=eMaterial_undefined; @@ -583,7 +583,7 @@ Item::Item(int id) : id( 256 + id ) //string descriptionId; //this->id = 256 + id; - if (items[256 + id] != NULL) + if (items[256 + id] != nullptr) { app.DebugPrintf("CONFLICT @ %d" , id); } @@ -837,7 +837,7 @@ Item *Item::getCraftingRemainingItem() bool Item::hasCraftingRemainingItem() { - return craftingRemainingItem != NULL; + return craftingRemainingItem != nullptr; } wstring Item::getName() diff --git a/Minecraft.World/ItemDispenseBehaviors.cpp b/Minecraft.World/ItemDispenseBehaviors.cpp index 8d051c735..0c9563261 100644 --- a/Minecraft.World/ItemDispenseBehaviors.cpp +++ b/Minecraft.World/ItemDispenseBehaviors.cpp @@ -104,7 +104,7 @@ shared_ptr SpawnEggDispenseBehavior::execute(BlockSource *source, shared_ptr entity = SpawnEggItem::spawnMobAt(source->getWorld(), dispensed->getAuxValue(), spawnX, spawnY, spawnZ, &iResult); // 4J-JEV: Added in-case spawn limit is encountered. - if (entity == NULL) + if (entity == nullptr) { outcome = LEFT_ITEM; return dispensed; diff --git a/Minecraft.World/ItemEntity.cpp b/Minecraft.World/ItemEntity.cpp index c012a9123..e1cc92755 100644 --- a/Minecraft.World/ItemEntity.cpp +++ b/Minecraft.World/ItemEntity.cpp @@ -66,7 +66,7 @@ ItemEntity::ItemEntity(Level *level) : Entity( level ) void ItemEntity::defineSynchedData() { - getEntityData()->defineNULL(DATA_ITEM, NULL); + getEntityData()->defineNULL(DATA_ITEM, nullptr); } void ItemEntity::tick() @@ -192,7 +192,7 @@ bool ItemEntity::hurt(DamageSource *source, float damage) if (level->isClientSide ) return false; if (isInvulnerable()) return false; - if (getItem() != NULL && getItem()->id == Item::netherStar_Id && source->isExplosion()) return false; + if (getItem() != nullptr && getItem()->id == Item::netherStar_Id && source->isExplosion()) return false; markHurt(); health -= damage; if (health <= 0) @@ -206,7 +206,7 @@ void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag) { entityTag->putShort(L"Health", static_cast(health)); entityTag->putShort(L"Age", static_cast(age)); - if (getItem() != NULL) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag())); + if (getItem() != nullptr) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag())); } void ItemEntity::readAdditionalSaveData(CompoundTag *tag) @@ -215,7 +215,7 @@ void ItemEntity::readAdditionalSaveData(CompoundTag *tag) age = tag->getShort(L"Age"); CompoundTag *itemTag = tag->getCompound(L"Item"); setItem(ItemInstance::fromTag(itemTag)); - if (getItem() == NULL) remove(); + if (getItem() == nullptr) remove(); } void ItemEntity::playerTouch(shared_ptr player) @@ -280,9 +280,9 @@ shared_ptr ItemEntity::getItem() { shared_ptr result = getEntityData()->getItemInstance(DATA_ITEM); - if (result == NULL) + if (result == nullptr) { - if (level != NULL) + if (level != nullptr) { app.DebugPrintf("Item entity %d has no item?!\n", entityId); //level.getLogger().severe("Item entity " + entityId + " has no item?!"); diff --git a/Minecraft.World/ItemFrame.cpp b/Minecraft.World/ItemFrame.cpp index f8f4731b0..7f1e0dcbc 100644 --- a/Minecraft.World/ItemFrame.cpp +++ b/Minecraft.World/ItemFrame.cpp @@ -37,7 +37,7 @@ ItemFrame::ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir) : H void ItemFrame::defineSynchedData() { - getEntityData()->defineNULL(DATA_ITEM, NULL); + getEntityData()->defineNULL(DATA_ITEM, nullptr); getEntityData()->define(DATA_ROTATION, static_cast(0)); } @@ -52,7 +52,7 @@ void ItemFrame::dropItem(shared_ptr causedBy) { shared_ptr item = getItem(); - if (causedBy != NULL && causedBy->instanceof(eTYPE_PLAYER)) + if (causedBy != nullptr && causedBy->instanceof(eTYPE_PLAYER)) { if (dynamic_pointer_cast(causedBy)->abilities.instabuild) { @@ -62,7 +62,7 @@ void ItemFrame::dropItem(shared_ptr causedBy) } spawnAtLocation( shared_ptr(new ItemInstance(Item::frame) ), 0); - if ( (item != NULL) && (random->nextFloat() < dropChance) ) + if ( (item != nullptr) && (random->nextFloat() < dropChance) ) { item = item->copy(); removeFramedMap(item); @@ -72,7 +72,7 @@ void ItemFrame::dropItem(shared_ptr causedBy) void ItemFrame::removeFramedMap(shared_ptr item) { - if (item == NULL) return; + if (item == nullptr) return; if (item->id == Item::map_Id) { shared_ptr mapItemSavedData = Item::map->getSavedData(item, level); @@ -89,7 +89,7 @@ shared_ptr ItemFrame::getItem() void ItemFrame::setItem(shared_ptr item) { - if(item != NULL) + if(item != nullptr) { item = item->copy(); item->count = 1; @@ -112,7 +112,7 @@ void ItemFrame::setRotation(int rotation) void ItemFrame::addAdditonalSaveData(CompoundTag *tag) { - if (getItem() != NULL) + if (getItem() != nullptr) { tag->putCompound(L"Item", getItem()->save(new CompoundTag())); tag->putByte(L"ItemRotation", static_cast(getRotation())); @@ -124,7 +124,7 @@ void ItemFrame::addAdditonalSaveData(CompoundTag *tag) void ItemFrame::readAdditionalSaveData(CompoundTag *tag) { CompoundTag *itemTag = tag->getCompound(L"Item"); - if (itemTag != NULL && !itemTag->isEmpty()) + if (itemTag != nullptr && !itemTag->isEmpty()) { setItem(ItemInstance::fromTag(itemTag)); setRotation(tag->getByte(L"ItemRotation")); @@ -141,11 +141,11 @@ bool ItemFrame::interact(shared_ptr player) return false; } - if (getItem() == NULL) + if (getItem() == nullptr) { shared_ptr item = player->getCarriedItem(); - if (item != NULL) + if (item != nullptr) { if (!level->isClientSide)//isClientSide) { diff --git a/Minecraft.World/ItemInstance.cpp b/Minecraft.World/ItemInstance.cpp index e344e4cd6..5452b72c5 100644 --- a/Minecraft.World/ItemInstance.cpp +++ b/Minecraft.World/ItemInstance.cpp @@ -25,7 +25,7 @@ void ItemInstance::_init(int id, int count, int auxValue) this->id = id; this->count = count; this->auxValue = auxValue; - this->tag = NULL; + this->tag = nullptr; this->frame = nullptr; // 4J-PB - for trading menu this->m_bForceNumberDisplay=false; @@ -81,18 +81,18 @@ shared_ptr ItemInstance::fromTag(CompoundTag *itemTag) { shared_ptr itemInstance = shared_ptr(new ItemInstance()); itemInstance->load(itemTag); - return itemInstance->getItem() != NULL ? itemInstance : nullptr; + return itemInstance->getItem() != nullptr ? itemInstance : nullptr; } ItemInstance::~ItemInstance() { - if(tag != NULL) delete tag; + if(tag != nullptr) delete tag; } shared_ptr ItemInstance::remove(int count) { shared_ptr ii = shared_ptr( new ItemInstance(id, count, auxValue) ); - if (tag != NULL) ii->tag = static_cast(tag->copy()); + if (tag != nullptr) ii->tag = static_cast(tag->copy()); this->count -= count; // 4J Stu Fix for duplication glitch, make sure that item count is in range @@ -148,7 +148,7 @@ CompoundTag *ItemInstance::save(CompoundTag *compoundTag) compoundTag->putShort(L"id", static_cast(id)); compoundTag->putByte(L"Count", static_cast(count)); compoundTag->putShort(L"Damage", static_cast(auxValue)); - if (tag != NULL) compoundTag->put(L"tag", tag->copy()); + if (tag != nullptr) compoundTag->put(L"tag", tag->copy()); return compoundTag; } @@ -257,7 +257,7 @@ bool ItemInstance::hurt(int dmg, Random *random) void ItemInstance::hurtAndBreak(int dmg, shared_ptr owner) { shared_ptr player = dynamic_pointer_cast(owner); - if (player != NULL && player->abilities.instabuild) return; + if (player != nullptr && player->abilities.instabuild) return; if (!isDamageableItem()) return; if (hurt(dmg, owner->getRandom())) @@ -265,10 +265,10 @@ void ItemInstance::hurtAndBreak(int dmg, shared_ptr owner) owner->breakItem(shared_from_this()); count--; - if (player != NULL) + if (player != nullptr) { //player->awardStat(Stats::itemBroke[id], 1); - if (count == 0 && dynamic_cast( getItem() ) != NULL) + if (count == 0 && dynamic_cast( getItem() ) != nullptr) { player->removeSelectedItem(); } @@ -303,7 +303,7 @@ bool ItemInstance::interactEnemy(shared_ptr player, shared_ptr ItemInstance::copy() const { shared_ptr copy = shared_ptr( new ItemInstance(id, count, auxValue) ); - if (tag != NULL) + if (tag != nullptr) { copy->tag = static_cast(tag->copy()); } @@ -314,7 +314,7 @@ shared_ptr ItemInstance::copy() const ItemInstance *ItemInstance::copy_not_shared() const { ItemInstance *copy = new ItemInstance(id, count, auxValue); - if (tag != NULL) + if (tag != nullptr) { copy->tag = static_cast(tag->copy()); if (!copy->tag->equals(tag)) @@ -328,14 +328,14 @@ ItemInstance *ItemInstance::copy_not_shared() const // 4J Brought forward from 1.2 bool ItemInstance::tagMatches(shared_ptr a, shared_ptr b) { - if (a == NULL && b == NULL) return true; - if (a == NULL || b == NULL) return false; + if (a == nullptr && b == nullptr) return true; + if (a == nullptr || b == nullptr) return false; - if (a->tag == NULL && b->tag != NULL) + if (a->tag == nullptr && b->tag != nullptr) { return false; } - if (a->tag != NULL && !a->tag->equals(b->tag)) + if (a->tag != nullptr && !a->tag->equals(b->tag)) { return false; } @@ -344,8 +344,8 @@ bool ItemInstance::tagMatches(shared_ptr a, shared_ptr a, shared_ptr b) { - if (a == NULL && b == NULL) return true; - if (a == NULL || b == NULL) return false; + if (a == nullptr && b == nullptr) return true; + if (a == nullptr || b == nullptr) return false; return a->matches(b); } @@ -354,11 +354,11 @@ bool ItemInstance::matches(shared_ptr b) if (count != b->count) return false; if (id != b->id) return false; if (auxValue != b->auxValue) return false; - if (tag == NULL && b->tag != NULL) + if (tag == nullptr && b->tag != nullptr) { return false; } - if (tag != NULL && !tag->equals(b->tag)) + if (tag != nullptr && !tag->equals(b->tag)) { return false; } @@ -381,11 +381,11 @@ bool ItemInstance::sameItemWithTags(shared_ptr b) { if (id != b->id) return false; if (auxValue != b->auxValue) return false; - if (tag == NULL && b->tag != NULL) + if (tag == nullptr && b->tag != nullptr) { return false; } - if (tag != NULL && !tag->equals(b->tag)) + if (tag != nullptr && !tag->equals(b->tag)) { return false; } @@ -417,7 +417,7 @@ ItemInstance *ItemInstance::setDescriptionId(unsigned int id) shared_ptr ItemInstance::clone(shared_ptr item) { - return item == NULL ? nullptr : item->copy(); + return item == nullptr ? nullptr : item->copy(); } wstring ItemInstance::toString() @@ -426,9 +426,9 @@ wstring ItemInstance::toString() std::wostringstream oss; // 4J-PB - TODO - temp fix until ore recipe issue is fixed - if(Item::items[id]==NULL) + if(Item::items[id]==nullptr) { - oss << std::dec << count << L"x" << L" Item::items[id] is NULL " << L"@" << auxValue; + oss << std::dec << count << L"x" << L" Item::items[id] is nullptr " << L"@" << auxValue; } else { @@ -479,7 +479,7 @@ void ItemInstance::releaseUsing(Level *level, shared_ptr player, int dur // 4J Stu - Brought forward these functions for enchanting/game rules bool ItemInstance::hasTag() { - return tag != NULL; + return tag != nullptr; } CompoundTag *ItemInstance::getTag() @@ -489,9 +489,9 @@ CompoundTag *ItemInstance::getTag() ListTag *ItemInstance::getEnchantmentTags() { - if (tag == NULL) + if (tag == nullptr) { - return NULL; + return nullptr; } return static_cast *>(tag->get(L"ench")); } @@ -506,7 +506,7 @@ wstring ItemInstance::getHoverName() { wstring title = getItem()->getHoverName(shared_from_this()); - if (tag != NULL && tag->contains(L"display")) + if (tag != nullptr && tag->contains(L"display")) { CompoundTag *display = tag->getCompound(L"display"); @@ -521,14 +521,14 @@ wstring ItemInstance::getHoverName() void ItemInstance::setHoverName(const wstring &name) { - if (tag == NULL) tag = new CompoundTag(); + if (tag == nullptr) tag = new CompoundTag(); if (!tag->contains(L"display")) tag->putCompound(L"display", new CompoundTag()); tag->getCompound(L"display")->putString(L"Name", name); } void ItemInstance::resetHoverName() { - if (tag == NULL) return; + if (tag == nullptr) return; if (!tag->contains(L"display")) return; CompoundTag *display = tag->getCompound(L"display"); display->remove(L"Name"); @@ -539,14 +539,14 @@ void ItemInstance::resetHoverName() if (tag->isEmpty()) { - setTag(NULL); + setTag(nullptr); } } } bool ItemInstance::hasCustomHoverName() { - if (tag == NULL) return false; + if (tag == nullptr) return false; if (!tag->contains(L"display")) return false; return tag->getCompound(L"display")->contains(L"Name"); } @@ -598,14 +598,14 @@ vector *ItemInstance::getHoverText(shared_ptr player, bool a if (hasTag()) { ListTag *list = getEnchantmentTags(); - if (list != NULL) + if (list != nullptr) { for (int i = 0; i < list->size(); i++) { int type = list->get(i)->getShort((wchar_t *)TAG_ENCH_ID); int level = list->get(i)->getShort((wchar_t *)TAG_ENCH_LEVEL); - if (Enchantment::enchantments[type] != NULL) + if (Enchantment::enchantments[type] != nullptr) { wstring unformatted = L""; lines->push_back(Enchantment::enchantments[type]->getFullname(level)); @@ -693,14 +693,14 @@ vector *ItemInstance::getHoverTextOnly(shared_ptr player, bo if (hasTag()) { ListTag *list = getEnchantmentTags(); - if (list != NULL) + if (list != nullptr) { for (int i = 0; i < list->size(); i++) { int type = list->get(i)->getShort((wchar_t *)TAG_ENCH_ID); int level = list->get(i)->getShort((wchar_t *)TAG_ENCH_LEVEL); - if (Enchantment::enchantments[type] != NULL) + if (Enchantment::enchantments[type] != nullptr) { wstring unformatted = L""; lines->push_back(Enchantment::enchantments[type]->getFullname(level)); @@ -730,7 +730,7 @@ bool ItemInstance::isEnchantable() void ItemInstance::enchant(const Enchantment *enchantment, int level) { - if (tag == NULL) this->setTag(new CompoundTag()); + if (tag == nullptr) this->setTag(new CompoundTag()); if (!tag->contains(L"ench")) tag->put(L"ench", new ListTag(L"ench")); ListTag *list = static_cast *>(tag->get(L"ench")); @@ -742,13 +742,13 @@ void ItemInstance::enchant(const Enchantment *enchantment, int level) bool ItemInstance::isEnchanted() { - if (tag != NULL && tag->contains(L"ench")) return true; + if (tag != nullptr && tag->contains(L"ench")) return true; return false; } void ItemInstance::addTagElement(wstring name, Tag *tag) { - if (this->tag == NULL) + if (this->tag == nullptr) { setTag(new CompoundTag()); } @@ -762,7 +762,7 @@ bool ItemInstance::mayBePlacedInAdventureMode() bool ItemInstance::isFramed() { - return frame != NULL; + return frame != nullptr; } void ItemInstance::setFramed(shared_ptr frame) @@ -795,7 +795,7 @@ void ItemInstance::setRepairCost(int cost) attrAttrModMap *ItemInstance::getAttributeModifiers() { - attrAttrModMap *result = NULL; + attrAttrModMap *result = nullptr; if (hasTag() && tag->contains(L"AttributeModifiers")) { @@ -824,8 +824,8 @@ attrAttrModMap *ItemInstance::getAttributeModifiers() void ItemInstance::set4JData(int data) { - if(tag == NULL && data == 0) return; - if (tag == NULL) this->setTag(new CompoundTag()); + if(tag == nullptr && data == 0) return; + if (tag == nullptr) this->setTag(new CompoundTag()); if (tag->contains(L"4jdata")) { @@ -840,7 +840,7 @@ void ItemInstance::set4JData(int data) int ItemInstance::get4JData() { - if(tag == NULL || !tag->contains(L"4jdata")) return 0; + if(tag == nullptr || !tag->contains(L"4jdata")) return 0; else { IntTag *dataTag = static_cast(tag->get(L"4jdata")); diff --git a/Minecraft.World/JukeboxTile.cpp b/Minecraft.World/JukeboxTile.cpp index cf53a751b..387ad9f2e 100644 --- a/Minecraft.World/JukeboxTile.cpp +++ b/Minecraft.World/JukeboxTile.cpp @@ -31,7 +31,7 @@ void JukeboxTile::Entity::save(CompoundTag *tag) { TileEntity::save(tag); - if (getRecord() != NULL) + if (getRecord() != nullptr) { tag->putCompound(L"RecordItem", getRecord()->save(new CompoundTag())); @@ -63,7 +63,7 @@ void JukeboxTile::Entity::setRecord(shared_ptr record) JukeboxTile::JukeboxTile(int id) : BaseEntityTile(id, Material::wood) { - iconTop = NULL; + iconTop = nullptr; } Icon *JukeboxTile::getTexture(int face, int data) @@ -107,10 +107,10 @@ void JukeboxTile::dropRecording(Level *level, int x, int y, int z) if (level->isClientSide) return; shared_ptr rte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if( rte == NULL ) return; + if( rte == nullptr ) return; shared_ptr oldRecord = rte->getRecord(); - if (oldRecord == NULL) return; + if (oldRecord == nullptr) return; level->levelEvent(LevelEvent::SOUND_PLAY_RECORDING, x, y, z, 0); @@ -163,5 +163,5 @@ bool JukeboxTile::hasAnalogOutputSignal() int JukeboxTile::getAnalogOutputSignal(Level *level, int x, int y, int z, int dir) { shared_ptr record = dynamic_pointer_cast( level->getTileEntity(x, y, z))->getRecord(); - return record == NULL ? Redstone::SIGNAL_NONE : record->id + 1 - Item::record_01_Id; + return record == nullptr ? Redstone::SIGNAL_NONE : record->id + 1 - Item::record_01_Id; } \ No newline at end of file diff --git a/Minecraft.World/LakeFeature.cpp b/Minecraft.World/LakeFeature.cpp index ac240e612..a25a7ece3 100644 --- a/Minecraft.World/LakeFeature.cpp +++ b/Minecraft.World/LakeFeature.cpp @@ -24,8 +24,8 @@ bool LakeFeature::place(Level *level, Random *random, int x, int y, int z) bool grid[16*16*8] = {0}; - LevelGenerationOptions *levelGenOptions = NULL; - if( app.getLevelGenerationOptions() != NULL ) + LevelGenerationOptions *levelGenOptions = nullptr; + if( app.getLevelGenerationOptions() != nullptr ) { levelGenOptions = app.getLevelGenerationOptions(); diff --git a/Minecraft.World/LargeFireball.cpp b/Minecraft.World/LargeFireball.cpp index 9f8da92c7..48f199d9b 100644 --- a/Minecraft.World/LargeFireball.cpp +++ b/Minecraft.World/LargeFireball.cpp @@ -23,7 +23,7 @@ void LargeFireball::onHit(HitResult *res) { if (!level->isClientSide) { - if (res->entity != NULL) + if (res->entity != nullptr) { DamageSource *damageSource = DamageSource::fireball(dynamic_pointer_cast( shared_from_this() ), owner); res->entity->hurt(damageSource, 6); diff --git a/Minecraft.World/Layer.cpp b/Minecraft.World/Layer.cpp index 5187af7e0..b604cabca 100644 --- a/Minecraft.World/Layer.cpp +++ b/Minecraft.World/Layer.cpp @@ -123,7 +123,7 @@ Layer::Layer(__int64 seedMixup) void Layer::init(__int64 seed) { this->seed = seed; - if (parent != NULL) parent->init(seed); + if (parent != nullptr) parent->init(seed); this->seed *= this->seed * 6364136223846793005l + 1442695040888963407l; this->seed += seedMixup; this->seed *= this->seed * 6364136223846793005l + 1442695040888963407l; diff --git a/Minecraft.World/LeafTile.cpp b/Minecraft.World/LeafTile.cpp index 684618a78..d66c9bda3 100644 --- a/Minecraft.World/LeafTile.cpp +++ b/Minecraft.World/LeafTile.cpp @@ -17,7 +17,7 @@ const wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leave LeafTile::LeafTile(int id) : TransparentTile(id, Material::leaves, false, isSolidRender()) { - checkBuffer = NULL; + checkBuffer = nullptr; fancyTextureSet = 0; setTicking(true); } @@ -123,7 +123,7 @@ void LeafTile::tick(Level *level, int x, int y, int z, Random *random) int W = 32; int WW = W * W; int WO = W / 2; - if (checkBuffer == NULL) + if (checkBuffer == nullptr) { checkBuffer = new int[W * W * W]; } @@ -270,7 +270,7 @@ void LeafTile::spawnResources(Level *level, int x, int y, int z, int data, float void LeafTile::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) { - if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) + if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears->id) { player->awardStat( GenericStats::blocksMined(id), diff --git a/Minecraft.World/LeapAtTargetGoal.cpp b/Minecraft.World/LeapAtTargetGoal.cpp index 6aebc9a83..b559ef7db 100644 --- a/Minecraft.World/LeapAtTargetGoal.cpp +++ b/Minecraft.World/LeapAtTargetGoal.cpp @@ -15,7 +15,7 @@ LeapAtTargetGoal::LeapAtTargetGoal(Mob *mob, float yd) bool LeapAtTargetGoal::canUse() { target = weak_ptr(mob->getTarget()); - if (target.lock() == NULL) return false; + if (target.lock() == nullptr) return false; double d = mob->distanceToSqr(target.lock()); if (d < 2 * 2 || d > 4 * 4) return false; if (!mob->onGround) return false; @@ -25,7 +25,7 @@ bool LeapAtTargetGoal::canUse() bool LeapAtTargetGoal::canContinueToUse() { - return target.lock() != NULL && !mob->onGround; + return target.lock() != nullptr && !mob->onGround; } void LeapAtTargetGoal::start() diff --git a/Minecraft.World/LeashFenceKnotEntity.cpp b/Minecraft.World/LeashFenceKnotEntity.cpp index 55947d045..f952a5abb 100644 --- a/Minecraft.World/LeashFenceKnotEntity.cpp +++ b/Minecraft.World/LeashFenceKnotEntity.cpp @@ -70,14 +70,14 @@ bool LeashFenceKnotEntity::interact(shared_ptr player) shared_ptr item = player->getCarriedItem(); bool attachedMob = false; - if (item != NULL && item->id == Item::lead_Id) + if (item != nullptr && item->id == Item::lead_Id) { if (!level->isClientSide) { // look for entities that can be attached to the fence double range = 7; vector > *mobs = level->getEntitiesOfClass(typeid(Mob), AABB::newTemp(x - range, y - range, z - range, x + range, y + range, z + range)); - if (mobs != NULL) + if (mobs != nullptr) { for(auto& it : *mobs) { @@ -101,7 +101,7 @@ bool LeashFenceKnotEntity::interact(shared_ptr player) // if the player is in creative mode, attempt to remove all leashed mobs without dropping additional items double range = 7; vector > *mobs = level->getEntitiesOfClass(typeid(Mob), AABB::newTemp(x - range, y - range, z - range, x + range, y + range, z + range)); - if (mobs != NULL) + if (mobs != nullptr) { for(auto& it : *mobs) { @@ -122,7 +122,7 @@ bool LeashFenceKnotEntity::survives() { // knots are placed on top of fence tiles int tile = level->getTile(xTile, yTile, zTile); - if (Tile::tiles[tile] != NULL && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE) + if (Tile::tiles[tile] != nullptr && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE) { return true; } @@ -140,7 +140,7 @@ shared_ptr LeashFenceKnotEntity::createAndAddKnot(Level *l shared_ptr LeashFenceKnotEntity::findKnotAt(Level *level, int x, int y, int z) { vector > *knots = level->getEntitiesOfClass(typeid(LeashFenceKnotEntity), AABB::newTemp(x - 1.0, y - 1.0, z - 1.0, x + 1.0, y + 1.0, z + 1.0)); - if (knots != NULL) + if (knots != nullptr) { for (auto& it : *knots ) { diff --git a/Minecraft.World/LeashItem.cpp b/Minecraft.World/LeashItem.cpp index ddb7878b8..4de74a5cc 100644 --- a/Minecraft.World/LeashItem.cpp +++ b/Minecraft.World/LeashItem.cpp @@ -12,7 +12,7 @@ LeashItem::LeashItem(int id) : Item(id) bool LeashItem::useOn(shared_ptr itemInstance, shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly) { int tile = level->getTile(x, y, z); - if (Tile::tiles[tile] != NULL && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE) + if (Tile::tiles[tile] != nullptr && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE) { if (bTestUseOnOnly) return bindPlayerMobsTest(player, level, x,y,z); @@ -36,14 +36,14 @@ bool LeashItem::bindPlayerMobs(shared_ptr player, Level *level, int x, i bool foundMobs = false; double range = 7; vector > *mobs = level->getEntitiesOfClass(typeid(Mob), AABB::newTemp(x - range, y - range, z - range, x + range, y + range, z + range)); - if (mobs != NULL) + if (mobs != nullptr) { for(auto& it : *mobs) { shared_ptr mob = dynamic_pointer_cast(it); if (mob->isLeashed() && mob->getLeashHolder() == player) { - if (activeKnot == NULL) + if (activeKnot == nullptr) { activeKnot = LeashFenceKnotEntity::createAndAddKnot(level, x, y, z); } @@ -62,7 +62,7 @@ bool LeashItem::bindPlayerMobsTest(shared_ptr player, Level *level, int double range = 7; vector > *mobs = level->getEntitiesOfClass(typeid(Mob), AABB::newTemp(x - range, y - range, z - range, x + range, y + range, z + range)); - if (mobs != NULL) + if (mobs != nullptr) { for(auto& it : *mobs) { diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index 6b83d0aa8..54bc04353 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -109,7 +109,7 @@ inline int GetIndex(int x, int y, int z) void Level::initCachePartial(lightCache_t *cache, int xc, int yc, int zc) { cachewritten = false; - if( cache == NULL ) return; + if( cache == nullptr ) return; int idx; if( !(yc & 0xffffff00) ) @@ -180,7 +180,7 @@ void Level::initCacheComplete(lightCache_t *cache, int xc, int yc, int zc) // Set a brightness value, going through the cache if enabled for this thread void inline Level::setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness) { - if( cache == NULL ) + if( cache == nullptr ) { setBrightness(layer, x, y, z, brightness, true); return; @@ -243,7 +243,7 @@ void inline Level::setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse, // Get a brightness value, going through the cache if enabled for this thread inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety layer, int x, int y, int z) { - if( cache == NULL ) return getBrightness(layer, x, y, z); + if( cache == nullptr ) return getBrightness(layer, x, y, z); if( y & 0xffffff00 ) return getBrightness(layer, x, y, z); // Fall back on original method for out-of-bounds y int idx = ( ( x & 15 ) << 8 ) | @@ -311,7 +311,7 @@ inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety l // Get a block emission value, going through the cache if enabled for this thread inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, int z) { - if( cache == NULL ) return Tile::lightEmission[ct]; + if( cache == nullptr ) return Tile::lightEmission[ct]; int idx = ( ( x & 15 ) << 8 ) | ( ( y & 15 ) << 4 ) | @@ -382,7 +382,7 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i // Get a tile light blocking value, going through cache if enabled for this thread inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety layer, int *ct, int x, int y, int z) { - if( cache == NULL ) + if( cache == nullptr ) { int t = getTile(x,y,z); if(ct) *ct = t; @@ -561,17 +561,17 @@ void Level::_init() random = new Random(); isNew = false; - dimension = NULL; + dimension = nullptr; - chunkSource = NULL; + chunkSource = nullptr; levelStorage = nullptr; - levelData = NULL; + levelData = nullptr; isFindingSpawn = false; - savedDataStorage = NULL; + savedDataStorage = nullptr; spawnEnemies = true; @@ -604,9 +604,9 @@ Biome *Level::getBiome(int x, int z) if (hasChunkAt(x, 0, z)) { LevelChunk *lc = getChunkAt(x, z); - if (lc != NULL) + if (lc != nullptr) { - // Water chunks at the edge of the world return NULL for their biome as they can't store it, so should fall back on the normal method below + // Water chunks at the edge of the world return nullptr for their biome as they can't store it, so should fall back on the normal method below Biome *biome = lc->getBiome(x & 0xf, z & 0xf, dimension->biomeSource); if( biome ) return biome; } @@ -630,7 +630,7 @@ Level::Level(shared_ptr levelStorage, const wstring& name, Dimensi savedDataStorage = new SavedDataStorage(levelStorage.get()); shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); - if (savedVillages == NULL) + if (savedVillages == nullptr) { villages = shared_ptr(new Villages(this)); savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages); @@ -642,7 +642,7 @@ Level::Level(shared_ptr levelStorage, const wstring& name, Dimensi } dimension->init(this); - chunkSource = NULL; // 4J - added flag so chunk source can be called from derived class instead + chunkSource = nullptr; // 4J - added flag so chunk source can be called from derived class instead updateSkyBrightness(); prepareWeather(); @@ -651,7 +651,7 @@ Level::Level(shared_ptr levelStorage, const wstring& name, Dimensi Level::Level(shared_ptrlevelStorage, const wstring& levelName, LevelSettings *levelSettings) : seaLevel( constSeaLevel ) { - _init(levelStorage, levelName, levelSettings, NULL, true); + _init(levelStorage, levelName, levelSettings, nullptr, true); } @@ -668,7 +668,7 @@ void Level::_init(shared_ptrlevelStorage, const wstring& levelName savedDataStorage = new SavedDataStorage(levelStorage.get()); shared_ptr savedVillages = dynamic_pointer_cast(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID)); - if (savedVillages == NULL) + if (savedVillages == nullptr) { villages = shared_ptr(new Villages(this)); savedDataStorage->set(Villages::VILLAGE_FILE_ID, villages); @@ -680,14 +680,14 @@ void Level::_init(shared_ptrlevelStorage, const wstring& levelName } levelData = levelStorage->prepareLevel(); - isNew = levelData == NULL; + isNew = levelData == nullptr; - if (fixedDimension != NULL) + if (fixedDimension != nullptr) { dimension = fixedDimension; } // 4J Remove TU9 as getDimensions was never accurate. This path was never used anyway as we always set fixedDimension - //else if (levelData != NULL && levelData->getDimension() != 0) + //else if (levelData != nullptr && levelData->getDimension() != 0) //{ // dimension = Dimension::getNew(levelData->getDimension()); //} @@ -696,7 +696,7 @@ void Level::_init(shared_ptrlevelStorage, const wstring& levelName dimension = Dimension::getNew(0); } - if (levelData == NULL) + if (levelData == nullptr) { levelData = new LevelData(levelSettings, levelName); } @@ -708,7 +708,7 @@ void Level::_init(shared_ptrlevelStorage, const wstring& levelName ((Dimension *) dimension)->init( this ); - chunkSource = doCreateChunkSource ? createChunkSource() : NULL; // 4J - added flag so chunk source can be called from derived class instead + chunkSource = doCreateChunkSource ? createChunkSource() : nullptr; // 4J - added flag so chunk source can be called from derived class instead // 4J Stu- Moved to derived classes //if (!levelData->isInitialized()) @@ -740,7 +740,7 @@ Level::~Level() DeleteCriticalSection(&m_checkLightCS); // 4J-PB - savedDataStorage is shared between overworld and nether levels in the server, so it will already have been deleted on the first level delete - if(savedDataStorage!=NULL) delete savedDataStorage; + if(savedDataStorage!=nullptr) delete savedDataStorage; DeleteCriticalSection(&m_entitiesCS); DeleteCriticalSection(&m_tileEntityListCS); @@ -807,7 +807,7 @@ bool Level::isEmptyTile(int x, int y, int z) bool Level::isEntityTile(int x, int y, int z) { int t = getTile(x, y, z); - if (Tile::tiles[t] != NULL && Tile::tiles[t]->isEntityTile()) + if (Tile::tiles[t] != nullptr && Tile::tiles[t]->isEntityTile()) { return true; } @@ -817,7 +817,7 @@ bool Level::isEntityTile(int x, int y, int z) int Level::getTileRenderShape(int x, int y, int z) { int t = getTile(x, y, z); - if (Tile::tiles[t] != NULL) + if (Tile::tiles[t] != nullptr) { return Tile::tiles[t]->getRenderShape(); } @@ -827,7 +827,7 @@ int Level::getTileRenderShape(int x, int y, int z) // 4J Added to slightly optimise and avoid getTile call if we already know the tile int Level::getTileRenderShape(int t) { - if (Tile::tiles[t] != NULL) + if (Tile::tiles[t] != nullptr) { return Tile::tiles[t]->getRenderShape(); } @@ -954,7 +954,7 @@ bool Level::setTileAndData(int x, int y, int z, int tile, int data, int updateFl { tileUpdated(x, y, z, oldTile); Tile *tobj = Tile::tiles[tile]; - if (tobj != NULL && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); + if (tobj != nullptr && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); } } return result; @@ -1011,7 +1011,7 @@ bool Level::setData(int x, int y, int z, int data, int updateFlags, bool forceUp { tileUpdated(x, y, z, tile); Tile *tobj = Tile::tiles[tile]; - if (tobj != NULL && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); + if (tobj != nullptr && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); } } return result; @@ -1145,7 +1145,7 @@ void Level::neighborChanged(int x, int y, int z, int type) int id = getTile(x, y, z); Tile *tile = Tile::tiles[id]; - if (tile != NULL) + if (tile != nullptr) { tile->neighborChanged(this, x, y, z, type); } @@ -1336,7 +1336,7 @@ int Level::getBrightness(LightLayer::variety layer, int x, int y, int z) int idx = ix * chunkSourceXZSize + iz; LevelChunk *c = chunkSourceCache[idx]; - if( c == NULL ) return (int)layer; + if( c == nullptr ) return (int)layer; if (y < 0) y = 0; if (y >= maxBuildHeight) y = maxBuildHeight - 1; @@ -1388,7 +1388,7 @@ void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety laye // 4J Stu - The java LightLayer was an enum class type with a member "surrounding" which is what we // were returning here. Surrounding has the same value as the enum value in our C++ code, so just cast // it to an int - if( c == NULL ) + if( c == nullptr ) { for( int i = 0; i < 6; i++ ) { @@ -1497,8 +1497,8 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid) HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) { - if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z)) return NULL; - if (Double::isNaN(b->x) || Double::isNaN(b->y) || Double::isNaN(b->z)) return NULL; + if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z)) return nullptr; + if (Double::isNaN(b->x) || Double::isNaN(b->y) || Double::isNaN(b->z)) return nullptr; int xTile1 = Mth::floor(b->x); int yTile1 = Mth::floor(b->y); @@ -1512,7 +1512,7 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) int t = getTile(xTile0, yTile0, zTile0); int data = getData(xTile0, yTile0, zTile0); Tile *tile = Tile::tiles[t]; - if (solidOnly && tile != NULL && tile->getAABB(this, xTile0, yTile0, zTile0) == NULL) + if (solidOnly && tile != nullptr && tile->getAABB(this, xTile0, yTile0, zTile0) == nullptr) { // No collision @@ -1520,15 +1520,15 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) else if (t > 0 && tile->mayPick(data, liquid)) { HitResult *r = tile->clip(this, xTile0, yTile0, zTile0, a, b); - if (r != NULL) return r; + if (r != nullptr) return r; } } int maxIterations = 200; while (maxIterations-- >= 0) { - if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z)) return NULL; - if (xTile0 == xTile1 && yTile0 == yTile1 && zTile0 == zTile1) return NULL; + if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z)) return nullptr; + if (xTile0 == xTile1 && yTile0 == yTile1 && zTile0 == zTile1) return nullptr; bool xClipped = true; bool yClipped = true; @@ -1614,7 +1614,7 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) int t = getTile(xTile0, yTile0, zTile0); int data = getData(xTile0, yTile0, zTile0); Tile *tile = Tile::tiles[t]; - if (solidOnly && tile != NULL && tile->getAABB(this, xTile0, yTile0, zTile0) == NULL) + if (solidOnly && tile != nullptr && tile->getAABB(this, xTile0, yTile0, zTile0) == nullptr) { // No collision @@ -1622,16 +1622,16 @@ HitResult *Level::clip(Vec3 *a, Vec3 *b, bool liquid, bool solidOnly) else if (t > 0 && tile->mayPick(data, liquid)) { HitResult *r = tile->clip(this, xTile0, yTile0, zTile0, a, b); - if (r != NULL) return r; + if (r != nullptr) return r; } } - return NULL; + return nullptr; } void Level::playEntitySound(shared_ptr entity, int iSound, float volume, float pitch) { - if(entity == NULL) return; + if(entity == nullptr) return; for (auto& listener : listeners) { // 4J-PB - if the entity is a local player, don't play the sound @@ -1650,7 +1650,7 @@ void Level::playEntitySound(shared_ptr entity, int iSound, float volume, void Level::playPlayerSound(shared_ptr entity, int iSound, float volume, float pitch) { - if (entity == NULL) return; + if (entity == nullptr) return; for (auto& listener : listeners) { listener->playSoundExceptPlayer(entity, iSound, entity->x, entity->y - entity->heightOffset, entity->z, volume, pitch); @@ -1703,7 +1703,7 @@ bool Level::addEntity(shared_ptr e) int xc = Mth::floor(e->x / 16); int zc = Mth::floor(e->z / 16); - if(e == NULL) + if(e == nullptr) { return false; } @@ -1892,7 +1892,7 @@ AABBList *Level::getCubes(shared_ptr source, AABB *box, bool noEntities/ for (int y = y0 - 1; y < y1; y++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL) + if (tile != nullptr) { tile->addAABBs(this, x, y, z, box, &boxes, source); } @@ -1938,13 +1938,13 @@ AABBList *Level::getCubes(shared_ptr source, AABB *box, bool noEntities/ for (auto& it : *ee) { AABB *collideBox = it->getCollideBox(); - if (collideBox != NULL && collideBox->intersects(box)) + if (collideBox != nullptr && collideBox->intersects(box)) { boxes.push_back(collideBox); } collideBox = source->getCollideAgainstBox(it); - if (collideBox != NULL && collideBox->intersects(box)) + if (collideBox != nullptr && collideBox->intersects(box)) { boxes.push_back(collideBox); } @@ -1975,7 +1975,7 @@ AABBList *Level::getTileCubes(AABB *box, bool blockAtEdge/* = false */) // { // Tile *tile = Tile::tiles[getTile(x, y, z)]; - // if (tile != NULL) + // if (tile != nullptr) // { // tile->addAABBs(this, x, y, z, box, &boxes); // } @@ -2087,7 +2087,7 @@ float Level::getTimeOfDay(float a) * getTimeOfDay and changed it before releasing (without * re-committing)... that should be the only difference // jeb */ - /* if (this != NULL) return 0.5f; */ + /* if (this != nullptr) return 0.5f; */ // 4J Added if so we can override timeOfDay without changing the time that affects ticking of things return dimension->getTimeOfDay(levelData->getDayTime(), a);; @@ -2303,7 +2303,7 @@ void Level::tickEntities() { shared_ptr e = entities.at(i); - if (e->riding != NULL) + if (e->riding != nullptr) { if (e->riding->removed || e->riding->rider.lock() != e) { @@ -2381,7 +2381,7 @@ void Level::tickEntities() if (hasChunk(te->x >> 4, te->z >> 4)) { LevelChunk *lc = getChunk(te->x >> 4, te->z >> 4); - if (lc != NULL) lc->removeTileEntity(te->x & 15, te->y, te->z & 15); + if (lc != nullptr) lc->removeTileEntity(te->x & 15, te->y, te->z & 15); } } else @@ -2437,7 +2437,7 @@ void Level::tickEntities() if (hasChunk(e->x >> 4, e->z >> 4)) { LevelChunk *lc = getChunk(e->x >> 4, e->z >> 4); - if (lc != NULL) lc->setTileEntity(e->x & 15, e->y, e->z & 15, e); + if (lc != nullptr) lc->setTileEntity(e->x & 15, e->y, e->z & 15, e); } sendTileUpdated(e->x, e->y, e->z); @@ -2503,7 +2503,7 @@ void Level::tick(shared_ptr e, bool actual) #endif { e->tickCount++; - if (e->riding != NULL) + if (e->riding != nullptr) { e->rideTick(); } @@ -2550,7 +2550,7 @@ void Level::tick(shared_ptr e, bool actual) if (actual && e->inChunk) { - if (e->rider.lock() != NULL) + if (e->rider.lock() != nullptr) { if (e->rider.lock()->removed || e->rider.lock()->riding != e) { @@ -2600,7 +2600,7 @@ bool Level::containsAnyBlocks(AABB *box) for (int z = z0; z < z1; z++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL) + if (tile != nullptr) { return true; } @@ -2627,7 +2627,7 @@ bool Level::containsAnyLiquid(AABB *box) for (int z = z0; z < z1; z++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL && tile->material->isLiquid()) + if (tile != nullptr && tile->material->isLiquid()) { return true; } @@ -2657,7 +2657,7 @@ bool Level::containsAnyLiquid_NoLoad(AABB *box) { if( !hasChunkAt(x,y,z) ) return true; // If we don't have it, it might be liquid... Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL && tile->material->isLiquid()) + if (tile != nullptr && tile->material->isLiquid()) { return true; } @@ -2715,7 +2715,7 @@ bool Level::checkAndHandleWater(AABB *box, Material *material, shared_ptrmaterial == material) + if (tile != nullptr && tile->material == material) { double yt0 = y + 1 - LiquidTile::getHeight(getData(x, y, z)); if (y1 >= yt0) @@ -2755,7 +2755,7 @@ bool Level::containsMaterial(AABB *box, Material *material) for (int z = z0; z < z1; z++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL && tile->material == material) + if (tile != nullptr && tile->material == material) { return true; } @@ -2782,7 +2782,7 @@ bool Level::containsLiquid(AABB *box, Material *material) for (int z = z0; z < z1; z++) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile != NULL && tile->material == material) + if (tile != nullptr && tile->material == material) { int data = getData(x, y, z); double yh1 = y + 1; @@ -2834,7 +2834,7 @@ float Level::getSeenPercent(Vec3 *center, AABB *bb) double y = bb->y0 + (bb->y1 - bb->y0) * yy; double z = bb->z0 + (bb->z1 - bb->z0) * zz; HitResult *res = clip(Vec3::newTemp(x, y, z), center); - if ( res == NULL) hits++; + if ( res == nullptr) hits++; delete res; count++; } @@ -2908,16 +2908,16 @@ shared_ptr Level::getTileEntity(int x, int y, int z) LeaveCriticalSection(&m_tileEntityListCS); } - if (tileEntity == NULL) + if (tileEntity == nullptr) { LevelChunk *lc = getChunk(x >> 4, z >> 4); - if (lc != NULL) + if (lc != nullptr) { tileEntity = lc->getTileEntity(x & 15, y, z & 15); } } - if (tileEntity == NULL) + if (tileEntity == nullptr) { EnterCriticalSection(&m_tileEntityListCS); for(auto& e : pendingTileEntities) @@ -2936,7 +2936,7 @@ shared_ptr Level::getTileEntity(int x, int y, int z) void Level::setTileEntity(int x, int y, int z, shared_ptr tileEntity) { - if (tileEntity != NULL && !tileEntity->isRemoved()) + if (tileEntity != nullptr && !tileEntity->isRemoved()) { EnterCriticalSection(&m_tileEntityListCS); if (updatingTileEntities) @@ -2967,7 +2967,7 @@ void Level::setTileEntity(int x, int y, int z, shared_ptr tileEntity tileEntityList.push_back(tileEntity); LevelChunk *lc = getChunk(x >> 4, z >> 4); - if (lc != NULL) lc->setTileEntity(x & 15, y, z & 15, tileEntity); + if (lc != nullptr) lc->setTileEntity(x & 15, y, z & 15, tileEntity); } LeaveCriticalSection(&m_tileEntityListCS); } @@ -2977,7 +2977,7 @@ void Level::removeTileEntity(int x, int y, int z) { EnterCriticalSection(&m_tileEntityListCS); shared_ptr te = getTileEntity(x, y, z); - if (te != NULL && updatingTileEntities) + if (te != nullptr && updatingTileEntities) { te->setRemoved(); auto it = find(pendingTileEntities.begin(), pendingTileEntities.end(), te); @@ -2988,7 +2988,7 @@ void Level::removeTileEntity(int x, int y, int z) } else { - if (te != NULL) + if (te != nullptr) { auto it = find(pendingTileEntities.begin(), pendingTileEntities.end(), te); if( it != pendingTileEntities.end() ) @@ -3002,7 +3002,7 @@ void Level::removeTileEntity(int x, int y, int z) } } LevelChunk *lc = getChunk(x >> 4, z >> 4); - if (lc != NULL) lc->removeTileEntity(x & 15, y, z & 15); + if (lc != nullptr) lc->removeTileEntity(x & 15, y, z & 15); } LeaveCriticalSection(&m_tileEntityListCS); } @@ -3015,7 +3015,7 @@ void Level::markForRemoval(shared_ptr entity) bool Level::isSolidRenderTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile == NULL) return false; + if (tile == nullptr) return false; // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so // blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by @@ -3031,7 +3031,7 @@ bool Level::isSolidRenderTile(int x, int y, int z) for( int i = 0; i < 6; i++ ) { int t = getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) + if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == nullptr ) || !Tile::tiles[t]->isSolidRender() ) ) { return false; } @@ -3061,25 +3061,25 @@ bool Level::isSolidBlockingTileInLoadedChunk(int x, int y, int z, bool valueIfNo return valueIfNotLoaded; } LevelChunk *chunk = chunkSource->getChunk(x >> 4, z >> 4); - if (chunk == NULL || chunk->isEmpty()) + if (chunk == nullptr || chunk->isEmpty()) { return valueIfNotLoaded; } Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile == NULL) return false; + if (tile == nullptr) return false; return tile->material->isSolidBlocking() && tile->isCubeShaped(); } bool Level::isFullAABBTile(int x, int y, int z) { int tile = getTile(x, y, z); - if (tile == 0 || Tile::tiles[tile] == NULL) + if (tile == 0 || Tile::tiles[tile] == nullptr) { return false; } AABB *aabb = Tile::tiles[tile]->getAABB(this, x, y, z); - return aabb != NULL && aabb->getSize() >= 1; + return aabb != nullptr && aabb->getSize() >= 1; } bool Level::isTopSolidBlocking(int x, int y, int z) @@ -3091,19 +3091,19 @@ bool Level::isTopSolidBlocking(int x, int y, int z) bool Level::isTopSolidBlocking(Tile *tile, int data) { - if (tile == NULL) return false; + if (tile == nullptr) return false; if (tile->material->isSolidBlocking() && tile->isCubeShaped()) return true; - if (dynamic_cast(tile) != NULL) + if (dynamic_cast(tile) != nullptr) { return (data & StairTile::UPSIDEDOWN_BIT) == StairTile::UPSIDEDOWN_BIT; } - if (dynamic_cast(tile) != NULL) + if (dynamic_cast(tile) != nullptr) { return (data & HalfSlabTile::TOP_SLOT_BIT) == HalfSlabTile::TOP_SLOT_BIT; } - if (dynamic_cast(tile) != NULL) return true; - if (dynamic_cast(tile) != NULL) return (data & TopSnowTile::HEIGHT_MASK) == TopSnowTile::MAX_HEIGHT + 1; + if (dynamic_cast(tile) != nullptr) return true; + if (dynamic_cast(tile) != nullptr) return (data & TopSnowTile::HEIGHT_MASK) == TopSnowTile::MAX_HEIGHT + 1; return false; } @@ -3320,7 +3320,7 @@ void Level::tickClientSideTiles(int xo, int zo, LevelChunk *lc) if (id == 0 && this->getDaytimeRawBrightness(x, y, z) <= random->nextInt(8) && getBrightness(LightLayer::Sky, x, y, z) <= 0) { shared_ptr player = getNearestPlayer(x + 0.5, y + 0.5, z + 0.5, 8); - if (player != NULL && player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 2 * 2) + if (player != nullptr && player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) > 2 * 2) { // 4J-PB - Fixed issue with cave audio event having 2 sounds at 192k #ifdef _XBOX @@ -3471,7 +3471,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f // If we're in cached mode, then use memory allocated after the cached data itself for the toCheck array, in an attempt to make both that & the other cached data sit on the CPU L2 cache better. int *toCheck; - if( cache == NULL ) + if( cache == nullptr ) { toCheck = toCheckLevel; } @@ -3551,7 +3551,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f if( ( yy < 0 ) || ( yy >= maxBuildHeight ) ) continue; // 4J - some changes here brought forward from 1.2.3 - int block = max(1, getBlockingCached(cache, layer, NULL, xx, yy, zz) ); + int block = max(1, getBlockingCached(cache, layer, nullptr, xx, yy, zz) ); current = getBrightnessCached(cache, layer, xx, yy, zz); if ((current == expected - block) && (toCheckCount < (32 * 32 * 32))) // 4J - 32 * 32 * 32 was toCheck.length { @@ -3670,13 +3670,13 @@ bool Level::tickPendingTicks(bool force) vector *Level::fetchTicksInChunk(LevelChunk *chunk, bool remove) { - return NULL; + return nullptr; } vector > *Level::getEntities(shared_ptr except, AABB *bb) { - return getEntities(except, bb, NULL); + return getEntities(except, bb, nullptr); } vector > *Level::getEntities(shared_ptr except, AABB *bb, const EntitySelector *selector) @@ -3720,7 +3720,7 @@ vector > *Level::getEntities(shared_ptr except, AABB vector > *Level::getEntitiesOfClass(const type_info& baseClass, AABB *bb) { - return getEntitiesOfClass(baseClass, bb, NULL); + return getEntitiesOfClass(baseClass, bb, nullptr); } vector > *Level::getEntitiesOfClass(const type_info& baseClass, AABB *bb, const EntitySelector *selector) @@ -3814,7 +3814,7 @@ unsigned int Level::countInstanceOf(BaseObject::Class *clas) // 4J - added - more limited (but faster) version of above, used to count water animals, animals, monsters for the mob spawner // singleType flag should be true if we are just trying to match eINSTANCEOF exactly, and false if it is a eINSTANCEOF from a group (eTYPE_WATERANIMAL, eTYPE_ANIMAL, eTYPE_MONSTER) -unsigned int Level::countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount/* = NULL*/, unsigned int *couldWanderCount/* = NULL*/) +unsigned int Level::countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount/* = nullptr*/, unsigned int *couldWanderCount/* = nullptr*/) { unsigned int count = 0; if( protectedCount ) *protectedCount = 0; @@ -3932,16 +3932,16 @@ bool Level::mayPlace(int tileId, int x, int y, int z, bool ignoreEntities, int f Tile *tile = Tile::tiles[tileId]; AABB *aabb = tile->getAABB(this, x, y, z); - if (ignoreEntities) aabb = NULL; - if (aabb != NULL && !isUnobstructed(aabb, ignoreEntity)) return false; - if (targetTile != NULL && + if (ignoreEntities) aabb = nullptr; + if (aabb != nullptr && !isUnobstructed(aabb, ignoreEntity)) return false; + if (targetTile != nullptr && (targetTile == Tile::water || targetTile == Tile::calmWater || targetTile == Tile::lava || targetTile == Tile::calmLava || targetTile == Tile::fire || targetTile->material->isReplaceable())) { - targetTile = NULL; + targetTile = nullptr; } - if (targetTile != NULL && targetTile->material == Material::decoration && tile == Tile::anvil) return true; - if (tileId > 0 && targetTile == NULL) + if (targetTile != nullptr && targetTile->material == Material::decoration && tile == Tile::anvil) return true; + if (tileId > 0 && targetTile == nullptr) { if (tile->mayPlace(this, x, y, z, face, item)) { @@ -4519,7 +4519,7 @@ int Level::getHeight() Tickable *Level::makeSoundUpdater(shared_ptr minecart) { - return NULL; + return nullptr; } Random *Level::getRandomFor(int x, int z, int blend) diff --git a/Minecraft.World/Level.h b/Minecraft.World/Level.h index 6e6b28cd5..e147892ca 100644 --- a/Minecraft.World/Level.h +++ b/Minecraft.World/Level.h @@ -438,7 +438,7 @@ public: vector > getAllEntities(); void tileEntityChanged(int x, int y, int z, shared_ptr te); // unsigned int countInstanceOf(BaseObject::Class *clas); - unsigned int countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount = NULL, unsigned int *couldWanderCount = NULL); // 4J added + unsigned int countInstanceOf(eINSTANCEOF clas, bool singleType, unsigned int *protectedCount = nullptr, unsigned int *couldWanderCount = nullptr); // 4J added unsigned int countInstanceOfInRange(eINSTANCEOF clas, bool singleType, int range, int x, int y, int z); // 4J Added void addEntities(vector > *list); virtual void removeEntities(vector > *list); diff --git a/Minecraft.World/LevelChunk.cpp b/Minecraft.World/LevelChunk.cpp index 9d7e51317..e96ea3d8f 100644 --- a/Minecraft.World/LevelChunk.cpp +++ b/Minecraft.World/LevelChunk.cpp @@ -123,7 +123,7 @@ void LevelChunk::init(Level *level, int x, int z) #ifdef _LARGE_WORLDS m_bUnloaded = false; // 4J Added - m_unloadedEntitiesTag = NULL; + m_unloadedEntitiesTag = nullptr; #endif } @@ -132,10 +132,10 @@ LevelChunk::LevelChunk(Level *level, int x, int z) { init(level, x, z); lowerBlocks = new CompressedTileStorage(); - lowerData = NULL; - lowerSkyLight = NULL; - lowerBlockLight = NULL; - serverTerrainPopulated = NULL; + lowerData = nullptr; + lowerSkyLight = nullptr; + lowerBlockLight = nullptr; + serverTerrainPopulated = nullptr; if(Level::maxBuildHeight > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) { @@ -147,10 +147,10 @@ LevelChunk::LevelChunk(Level *level, int x, int z) } else { - upperBlocks = NULL; - upperData = NULL; - upperSkyLight = NULL; - upperBlockLight = NULL; + upperBlocks = nullptr; + upperData = nullptr; + upperSkyLight = nullptr; + upperBlockLight = nullptr; } #ifdef SHARING_ENABLED @@ -167,7 +167,7 @@ LevelChunk::LevelChunk(Level *level, byteArray blocks, int x, int z) // We'll be creating this as "empty" when this ctor is called on the client, as a result of a chunk becoming visible (but we don't have the data yet for it). // In this case, we want to keep memory usage down and so create all data as empty/compressed as possible. On the client we get the full data for the chunk as a single // update in a block region update packet, and so there is a single point where it is good to compress the data. - bool createEmpty = ( blocks.data == NULL ); + bool createEmpty = ( blocks.data == nullptr ); if( createEmpty ) { @@ -199,13 +199,13 @@ LevelChunk::LevelChunk(Level *level, byteArray blocks, int x, int z) } else { - upperBlocks = NULL; - upperData = NULL; - upperSkyLight = NULL; - upperBlockLight = NULL; + upperBlocks = nullptr; + upperData = nullptr; + upperSkyLight = nullptr; + upperBlockLight = nullptr; } - serverTerrainPopulated = NULL; + serverTerrainPopulated = nullptr; #ifdef SHARING_ENABLED sharingTilesAndData = false; #endif @@ -237,7 +237,7 @@ LevelChunk::LevelChunk(Level *level, int x, int z, LevelChunk *lc) this->data = new SparseDataStorage(lc->data); this->skyLight = new SparseLightStorage(lc->skyLight); this->blockLight = new SparseLightStorage(lc->blockLight); - serverTerrainPopulated = NULL; + serverTerrainPopulated = nullptr; #endif } @@ -296,8 +296,8 @@ void LevelChunk::stopSharingTilesAndData() } else { - upperBlocks = NULL; - upperData = NULL; + upperBlocks = nullptr; + upperData = nullptr; } /* @@ -939,7 +939,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) { // 4J Stu - Need to do this here otherwise double chests don't always work correctly shared_ptr te = getTileEntity(x, y, z); - if (te != NULL) + if (te != nullptr) { te->clearCache(); } @@ -1032,17 +1032,17 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) } } // AP - changed the method of EntityTile detection cos it's well slow on Vita mate - // if (_tile > 0 && dynamic_cast(Tile::tiles[_tile]) != NULL) - if (_tile > 0 && Tile::tiles[_tile] != NULL && Tile::tiles[_tile]->isEntityTile()) + // if (_tile > 0 && dynamic_cast(Tile::tiles[_tile]) != nullptr) + if (_tile > 0 && Tile::tiles[_tile] != nullptr && Tile::tiles[_tile]->isEntityTile()) { shared_ptr te = getTileEntity(x, y, z); - if (te == NULL) + if (te == nullptr) { te = dynamic_cast(Tile::tiles[_tile])->newTileEntity(level); //app.DebugPrintf("%s: Setting tile id %d, created tileEntity type %d\n", level->isClientSide?"Client":"Server", _tile, te->GetType()); level->setTileEntity(xOffs, y, zOffs, te); } - if (te != NULL) + if (te != nullptr) { //app.DebugPrintf("%s: Setting tile id %d, found tileEntity type %d\n", level->isClientSide?"Client":"Server", _tile, te->GetType()); te->clearCache(); @@ -1050,11 +1050,11 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) } } // AP - changed the method of EntityTile detection cos it's well slow on Vita mate - // else if (old > 0 && dynamic_cast(Tile::tiles[old]) != NULL) - else if (old > 0 && Tile::tiles[_tile] != NULL && Tile::tiles[_tile]->isEntityTile()) + // else if (old > 0 && dynamic_cast(Tile::tiles[old]) != nullptr) + else if (old > 0 && Tile::tiles[_tile] != nullptr && Tile::tiles[_tile]->isEntityTile()) { shared_ptr te = getTileEntity(x, y, z); - if (te != NULL) + if (te != nullptr) { te->clearCache(); } @@ -1091,10 +1091,10 @@ bool LevelChunk::setData(int x, int y, int z, int val, int mask, bool *maskedBit data->set(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z, val); int _tile = getTile(x, y, z); - if (_tile > 0 && dynamic_cast( Tile::tiles[_tile] ) != NULL) + if (_tile > 0 && dynamic_cast( Tile::tiles[_tile] ) != nullptr) { shared_ptr te = getTileEntity(x, y, z); - if (te != NULL) + if (te != nullptr) { te->clearCache(); te->data = val; @@ -1310,7 +1310,7 @@ shared_ptr LevelChunk::getTileEntity(int x, int y, int z) //EntityTile *et = (EntityTile *) Tile::tiles[t]; //et->onPlace(level, this->x * 16 + x, y, this->z * 16 + z); - //if (tileEntity == NULL) + //if (tileEntity == nullptr) //{ tileEntity = dynamic_cast(Tile::tiles[t])->newTileEntity(level); level->setTileEntity(this->x * 16 + x, y, this->z * 16 + z, tileEntity); @@ -1332,7 +1332,7 @@ shared_ptr LevelChunk::getTileEntity(int x, int y, int z) tileEntity = it->second; LeaveCriticalSection(&m_csTileEntities); } - if (tileEntity != NULL && tileEntity->isRemoved()) + if (tileEntity != nullptr && tileEntity->isRemoved()) { EnterCriticalSection(&m_csTileEntities); tileEntities.erase(pos); @@ -1398,7 +1398,7 @@ void LevelChunk::removeTileEntity(int x, int y, int z) { shared_ptr te = tileEntities[pos]; tileEntities.erase(pos); - if( te != NULL ) + if( te != nullptr ) { if(level->isClientSide) { @@ -1421,13 +1421,13 @@ void LevelChunk::load() if(m_bUnloaded && m_unloadedEntitiesTag) { ListTag *entityTags = (ListTag *) m_unloadedEntitiesTag->getList(L"Entities"); - if (entityTags != NULL) + if (entityTags != nullptr) { for (int i = 0; i < entityTags->size(); i++) { CompoundTag *teTag = entityTags->get(i); shared_ptr ent = EntityIO::loadStatic(teTag, level); - if (ent != NULL) + if (ent != nullptr) { ent->onLoadedFromSave(); addEntity(ent); @@ -1436,20 +1436,20 @@ void LevelChunk::load() } ListTag *tileEntityTags = (ListTag *) m_unloadedEntitiesTag->getList(L"TileEntities"); - if (tileEntityTags != NULL) + if (tileEntityTags != nullptr) { for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); shared_ptr te = TileEntity::loadStatic(teTag); - if (te != NULL) + if (te != nullptr) { addTileEntity(te); } } } delete m_unloadedEntitiesTag; - m_unloadedEntitiesTag = NULL; + m_unloadedEntitiesTag = nullptr; m_bUnloaded = false; } #endif @@ -1628,16 +1628,16 @@ void LevelChunk::getEntities(shared_ptr except, AABB *bb, vectorbb->intersects(bb) && (selector == NULL || selector->matches(e))) + if ( e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e))) { es.push_back(e); vector > *subs = e->getSubEntities(); - if (subs != NULL) + if (subs != nullptr) { for (const auto& sub : *subs) { e = sub; - if ( e && e != except && e->bb->intersects(bb) && (selector == NULL || selector->matches(e))) + if ( e && e != except && e->bb->intersects(bb) && (selector == nullptr || selector->matches(e))) { es.push_back(e); } @@ -1693,10 +1693,10 @@ void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vectorinstanceof(eTYPE_MINECART); else if ( ec==typeid(Monster) ) isAssignableFrom = e->instanceof(eTYPE_MONSTER); else if ( ec==typeid(Zombie) ) isAssignableFrom = e->instanceof(eTYPE_ZOMBIE); - else if(e != NULL && ec == typeid(*(e.get())) ) isAssignableFrom = true; + else if(e != nullptr && ec == typeid(*(e.get())) ) isAssignableFrom = true; if (isAssignableFrom && e->bb->intersects(bb)) { - if (selector == NULL || selector->matches(e)) + if (selector == nullptr || selector->matches(e)) { es.push_back(e); } @@ -1849,8 +1849,8 @@ int LevelChunk::setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; // 4J - replaced block storage as now uses CompressedTileStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlocks->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? NULL : tileUpdatedCallback, this, 0 ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlocks->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? NULL : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlocks->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? nullptr : tileUpdatedCallback, this, 0 ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlocks->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? nullptr : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); /* for (int x = x0; x < x1; x++) for (int z = z0; z < z1; z++) @@ -1864,8 +1864,8 @@ int LevelChunk::setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, recalcHeightmapOnly(); // 4J - replaced data storage as now uses SparseDataStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? NULL : tileUpdatedCallback, this, 0 ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? NULL : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? nullptr : tileUpdatedCallback, this, 0 ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? nullptr : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); if( includeLighting ) { @@ -2061,7 +2061,7 @@ Biome *LevelChunk::getBiome(int x, int z, BiomeSource *biomeSource) value = biome->id; biomes[(z << 4) | x] = static_cast(value & 0xff); } - if (Biome::biomes[value] == NULL) + if (Biome::biomes[value] == nullptr) { return Biome::plains; } @@ -2075,7 +2075,7 @@ byteArray LevelChunk::getBiomes() void LevelChunk::setBiomes(byteArray biomes) { - if(this->biomes.data != NULL) delete[] this->biomes.data; + if(this->biomes.data != nullptr) delete[] this->biomes.data; this->biomes = biomes; } @@ -2156,8 +2156,8 @@ void LevelChunk::getDataData(byteArray data) // Set data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setDataData(byteArray data) { - if( lowerData == NULL ) lowerData = new SparseDataStorage(); - if( upperData == NULL ) upperData = new SparseDataStorage(true); + if( lowerData == nullptr ) lowerData = new SparseDataStorage(); + if( upperData == nullptr ) upperData = new SparseDataStorage(true); lowerData->setData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperData->setData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } @@ -2179,8 +2179,8 @@ void LevelChunk::getBlockLightData(byteArray data) // Set sky light data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setSkyLightData(byteArray data) { - if( lowerSkyLight == NULL ) lowerSkyLight = new SparseLightStorage(true); - if( upperSkyLight == NULL ) upperSkyLight = new SparseLightStorage(true,true); + if( lowerSkyLight == nullptr ) lowerSkyLight = new SparseLightStorage(true); + if( upperSkyLight == nullptr ) upperSkyLight = new SparseLightStorage(true,true); lowerSkyLight->setData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperSkyLight->setData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } @@ -2188,8 +2188,8 @@ void LevelChunk::setSkyLightData(byteArray data) // Set block light data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setBlockLightData(byteArray data) { - if( lowerBlockLight == NULL ) lowerBlockLight = new SparseLightStorage(false); - if( upperBlockLight == NULL ) upperBlockLight = new SparseLightStorage(false, true); + if( lowerBlockLight == nullptr ) lowerBlockLight = new SparseLightStorage(false); + if( upperBlockLight == nullptr ) upperBlockLight = new SparseLightStorage(false, true); lowerBlockLight->setData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperBlockLight->setData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } @@ -2215,8 +2215,8 @@ void LevelChunk::compressLighting() void LevelChunk::compressBlocks() { #ifdef SHARING_ENABLED - CompressedTileStorage *blocksToCompressLower = NULL; - CompressedTileStorage *blocksToCompressUpper = NULL; + CompressedTileStorage *blocksToCompressLower = nullptr; + CompressedTileStorage *blocksToCompressUpper = nullptr; // If we're the host machine, and this is the client level, then we only want to do this if we are sharing data. This means that we will be compressing the data that is shared from the server. // No point trying to compress the local client copy of the data if the data is unshared, since we'll be throwing this data away again anyway once we share with the server again. @@ -2293,24 +2293,24 @@ void LevelChunk::readCompressedBlockData(DataInputStream *dis) void LevelChunk::readCompressedDataData(DataInputStream *dis) { - if( lowerData == NULL ) lowerData = new SparseDataStorage(); - if( upperData == NULL ) upperData = new SparseDataStorage(true); + if( lowerData == nullptr ) lowerData = new SparseDataStorage(); + if( upperData == nullptr ) upperData = new SparseDataStorage(true); lowerData->read(dis); upperData->read(dis); } void LevelChunk::readCompressedSkyLightData(DataInputStream *dis) { - if( lowerSkyLight == NULL ) lowerSkyLight = new SparseLightStorage(true); - if( upperSkyLight == NULL ) upperSkyLight = new SparseLightStorage(true,true); + if( lowerSkyLight == nullptr ) lowerSkyLight = new SparseLightStorage(true); + if( upperSkyLight == nullptr ) upperSkyLight = new SparseLightStorage(true,true); lowerSkyLight->read(dis); upperSkyLight->read(dis); } void LevelChunk::readCompressedBlockLightData(DataInputStream *dis) { - if( lowerBlockLight == NULL ) lowerBlockLight = new SparseLightStorage(false); - if( upperBlockLight == NULL ) upperBlockLight = new SparseLightStorage(false, true); + if( lowerBlockLight == nullptr ) lowerBlockLight = new SparseLightStorage(false); + if( upperBlockLight == nullptr ) upperBlockLight = new SparseLightStorage(false, true); lowerBlockLight->read(dis); upperBlockLight->read(dis); } @@ -2319,8 +2319,8 @@ void LevelChunk::readCompressedBlockLightData(DataInputStream *dis) void LevelChunk::compressData() { #ifdef SHARING_ENABLED - SparseDataStorage *dataToCompressLower = NULL; - SparseDataStorage *dataToCompressUpper = NULL; + SparseDataStorage *dataToCompressLower = nullptr; + SparseDataStorage *dataToCompressUpper = nullptr; // If we're the host machine, and this is the client level, then we only want to do this if we are sharing data. This means that we will be compressing the data that is shared from the server. // No point trying to compress the local client copy of the data if the data is unshared, since we'll be throwing this data away again anyway once we share with the server again. diff --git a/Minecraft.World/LevelData.cpp b/Minecraft.World/LevelData.cpp index a40602573..97f60bbc3 100644 --- a/Minecraft.World/LevelData.cpp +++ b/Minecraft.World/LevelData.cpp @@ -18,7 +18,7 @@ LevelData::LevelData(CompoundTag *tag) { wstring generatorName = tag->getString(L"generatorName"); m_pGenerator = LevelType::getLevelType(generatorName); - if (m_pGenerator == NULL) + if (m_pGenerator == nullptr) { m_pGenerator = LevelType::lvl_normal; } @@ -189,7 +189,7 @@ LevelData::LevelData(CompoundTag *tag) } else { - this->loadedPlayerTag = NULL; + this->loadedPlayerTag = nullptr; } */ dimension = 0; @@ -215,7 +215,7 @@ LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName) gameTime = -1; lastPlayed = 0; sizeOnDisk = 0; - // this->loadedPlayerTag = NULL; // 4J - we don't store this anymore + // this->loadedPlayerTag = nullptr; // 4J - we don't store this anymore dimension = 0; version = 0; rainTime = 0; @@ -432,7 +432,7 @@ __int64 LevelData::getSizeOnDisk() CompoundTag *LevelData::getLoadedPlayerTag() { - return NULL; // 4J - we don't store this anymore + return nullptr; // 4J - we don't store this anymore } // 4J Removed TU9 as it's never accurate due to the dimension never being set diff --git a/Minecraft.World/LevelSettings.cpp b/Minecraft.World/LevelSettings.cpp index dca8ce618..398e9cf49 100644 --- a/Minecraft.World/LevelSettings.cpp +++ b/Minecraft.World/LevelSettings.cpp @@ -3,10 +3,10 @@ #include "net.minecraft.world.level.storage.h" #include "LevelType.h" -GameType *GameType::NOT_SET = NULL; -GameType *GameType::SURVIVAL= NULL; -GameType *GameType::CREATIVE = NULL; -GameType *GameType::ADVENTURE = NULL; +GameType *GameType::NOT_SET = nullptr; +GameType *GameType::SURVIVAL= nullptr; +GameType *GameType::CREATIVE = nullptr; +GameType *GameType::ADVENTURE = nullptr; void GameType::staticCtor() { diff --git a/Minecraft.World/LevelStorage.h b/Minecraft.World/LevelStorage.h index 25d2aba2c..f0d2ac785 100644 --- a/Minecraft.World/LevelStorage.h +++ b/Minecraft.World/LevelStorage.h @@ -29,7 +29,7 @@ public: virtual wstring getLevelId() = 0; public: - virtual ConsoleSaveFile *getSaveFile() { return NULL; } + virtual ConsoleSaveFile *getSaveFile() { return nullptr; } virtual void flushSaveFile(bool autosave) {} // 4J Added diff --git a/Minecraft.World/LevelType.cpp b/Minecraft.World/LevelType.cpp index 30b081329..924c8ab40 100644 --- a/Minecraft.World/LevelType.cpp +++ b/Minecraft.World/LevelType.cpp @@ -14,14 +14,14 @@ // private boolean replacement; LevelType *LevelType::levelTypes[16];// = new LevelType[16]; -LevelType *LevelType::lvl_normal=NULL;// = new LevelType(0, "default", 1).setHasReplacement(); -LevelType *LevelType::lvl_flat=NULL;// = new LevelType(1, "flat"); -LevelType *LevelType::lvl_largeBiomes = NULL;// = new LevelType(2, "largeBiomes"); -LevelType *LevelType::lvl_normal_1_1=NULL;// = new LevelType(8, "default_1_1", 0).setSelectableByUser(false); +LevelType *LevelType::lvl_normal=nullptr;// = new LevelType(0, "default", 1).setHasReplacement(); +LevelType *LevelType::lvl_flat=nullptr;// = new LevelType(1, "flat"); +LevelType *LevelType::lvl_largeBiomes = nullptr;// = new LevelType(2, "largeBiomes"); +LevelType *LevelType::lvl_normal_1_1=nullptr;// = new LevelType(8, "default_1_1", 0).setSelectableByUser(false); void LevelType::staticCtor() { - for(int i=0;i<16;i++) levelTypes[i]=NULL; + for(int i=0;i<16;i++) levelTypes[i]=nullptr; lvl_normal = new LevelType(0, L"default", 1); lvl_normal->setHasReplacement(); lvl_flat = new LevelType(1, L"flat"); @@ -107,13 +107,13 @@ LevelType *LevelType::getLevelType(wstring name) { wstring genname=levelTypes[i]->m_generatorName; - if (levelTypes[i] != NULL && (genname.compare(name)==0)) + if (levelTypes[i] != nullptr && (genname.compare(name)==0)) { return levelTypes[i]; } } } - return NULL; + return nullptr; } int LevelType::getId() diff --git a/Minecraft.World/LeverTile.cpp b/Minecraft.World/LeverTile.cpp index eea9e3d32..7a7cdfd54 100644 --- a/Minecraft.World/LeverTile.cpp +++ b/Minecraft.World/LeverTile.cpp @@ -10,7 +10,7 @@ LeverTile::LeverTile(int id) : Tile(id, Material::decoration,isSolidRender()) AABB *LeverTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool LeverTile::blocksLight() diff --git a/Minecraft.World/LiquidTile.cpp b/Minecraft.World/LiquidTile.cpp index 2e098928d..be6c582d3 100644 --- a/Minecraft.World/LiquidTile.cpp +++ b/Minecraft.World/LiquidTile.cpp @@ -131,7 +131,7 @@ bool LiquidTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int f AABB *LiquidTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } int LiquidTile::getRenderShape() @@ -349,7 +349,7 @@ void LiquidTile::animateTick(Level *level, int x, int y, int z, Random *random) double LiquidTile::getSlopeAngle(LevelSource *level, int x, int y, int z, Material *m) { - Vec3 *flow = NULL; + Vec3 *flow = nullptr; if (m == Material::water) flow = ((LiquidTile *) Tile::water)->getFlow(level, x, y, z); if (m == Material::lava) flow = ((LiquidTile *) Tile::lava)->getFlow(level, x, y, z); if (flow->x == 0 && flow->z == 0) return -1000; @@ -425,5 +425,5 @@ Icon *LiquidTile::getTexture(const wstring &name) if (name.compare(TEXTURE_WATER_FLOW)==0) return Tile::water->icons[1]; if (name.compare(TEXTURE_LAVA_STILL)==0) return Tile::lava->icons[0]; if (name.compare(TEXTURE_LAVA_FLOW)==0) return Tile::lava->icons[1]; - return NULL; + return nullptr; } diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index c12f0a989..814a768c3 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -39,7 +39,7 @@ AttributeModifier *LivingEntity::SPEED_MODIFIER_SPRINTING = (new AttributeModifi void LivingEntity::_init() { - attributes = NULL; + attributes = nullptr; combatTracker = new CombatTracker(this); lastEquipment = ItemInstanceArray(5); @@ -126,7 +126,7 @@ LivingEntity::~LivingEntity() delete attributes; delete combatTracker; - if(lastEquipment.data != NULL) delete [] lastEquipment.data; + if(lastEquipment.data != nullptr) delete [] lastEquipment.data; } void LivingEntity::defineSynchedData() @@ -198,7 +198,7 @@ void LivingEntity::baseTick() if (isFireImmune() || level->isClientSide) clearFire(); shared_ptr thisPlayer = dynamic_pointer_cast(shared_from_this()); - bool isInvulnerable = (thisPlayer != NULL && thisPlayer->abilities.invulnerable); + bool isInvulnerable = (thisPlayer != nullptr && thisPlayer->abilities.invulnerable); if (isAlive() && isUnderLiquid(Material::water)) { @@ -253,13 +253,13 @@ void LivingEntity::baseTick() lastHurtByPlayer.reset(); } } - if (lastHurtMob != NULL && !lastHurtMob->isAlive()) + if (lastHurtMob != nullptr && !lastHurtMob->isAlive()) { lastHurtMob = nullptr; } // If lastHurtByMob is dead, remove it - if (lastHurtByMob != NULL && !lastHurtByMob->isAlive()) + if (lastHurtByMob != nullptr && !lastHurtByMob->isAlive()) { setLastHurtByMob(nullptr); } @@ -401,7 +401,7 @@ void LivingEntity::addAdditonalSaveData(CompoundTag *entityTag) for (unsigned int i = 0; i < items.length; ++i) { shared_ptr item = items[i]; - if (item != NULL) + if (item != nullptr) { attributes->removeItemModifiers(item); } @@ -412,7 +412,7 @@ void LivingEntity::addAdditonalSaveData(CompoundTag *entityTag) for (unsigned int i = 0; i < items.length; ++i) { shared_ptr item = items[i]; - if (item != NULL) + if (item != nullptr) { attributes->addItemModifiers(item); } @@ -435,7 +435,7 @@ void LivingEntity::readAdditionalSaveData(CompoundTag *tag) { setAbsorptionAmount(tag->getFloat(L"AbsorptionAmount")); - if (tag->contains(L"Attributes") && level != NULL && !level->isClientSide) + if (tag->contains(L"Attributes") && level != nullptr && !level->isClientSide) { SharedMonsterAttributes::loadAttributes(getAttributes(), (ListTag *) tag->getList(L"Attributes")); } @@ -458,7 +458,7 @@ void LivingEntity::readAdditionalSaveData(CompoundTag *tag) else { Tag *healthTag = tag->get(L"Health"); - if (healthTag == NULL) + if (healthTag == nullptr) { setHealth(getMaxHealth()); } @@ -611,7 +611,7 @@ bool LivingEntity::hasEffect(MobEffect *effect) MobEffectInstance *LivingEntity::getEffect(MobEffect *effect) { - MobEffectInstance *effectInst = NULL; + MobEffectInstance *effectInst = nullptr; auto it = activeEffects.find(effect->id); if(it != activeEffects.end() ) effectInst = it->second; @@ -685,7 +685,7 @@ void LivingEntity::removeEffectNoUpdate(int effectId) if (it != activeEffects.end()) { MobEffectInstance *effect = it->second; - if(effect != NULL) + if(effect != nullptr) { delete effect; } @@ -699,7 +699,7 @@ void LivingEntity::removeEffect(int effectId) if (it != activeEffects.end()) { MobEffectInstance *effect = it->second; - if(effect != NULL) + if(effect != nullptr) { onEffectRemoved(effect); delete effect; @@ -757,8 +757,8 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) // Fix for #8823 - Gameplay: Confirmation that a monster or animal has taken damage from an attack is highly delayed // 4J Stu - Change to the fix to only show damage when attacked, rather than collision damage // Fix for #10299 - When in corners, passive mobs may show that they are taking damage. - // 4J Stu - Change to the fix for TU6, as source is never NULL due to changes in 1.8.2 to what source actually is - if (level->isClientSide && dynamic_cast(source) == NULL) return false; + // 4J Stu - Change to the fix for TU6, as source is never nullptr due to changes in 1.8.2 to what source actually is + if (level->isClientSide && dynamic_cast(source) == nullptr) return false; noActionTime = 0; if (getHealth() <= 0) return false; @@ -773,7 +773,7 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) return false; } - if ((source == DamageSource::anvil || source == DamageSource::fallingBlock) && getCarried(SLOT_HELM) != NULL) + if ((source == DamageSource::anvil || source == DamageSource::fallingBlock) && getCarried(SLOT_HELM) != nullptr) { getCarried(SLOT_HELM)->hurtAndBreak(static_cast(dmg * 4 + random->nextFloat() * dmg * 2.0f), dynamic_pointer_cast( shared_from_this() )); dmg *= 0.75f; @@ -801,7 +801,7 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) hurtDir = 0; shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != NULL) + if (sourceEntity != nullptr) { if ( sourceEntity->instanceof(eTYPE_LIVINGENTITY) ) { @@ -833,7 +833,7 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) { level->broadcastEntityEvent(shared_from_this(), EntityEvent::HURT); if (source != DamageSource::drown) markHurt(); - if (sourceEntity != NULL) + if (sourceEntity != nullptr) { double xd = sourceEntity->x - x; double zd = sourceEntity->z - z; @@ -888,9 +888,9 @@ void LivingEntity::die(DamageSource *source) { shared_ptr sourceEntity = source->getEntity(); shared_ptr killer = getKillCredit(); - if (deathScore >= 0 && killer != NULL) killer->awardKillScore(shared_from_this(), deathScore); + if (deathScore >= 0 && killer != nullptr) killer->awardKillScore(shared_from_this(), deathScore); - if (sourceEntity != NULL) sourceEntity->killed( dynamic_pointer_cast( shared_from_this() ) ); + if (sourceEntity != nullptr) sourceEntity->killed( dynamic_pointer_cast( shared_from_this() ) ); dead = true; @@ -899,7 +899,7 @@ void LivingEntity::die(DamageSource *source) int playerBonus = 0; shared_ptr player = nullptr; - if ( (sourceEntity != NULL) && sourceEntity->instanceof(eTYPE_PLAYER) ) + if ( (sourceEntity != nullptr) && sourceEntity->instanceof(eTYPE_PLAYER) ) { player = dynamic_pointer_cast(sourceEntity); playerBonus = EnchantmentHelper::getKillingLootBonus(dynamic_pointer_cast(player)); @@ -920,7 +920,7 @@ void LivingEntity::die(DamageSource *source) } // 4J-JEV, hook for Durango mobKill event. - if (player != NULL) + if (player != nullptr) { player->awardStat(GenericStats::killMob(),GenericStats::param_mobKill(player, dynamic_pointer_cast(shared_from_this()), source)); } @@ -1005,7 +1005,7 @@ void LivingEntity::causeFallDamage(float distance) { Entity::causeFallDamage(distance); MobEffectInstance *jumpBoost = getEffect(MobEffect::jump); - float padding = jumpBoost != NULL ? jumpBoost->getAmplifier() + 1 : 0; + float padding = jumpBoost != nullptr ? jumpBoost->getAmplifier() + 1 : 0; int dmg = static_cast(ceil(distance - 3 - padding)); if (dmg > 0) @@ -1050,7 +1050,7 @@ int LivingEntity::getArmorValue() for (unsigned int i = 0; i < items.length; ++i) { shared_ptr item = items[i]; - if (item != NULL && dynamic_cast(item->getItem()) != NULL) + if (item != nullptr && dynamic_cast(item->getItem()) != nullptr) { int baseProtection = static_cast(item->getItem())->defense; val += baseProtection; @@ -1131,9 +1131,9 @@ CombatTracker *LivingEntity::getCombatTracker() shared_ptr LivingEntity::getKillCredit() { - if (combatTracker->getKiller() != NULL) return combatTracker->getKiller(); - if (lastHurtByPlayer != NULL) return lastHurtByPlayer; - if (lastHurtByMob != NULL) return lastHurtByMob; + if (combatTracker->getKiller() != nullptr) return combatTracker->getKiller(); + if (lastHurtByPlayer != nullptr) return lastHurtByPlayer; + if (lastHurtByMob != nullptr) return lastHurtByMob; return nullptr; } @@ -1172,7 +1172,7 @@ void LivingEntity::swing() swingTime = -1; swinging = true; - if (dynamic_cast(level) != NULL) + if (dynamic_cast(level) != nullptr) { static_cast(level)->getTracker()->broadcast(shared_from_this(), shared_ptr( new AnimatePacket(shared_from_this(), AnimatePacket::SWING))); } @@ -1250,7 +1250,7 @@ AttributeInstance *LivingEntity::getAttribute(Attribute *attribute) BaseAttributeMap *LivingEntity::getAttributes() { - if (attributes == NULL) + if (attributes == nullptr) { attributes = new ServersideAttributeMap(); } @@ -1268,7 +1268,7 @@ void LivingEntity::setSprinting(bool value) Entity::setSprinting(value); AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); - if (speed->getModifier(eModifierId_MOB_SPRINTING) != NULL) + if (speed->getModifier(eModifierId_MOB_SPRINTING) != nullptr) { speed->removeModifier(eModifierId_MOB_SPRINTING); } @@ -1378,7 +1378,7 @@ void LivingEntity::travel(float xa, float ya) { #ifdef __PSVITA__ // AP - dynamic_pointer_cast is a non-trivial call - Player *thisPlayer = NULL; + Player *thisPlayer = nullptr; if( this->instanceof(eTYPE_PLAYER) ) { thisPlayer = (Player*) this; @@ -1603,9 +1603,9 @@ void LivingEntity::tick() if (!ItemInstance::matches(current, previous)) { static_cast(level)->getTracker()->broadcast(shared_from_this(), shared_ptr( new SetEquippedItemPacket(entityId, i, current))); - if (previous != NULL) attributes->removeItemModifiers(previous); - if (current != NULL) attributes->addItemModifiers(current); - lastEquipment[i] = current == NULL ? nullptr : current->copy(); + if (previous != nullptr) attributes->removeItemModifiers(previous); + if (current != nullptr) attributes->addItemModifiers(current); + lastEquipment[i] = current == nullptr ? nullptr : current->copy(); } } } @@ -1804,7 +1804,7 @@ void LivingEntity::pushEntities() { vector > *entities = level->getEntities(shared_from_this(), this->bb->grow(0.2f, 0, 0.2f)); - if (entities != NULL && !entities->empty()) + if (entities != nullptr && !entities->empty()) { for (auto& e : *entities) { @@ -1876,7 +1876,7 @@ void LivingEntity::take(shared_ptr e, int orgCount) bool LivingEntity::canSee(shared_ptr target) { HitResult *hres = level->clip(Vec3::newTemp(x, y + getHeadHeight(), z), Vec3::newTemp(target->x, target->y + target->getHeadHeight(), target->z)); - bool retVal = (hres == NULL); + bool retVal = (hres == nullptr); delete hres; return retVal; } @@ -1984,7 +1984,7 @@ void LivingEntity::setAbsorptionAmount(float absorptionAmount) Team *LivingEntity::getTeam() { - return NULL; + return nullptr; } bool LivingEntity::isAlliedTo(shared_ptr other) @@ -1994,7 +1994,7 @@ bool LivingEntity::isAlliedTo(shared_ptr other) bool LivingEntity::isAlliedTo(Team *other) { - if (getTeam() != NULL) + if (getTeam() != nullptr) { return getTeam()->isAlliedTo(other); } diff --git a/Minecraft.World/LivingEntity.h b/Minecraft.World/LivingEntity.h index 5869eeb29..ecc819df9 100644 --- a/Minecraft.World/LivingEntity.h +++ b/Minecraft.World/LivingEntity.h @@ -26,7 +26,7 @@ protected: public: // 4J-PB - added to replace (e instanceof Type), avoiding dynamic casts eINSTANCEOF GetType() { return eTYPE_LIVINGENTITY;} - static Entity *create(Level *level) { return NULL; } + static Entity *create(Level *level) { return nullptr; } private: static AttributeModifier *SPEED_MODIFIER_SPRINTING; diff --git a/Minecraft.World/LoginPacket.cpp b/Minecraft.World/LoginPacket.cpp index 97f25a677..3ae5fe46f 100644 --- a/Minecraft.World/LoginPacket.cpp +++ b/Minecraft.World/LoginPacket.cpp @@ -30,7 +30,7 @@ LoginPacket::LoginPacket() m_playerCapeId = 0; m_isGuest = false; m_newSeaLevel = false; - m_pLevelType = NULL; + m_pLevelType = nullptr; m_uiGamePrivileges = 0; m_xzSize = LEVEL_MAX_WIDTH; m_hellScale = HELL_LEVEL_MAX_SCALE; @@ -59,7 +59,7 @@ LoginPacket::LoginPacket(const wstring& userName, int clientVersion, PlayerUID o m_playerCapeId = capeId; m_isGuest = isGuest; m_newSeaLevel = false; - m_pLevelType = NULL; + m_pLevelType = nullptr; m_uiGamePrivileges = 0; m_xzSize = LEVEL_MAX_WIDTH; m_hellScale = HELL_LEVEL_MAX_SCALE; @@ -100,7 +100,7 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException userName = readUtf(dis, Player::MAX_NAME_LENGTH); wstring typeName = readUtf(dis, 16); m_pLevelType = LevelType::getLevelType(typeName); - if (m_pLevelType == NULL) + if (m_pLevelType == nullptr) { m_pLevelType = LevelType::lvl_normal; } @@ -135,7 +135,7 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException { dos->writeInt(clientVersion); writeUtf(userName, dos); - if (m_pLevelType == NULL) + if (m_pLevelType == nullptr) { writeUtf(L"", dos); } @@ -174,7 +174,7 @@ void LoginPacket::handle(PacketListener *listener) int LoginPacket::getEstimatedSize() { int length=0; - if (m_pLevelType != NULL) + if (m_pLevelType != nullptr) { length = static_cast(m_pLevelType->getGeneratorName().length()); } diff --git a/Minecraft.World/LookAtPlayerGoal.cpp b/Minecraft.World/LookAtPlayerGoal.cpp index dcf1ea4fa..a2e4786a5 100644 --- a/Minecraft.World/LookAtPlayerGoal.cpp +++ b/Minecraft.World/LookAtPlayerGoal.cpp @@ -29,7 +29,7 @@ bool LookAtPlayerGoal::canUse() { if (mob->getRandom()->nextFloat() >= probability) return false; - if (mob->getTarget() != NULL) + if (mob->getTarget() != nullptr) { lookAt = mob->getTarget(); } @@ -41,12 +41,12 @@ bool LookAtPlayerGoal::canUse() { lookAt = weak_ptr(mob->level->getClosestEntityOfClass(lookAtType, mob->bb->grow(lookDistance, 3, lookDistance), mob->shared_from_this())); } - return lookAt.lock() != NULL; + return lookAt.lock() != nullptr; } bool LookAtPlayerGoal::canContinueToUse() { - if (lookAt.lock() == NULL || !lookAt.lock()->isAlive()) return false; + if (lookAt.lock() == nullptr || !lookAt.lock()->isAlive()) return false; if (mob->distanceToSqr(lookAt.lock()) > lookDistance * lookDistance) return false; return lookTime > 0; } diff --git a/Minecraft.World/MakeLoveGoal.cpp b/Minecraft.World/MakeLoveGoal.cpp index d64ee9b13..c308e33cc 100644 --- a/Minecraft.World/MakeLoveGoal.cpp +++ b/Minecraft.World/MakeLoveGoal.cpp @@ -26,11 +26,11 @@ bool MakeLoveGoal::canUse() if (villager->getRandom()->nextInt(500) != 0) return false; village = level->villages->getClosestVillage(Mth::floor(villager->x), Mth::floor(villager->y), Mth::floor(villager->z), 0); - if (village.lock() == NULL) return false; + if (village.lock() == nullptr) return false; if (!villageNeedsMoreVillagers()) return false; shared_ptr mate = level->getClosestEntityOfClass(typeid(Villager), villager->bb->grow(8, 3, 8), villager->shared_from_this()); - if (mate == NULL) return false; + if (mate == nullptr) return false; partner = weak_ptr(dynamic_pointer_cast(mate)); if (partner.lock()->getAge() != 0) return false; @@ -53,7 +53,7 @@ void MakeLoveGoal::stop() bool MakeLoveGoal::canContinueToUse() { - return partner.lock() != NULL && loveMakingTime >= 0 && villageNeedsMoreVillagers() && villager->getAge() == 0; + return partner.lock() != nullptr && loveMakingTime >= 0 && villageNeedsMoreVillagers() && villager->getAge() == 0; } void MakeLoveGoal::tick() @@ -76,7 +76,7 @@ void MakeLoveGoal::tick() bool MakeLoveGoal::villageNeedsMoreVillagers() { shared_ptr _village = village.lock(); - if( _village == NULL ) return false; + if( _village == nullptr ) return false; if (!_village->isBreedTimerOk()) { diff --git a/Minecraft.World/MapItem.cpp b/Minecraft.World/MapItem.cpp index c02a8716e..af9792afb 100644 --- a/Minecraft.World/MapItem.cpp +++ b/Minecraft.World/MapItem.cpp @@ -24,7 +24,7 @@ shared_ptr MapItem::getSavedData(short idNum, Level *level) std::wstring id = wstring( L"map_" ) + std::to_wstring(idNum); shared_ptr mapItemSavedData = dynamic_pointer_cast(level->getSavedData(typeid(MapItemSavedData), id)); - if (mapItemSavedData == NULL) + if (mapItemSavedData == nullptr) { // 4J Stu - This call comes from ClientConnection, but i don't see why we should be trying to work out // the id again when it's passed as a param. In any case that won't work with the new map setup @@ -48,7 +48,7 @@ shared_ptr MapItem::getSavedData(shared_ptr item shared_ptr mapItemSavedData = dynamic_pointer_cast( level->getSavedData(typeid(MapItemSavedData), id ) ); bool newData = false; - if (mapItemSavedData == NULL) + if (mapItemSavedData == nullptr) { // 4J Stu - I don't see why we should be trying to work out the id again when it's passed as a param. // In any case that won't work with the new map setup @@ -295,7 +295,7 @@ shared_ptr MapItem::getUpdatePacket(shared_ptr itemInstanc { charArray data = MapItem::getSavedData(itemInstance, level)->getUpdatePacket(itemInstance, level, player); - if (data.data == NULL || data.length == 0) return nullptr; + if (data.data == nullptr || data.length == 0) return nullptr; shared_ptr retval = shared_ptr(new ComplexItemDataPacket(static_cast(Item::map->id), static_cast(itemInstance->getAuxValue()), data)); delete data.data; @@ -325,7 +325,7 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s shared_ptr data = getSavedData(itemInstance->getAuxValue(), level); // 4J Stu - We only have one map per player per dimension, so don't reset the one that they have // when a new one is created - if( data == NULL ) + if( data == nullptr ) { data = shared_ptr( new MapItemSavedData(id) ); } diff --git a/Minecraft.World/MapItemSavedData.cpp b/Minecraft.World/MapItemSavedData.cpp index 7bbc9f0b6..2495b4551 100644 --- a/Minecraft.World/MapItemSavedData.cpp +++ b/Minecraft.World/MapItemSavedData.cpp @@ -107,7 +107,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptrisFramed(); - if (lastSentDecorations.data == NULL || lastSentDecorations.length != data.length) + if (lastSentDecorations.data == nullptr || lastSentDecorations.length != data.length) { thesame = false; } @@ -125,7 +125,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(shared_ptrgetByteArray(L"colors"); //4J - if(colors.data != NULL) + if(colors.data != nullptr) { delete[] colors.data; } @@ -399,7 +399,7 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptrgetPlayerList(); for(auto& decorationPlayer : players->players) { - if(decorationPlayer!=NULL && decorationPlayer->dimension == this->dimension) + if(decorationPlayer!=nullptr && decorationPlayer->dimension == this->dimension) { float xd = static_cast(decorationPlayer->x - x) / (1 << scale); float yd = static_cast(decorationPlayer->z - z) / (1 << scale); diff --git a/Minecraft.World/Material.cpp b/Minecraft.World/Material.cpp index 9e201ad54..d17965dfb 100644 --- a/Minecraft.World/Material.cpp +++ b/Minecraft.World/Material.cpp @@ -6,39 +6,39 @@ #include "PortalMaterial.h" #include "WebMaterial.h"// 4J added, Java version just does a local alteration when instantiating the Material for webs to get the same thing -Material *Material::air = NULL; -Material *Material::grass = NULL; -Material *Material::dirt = NULL; -Material *Material::wood = NULL; -Material *Material::stone = NULL; -Material *Material::metal = NULL; -Material *Material::heavyMetal = NULL; -Material *Material::water = NULL; -Material *Material::lava = NULL; -Material *Material::leaves = NULL; -Material *Material::plant = NULL; -Material *Material::replaceable_plant = NULL; -Material *Material::sponge = NULL; -Material *Material::cloth = NULL; -Material *Material::fire = NULL; -Material *Material::sand = NULL; -Material *Material::decoration = NULL; -Material *Material::clothDecoration = NULL; -Material *Material::glass = NULL; -Material *Material::buildable_glass = NULL; -Material *Material::explosive = NULL; -Material *Material::coral = NULL; -Material *Material::ice = NULL; -Material *Material::topSnow = NULL; -Material *Material::snow = NULL; -Material *Material::cactus = NULL; -Material *Material::clay = NULL; -Material *Material::vegetable = NULL; -Material *Material::egg = NULL; -Material *Material::portal = NULL; -Material *Material::cake = NULL; -Material *Material::piston = NULL; -Material *Material::web = NULL; +Material *Material::air = nullptr; +Material *Material::grass = nullptr; +Material *Material::dirt = nullptr; +Material *Material::wood = nullptr; +Material *Material::stone = nullptr; +Material *Material::metal = nullptr; +Material *Material::heavyMetal = nullptr; +Material *Material::water = nullptr; +Material *Material::lava = nullptr; +Material *Material::leaves = nullptr; +Material *Material::plant = nullptr; +Material *Material::replaceable_plant = nullptr; +Material *Material::sponge = nullptr; +Material *Material::cloth = nullptr; +Material *Material::fire = nullptr; +Material *Material::sand = nullptr; +Material *Material::decoration = nullptr; +Material *Material::clothDecoration = nullptr; +Material *Material::glass = nullptr; +Material *Material::buildable_glass = nullptr; +Material *Material::explosive = nullptr; +Material *Material::coral = nullptr; +Material *Material::ice = nullptr; +Material *Material::topSnow = nullptr; +Material *Material::snow = nullptr; +Material *Material::cactus = nullptr; +Material *Material::clay = nullptr; +Material *Material::vegetable = nullptr; +Material *Material::egg = nullptr; +Material *Material::portal = nullptr; +Material *Material::cake = nullptr; +Material *Material::piston = nullptr; +Material *Material::web = nullptr; void Material::staticCtor() { diff --git a/Minecraft.World/MaterialColor.cpp b/Minecraft.World/MaterialColor.cpp index d14748b2a..5c4fa9d78 100644 --- a/Minecraft.World/MaterialColor.cpp +++ b/Minecraft.World/MaterialColor.cpp @@ -3,20 +3,20 @@ MaterialColor **MaterialColor::colors; -MaterialColor *MaterialColor::none = NULL; -MaterialColor *MaterialColor::grass = NULL; -MaterialColor *MaterialColor::sand = NULL; -MaterialColor *MaterialColor::cloth = NULL; -MaterialColor *MaterialColor::fire = NULL; -MaterialColor *MaterialColor::ice = NULL; -MaterialColor *MaterialColor::metal = NULL; -MaterialColor *MaterialColor::plant = NULL; -MaterialColor *MaterialColor::snow = NULL; -MaterialColor *MaterialColor::clay = NULL; -MaterialColor *MaterialColor::dirt = NULL; -MaterialColor *MaterialColor::stone = NULL; -MaterialColor *MaterialColor::water = NULL; -MaterialColor *MaterialColor::wood = NULL; +MaterialColor *MaterialColor::none = nullptr; +MaterialColor *MaterialColor::grass = nullptr; +MaterialColor *MaterialColor::sand = nullptr; +MaterialColor *MaterialColor::cloth = nullptr; +MaterialColor *MaterialColor::fire = nullptr; +MaterialColor *MaterialColor::ice = nullptr; +MaterialColor *MaterialColor::metal = nullptr; +MaterialColor *MaterialColor::plant = nullptr; +MaterialColor *MaterialColor::snow = nullptr; +MaterialColor *MaterialColor::clay = nullptr; +MaterialColor *MaterialColor::dirt = nullptr; +MaterialColor *MaterialColor::stone = nullptr; +MaterialColor *MaterialColor::water = nullptr; +MaterialColor *MaterialColor::wood = nullptr; void MaterialColor::staticCtor() { diff --git a/Minecraft.World/McRegionChunkStorage.cpp b/Minecraft.World/McRegionChunkStorage.cpp index 344ff6c7c..4b543de57 100644 --- a/Minecraft.World/McRegionChunkStorage.cpp +++ b/Minecraft.World/McRegionChunkStorage.cpp @@ -76,7 +76,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) #ifdef SPLIT_SAVES // If we can't find the chunk in the save file, then we should remove any entities we might have for that chunk - if(regionChunkInputStream == NULL) + if(regionChunkInputStream == nullptr) { __int64 index = ((__int64)(x) << 32) | (((__int64)(z))&0x00000000FFFFFFFF); @@ -89,11 +89,11 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) } #endif - LevelChunk *levelChunk = NULL; + LevelChunk *levelChunk = nullptr; if(m_saveFile->getOriginalSaveVersion() >= SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE) { - if (regionChunkInputStream != NULL) + if (regionChunkInputStream != nullptr) { MemSect(9); levelChunk = OldChunkStorage::load(level, regionChunkInputStream); @@ -106,14 +106,14 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) else { CompoundTag *chunkData; - if (regionChunkInputStream != NULL) + if (regionChunkInputStream != nullptr) { MemSect(8); chunkData = NbtIo::read((DataInput *)regionChunkInputStream); MemSect(0); } else { - return NULL; + return nullptr; } regionChunkInputStream->deleteChildStream(); @@ -125,7 +125,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) sprintf(buf,"Chunk file at %d, %d is missing level data, skipping\n",x, z); app.DebugPrintf(buf); delete chunkData; - return NULL; + return nullptr; } if (!chunkData->getCompound(L"Level")->contains(L"Blocks")) { @@ -133,7 +133,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) sprintf(buf,"Chunk file at %d, %d is missing block data, skipping\n",x, z); app.DebugPrintf(buf); delete chunkData; - return NULL; + return nullptr; } MemSect(9); levelChunk = OldChunkStorage::load(level, chunkData->getCompound(L"Level")); @@ -146,7 +146,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z) app.DebugPrintf(buf); delete levelChunk; delete chunkData; - return NULL; + return nullptr; // 4J Stu - We delete the data within OldChunkStorage::load, so we can never reload from it //chunkData->putInt(L"xPos", x); @@ -330,8 +330,8 @@ void McRegionChunkStorage::staticCtor() sprintf(threadName,"McRegion Save thread %d\n",i); SetThreadName(0, threadName); - //saveThreads[j] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); - s_saveThreads[i] = new C4JThread(runSaveThreadProc,NULL,threadName); + //saveThreads[j] = CreateThread(nullptr,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]); + s_saveThreads[i] = new C4JThread(runSaveThreadProc,nullptr,threadName); //app.DebugPrintf("Created new thread: %s\n",threadName); @@ -359,7 +359,7 @@ int McRegionChunkStorage::runSaveThreadProc(LPVOID lpParam) bool running = true; size_t lastQueueSize = 0; - DataOutputStream *dos = NULL; + DataOutputStream *dos = nullptr; while(running) { if( TryEnterCriticalSection(&cs_memory) ) @@ -382,7 +382,7 @@ int McRegionChunkStorage::runSaveThreadProc(LPVOID lpParam) PIXEndNamedEvent(); } delete dos; - dos = NULL; + dos = nullptr; EnterCriticalSection(&cs_memory); s_runningThreadCount--; diff --git a/Minecraft.World/McRegionLevelStorage.cpp b/Minecraft.World/McRegionLevelStorage.cpp index daf6a7ef2..ec472fad7 100644 --- a/Minecraft.World/McRegionLevelStorage.cpp +++ b/Minecraft.World/McRegionLevelStorage.cpp @@ -24,14 +24,14 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) { //File folder = getFolder(); - if (dynamic_cast(dimension) != NULL) + if (dynamic_cast(dimension) != nullptr) { if(app.GetResetNether()) { #ifdef SPLIT_SAVES vector *netherFiles = m_saveFile->getRegionFilesByDimension(1); - if(netherFiles!=NULL) + if(netherFiles!=nullptr) { DWORD bytesWritten = 0; for(auto& netherFile : *netherFiles) @@ -42,7 +42,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) } #else vector *netherFiles = m_saveFile->getFilesWithPrefix(LevelStorage::NETHER_FOLDER); - if(netherFiles!=NULL) + if(netherFiles!=nullptr) { for(auto& netherFile : *netherFiles) { @@ -74,7 +74,7 @@ ChunkStorage *McRegionLevelStorage::createChunkStorage(Dimension *dimension) vector *endFiles = m_saveFile->getFilesWithPrefix(LevelStorage::ENDER_FOLDER); // 4J-PB - There will be no End in early saves - if(endFiles!=NULL) + if(endFiles!=nullptr) { for(auto& endFile : *endFiles) { diff --git a/Minecraft.World/McRegionLevelStorageSource.cpp b/Minecraft.World/McRegionLevelStorageSource.cpp index d0aef97a4..d36706ead 100644 --- a/Minecraft.World/McRegionLevelStorageSource.cpp +++ b/Minecraft.World/McRegionLevelStorageSource.cpp @@ -51,12 +51,12 @@ vector *McRegionLevelStorageSource::getLevelList() wstring levelId = file->getName(); LevelData *levelData = getDataTagFor(levelId); - if (levelData != NULL) + if (levelData != nullptr) { bool requiresConversion = levelData->getVersion() != McRegionLevelStorage::MCREGION_VERSION_ID; wstring levelName = levelData->getLevelName(); - if (levelName.empty()) // 4J Jev TODO: levelName can't be NULL? if (levelName == NULL || isEmpty(levelName)) + if (levelName.empty()) // 4J Jev TODO: levelName can't be nullptr? if (levelName == nullptr || isEmpty(levelName)) { levelName = levelId; } @@ -83,7 +83,7 @@ bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const { // check if there is old file format level data LevelData *levelData = getDataTagFor(saveFile, levelId); - if (levelData == NULL || levelData->getVersion() != 0) + if (levelData == nullptr || levelData->getVersion() != 0) { delete levelData; return false; @@ -96,7 +96,7 @@ bool McRegionLevelStorageSource::isConvertible(ConsoleSaveFile *saveFile, const bool McRegionLevelStorageSource::requiresConversion(ConsoleSaveFile *saveFile, const wstring& levelId) { LevelData *levelData = getDataTagFor(saveFile, levelId); - if (levelData == NULL || levelData->getVersion() != 0) + if (levelData == nullptr || levelData->getVersion() != 0) { delete levelData; return false; diff --git a/Minecraft.World/MegaTreeFeature.cpp b/Minecraft.World/MegaTreeFeature.cpp index 0d01130f6..db4a336ac 100644 --- a/Minecraft.World/MegaTreeFeature.cpp +++ b/Minecraft.World/MegaTreeFeature.cpp @@ -15,7 +15,7 @@ bool MegaTreeFeature::place(Level *level, Random *random, int x, int y, int z) if (y < 1 || y + treeHeight + 1 > Level::maxBuildHeight) return false; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { PIXBeginNamedEvent(0, "MegaTreeFeature Checking intersects"); LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); diff --git a/Minecraft.World/MeleeAttackGoal.cpp b/Minecraft.World/MeleeAttackGoal.cpp index 7003609e2..5b7b01799 100644 --- a/Minecraft.World/MeleeAttackGoal.cpp +++ b/Minecraft.World/MeleeAttackGoal.cpp @@ -19,7 +19,7 @@ void MeleeAttackGoal::_init(PathfinderMob *mob, double speedModifier, bool track attackTime = 0; - path = NULL; + path = nullptr; timeToRecalcPath = 0; } @@ -36,24 +36,24 @@ MeleeAttackGoal::MeleeAttackGoal(PathfinderMob *mob, double speedModifier, bool MeleeAttackGoal::~MeleeAttackGoal() { - if(path != NULL) delete path; + if(path != nullptr) delete path; } bool MeleeAttackGoal::canUse() { shared_ptr target = mob->getTarget(); - if (target == NULL) return false; + if (target == nullptr) return false; if (!target->isAlive()) return false; - if (attackType != NULL && !target->instanceof(attackType)) return false; + if (attackType != eTYPE_NOTSET && !target->instanceof(attackType)) return false; delete path; path = mob->getNavigation()->createPath(target); - return path != NULL; + return path != nullptr; } bool MeleeAttackGoal::canContinueToUse() { shared_ptr target = mob->getTarget(); - if (target == NULL) return false; + if (target == nullptr) return false; if (!target->isAlive()) return false; if (!trackTarget) return !mob->getNavigation()->isDone(); if (!mob->isWithinRestriction(Mth::floor(target->x), Mth::floor(target->y), Mth::floor(target->z))) return false; @@ -63,7 +63,7 @@ bool MeleeAttackGoal::canContinueToUse() void MeleeAttackGoal::start() { mob->getNavigation()->moveTo(path, speedModifier); - path = NULL; + path = nullptr; timeToRecalcPath = 0; } @@ -91,6 +91,6 @@ void MeleeAttackGoal::tick() if (mob->distanceToSqr(target->x, target->bb->y0, target->z) > meleeRadiusSqr) return; if (attackTime > 0) return; attackTime = 20; - if (mob->getCarriedItem() != NULL) mob->swing(); + if (mob->getCarriedItem() != nullptr) mob->swing(); mob->doHurtTarget(target); } diff --git a/Minecraft.World/MelonTile.cpp b/Minecraft.World/MelonTile.cpp index 298ae61f0..be7cd98b8 100644 --- a/Minecraft.World/MelonTile.cpp +++ b/Minecraft.World/MelonTile.cpp @@ -6,7 +6,7 @@ MelonTile::MelonTile(int id) : Tile(id, Material::vegetable) { - iconTop = NULL; + iconTop = nullptr; } Icon *MelonTile::getTexture(int face, int data) diff --git a/Minecraft.World/MemoryChunkStorage.cpp b/Minecraft.World/MemoryChunkStorage.cpp index 249efdd9a..9ce5305dc 100644 --- a/Minecraft.World/MemoryChunkStorage.cpp +++ b/Minecraft.World/MemoryChunkStorage.cpp @@ -5,7 +5,7 @@ LevelChunk *MemoryChunkStorage::load(Level *level, int x, int z) //throws IOException { - return NULL; + return nullptr; } void MemoryChunkStorage::save(Level *level, LevelChunk *levelChunk) //throws IOException diff --git a/Minecraft.World/MemoryLevelStorage.cpp b/Minecraft.World/MemoryLevelStorage.cpp index 5a1d43bb5..5c5fe53d6 100644 --- a/Minecraft.World/MemoryLevelStorage.cpp +++ b/Minecraft.World/MemoryLevelStorage.cpp @@ -14,7 +14,7 @@ MemoryLevelStorage::MemoryLevelStorage() LevelData *MemoryLevelStorage::prepareLevel() { - return NULL; + return nullptr; } void MemoryLevelStorage::checkSession() @@ -54,7 +54,7 @@ bool MemoryLevelStorage::load(shared_ptr player) CompoundTag *MemoryLevelStorage::loadPlayerDataTag(const wstring& playerName) { - return NULL; + return nullptr; } ConsoleSavePath MemoryLevelStorage::getDataFile(const wstring& id) diff --git a/Minecraft.World/MemoryLevelStorageSource.cpp b/Minecraft.World/MemoryLevelStorageSource.cpp index db0cfa583..3028b3b19 100644 --- a/Minecraft.World/MemoryLevelStorageSource.cpp +++ b/Minecraft.World/MemoryLevelStorageSource.cpp @@ -29,7 +29,7 @@ void MemoryLevelStorageSource::clearAll() LevelData *MemoryLevelStorageSource::getDataTagFor(const wstring& levelId) { - return NULL; + return nullptr; } bool MemoryLevelStorageSource::isNewLevelIdAcceptable(const wstring& levelId) diff --git a/Minecraft.World/MerchantContainer.cpp b/Minecraft.World/MerchantContainer.cpp index 7ceb47455..b9c9bb529 100644 --- a/Minecraft.World/MerchantContainer.cpp +++ b/Minecraft.World/MerchantContainer.cpp @@ -11,7 +11,7 @@ MerchantContainer::MerchantContainer(shared_ptr player, shared_ptr MerchantContainer::getItem(unsigned int slot) shared_ptr MerchantContainer::removeItem(unsigned int slot, int count) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { if (slot == MerchantMenu::RESULT_SLOT) { @@ -71,7 +71,7 @@ bool MerchantContainer::isPaymentSlot(int slot) shared_ptr MerchantContainer::removeItemNoUpdate(int slot) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -83,7 +83,7 @@ shared_ptr MerchantContainer::removeItemNoUpdate(int slot) void MerchantContainer::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); if (isPaymentSlot(slot)) { updateSellItem(); @@ -135,37 +135,37 @@ void MerchantContainer::setChanged() void MerchantContainer::updateSellItem() { - activeRecipe = NULL; + activeRecipe = nullptr; shared_ptr buyItem1 = items[MerchantMenu::PAYMENT1_SLOT]; shared_ptr buyItem2 = items[MerchantMenu::PAYMENT2_SLOT]; - if (buyItem1 == NULL) + if (buyItem1 == nullptr) { buyItem1 = buyItem2; buyItem2 = nullptr; } - if (buyItem1 == NULL) + if (buyItem1 == nullptr) { setItem(MerchantMenu::RESULT_SLOT, nullptr); } else { MerchantRecipeList *offers = merchant->getOffers(player); - if (offers != NULL) + if (offers != nullptr) { MerchantRecipe *recipeFor = offers->getRecipeFor(buyItem1, buyItem2, selectionHint); - if (recipeFor != NULL && !recipeFor->isDeprecated()) + if (recipeFor != nullptr && !recipeFor->isDeprecated()) { activeRecipe = recipeFor; setItem(MerchantMenu::RESULT_SLOT, recipeFor->getSellItem()->copy()); } - else if (buyItem2 != NULL) + else if (buyItem2 != nullptr) { // try to switch recipeFor = offers->getRecipeFor(buyItem2, buyItem1, selectionHint); - if (recipeFor != NULL && !recipeFor->isDeprecated()) + if (recipeFor != nullptr && !recipeFor->isDeprecated()) { activeRecipe = recipeFor; setItem(MerchantMenu::RESULT_SLOT, recipeFor->getSellItem()->copy()); diff --git a/Minecraft.World/MerchantMenu.cpp b/Minecraft.World/MerchantMenu.cpp index 52ce34f9d..2fe9cf6aa 100644 --- a/Minecraft.World/MerchantMenu.cpp +++ b/Minecraft.World/MerchantMenu.cpp @@ -67,10 +67,10 @@ bool MerchantMenu::stillValid(shared_ptr player) shared_ptr MerchantMenu::quickMoveStack(shared_ptr player, int slotIndex) { shared_ptr clicked = nullptr; - Slot *slot = NULL; + Slot *slot = nullptr; if(slotIndex < slots.size()) slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); @@ -138,7 +138,7 @@ void MerchantMenu::removed(shared_ptr player) player->drop(item); } item = tradeContainer->removeItemNoUpdate(PAYMENT2_SLOT); - if (item != NULL) + if (item != nullptr) { player->drop(item); } diff --git a/Minecraft.World/MerchantRecipe.cpp b/Minecraft.World/MerchantRecipe.cpp index b772b0c71..9c30c36bb 100644 --- a/Minecraft.World/MerchantRecipe.cpp +++ b/Minecraft.World/MerchantRecipe.cpp @@ -54,7 +54,7 @@ shared_ptr MerchantRecipe::getBuyBItem() bool MerchantRecipe::hasSecondaryBuyItem() { - return buyB != NULL; + return buyB != nullptr; } shared_ptr MerchantRecipe::getSellItem() @@ -68,13 +68,13 @@ bool MerchantRecipe::isSame(MerchantRecipe *other) { return false; } - return (buyB == NULL && other->buyB == NULL) || (buyB != NULL && other->buyB != NULL && buyB->id == other->buyB->id); + return (buyB == nullptr && other->buyB == nullptr) || (buyB != nullptr && other->buyB != nullptr && buyB->id == other->buyB->id); } bool MerchantRecipe::isSameSameButBetter(MerchantRecipe *other) { // same deal, but cheaper - return isSame(other) && (buyA->count < other->buyA->count || (buyB != NULL && buyB->count < other->buyB->count)); + return isSame(other) && (buyA->count < other->buyA->count || (buyB != nullptr && buyB->count < other->buyB->count)); } int MerchantRecipe::getUses() @@ -136,7 +136,7 @@ CompoundTag *MerchantRecipe::createTag() CompoundTag *tag = new CompoundTag(); tag->putCompound(L"buy", buyA->save(new CompoundTag(L"buy"))); tag->putCompound(L"sell", sell->save(new CompoundTag(L"sell"))); - if (buyB != NULL) + if (buyB != nullptr) { tag->putCompound(L"buyB", buyB->save(new CompoundTag(L"buyB"))); } diff --git a/Minecraft.World/MerchantRecipeList.cpp b/Minecraft.World/MerchantRecipeList.cpp index d8f37c7f2..2a88da16d 100644 --- a/Minecraft.World/MerchantRecipeList.cpp +++ b/Minecraft.World/MerchantRecipeList.cpp @@ -25,25 +25,25 @@ MerchantRecipe *MerchantRecipeList::getRecipeFor(shared_ptr buyA, { // attempt to match vs the hint MerchantRecipe *r = m_recipes.at(selectionHint); - if (buyA->id == r->getBuyAItem()->id && ((buyB == NULL && !r->hasSecondaryBuyItem()) || (r->hasSecondaryBuyItem() && buyB != NULL && r->getBuyBItem()->id == buyB->id))) + if (buyA->id == r->getBuyAItem()->id && ((buyB == nullptr && !r->hasSecondaryBuyItem()) || (r->hasSecondaryBuyItem() && buyB != nullptr && r->getBuyBItem()->id == buyB->id))) { if (buyA->count >= r->getBuyAItem()->count && (!r->hasSecondaryBuyItem() || buyB->count >= r->getBuyBItem()->count)) { return r; } } - return NULL; + return nullptr; } for (int i = 0; i < m_recipes.size(); i++) { MerchantRecipe *r = m_recipes.at(i); if (buyA->id == r->getBuyAItem()->id && buyA->count >= r->getBuyAItem()->count - && ((!r->hasSecondaryBuyItem() && buyB == NULL) || (r->hasSecondaryBuyItem() && buyB != NULL && r->getBuyBItem()->id == buyB->id && buyB->count >= r->getBuyBItem()->count))) + && ((!r->hasSecondaryBuyItem() && buyB == nullptr) || (r->hasSecondaryBuyItem() && buyB != nullptr && r->getBuyBItem()->id == buyB->id && buyB->count >= r->getBuyBItem()->count))) { return r; } } - return NULL; + return nullptr; } bool MerchantRecipeList::addIfNewOrBetter(MerchantRecipe *recipe) @@ -74,13 +74,13 @@ MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptrid == r->getBuyAItem()->id && buy->count >= r->getBuyAItem()->count && sell->id == r->getSellItem()->id) { - if (!r->hasSecondaryBuyItem() || (buyB != NULL && buyB->id == r->getBuyBItem()->id && buyB->count >= r->getBuyBItem()->count)) + if (!r->hasSecondaryBuyItem() || (buyB != nullptr && buyB->id == r->getBuyBItem()->id && buyB->count >= r->getBuyBItem()->count)) { return r; } } } - return NULL; + return nullptr; } void MerchantRecipeList::writeToStream(DataOutputStream *stream) @@ -93,8 +93,8 @@ void MerchantRecipeList::writeToStream(DataOutputStream *stream) Packet::writeItem(r->getSellItem(), stream); shared_ptr buyBItem = r->getBuyBItem(); - stream->writeBoolean(buyBItem != NULL); - if (buyBItem != NULL) + stream->writeBoolean(buyBItem != nullptr); + if (buyBItem != nullptr) { Packet::writeItem(buyBItem, stream); } diff --git a/Minecraft.World/MerchantResultSlot.cpp b/Minecraft.World/MerchantResultSlot.cpp index fedbcc4ad..7a09d069a 100644 --- a/Minecraft.World/MerchantResultSlot.cpp +++ b/Minecraft.World/MerchantResultSlot.cpp @@ -42,7 +42,7 @@ void MerchantResultSlot::onTake(shared_ptr player, shared_ptrgetActiveRecipe(); - if (activeRecipe != NULL) + if (activeRecipe != nullptr) { shared_ptr item1 = slots->getItem(MerchantMenu::PAYMENT1_SLOT); shared_ptr item2 = slots->getItem(MerchantMenu::PAYMENT2_SLOT); @@ -76,15 +76,15 @@ bool MerchantResultSlot::removePaymentItemsIfMatching(MerchantRecipe *activeReci shared_ptr buyA = activeRecipe->getBuyAItem(); shared_ptr buyB = activeRecipe->getBuyBItem(); - if (a != NULL && a->id == buyA->id) + if (a != nullptr && a->id == buyA->id) { - if (buyB != NULL && b != NULL && buyB->id == b->id) + if (buyB != nullptr && b != nullptr && buyB->id == b->id) { a->count -= buyA->count; b->count -= buyB->count; return true; } - else if (buyB == NULL && b == NULL) + else if (buyB == nullptr && b == nullptr) { a->count -= buyA->count; return true; diff --git a/Minecraft.World/MineShaftFeature.cpp b/Minecraft.World/MineShaftFeature.cpp index d32af346a..ebf59025d 100644 --- a/Minecraft.World/MineShaftFeature.cpp +++ b/Minecraft.World/MineShaftFeature.cpp @@ -32,7 +32,7 @@ bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) { bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != NULL ) + if( levelGenOptions != nullptr ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Mineshaft); } diff --git a/Minecraft.World/MineShaftPieces.cpp b/Minecraft.World/MineShaftPieces.cpp index 3fda1bfcd..6f1d9adbd 100644 --- a/Minecraft.World/MineShaftPieces.cpp +++ b/Minecraft.World/MineShaftPieces.cpp @@ -44,7 +44,7 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list * if (randomSelection >= 80) { BoundingBox *crossingBox = MineShaftCrossing::findCrossing(pieces, random, footX, footY, footZ, direction); - if (crossingBox != NULL) + if (crossingBox != nullptr) { return new MineShaftCrossing(genDepth, random, crossingBox, direction); } @@ -52,7 +52,7 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list * else if (randomSelection >= 70) { BoundingBox *stairsBox = MineShaftStairs::findStairs(pieces, random, footX, footY, footZ, direction); - if (stairsBox != NULL) + if (stairsBox != nullptr) { return new MineShaftPieces::MineShaftStairs(genDepth, random, stairsBox, direction); } @@ -60,28 +60,28 @@ StructurePiece *MineShaftPieces::createRandomShaftPiece(list * else { BoundingBox *corridorBox = MineShaftCorridor::findCorridorSize(pieces, random, footX, footY, footZ, direction); - if (corridorBox != NULL) + if (corridorBox != nullptr) { return new MineShaftCorridor(genDepth, random, corridorBox, direction); } } - return NULL; + return nullptr; } StructurePiece *MineShaftPieces::generateAndAddPiece(StructurePiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { if (depth > MAX_DEPTH) { - return NULL; + return nullptr; } if (abs(footX - startPiece->getBoundingBox()->x0) > 5 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 5 * 16) { - return NULL; + return nullptr; } StructurePiece *newPiece = createRandomShaftPiece(pieces, random, footX, footY, footZ, direction, depth + 1); - if (newPiece != NULL) + if (newPiece != nullptr) { MemSect(50); pieces->push_back(newPiece); @@ -132,7 +132,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis break; } StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + pos, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 - 1, Direction::NORTH, depth); - if (child != NULL) + if (child != nullptr) { BoundingBox *childBox = child->getBoundingBox(); childEntranceBoxes.push_back(new BoundingBox(childBox->x0, childBox->y0, boundingBox->z0, childBox->x1, childBox->y1, boundingBox->z0 + 1)); @@ -149,7 +149,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis break; } StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + pos, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z1 + 1, Direction::SOUTH, depth); - if (child != NULL) + if (child != nullptr) { BoundingBox *childBox = child->getBoundingBox(); childEntranceBoxes.push_back(new BoundingBox(childBox->x0, childBox->y0, boundingBox->z1 - 1, childBox->x1, childBox->y1, boundingBox->z1)); @@ -166,7 +166,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis break; } StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 - 1, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 + pos, Direction::WEST, depth); - if (child != NULL) + if (child != nullptr) { BoundingBox *childBox = child->getBoundingBox(); childEntranceBoxes.push_back(new BoundingBox(boundingBox->x0, childBox->y0, childBox->z0, boundingBox->x0 + 1, childBox->y1, childBox->z1)); @@ -183,7 +183,7 @@ void MineShaftPieces::MineShaftRoom::addChildren(StructurePiece *startPiece, lis break; } StructurePiece *child = generateAndAddPiece(startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0 + random->nextInt(heightSpace) + 1, boundingBox->z0 + pos, Direction::EAST, depth); - if (child != NULL) + if (child != nullptr) { BoundingBox *childBox = child->getBoundingBox(); childEntranceBoxes.push_back(new BoundingBox(boundingBox->x1 - 1, childBox->y0, childBox->z0, boundingBox->x1, childBox->y1, childBox->z1)); @@ -304,7 +304,7 @@ BoundingBox *MineShaftPieces::MineShaftCorridor::findCorridorSize(list *pieces, Random *random) @@ -515,7 +515,7 @@ bool MineShaftPieces::MineShaftCorridor::postProcess(Level *level, Random *rando hasPlacedSpider = true; level->setTileAndData(x, y, newZ, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, newZ) ); - if (entity != NULL) entity->getSpawner()->setEntityId(L"CaveSpider"); + if (entity != nullptr) entity->getSpawner()->setEntityId(L"CaveSpider"); } } } @@ -605,10 +605,10 @@ BoundingBox *MineShaftPieces::MineShaftCrossing::findCrossing(list break; } - if (StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return box; diff --git a/Minecraft.World/Minecart.cpp b/Minecraft.World/Minecart.cpp index 43caf0a23..34076b126 100644 --- a/Minecraft.World/Minecart.cpp +++ b/Minecraft.World/Minecart.cpp @@ -44,7 +44,7 @@ void Minecart::_init() blocksBuilding = true; setSize(0.98f, 0.7f); heightOffset = bbHeight / 2.0f; - soundUpdater = NULL; + soundUpdater = nullptr; name = L""; // @@ -56,7 +56,7 @@ Minecart::Minecart(Level *level) : Entity( level ) { _init(); - //soundUpdater = level != NULL ? level->makeSoundUpdater(this) : NULL; + //soundUpdater = level != nullptr ? level->makeSoundUpdater(this) : nullptr; } Minecart::~Minecart() @@ -105,12 +105,12 @@ AABB *Minecart::getCollideAgainstBox(shared_ptr entity) { return entity->bb; } - return NULL; + return nullptr; } AABB *Minecart::getCollideBox() { - return NULL; + return nullptr; } bool Minecart::isPushable() @@ -145,7 +145,7 @@ bool Minecart::hurt(DamageSource *source, float hurtDamage) // 4J-JEV: Fix for #88212, // Untrusted players shouldn't be able to damage minecarts or boats. - if (dynamic_cast(source) != NULL) + if (dynamic_cast(source) != nullptr) { shared_ptr attacker = source->getDirectEntity(); @@ -163,14 +163,14 @@ bool Minecart::hurt(DamageSource *source, float hurtDamage) // 4J Stu - If someone is riding in this, then it can tick multiple times which causes the damage to // decrease too quickly. So just make the damage a bit higher to start with for similar behaviour // to an unridden one. Only do this change if the riding player is attacking it. - if( rider.lock() != NULL && rider.lock() == source->getEntity() ) hurtDamage += 1; + if( rider.lock() != nullptr && rider.lock() == source->getEntity() ) hurtDamage += 1; - bool creativePlayer = source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast(source->getEntity())->abilities.instabuild; + bool creativePlayer = source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER) && dynamic_pointer_cast(source->getEntity())->abilities.instabuild; if (creativePlayer || getDamage() > 20 * 2) { // 4J HEG - Fixed issue with player falling through the ground on destroying a minecart while riding (issue #160607) - if (rider.lock() != NULL) rider.lock()->ride(nullptr); + if (rider.lock() != nullptr) rider.lock()->ride(nullptr); if (!creativePlayer || hasCustomName()) { @@ -207,12 +207,12 @@ bool Minecart::isPickable() void Minecart::remove() { Entity::remove(); - //if (soundUpdater != NULL) soundUpdater->tick(); + //if (soundUpdater != nullptr) soundUpdater->tick(); } void Minecart::tick() { - //if (soundUpdater != NULL) soundUpdater->tick(); + //if (soundUpdater != nullptr) soundUpdater->tick(); // 4J - make minecarts (server-side) tick twice, to put things back to how they were when we were accidently ticking them twice for( int i = 0; i < 2; i++ ) { @@ -223,7 +223,7 @@ void Minecart::tick() outOfWorld(); } - if (!level->isClientSide && dynamic_cast(level) != NULL) + if (!level->isClientSide && dynamic_cast(level) != nullptr) { MinecraftServer *server = static_cast(level)->getServer(); int waitTime = getPortalWaitTime(); @@ -232,7 +232,7 @@ void Minecart::tick() { if (server->isNetherEnabled()) { - if (riding == NULL) + if (riding == nullptr) { if (portalTime++ >= waitTime) { @@ -344,7 +344,7 @@ void Minecart::tick() setRot(yRot, xRot); vector > *entities = level->getEntities(shared_from_this(), bb->grow(0.2f, 0, 0.2f)); - if (entities != NULL && !entities->empty()) + if (entities != nullptr && !entities->empty()) { for (auto& e : *entities) { @@ -361,7 +361,7 @@ void Minecart::tick() } } - if (rider.lock() != NULL) + if (rider.lock() != nullptr) { if (rider.lock()->removed) { @@ -454,7 +454,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl zd = pow * zD / dd; - if ( rider.lock() != NULL && rider.lock()->instanceof(eTYPE_LIVINGENTITY) ) + if ( rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_LIVINGENTITY) ) { shared_ptr living = dynamic_pointer_cast(rider.lock()); @@ -530,7 +530,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl double xdd = xd; double zdd = zd; - if (rider.lock() != NULL) + if (rider.lock() != nullptr) { xdd *= 0.75; zdd *= 0.75; @@ -554,7 +554,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl applyNaturalSlowdown(); Vec3 *newPos = getPos(x, y, z); - if (newPos != NULL && oldPos != NULL) + if (newPos != nullptr && oldPos != nullptr) { double speed = (oldPos->y - newPos->y) * 0.05; @@ -619,7 +619,7 @@ void Minecart::moveAlongTrack(int xt, int yt, int zt, double maxSpeed, double sl void Minecart::applyNaturalSlowdown() { - if (rider.lock() != NULL) + if (rider.lock() != nullptr) { xd *= 0.997f; yd *= 0; @@ -684,7 +684,7 @@ Vec3 *Minecart::getPosOffs(double x, double y, double z, double offs) return getPos(x, y, z); } - return NULL; + return nullptr; } Vec3 *Minecart::getPos(double x, double y, double z) @@ -756,7 +756,7 @@ Vec3 *Minecart::getPos(double x, double y, double z) if (yD > 0) y += 0.5; return Vec3::newTemp(x, y, z); } - return NULL; + return nullptr; } void Minecart::readAdditionalSaveData(CompoundTag *tag) @@ -776,7 +776,7 @@ void Minecart::addAdditonalSaveData(CompoundTag *tag) if (hasCustomDisplay()) { tag->putBoolean(L"CustomDisplayTile", true); - tag->putInt(L"DisplayTile", getDisplayTile() == NULL ? 0 : getDisplayTile()->id); + tag->putInt(L"DisplayTile", getDisplayTile() == nullptr ? 0 : getDisplayTile()->id); tag->putInt(L"DisplayData", getDisplayData()); tag->putInt(L"DisplayOffset", getDisplayOffset()); } @@ -796,7 +796,7 @@ void Minecart::push(shared_ptr e) if (e == rider.lock()) return; if ( e->instanceof(eTYPE_LIVINGENTITY) && !e->instanceof(eTYPE_PLAYER) && !e->instanceof(eTYPE_VILLAGERGOLEM) && (getType() == TYPE_RIDEABLE) && (xd * xd + zd * zd > 0.01) ) { - if ( (rider.lock() == NULL) && (e->riding == NULL) ) + if ( (rider.lock() == nullptr) && (e->riding == nullptr) ) { e->ride( shared_from_this() ); } @@ -844,7 +844,7 @@ void Minecart::push(shared_ptr e) double zdd = (e->zd + zd); shared_ptr cart = dynamic_pointer_cast(e); - if (cart != NULL && cart->getType() == TYPE_FURNACE && getType() != TYPE_FURNACE) + if (cart != nullptr && cart->getType() == TYPE_FURNACE && getType() != TYPE_FURNACE) { xd *= 0.2f; zd *= 0.2f; @@ -853,7 +853,7 @@ void Minecart::push(shared_ptr e) e->zd *= 0.95f; m_bHasPushedCartThisTick = true; } - else if (cart != NULL && cart->getType() != TYPE_FURNACE && getType() == TYPE_FURNACE) + else if (cart != nullptr && cart->getType() != TYPE_FURNACE && getType() == TYPE_FURNACE) { e->xd *= 0.2f; e->zd *= 0.2f; @@ -957,12 +957,12 @@ Tile *Minecart::getDisplayTile() { if (!hasCustomDisplay()) return getDefaultDisplayTile(); int id = getEntityData()->getInteger(DATA_ID_DISPLAY_TILE) & 0xFFFF; - return id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : NULL; + return id > 0 && id < Tile::TILE_NUM_COUNT ? Tile::tiles[id] : nullptr; } Tile *Minecart::getDefaultDisplayTile() { - return NULL; + return nullptr; } int Minecart::getDisplayData() @@ -996,7 +996,7 @@ void Minecart::setDisplayTile(int id) void Minecart::setDisplayData(int data) { Tile *tile = getDisplayTile(); - int id = tile == NULL ? 0 : tile->id; + int id = tile == nullptr ? 0 : tile->id; getEntityData()->set(DATA_ID_DISPLAY_TILE, (id & 0xFFFF) | (data << 16)); setCustomDisplay(true); diff --git a/Minecraft.World/MinecartContainer.cpp b/Minecraft.World/MinecartContainer.cpp index 54883281c..e1a7e002a 100644 --- a/Minecraft.World/MinecartContainer.cpp +++ b/Minecraft.World/MinecartContainer.cpp @@ -33,7 +33,7 @@ void MinecartContainer::destroy(DamageSource *source) for (int i = 0; i < getContainerSize(); i++) { shared_ptr item = getItem(i); - if (item != NULL) + if (item != nullptr) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -63,7 +63,7 @@ shared_ptr MinecartContainer::getItem(unsigned int slot) shared_ptr MinecartContainer::removeItem(unsigned int slot, int count) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { if (items[slot]->count <= count) { @@ -83,7 +83,7 @@ shared_ptr MinecartContainer::removeItem(unsigned int slot, int co shared_ptr MinecartContainer::removeItemNoUpdate(int slot) { - if (items[slot] != NULL) + if (items[slot] != nullptr) { shared_ptr item = items[slot]; items[slot] = nullptr; @@ -95,7 +95,7 @@ shared_ptr MinecartContainer::removeItemNoUpdate(int slot) void MinecartContainer::setItem(unsigned int slot, shared_ptr item) { items[slot] = item; - if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); } void MinecartContainer::setChanged() @@ -145,7 +145,7 @@ void MinecartContainer::remove() for (int i = 0; i < getContainerSize(); i++) { shared_ptr item = getItem(i); - if (item != NULL) + if (item != nullptr) { float xo = random->nextFloat() * 0.8f + 0.1f; float yo = random->nextFloat() * 0.8f + 0.1f; @@ -185,7 +185,7 @@ void MinecartContainer::addAdditonalSaveData(CompoundTag *base) for (int i = 0; i < items.length; i++) { - if (items[i] != NULL) + if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i)); diff --git a/Minecraft.World/MinecartFurnace.cpp b/Minecraft.World/MinecartFurnace.cpp index 838d8a272..b2ced6ed3 100644 --- a/Minecraft.World/MinecartFurnace.cpp +++ b/Minecraft.World/MinecartFurnace.cpp @@ -123,7 +123,7 @@ void MinecartFurnace::applyNaturalSlowdown() bool MinecartFurnace::interact(shared_ptr player) { shared_ptr selected = player->inventory->getSelected(); - if (selected != NULL && selected->id == Item::coal_Id) + if (selected != nullptr && selected->id == Item::coal_Id) { if (!player->abilities.instabuild && --selected->count == 0) player->inventory->setItem(player->inventory->selected, nullptr); fuel += SharedConstants::TICKS_PER_SECOND * 180; diff --git a/Minecraft.World/MinecartRideable.cpp b/Minecraft.World/MinecartRideable.cpp index a006a2bc1..5578fe3f4 100644 --- a/Minecraft.World/MinecartRideable.cpp +++ b/Minecraft.World/MinecartRideable.cpp @@ -23,8 +23,8 @@ MinecartRideable::MinecartRideable(Level *level, double x, double y, double z) : bool MinecartRideable::interact(shared_ptr player) { - if (rider.lock() != NULL && rider.lock()->instanceof(eTYPE_PLAYER) && rider.lock() != player) return true; - if (rider.lock() != NULL && rider.lock() != player) return false; + if (rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_PLAYER) && rider.lock() != player) return true; + if (rider.lock() != nullptr && rider.lock() != player) return false; if (!level->isClientSide) { player->ride(shared_from_this()); diff --git a/Minecraft.World/Mob.cpp b/Minecraft.World/Mob.cpp index 2d363c0b0..af49499ae 100644 --- a/Minecraft.World/Mob.cpp +++ b/Minecraft.World/Mob.cpp @@ -43,7 +43,7 @@ void Mob::_init() lookingAt = nullptr; lookTime = 0; target = nullptr; - sensing = NULL; + sensing = nullptr; equipment = ItemInstanceArray(5); dropChances = floatArray(5); @@ -58,7 +58,7 @@ void Mob::_init() _isLeashed = false; leashHolder = nullptr; - leashInfoTag = NULL; + leashInfoTag = nullptr; } Mob::Mob( Level* level) : LivingEntity(level) @@ -87,16 +87,16 @@ Mob::Mob( Level* level) : LivingEntity(level) Mob::~Mob() { - if(lookControl != NULL) delete lookControl; - if(moveControl != NULL) delete moveControl; - if(jumpControl != NULL) delete jumpControl; - if(bodyControl != NULL) delete bodyControl; - if(navigation != NULL) delete navigation; - if(sensing != NULL) delete sensing; + if(lookControl != nullptr) delete lookControl; + if(moveControl != nullptr) delete moveControl; + if(jumpControl != nullptr) delete jumpControl; + if(bodyControl != nullptr) delete bodyControl; + if(navigation != nullptr) delete navigation; + if(sensing != nullptr) delete sensing; - if(leashInfoTag != NULL) delete leashInfoTag; + if(leashInfoTag != nullptr) delete leashInfoTag; - if(equipment.data != NULL) delete [] equipment.data; + if(equipment.data != nullptr) delete [] equipment.data; delete [] dropChances.data; } @@ -196,7 +196,7 @@ int Mob::getExperienceReward(shared_ptr killedBy) ItemInstanceArray slots = getEquipmentSlots(); for (int i = 0; i < slots.length; i++) { - if (slots[i] != NULL && dropChances[i] <= 1) + if (slots[i] != nullptr && dropChances[i] <= 1) { result += 1 + random->nextInt(3); } @@ -280,7 +280,7 @@ void Mob::addAdditonalSaveData(CompoundTag *entityTag) for (int i = 0; i < equipment.length; i++) { CompoundTag *tag = new CompoundTag(); - if (equipment[i] != NULL) equipment[i]->save(tag); + if (equipment[i] != nullptr) equipment[i]->save(tag); gear->add(tag); } entityTag->put(L"Equipment", gear); @@ -296,7 +296,7 @@ void Mob::addAdditonalSaveData(CompoundTag *entityTag) // leash info entityTag->putBoolean(L"Leashed", _isLeashed); - if (leashHolder != NULL) + if (leashHolder != nullptr) { CompoundTag *leashTag = new CompoundTag(L"Leash"); if ( leashHolder->instanceof(eTYPE_LIVINGENTITY) ) @@ -372,7 +372,7 @@ void Mob::aiStep() for (auto& it : *entities) { shared_ptr entity = dynamic_pointer_cast(it); - if (entity->removed || entity->getItem() == NULL) continue; + if (entity->removed || entity->getItem() == nullptr) continue; shared_ptr item = entity->getItem(); int slot = getEquipmentSlotForItem(item); @@ -381,17 +381,17 @@ void Mob::aiStep() bool replace = true; shared_ptr current = getCarried(slot); - if (current != NULL) + if (current != nullptr) { if (slot == SLOT_WEAPON) { WeaponItem *newWeapon = dynamic_cast(item->getItem()); WeaponItem *oldWeapon = dynamic_cast(current->getItem()); - if ( newWeapon != NULL && oldWeapon == NULL) + if ( newWeapon != nullptr && oldWeapon == nullptr) { replace = true; } - else if (newWeapon != NULL && oldWeapon != NULL) + else if (newWeapon != nullptr && oldWeapon != nullptr) { if (newWeapon->getTierDamage() == oldWeapon->getTierDamage()) { @@ -411,11 +411,11 @@ void Mob::aiStep() { ArmorItem *newArmor = dynamic_cast(item->getItem()); ArmorItem *oldArmor = dynamic_cast(current->getItem()); - if (newArmor != NULL && oldArmor == NULL) + if (newArmor != nullptr && oldArmor == nullptr) { replace = true; } - else if (newArmor != NULL && oldArmor != NULL) + else if (newArmor != nullptr && oldArmor != nullptr) { if (newArmor->defense == oldArmor->defense) { @@ -435,7 +435,7 @@ void Mob::aiStep() if (replace) { - if (current != NULL && random->nextFloat() - 0.1f < dropChances[slot]) + if (current != nullptr && random->nextFloat() - 0.1f < dropChances[slot]) { spawnAtLocation(current, 0); } @@ -470,7 +470,7 @@ void Mob::checkDespawn() return; } shared_ptr player = level->getNearestPlayer(shared_from_this(), -1); - if (player != NULL) + if (player != nullptr) { double xd = player->x - x; double yd = player->y - y; @@ -547,7 +547,7 @@ void Mob::serverAiStep() if (random->nextFloat() < 0.02f) { shared_ptr player = level->getNearestPlayer(shared_from_this(), lookDistance); - if (player != NULL) + if (player != nullptr) { lookingAt = player; lookTime = 10 + random->nextInt(20); @@ -558,7 +558,7 @@ void Mob::serverAiStep() } } - if (lookingAt != NULL) + if (lookingAt != nullptr) { lookAt(lookingAt, 10.0f, static_cast(getMaxHeadXRot())); if (lookTime-- <= 0 || lookingAt->removed || lookingAt->distanceToSqr(shared_from_this()) > lookDistance * lookDistance) @@ -613,7 +613,7 @@ void Mob::lookAt(shared_ptr e, float yMax, float xMax) bool Mob::isLookingAtAnEntity() { - return lookingAt != NULL; + return lookingAt != nullptr; } shared_ptr Mob::getLookingAt() @@ -658,7 +658,7 @@ int Mob::getMaxSpawnClusterSize() int Mob::getMaxFallDistance() { - if (getTarget() == NULL) return 3; + if (getTarget() == nullptr) return 3; int sacrifice = static_cast(getHealth() - (getMaxHealth() * 0.33f)); sacrifice -= (3 - level->difficulty) * 4; if (sacrifice < 0) sacrifice = 0; @@ -697,7 +697,7 @@ void Mob::dropEquipment(bool byPlayer, int playerBonusLevel) shared_ptr item = getCarried(slot); bool preserve = dropChances[slot] > 1; - if (item != NULL && (byPlayer || preserve) && random->nextFloat() - playerBonusLevel * 0.01f < dropChances[slot]) + if (item != nullptr && (byPlayer || preserve) && random->nextFloat() - playerBonusLevel * 0.01f < dropChances[slot]) { if (!preserve && item->isDamageableItem()) { @@ -726,10 +726,10 @@ void Mob::populateDefaultEquipmentSlots() { shared_ptr item = getArmor(i); if (i < 3 && random->nextFloat() < partialChance) break; - if (item == NULL) + if (item == nullptr) { Item *equip = getEquipmentForSlot(i + 1, armorType); - if (equip != NULL) setEquippedSlot(i + 1, shared_ptr(new ItemInstance(equip))); + if (equip != nullptr) setEquippedSlot(i + 1, shared_ptr(new ItemInstance(equip))); } } } @@ -743,7 +743,7 @@ int Mob::getEquipmentSlotForItem(shared_ptr item) } ArmorItem *armorItem = dynamic_cast(item->getItem()); - if (armorItem != NULL) + if (armorItem != nullptr) { switch (armorItem->slot) { @@ -791,21 +791,21 @@ Item *Mob::getEquipmentForSlot(int slot, int type) if (type == 4) return Item::boots_diamond; } - return NULL; + return nullptr; } void Mob::populateDefaultEquipmentEnchantments() { float difficulty = level->getDifficulty(x, y, z); - if (getCarriedItem() != NULL && random->nextFloat() < MAX_ENCHANTED_WEAPON_CHANCE * difficulty) { + if (getCarriedItem() != nullptr && random->nextFloat() < MAX_ENCHANTED_WEAPON_CHANCE * difficulty) { EnchantmentHelper::enchantItem(random, getCarriedItem(), static_cast(5 + difficulty * random->nextInt(18))); } for (int i = 0; i < 4; i++) { shared_ptr item = getArmor(i); - if (item != NULL && random->nextFloat() < MAX_ENCHANTED_ARMOR_CHANCE * difficulty) + if (item != nullptr && random->nextFloat() < MAX_ENCHANTED_ARMOR_CHANCE * difficulty) { EnchantmentHelper::enchantItem(random, item, static_cast(5 + difficulty * random->nextInt(18))); } @@ -908,7 +908,7 @@ bool Mob::interact(shared_ptr player) } shared_ptr itemstack = player->inventory->getSelected(); - if (itemstack != NULL) + if (itemstack != nullptr) { // it's inconvenient to have the leash code here, but it's because // the mob.interact(player) method has priority over @@ -953,7 +953,7 @@ bool Mob::mobInteract(shared_ptr player) void Mob::tickLeash() { - if (leashInfoTag != NULL) + if (leashInfoTag != nullptr) { restoreLeashFromSave(); } @@ -962,7 +962,7 @@ void Mob::tickLeash() return; } - if (leashHolder == NULL || leashHolder->removed) + if (leashHolder == nullptr || leashHolder->removed) { dropLeash(true, true); return; @@ -981,7 +981,7 @@ void Mob::dropLeash(bool synch, bool createItemDrop) } ServerLevel *serverLevel = dynamic_cast(level); - if (!level->isClientSide && synch && serverLevel != NULL) + if (!level->isClientSide && synch && serverLevel != nullptr) { serverLevel->getTracker()->broadcast(shared_from_this(), shared_ptr(new SetEntityLinkPacket(SetEntityLinkPacket::LEASH, shared_from_this(), nullptr))); } @@ -1018,7 +1018,7 @@ void Mob::setLeashedTo(shared_ptr holder, bool synch) void Mob::restoreLeashFromSave() { // after being added to the world, attempt to recreate leash bond - if (_isLeashed && leashInfoTag != NULL) + if (_isLeashed && leashInfoTag != nullptr) { if (leashInfoTag->contains(L"UUID")) { @@ -1043,7 +1043,7 @@ void Mob::restoreLeashFromSave() int z = leashInfoTag->getInt(L"Z"); shared_ptr activeKnot = LeashFenceKnotEntity::findKnotAt(level, x, y, z); - if (activeKnot == NULL) + if (activeKnot == nullptr) { activeKnot = LeashFenceKnotEntity::createAndAddKnot(level, x, y, z); } @@ -1055,7 +1055,7 @@ void Mob::restoreLeashFromSave() dropLeash(false, true); } } - leashInfoTag = NULL; + leashInfoTag = nullptr; } // 4J added so we can not render mobs before their chunks are loaded - to resolve bug 10327 :Gameplay: NPCs can spawn over chunks that have not yet been streamed and display jitter. diff --git a/Minecraft.World/Mob.h b/Minecraft.World/Mob.h index 113105098..e070e3695 100644 --- a/Minecraft.World/Mob.h +++ b/Minecraft.World/Mob.h @@ -27,7 +27,7 @@ class Mob : public LivingEntity public: // 4J-PB - added to replace (e instanceof Type), avoiding dynamic casts eINSTANCEOF GetType() { return eTYPE_MOB;} - static Entity *create(Level *level) { return NULL; } + static Entity *create(Level *level) { return nullptr; } public: static const float MAX_WEARING_ARMOR_CHANCE; diff --git a/Minecraft.World/MobCategory.cpp b/Minecraft.World/MobCategory.cpp index 507be6eda..8c6d3b444 100644 --- a/Minecraft.World/MobCategory.cpp +++ b/Minecraft.World/MobCategory.cpp @@ -5,14 +5,14 @@ #include "Material.h" #include "MobCategory.h" -MobCategory *MobCategory::monster = NULL; -MobCategory *MobCategory::creature = NULL; -MobCategory *MobCategory::ambient = NULL; -MobCategory *MobCategory::waterCreature = NULL; +MobCategory *MobCategory::monster = nullptr; +MobCategory *MobCategory::creature = nullptr; +MobCategory *MobCategory::ambient = nullptr; +MobCategory *MobCategory::waterCreature = nullptr; // 4J - added these extra categories -MobCategory *MobCategory::creature_wolf = NULL; -MobCategory *MobCategory::creature_chicken = NULL; -MobCategory *MobCategory::creature_mushroomcow = NULL; +MobCategory *MobCategory::creature_wolf = nullptr; +MobCategory *MobCategory::creature_chicken = nullptr; +MobCategory *MobCategory::creature_mushroomcow = nullptr; MobCategoryArray MobCategory::values = MobCategoryArray(7); diff --git a/Minecraft.World/MobEffect.cpp b/Minecraft.World/MobEffect.cpp index f9978ca7d..4ded9c41a 100644 --- a/Minecraft.World/MobEffect.cpp +++ b/Minecraft.World/MobEffect.cpp @@ -46,7 +46,7 @@ MobEffect *MobEffect::reserved_31; void MobEffect::staticCtor() { - voidEffect = NULL; + voidEffect = nullptr; movementSpeed = (new MobEffect(1, false, eMinecraftColour_Effect_MovementSpeed)) ->setDescriptionId(IDS_POTION_MOVESPEED) ->setPostfixDescriptionId(IDS_POTION_MOVESPEED_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Speed)->addAttributeModifier(SharedMonsterAttributes::MOVEMENT_SPEED, eModifierId_POTION_MOVESPEED, 0.2f, AttributeModifier::OPERATION_MULTIPLY_TOTAL); //setIcon(0, 0); movementSlowdown = (new MobEffect(2, true, eMinecraftColour_Effect_MovementSlowDown)) ->setDescriptionId(IDS_POTION_MOVESLOWDOWN) ->setPostfixDescriptionId(IDS_POTION_MOVESLOWDOWN_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Slowness)->addAttributeModifier(SharedMonsterAttributes::MOVEMENT_SPEED, eModifierId_POTION_MOVESLOWDOWN, -0.15f, AttributeModifier::OPERATION_MULTIPLY_TOTAL); //->setIcon(1, 0); digSpeed = (new MobEffect(3, false, eMinecraftColour_Effect_DigSpeed)) ->setDescriptionId(IDS_POTION_DIGSPEED) ->setPostfixDescriptionId(IDS_POTION_DIGSPEED_POSTFIX)->setDurationModifier(1.5)->setIcon(MobEffect::e_MobEffectIcon_Haste); //->setIcon(2, 0); @@ -70,14 +70,14 @@ void MobEffect::staticCtor() healthBoost = (new HealthBoostMobEffect(21, false, eMinecraftColour_Effect_HealthBoost)) ->setDescriptionId(IDS_POTION_HEALTHBOOST) ->setPostfixDescriptionId(IDS_POTION_HEALTHBOOST_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_HealthBoost)->addAttributeModifier(SharedMonsterAttributes::MAX_HEALTH, eModifierId_POTION_HEALTHBOOST, 4, AttributeModifier::OPERATION_ADDITION); absorption = (new AbsoptionMobEffect(22, false, eMinecraftColour_Effect_Absoprtion)) ->setDescriptionId(IDS_POTION_ABSORPTION) ->setPostfixDescriptionId(IDS_POTION_ABSORPTION_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Absorption); saturation = (new InstantenousMobEffect(23, false, eMinecraftColour_Effect_Saturation)) ->setDescriptionId(IDS_POTION_SATURATION) ->setPostfixDescriptionId(IDS_POTION_SATURATION_POSTFIX); - reserved_24 = NULL; - reserved_25 = NULL; - reserved_26 = NULL; - reserved_27 = NULL; - reserved_28 = NULL; - reserved_29 = NULL; - reserved_30 = NULL; - reserved_31 = NULL; + reserved_24 = nullptr; + reserved_25 = nullptr; + reserved_26 = nullptr; + reserved_27 = nullptr; + reserved_28 = nullptr; + reserved_29 = nullptr; + reserved_30 = nullptr; + reserved_31 = nullptr; } MobEffect::MobEffect(int id, bool isHarmful, eMinecraftColour color) : id(id), _isHarmful(isHarmful), color(color) @@ -179,7 +179,7 @@ void MobEffect::applyInstantenousEffect(shared_ptr source, shared_ else if ((id == harm->id && !mob->isInvertedHealAndHarm()) || (id == heal->id && mob->isInvertedHealAndHarm())) { int amount = static_cast(scale * (double)(6 << amplification) + .5); - if (source == NULL) + if (source == nullptr) { mob->hurt(DamageSource::magic, amount); } @@ -359,7 +359,7 @@ void MobEffect::removeAttributeModifiers(shared_ptr entity, BaseAt { AttributeInstance *attribute = attributes->getInstance(it.first); - if (attribute != NULL) + if (attribute != nullptr) { attribute->removeModifier(it.second); } @@ -372,7 +372,7 @@ void MobEffect::addAttributeModifiers(shared_ptr entity, BaseAttri { AttributeInstance *attribute = attributes->getInstance(it.first); - if (attribute != NULL) + if (attribute != nullptr) { AttributeModifier *original = it.second; attribute->removeModifier(original); diff --git a/Minecraft.World/MobSpawner.cpp b/Minecraft.World/MobSpawner.cpp index 233cc28ff..35b24721b 100644 --- a/Minecraft.World/MobSpawner.cpp +++ b/Minecraft.World/MobSpawner.cpp @@ -251,8 +251,8 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie int z = zStart; int ss = 6; - Biome::MobSpawnerData *currentMobType = NULL; - MobGroupData *groupData = NULL; + Biome::MobSpawnerData *currentMobType = nullptr; + MobGroupData *groupData = nullptr; for (int ll = 0; ll < 4; ll++) { @@ -269,7 +269,7 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie float xx = x + 0.5f; float yy = static_cast(y); float zz = z + 0.5f; - if (level->getNearestPlayer(xx, yy, zz, MIN_SPAWN_DISTANCE) != NULL) + if (level->getNearestPlayer(xx, yy, zz, MIN_SPAWN_DISTANCE) != nullptr) { continue; } @@ -285,10 +285,10 @@ const int MobSpawner::tick(ServerLevel *level, bool spawnEnemies, bool spawnFrie } } - if (currentMobType == NULL) + if (currentMobType == nullptr) { currentMobType = level->getRandomMobSpawnAt(mobCategory, x, y, z); - if (currentMobType == NULL) + if (currentMobType == nullptr) { break; } @@ -440,7 +440,7 @@ void MobSpawner::postProcessSpawnMobs(Level *level, Biome *biome, int xo, int zo while (random->nextFloat() < biome->getCreatureProbability()) { Biome::MobSpawnerData *type = (Biome::MobSpawnerData *) WeighedRandom::getRandomItem(level->random, ((vector *)mobs)); - MobGroupData *groupData = NULL; + MobGroupData *groupData = nullptr; int count = type->minCount + random->nextInt(1 + type->maxCount - type->minCount); int x = xo + random->nextInt(cellWidth); diff --git a/Minecraft.World/MobSpawnerTileEntity.cpp b/Minecraft.World/MobSpawnerTileEntity.cpp index 013503b60..028ad3e44 100644 --- a/Minecraft.World/MobSpawnerTileEntity.cpp +++ b/Minecraft.World/MobSpawnerTileEntity.cpp @@ -37,7 +37,7 @@ int MobSpawnerTileEntity::TileEntityMobSpawner::getZ() void MobSpawnerTileEntity::TileEntityMobSpawner::setNextSpawnData(BaseMobSpawner::SpawnData *nextSpawnData) { BaseMobSpawner::setNextSpawnData(nextSpawnData); - if (getLevel() != NULL) getLevel()->sendTileUpdated(m_parent->x, m_parent->y, m_parent->z); + if (getLevel() != nullptr) getLevel()->sendTileUpdated(m_parent->x, m_parent->y, m_parent->z); } MobSpawnerTileEntity::MobSpawnerTileEntity() diff --git a/Minecraft.World/MockedLevelStorage.cpp b/Minecraft.World/MockedLevelStorage.cpp index 9a7a63c04..56910e3ec 100644 --- a/Minecraft.World/MockedLevelStorage.cpp +++ b/Minecraft.World/MockedLevelStorage.cpp @@ -9,7 +9,7 @@ LevelData *MockedLevelStorage::prepareLevel() { - return NULL; + return nullptr; } void MockedLevelStorage::checkSession() @@ -18,7 +18,7 @@ void MockedLevelStorage::checkSession() ChunkStorage *MockedLevelStorage::createChunkStorage(Dimension *dimension) { - return NULL; + return nullptr; } void MockedLevelStorage::saveLevelData(LevelData *levelData, vector > *players) @@ -31,7 +31,7 @@ void MockedLevelStorage::saveLevelData(LevelData *levelData) PlayerIO *MockedLevelStorage::getPlayerIO() { - return NULL; + return nullptr; } void MockedLevelStorage::closeAll() diff --git a/Minecraft.World/MockedLevelStorage.h b/Minecraft.World/MockedLevelStorage.h index 6a9eed70b..faa50582b 100644 --- a/Minecraft.World/MockedLevelStorage.h +++ b/Minecraft.World/MockedLevelStorage.h @@ -18,5 +18,5 @@ public: virtual ConsoleSavePath getDataFile(const wstring& id); virtual wstring getLevelId(); public: - virtual ConsoleSaveFile *getSaveFile() { return NULL; } + virtual ConsoleSaveFile *getSaveFile() { return nullptr; } }; \ No newline at end of file diff --git a/Minecraft.World/ModifiableAttributeInstance.cpp b/Minecraft.World/ModifiableAttributeInstance.cpp index 3108df4d5..216e5719c 100644 --- a/Minecraft.World/ModifiableAttributeInstance.cpp +++ b/Minecraft.World/ModifiableAttributeInstance.cpp @@ -62,7 +62,7 @@ void ModifiableAttributeInstance::getModifiers(unordered_setgetId() != eModifierId_ANONYMOUS && getModifier(modifier->getId()) != NULL) + if (modifier->getId() != eModifierId_ANONYMOUS && getModifier(modifier->getId()) != nullptr) { assert(0); // throw new IllegalArgumentException("Modifier is already applied on this attribute!"); @@ -126,7 +126,7 @@ void ModifiableAttributeInstance::removeModifier(AttributeModifier *modifier) void ModifiableAttributeInstance::removeModifier(eMODIFIER_ID id) { AttributeModifier *modifier = getModifier(id); - if (modifier != NULL) removeModifier(modifier); + if (modifier != nullptr) removeModifier(modifier); } void ModifiableAttributeInstance::removeModifiers() diff --git a/Minecraft.World/Monster.cpp b/Minecraft.World/Monster.cpp index 254a5a6c6..2de453153 100644 --- a/Minecraft.World/Monster.cpp +++ b/Minecraft.World/Monster.cpp @@ -46,7 +46,7 @@ shared_ptr Monster::findAttackTarget() #endif shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 16); - if (player != NULL && canSee(player) ) return player; + if (player != nullptr && canSee(player) ) return player; return shared_ptr(); } diff --git a/Minecraft.World/Monster.h b/Minecraft.World/Monster.h index 33f72b0e1..2c21b1d28 100644 --- a/Minecraft.World/Monster.h +++ b/Minecraft.World/Monster.h @@ -12,7 +12,7 @@ class Monster : public PathfinderMob, public Enemy { public: eINSTANCEOF GetType() { return eTYPE_MONSTER; } - static Entity *create(Level *level) { return NULL; } + static Entity *create(Level *level) { return nullptr; } public: Monster(Level *level); diff --git a/Minecraft.World/MonsterRoomFeature.cpp b/Minecraft.World/MonsterRoomFeature.cpp index 17ac55aec..e11ebcb29 100644 --- a/Minecraft.World/MonsterRoomFeature.cpp +++ b/Minecraft.World/MonsterRoomFeature.cpp @@ -110,7 +110,7 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z WeighedTreasureArray wrapperArray(monsterRoomTreasure, TREASURE_ITEMS_COUNT); WeighedTreasureArray treasure = WeighedTreasure::addToTreasure(wrapperArray, Item::enchantedBook->createForRandomTreasure(random)); shared_ptr chest = dynamic_pointer_cast( level->getTileEntity(xc, yc, zc) ); - if (chest != NULL ) + if (chest != nullptr ) { WeighedTreasure::addChestItems(random, treasure, chest, 8); } @@ -122,7 +122,7 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if( entity != NULL ) + if( entity != nullptr ) { entity->getSpawner()->setEntityId(randomEntityId(random)); } diff --git a/Minecraft.World/MoveEntityPacket.cpp b/Minecraft.World/MoveEntityPacket.cpp index e897c6f48..cae28e912 100644 --- a/Minecraft.World/MoveEntityPacket.cpp +++ b/Minecraft.World/MoveEntityPacket.cpp @@ -61,7 +61,7 @@ bool MoveEntityPacket::canBeInvalidated() bool MoveEntityPacket::isInvalidatedBy(shared_ptr packet) { shared_ptr target = dynamic_pointer_cast(packet); - return target != NULL && target->id == id; + return target != nullptr && target->id == id; } MoveEntityPacket::PosRot::PosRot() diff --git a/Minecraft.World/MoveEntityPacketSmall.cpp b/Minecraft.World/MoveEntityPacketSmall.cpp index 89f5e13ec..ec67f37f2 100644 --- a/Minecraft.World/MoveEntityPacketSmall.cpp +++ b/Minecraft.World/MoveEntityPacketSmall.cpp @@ -68,7 +68,7 @@ bool MoveEntityPacketSmall::canBeInvalidated() bool MoveEntityPacketSmall::isInvalidatedBy(shared_ptr packet) { shared_ptr target = dynamic_pointer_cast(packet); - return target != NULL && target->id == id; + return target != nullptr && target->id == id; } MoveEntityPacketSmall::PosRot::PosRot() diff --git a/Minecraft.World/MoveIndoorsGoal.cpp b/Minecraft.World/MoveIndoorsGoal.cpp index 395fe5789..f329a6bb3 100644 --- a/Minecraft.World/MoveIndoorsGoal.cpp +++ b/Minecraft.World/MoveIndoorsGoal.cpp @@ -22,10 +22,10 @@ bool MoveIndoorsGoal::canUse() if (mob->getRandom()->nextInt(50) != 0) return false; if (insideX != -1 && mob->distanceToSqr(insideX, mob->y, insideZ) < 2 * 2) return false; shared_ptr village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 14); - if (village == NULL) return false; + if (village == nullptr) return false; shared_ptr _doorInfo = village->getBestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); doorInfo = _doorInfo; - return _doorInfo != NULL; + return _doorInfo != nullptr; } bool MoveIndoorsGoal::canContinueToUse() @@ -37,7 +37,7 @@ void MoveIndoorsGoal::start() { insideX = -1; shared_ptr _doorInfo = doorInfo.lock(); - if( _doorInfo == NULL ) + if( _doorInfo == nullptr ) { doorInfo = weak_ptr(); return; @@ -45,7 +45,7 @@ void MoveIndoorsGoal::start() if (mob->distanceToSqr(_doorInfo->getIndoorX(), _doorInfo->y, _doorInfo->getIndoorZ()) > 16 * 16) { Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 14, 3, Vec3::newTemp(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5)); - if (pos != NULL) mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, 1.0f); + if (pos != nullptr) mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, 1.0f); } else mob->getNavigation()->moveTo(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5, 1.0f); } @@ -53,7 +53,7 @@ void MoveIndoorsGoal::start() void MoveIndoorsGoal::stop() { shared_ptr _doorInfo = doorInfo.lock(); - if( _doorInfo == NULL ) + if( _doorInfo == nullptr ) { doorInfo = weak_ptr(); return; diff --git a/Minecraft.World/MoveThroughVillageGoal.cpp b/Minecraft.World/MoveThroughVillageGoal.cpp index f112c109f..81476aeca 100644 --- a/Minecraft.World/MoveThroughVillageGoal.cpp +++ b/Minecraft.World/MoveThroughVillageGoal.cpp @@ -11,7 +11,7 @@ MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, double speedModifier, bool onlyAtNight) { - path = NULL; + path = nullptr; doorInfo = weak_ptr(); this->mob = mob; @@ -22,7 +22,7 @@ MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, double speedM MoveThroughVillageGoal::~MoveThroughVillageGoal() { - if(path != NULL) delete path; + if(path != nullptr) delete path; } bool MoveThroughVillageGoal::canUse() @@ -32,10 +32,10 @@ bool MoveThroughVillageGoal::canUse() if (onlyAtNight && mob->level->isDay()) return false; shared_ptr village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 0); - if (village == NULL) return false; + if (village == nullptr) return false; shared_ptr _doorInfo = getNextDoorInfo(village); - if (_doorInfo == NULL) return false; + if (_doorInfo == nullptr) return false; doorInfo = _doorInfo; bool oldCanOpenDoors = mob->getNavigation()->canOpenDoors(); @@ -44,15 +44,15 @@ bool MoveThroughVillageGoal::canUse() path = mob->getNavigation()->createPath(_doorInfo->x, _doorInfo->y, _doorInfo->z); mob->getNavigation()->setCanOpenDoors(oldCanOpenDoors); - if (path != NULL) return true; + if (path != nullptr) return true; Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 10, 7, Vec3::newTemp(_doorInfo->x, _doorInfo->y, _doorInfo->z)); - if (pos == NULL) return false; + if (pos == nullptr) return false; mob->getNavigation()->setCanOpenDoors(false); delete path; path = mob->getNavigation()->createPath(pos->x, pos->y, pos->z); mob->getNavigation()->setCanOpenDoors(oldCanOpenDoors); - return path != NULL; + return path != nullptr; } bool MoveThroughVillageGoal::canContinueToUse() @@ -60,7 +60,7 @@ bool MoveThroughVillageGoal::canContinueToUse() if (mob->getNavigation()->isDone()) return false; float dist = mob->bbWidth + 4.f; shared_ptr _doorInfo = doorInfo.lock(); - if( _doorInfo == NULL ) return false; + if( _doorInfo == nullptr ) return false; return mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) > dist * dist; } @@ -68,13 +68,13 @@ bool MoveThroughVillageGoal::canContinueToUse() void MoveThroughVillageGoal::start() { mob->getNavigation()->moveTo(path, speedModifier); - path = NULL; + path = nullptr; } void MoveThroughVillageGoal::stop() { shared_ptr _doorInfo = doorInfo.lock(); - if( _doorInfo == NULL ) return; + if( _doorInfo == nullptr ) return; if (mob->getNavigation()->isDone() || mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) < 4 * 4) { diff --git a/Minecraft.World/MoveTowardsRestrictionGoal.cpp b/Minecraft.World/MoveTowardsRestrictionGoal.cpp index 2c3900b62..1d54f9352 100644 --- a/Minecraft.World/MoveTowardsRestrictionGoal.cpp +++ b/Minecraft.World/MoveTowardsRestrictionGoal.cpp @@ -20,7 +20,7 @@ bool MoveTowardsRestrictionGoal::canUse() if (mob->isWithinRestriction()) return false; Pos *towards = mob->getRestrictCenter(); Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 16, 7, Vec3::newTemp(towards->x, towards->y, towards->z)); - if (pos == NULL) return false; + if (pos == nullptr) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; diff --git a/Minecraft.World/MoveTowardsTargetGoal.cpp b/Minecraft.World/MoveTowardsTargetGoal.cpp index c0537d1f2..a0e18115a 100644 --- a/Minecraft.World/MoveTowardsTargetGoal.cpp +++ b/Minecraft.World/MoveTowardsTargetGoal.cpp @@ -17,10 +17,10 @@ MoveTowardsTargetGoal::MoveTowardsTargetGoal(PathfinderMob *mob, double speedMod bool MoveTowardsTargetGoal::canUse() { target = weak_ptr(mob->getTarget()); - if (target.lock() == NULL) return false; + if (target.lock() == nullptr) return false; if (target.lock()->distanceToSqr(mob->shared_from_this()) > within * within) return false; Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 16, 7, Vec3::newTemp(target.lock()->x, target.lock()->y, target.lock()->z)); - if (pos == NULL) return false; + if (pos == nullptr) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; @@ -29,7 +29,7 @@ bool MoveTowardsTargetGoal::canUse() bool MoveTowardsTargetGoal::canContinueToUse() { - return target.lock() != NULL && !mob->getNavigation()->isDone() && target.lock()->isAlive() && target.lock()->distanceToSqr(mob->shared_from_this()) < within * within; + return target.lock() != nullptr && !mob->getNavigation()->isDone() && target.lock()->isAlive() && target.lock()->distanceToSqr(mob->shared_from_this()) < within * within; } void MoveTowardsTargetGoal::stop() diff --git a/Minecraft.World/Mth.cpp b/Minecraft.World/Mth.cpp index 95e8ccbbb..6cf976c38 100644 --- a/Minecraft.World/Mth.cpp +++ b/Minecraft.World/Mth.cpp @@ -9,7 +9,7 @@ const float Mth::DEGRAD = PI / 180.0f; const float Mth::RADDEG = 180.0f / PI; const float Mth::RAD_TO_GRAD = PI / 180.0f; -float *Mth::_sin = NULL; +float *Mth::_sin = nullptr; const float Mth::sinScale = 65536.0f / (float) (PI * 2); @@ -25,13 +25,13 @@ void Mth::init() float Mth::sin(float i) { - if(_sin == NULL) init(); // 4J - added + if(_sin == nullptr) init(); // 4J - added return _sin[static_cast(i * sinScale) & 65535]; } float Mth::cos(float i) { - if(_sin == NULL) init(); // 4J - added + if(_sin == nullptr) init(); // 4J - added return _sin[static_cast(i * sinScale + 65536 / 4) & 65535]; } diff --git a/Minecraft.World/Mushroom.cpp b/Minecraft.World/Mushroom.cpp index 6b20e0d19..ca8a85546 100644 --- a/Minecraft.World/Mushroom.cpp +++ b/Minecraft.World/Mushroom.cpp @@ -77,7 +77,7 @@ bool Mushroom::growTree(Level *level, int x, int y, int z, Random *random) int data = level->getData(x, y, z); level->removeTile(x, y, z); - Feature *f = NULL; + Feature *f = nullptr; if (id == Tile::mushroom_brown_Id) { @@ -88,14 +88,14 @@ bool Mushroom::growTree(Level *level, int x, int y, int z, Random *random) f = new HugeMushroomFeature(1); } - if (f == NULL || !f->place(level, random, x, y, z)) + if (f == nullptr || !f->place(level, random, x, y, z)) { level->setTileAndData(x, y, z, id, data, Tile::UPDATE_ALL); - if( f != NULL ) + if( f != nullptr ) delete f; return false; } - if( f != NULL ) + if( f != nullptr ) delete f; return true; } \ No newline at end of file diff --git a/Minecraft.World/MushroomCow.cpp b/Minecraft.World/MushroomCow.cpp index 0f88c8435..66969a00f 100644 --- a/Minecraft.World/MushroomCow.cpp +++ b/Minecraft.World/MushroomCow.cpp @@ -24,7 +24,7 @@ MushroomCow::MushroomCow(Level *level) : Cow(level) bool MushroomCow::mobInteract(shared_ptr player) { shared_ptr item = player->inventory->getSelected(); - if (item != NULL && item->id == Item::bowl_Id && getAge() >= 0) + if (item != nullptr && item->id == Item::bowl_Id && getAge() >= 0) { if (item->count == 1) { @@ -39,7 +39,7 @@ bool MushroomCow::mobInteract(shared_ptr player) } } // 4J: Do not allow shearing if we can't create more cows - if (item != NULL && item->id == Item::shears_Id && getAge() >= 0 && level->canCreateMore(eTYPE_COW, Level::eSpawnType_Breed)) + if (item != nullptr && item->id == Item::shears_Id && getAge() >= 0 && level->canCreateMore(eTYPE_COW, Level::eSpawnType_Breed)) { remove(); level->addParticle(eParticleType_largeexplode, x, y + bbHeight / 2, z, 0, 0, 0); diff --git a/Minecraft.World/MycelTile.cpp b/Minecraft.World/MycelTile.cpp index 875a598d2..76b742e34 100644 --- a/Minecraft.World/MycelTile.cpp +++ b/Minecraft.World/MycelTile.cpp @@ -6,8 +6,8 @@ MycelTile::MycelTile(int id) : Tile(id, Material::grass) { - iconTop = NULL; - iconSnowSide = NULL; + iconTop = nullptr; + iconSnowSide = nullptr; setTicking(true); } diff --git a/Minecraft.World/NameTagItem.cpp b/Minecraft.World/NameTagItem.cpp index 9c11f2af0..fc9b80b4a 100644 --- a/Minecraft.World/NameTagItem.cpp +++ b/Minecraft.World/NameTagItem.cpp @@ -10,7 +10,7 @@ bool NameTagItem::interactEnemy(shared_ptr itemInstance, shared_pt { if (!itemInstance->hasCustomHoverName()) return false; - if ( (target != NULL) && target->instanceof(eTYPE_MOB) ) + if ( (target != nullptr) && target->instanceof(eTYPE_MOB) ) { shared_ptr mob = dynamic_pointer_cast(target); mob->setCustomName(itemInstance->getHoverName()); diff --git a/Minecraft.World/NbtIo.cpp b/Minecraft.World/NbtIo.cpp index 12b710163..7e566114d 100644 --- a/Minecraft.World/NbtIo.cpp +++ b/Minecraft.World/NbtIo.cpp @@ -54,9 +54,9 @@ CompoundTag *NbtIo::read(DataInput *dis) if( tag->getId() == Tag::TAG_Compound ) return static_cast(tag); - if(tag!=NULL) delete tag; + if(tag!=nullptr) delete tag; // Root tag must be a named compound tag - return NULL; + return nullptr; } void NbtIo::write(CompoundTag *tag, DataOutput *dos) diff --git a/Minecraft.World/NbtSlotFile.cpp b/Minecraft.World/NbtSlotFile.cpp index 8bae14c64..f6c9be2a9 100644 --- a/Minecraft.World/NbtSlotFile.cpp +++ b/Minecraft.World/NbtSlotFile.cpp @@ -14,12 +14,12 @@ NbtSlotFile::NbtSlotFile(File file) if ( !file.exists() || file.length() ) { - raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); writeHeader(); } else { - raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + raf = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); } readHeader(); @@ -34,7 +34,7 @@ NbtSlotFile::NbtSlotFile(File file) { seekSlotHeader(fileSlot); short slot; - ReadFile(raf,&slot,2,&numberofBytesRead,NULL); + ReadFile(raf,&slot,2,&numberofBytesRead,nullptr); if (slot == 0) { freeFileSlots.push_back(fileSlot); @@ -52,12 +52,12 @@ void NbtSlotFile::readHeader() DWORD numberOfBytesRead; SetFilePointer(raf,0,0,FILE_BEGIN); int magic; - ReadFile(raf,&magic,4,&numberOfBytesRead,NULL); + ReadFile(raf,&magic,4,&numberOfBytesRead,nullptr); // if (magic != MAGIC_NUMBER) throw new IOException("Bad magic number: " + magic); // 4J - TODO short version; - ReadFile(raf,&version,2,&numberOfBytesRead,NULL); + ReadFile(raf,&version,2,&numberOfBytesRead,nullptr); // if (version != 0) throw new IOException("Bad version number: " + version); // 4J - TODO - ReadFile(raf,&totalFileSlots,4,&numberOfBytesRead,NULL); + ReadFile(raf,&totalFileSlots,4,&numberOfBytesRead,nullptr); } void NbtSlotFile::writeHeader() @@ -65,9 +65,9 @@ void NbtSlotFile::writeHeader() DWORD numberOfBytesWritten; short version = 0; SetFilePointer(raf,0,0,FILE_BEGIN); - WriteFile(raf,&MAGIC_NUMBER,4,&numberOfBytesWritten,NULL); - WriteFile(raf,&version,2,&numberOfBytesWritten,NULL); - WriteFile(raf,&totalFileSlots,4,&numberOfBytesWritten,NULL); + WriteFile(raf,&MAGIC_NUMBER,4,&numberOfBytesWritten,nullptr); + WriteFile(raf,&version,2,&numberOfBytesWritten,nullptr); + WriteFile(raf,&totalFileSlots,4,&numberOfBytesWritten,nullptr); } void NbtSlotFile::seekSlotHeader(int fileSlot) @@ -98,12 +98,12 @@ vector *NbtSlotFile::readAll(int slot) { seekSlotHeader(c); short oldSlot; - ReadFile(raf,&oldSlot,2,&numberOfBytesRead,NULL); + ReadFile(raf,&oldSlot,2,&numberOfBytesRead,nullptr); short size; - ReadFile(raf,&size,2,&numberOfBytesRead,NULL); - ReadFile(raf,&continuesAt,4,&numberOfBytesRead,NULL); + ReadFile(raf,&size,2,&numberOfBytesRead,nullptr); + ReadFile(raf,&continuesAt,4,&numberOfBytesRead,nullptr); int lastSlot; - ReadFile(raf,&lastSlot,4,&numberOfBytesRead,NULL); + ReadFile(raf,&lastSlot,4,&numberOfBytesRead,nullptr); seekSlot(c); if (expectedSlot > 0 && oldSlot == -expectedSlot) @@ -112,7 +112,7 @@ vector *NbtSlotFile::readAll(int slot) goto fileSlotLoop; // 4J - used to be continue fileSlotLoop, with for loop labelled as fileSlotLoop } - ReadFile(raf,READ_BUFFER.data + pos,size,&numberOfBytesRead,NULL); + ReadFile(raf,READ_BUFFER.data + pos,size,&numberOfBytesRead,nullptr); if (continuesAt >= 0) { @@ -203,13 +203,13 @@ void NbtSlotFile::replaceSlot(int slot, vector *tags) } seekSlotHeader(fileSlot); - WriteFile(raf,¤tSlot,2,&numberOfBytesWritten,NULL); - WriteFile(raf,&toWrite,2,&numberOfBytesWritten,NULL); - WriteFile(raf,&nextFileSlot,4,&numberOfBytesWritten,NULL); - WriteFile(raf,&lastFileSlot,4,&numberOfBytesWritten,NULL); + WriteFile(raf,¤tSlot,2,&numberOfBytesWritten,nullptr); + WriteFile(raf,&toWrite,2,&numberOfBytesWritten,nullptr); + WriteFile(raf,&nextFileSlot,4,&numberOfBytesWritten,nullptr); + WriteFile(raf,&lastFileSlot,4,&numberOfBytesWritten,nullptr); seekSlot(fileSlot); - WriteFile(raf,compressed.data+pos,toWrite,&numberOfBytesWritten,NULL); + WriteFile(raf,compressed.data+pos,toWrite,&numberOfBytesWritten,nullptr); if (remaining > 0) { @@ -227,7 +227,7 @@ void NbtSlotFile::replaceSlot(int slot, vector *tags) seekSlotHeader(c); short zero = 0; - WriteFile(raf,&zero,2,&numberOfBytesWritten,NULL); + WriteFile(raf,&zero,2,&numberOfBytesWritten,nullptr); } toReplace->clear(); diff --git a/Minecraft.World/NearestAttackableTargetGoal.cpp b/Minecraft.World/NearestAttackableTargetGoal.cpp index 7ddd88950..c6b75481d 100644 --- a/Minecraft.World/NearestAttackableTargetGoal.cpp +++ b/Minecraft.World/NearestAttackableTargetGoal.cpp @@ -18,7 +18,7 @@ SubselectEntitySelector::~SubselectEntitySelector() bool SubselectEntitySelector::matches(shared_ptr entity) const { if (!entity->instanceof(eTYPE_LIVINGENTITY)) return false; - if (m_subselector != NULL && !m_subselector->matches(entity)) return false; + if (m_subselector != nullptr && !m_subselector->matches(entity)) return false; return m_parent->canAttack(dynamic_pointer_cast(entity), false); } @@ -37,7 +37,7 @@ bool NearestAttackableTargetGoal::DistComp::operator() (shared_ptr e1, s return false; } -NearestAttackableTargetGoal::NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach /*= false*/, EntitySelector *entitySelector /* =NULL */) +NearestAttackableTargetGoal::NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach /*= false*/, EntitySelector *entitySelector /* =nullptr */) : TargetGoal(mob, mustSee, mustReach), targetType(targetType) { this->randomInterval = randomInterval; @@ -61,7 +61,7 @@ bool NearestAttackableTargetGoal::canUse() vector > *entities = mob->level->getEntitiesOfClass(targetType, mob->bb->grow(within, 4, within), selector); bool result = false; - if(entities != NULL && !entities->empty() ) + if(entities != nullptr && !entities->empty() ) { std::sort(entities->begin(), entities->end(), *distComp); target = weak_ptr(dynamic_pointer_cast(entities->at(0))); diff --git a/Minecraft.World/NearestAttackableTargetGoal.h b/Minecraft.World/NearestAttackableTargetGoal.h index 1ba6c519d..2bdb81ec1 100644 --- a/Minecraft.World/NearestAttackableTargetGoal.h +++ b/Minecraft.World/NearestAttackableTargetGoal.h @@ -41,7 +41,7 @@ private: weak_ptr target; public: - NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach = false, EntitySelector *entitySelector = NULL); + NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach = false, EntitySelector *entitySelector = nullptr); virtual ~NearestAttackableTargetGoal(); diff --git a/Minecraft.World/NetherBridgeFeature.cpp b/Minecraft.World/NetherBridgeFeature.cpp index 42cdfac94..e78002ec7 100644 --- a/Minecraft.World/NetherBridgeFeature.cpp +++ b/Minecraft.World/NetherBridgeFeature.cpp @@ -15,13 +15,13 @@ NetherBridgeFeature::NetherBridgeFeature() : StructureFeature() bridgeEnemies.push_back(new Biome::MobSpawnerData(eTYPE_SKELETON, 10, 4, 4)); bridgeEnemies.push_back(new Biome::MobSpawnerData(eTYPE_LAVASLIME, 3, 4, 4)); isSpotSelected=false; - netherFortressPos = NULL; + netherFortressPos = nullptr; } NetherBridgeFeature::~NetherBridgeFeature() { - if( netherFortressPos != NULL ) delete netherFortressPos; + if( netherFortressPos != nullptr ) delete netherFortressPos; } wstring NetherBridgeFeature::getFeatureName() @@ -57,7 +57,7 @@ bool NetherBridgeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != NULL ) + if( levelGenOptions != nullptr ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_NetherBridge); } diff --git a/Minecraft.World/NetherBridgePieces.cpp b/Minecraft.World/NetherBridgePieces.cpp index de102da54..d9fbbf35b 100644 --- a/Minecraft.World/NetherBridgePieces.cpp +++ b/Minecraft.World/NetherBridgePieces.cpp @@ -79,7 +79,7 @@ NetherBridgePieces::PieceWeight *NetherBridgePieces::castlePieceWeights[NetherBr NetherBridgePieces::NetherBridgePiece *NetherBridgePieces::findAndCreateBridgePieceFactory(NetherBridgePieces::PieceWeight *piece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { EPieceClass pieceClass = piece->pieceClass; - NetherBridgePiece *structurePiece = NULL; + NetherBridgePiece *structurePiece = nullptr; if (pieceClass == EPieceClass_BridgeStraight) { @@ -204,7 +204,7 @@ NetherBridgePieces::NetherBridgePiece *NetherBridgePieces::NetherBridgePiece::ge } NetherBridgePiece *structurePiece = findAndCreateBridgePieceFactory(piece, pieces, random, footX, footY, footZ, direction, depth); - if (structurePiece != NULL) + if (structurePiece != nullptr) { piece->placeCount++; startPiece->previousPiece = piece; @@ -236,7 +236,7 @@ StructurePiece *NetherBridgePieces::NetherBridgePiece::generateAndAddPiece(Start availablePieces = &startPiece->availableCastlePieces; } StructurePiece *newPiece = generatePiece(startPiece, availablePieces, pieces, random, footX, footY, footZ, direction, depth + 1); - if (newPiece != NULL) + if (newPiece != nullptr) { pieces->push_back(newPiece); startPiece->pendingChildren.push_back(newPiece); @@ -257,7 +257,7 @@ StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildForward(Star case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0 + yOff, boundingBox->z0 + xOff, orientation, getGenDepth(), isCastle); } - return NULL; + return nullptr; } StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildLeft(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff, bool isCastle) @@ -273,7 +273,7 @@ StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildLeft(StartPi case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z0 - 1, Direction::NORTH, getGenDepth(), isCastle); } - return NULL; + return nullptr; } StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildRight(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff, bool isCastle) @@ -289,14 +289,14 @@ StructurePiece *NetherBridgePieces::NetherBridgePiece::generateChildRight(StartP case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth(), isCastle); } - return NULL; + return nullptr; } bool NetherBridgePieces::NetherBridgePiece::isOkBox(BoundingBox *box, StartPiece *startPiece) { bool bIsOk = false; - if(box != NULL) + if(box != nullptr) { if( box->y0 > LOWEST_Y_POSITION ) bIsOk = true; int xzSize = (startPiece->m_level->getLevelData()->getXZSize() / startPiece->m_level->getLevelData()->getHellScale()); //HellRandomLevelSource::XZSIZE; @@ -375,13 +375,13 @@ NetherBridgePieces::BridgeStraight *NetherBridgePieces::BridgeStraight::createPi { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new BridgeStraight(genDepth, random, box, direction); @@ -441,13 +441,13 @@ NetherBridgePieces::BridgeEndFiller *NetherBridgePieces::BridgeEndFiller::create { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new BridgeEndFiller(genDepth, random, box, direction); @@ -549,13 +549,13 @@ NetherBridgePieces::BridgeCrossing *NetherBridgePieces::BridgeCrossing::createPi { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -8, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new BridgeCrossing(genDepth, random, box, direction); @@ -612,12 +612,12 @@ bool NetherBridgePieces::BridgeCrossing::postProcess(Level *level, Random *rando NetherBridgePieces::StartPiece::StartPiece() { // for reflection - previousPiece = NULL; + previousPiece = nullptr; } NetherBridgePieces::StartPiece::StartPiece(Random *random, int west, int north, Level *level) : BridgeCrossing(random, west, north) { - previousPiece = NULL; + previousPiece = nullptr; m_level = level; for( int i = 0; i < BRIDGE_PIECEWEIGHTS_COUNT; i++ ) @@ -668,13 +668,13 @@ NetherBridgePieces::RoomCrossing *NetherBridgePieces::RoomCrossing::createPiece( { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new RoomCrossing(genDepth, random, box, direction); @@ -738,13 +738,13 @@ NetherBridgePieces::StairsRoom *NetherBridgePieces::StairsRoom::createPiece(list { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new StairsRoom(genDepth, random, box, direction); @@ -812,13 +812,13 @@ NetherBridgePieces::MonsterThrone *NetherBridgePieces::MonsterThrone::createPiec { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -2, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new MonsterThrone(genDepth, random, box, direction); @@ -873,7 +873,7 @@ bool NetherBridgePieces::MonsterThrone::postProcess(Level *level, Random *random hasPlacedMobSpawner = true; level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (entity != NULL) entity->getSpawner()->setEntityId(L"Blaze"); + if (entity != nullptr) entity->getSpawner()->setEntityId(L"Blaze"); } } @@ -908,13 +908,13 @@ NetherBridgePieces::CastleEntrance *NetherBridgePieces::CastleEntrance::createPi { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -5, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new CastleEntrance(genDepth, random, box, direction); @@ -1038,13 +1038,13 @@ NetherBridgePieces::CastleStalkRoom *NetherBridgePieces::CastleStalkRoom::create { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -5, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new CastleStalkRoom(genDepth, random, box, direction); @@ -1204,13 +1204,13 @@ NetherBridgePieces::CastleSmallCorridorPiece *NetherBridgePieces::CastleSmallCor BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new CastleSmallCorridorPiece(genDepth, random, box, direction); @@ -1268,13 +1268,13 @@ NetherBridgePieces::CastleSmallCorridorCrossingPiece *NetherBridgePieces::Castle { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new CastleSmallCorridorCrossingPiece(genDepth, random, box, direction); @@ -1344,13 +1344,13 @@ NetherBridgePieces::CastleSmallCorridorRightTurnPiece *NetherBridgePieces::Castl { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new CastleSmallCorridorRightTurnPiece(genDepth, random, box, direction); @@ -1436,13 +1436,13 @@ NetherBridgePieces::CastleSmallCorridorLeftTurnPiece *NetherBridgePieces::Castle { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new CastleSmallCorridorLeftTurnPiece(genDepth, random, box, direction); @@ -1512,13 +1512,13 @@ NetherBridgePieces::CastleCorridorStairsPiece *NetherBridgePieces::CastleCorrido { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -7, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new CastleCorridorStairsPiece(genDepth, random, box, direction); @@ -1594,13 +1594,13 @@ NetherBridgePieces::CastleCorridorTBalconyPiece *NetherBridgePieces::CastleCorri { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -3, 0, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new CastleCorridorTBalconyPiece(genDepth, random, box, direction); diff --git a/Minecraft.World/Node.cpp b/Minecraft.World/Node.cpp index a8988091c..408370a06 100644 --- a/Minecraft.World/Node.cpp +++ b/Minecraft.World/Node.cpp @@ -10,7 +10,7 @@ void Node::_init() closed = false; - cameFrom = NULL; + cameFrom = nullptr; } Node::Node(const int x, const int y, const int z) : @@ -52,7 +52,7 @@ float Node::distanceToSqr(Node *to) bool Node::equals(Node *o) { //4J Jev, never used anything other than a node. - //if (dynamic_cast((Node *) o) != NULL) + //if (dynamic_cast((Node *) o) != nullptr) //{ return hash == o->hash && x == o->x && y == o->y && z == o->z; //} diff --git a/Minecraft.World/NotGateTile.cpp b/Minecraft.World/NotGateTile.cpp index 3aa9aee1f..e6c5fd063 100644 --- a/Minecraft.World/NotGateTile.cpp +++ b/Minecraft.World/NotGateTile.cpp @@ -233,7 +233,7 @@ void NotGateTile::levelTimeChanged(Level *level, __int64 delta, __int64 newTime) { deque *toggles = recentToggles[level]; - if (toggles != NULL) + if (toggles != nullptr) { for (auto& toggle : *toggles) { diff --git a/Minecraft.World/NoteBlockTile.cpp b/Minecraft.World/NoteBlockTile.cpp index 504ed511e..4c58ec8b1 100644 --- a/Minecraft.World/NoteBlockTile.cpp +++ b/Minecraft.World/NoteBlockTile.cpp @@ -14,7 +14,7 @@ void NoteBlockTile::neighborChanged(Level *level, int x, int y, int z, int type) bool signal = level->hasNeighborSignal(x, y, z); shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); app.DebugPrintf("-------- Signal is %s, tile is currently %s\n",signal?"TRUE":"FALSE", mte->on?"ON":"OFF"); - if (mte != NULL && mte->on != signal) + if (mte != nullptr && mte->on != signal) { if (signal) { @@ -35,7 +35,7 @@ bool NoteBlockTile::use(Level *level, int x, int y, int z, shared_ptr pl if (soundOnly) return false; if (level->isClientSide) return true; shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (mte != NULL ) + if (mte != nullptr ) { mte->tune(); mte->playNote(level, x, y, z); @@ -47,7 +47,7 @@ void NoteBlockTile::attack(Level *level, int x, int y, int z, shared_ptr { if (level->isClientSide) return; shared_ptr mte = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if( mte != NULL ) mte->playNote(level, x, y, z); + if( mte != nullptr ) mte->playNote(level, x, y, z); } shared_ptr NoteBlockTile::newTileEntity(Level *level) diff --git a/Minecraft.World/Ocelot.cpp b/Minecraft.World/Ocelot.cpp index 53ee27299..474fcd71e 100644 --- a/Minecraft.World/Ocelot.cpp +++ b/Minecraft.World/Ocelot.cpp @@ -199,7 +199,7 @@ bool Ocelot::mobInteract(shared_ptr player) } else { - if (temptGoal->isRunning() && item != NULL && item->id == Item::fish_raw_Id && player->distanceToSqr(shared_from_this()) < 3 * 3) + if (temptGoal->isRunning() && item != nullptr && item->id == Item::fish_raw_Id && player->distanceToSqr(shared_from_this()) < 3 * 3) { // 4J-PB - don't lose the fish in creative mode if (!player->abilities.instabuild) item->count--; @@ -257,7 +257,7 @@ shared_ptr Ocelot::getBreedOffspring(shared_ptr target) bool Ocelot::isFood(shared_ptr itemInstance) { - return itemInstance != NULL && itemInstance->id == Item::fish_raw_Id; + return itemInstance != nullptr && itemInstance->id == Item::fish_raw_Id; } bool Ocelot::canMate(shared_ptr animal) @@ -266,7 +266,7 @@ bool Ocelot::canMate(shared_ptr animal) if (!isTame()) return false; shared_ptr partner = dynamic_pointer_cast(animal); - if (partner == NULL) return false; + if (partner == nullptr) return false; if (!partner->isTame()) return false; return isInLove() && partner->isInLove(); diff --git a/Minecraft.World/OcelotAttackGoal.cpp b/Minecraft.World/OcelotAttackGoal.cpp index d9e0f29b5..9871de2f0 100644 --- a/Minecraft.World/OcelotAttackGoal.cpp +++ b/Minecraft.World/OcelotAttackGoal.cpp @@ -21,14 +21,14 @@ OcelotAttackGoal::OcelotAttackGoal(Mob *mob) bool OcelotAttackGoal::canUse() { shared_ptr bestTarget = mob->getTarget(); - if (bestTarget == NULL) return false; + if (bestTarget == nullptr) return false; target = weak_ptr(bestTarget); return true; } bool OcelotAttackGoal::canContinueToUse() { - if (target.lock() == NULL || !target.lock()->isAlive()) return false; + if (target.lock() == nullptr || !target.lock()->isAlive()) return false; if (mob->distanceToSqr(target.lock()) > 15 * 15) return false; return !mob->getNavigation()->isDone() || canUse(); } diff --git a/Minecraft.World/OfferFlowerGoal.cpp b/Minecraft.World/OfferFlowerGoal.cpp index b604ea84c..2951b5fff 100644 --- a/Minecraft.World/OfferFlowerGoal.cpp +++ b/Minecraft.World/OfferFlowerGoal.cpp @@ -17,12 +17,12 @@ bool OfferFlowerGoal::canUse() if (!golem->level->isDay()) return false; if (golem->getRandom()->nextInt(8000) != 0) return false; villager = weak_ptr(dynamic_pointer_cast( golem->level->getClosestEntityOfClass(typeid(Villager), golem->bb->grow(6, 2, 6), golem->shared_from_this()) )); - return villager.lock() != NULL; + return villager.lock() != nullptr; } bool OfferFlowerGoal::canContinueToUse() { - return _tick > 0 && villager.lock() != NULL; + return _tick > 0 && villager.lock() != nullptr; } void OfferFlowerGoal::start() diff --git a/Minecraft.World/OldChunkStorage.cpp b/Minecraft.World/OldChunkStorage.cpp index c3e6f4aea..cec355bf2 100644 --- a/Minecraft.World/OldChunkStorage.cpp +++ b/Minecraft.World/OldChunkStorage.cpp @@ -9,7 +9,7 @@ #include "FileHeader.h" #include "OldChunkStorage.h" DWORD OldChunkStorage::tlsIdx = 0; -OldChunkStorage::ThreadStorage *OldChunkStorage::tlsDefault = NULL; +OldChunkStorage::ThreadStorage *OldChunkStorage::tlsDefault = nullptr; OldChunkStorage::ThreadStorage::ThreadStorage() { @@ -30,7 +30,7 @@ OldChunkStorage::ThreadStorage::~ThreadStorage() void OldChunkStorage::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == NULL ) + if(tlsDefault == nullptr ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -126,14 +126,14 @@ LevelChunk *OldChunkStorage::load(Level *level, int x, int z) char buf[256]; sprintf(buf,"Chunk file at %d, %d is missing level data, skipping\n",x,z); app.DebugPrintf(buf); - return NULL; + return nullptr; } if (!tag->getCompound(L"Level")->contains(L"Blocks")) { char buf[256]; sprintf(buf,"Chunk file at %d, %d is missing block data, skipping\n",x,z); app.DebugPrintf(buf); - return NULL; + return nullptr; } LevelChunk *levelChunk = OldChunkStorage::load(level, tag->getCompound(L"Level")); if (!levelChunk->isAt(x, z)) @@ -152,7 +152,7 @@ LevelChunk *OldChunkStorage::load(Level *level, int x, int z) // e.printStackTrace(); // } } - return NULL; + return nullptr; } void OldChunkStorage::save(Level *level, LevelChunk *levelChunk) @@ -277,7 +277,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos) PIXBeginNamedEvent(0,"Saving tile tick data"); vector *ticksInChunk = level->fetchTicksInChunk(lc, false); - if (ticksInChunk != NULL) + if (ticksInChunk != nullptr) { __int64 levelTime = level->getGameTime(); @@ -365,7 +365,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) PIXBeginNamedEvent(0,"Saving tile tick data"); vector *ticksInChunk = level->fetchTicksInChunk(lc, false); - if (ticksInChunk != NULL) + if (ticksInChunk != nullptr) { __int64 levelTime = level->getGameTime(); @@ -393,14 +393,14 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag) void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *tag) { ListTag *entityTags = (ListTag *) tag->getList(L"Entities"); - if (entityTags != NULL) + if (entityTags != nullptr) { for (int i = 0; i < entityTags->size(); i++) { CompoundTag *teTag = entityTags->get(i); shared_ptr te = EntityIO::loadStatic(teTag, level); lc->lastSaveHadEntities = true; - if (te != NULL) + if (te != nullptr) { lc->addEntity(te); } @@ -408,13 +408,13 @@ void OldChunkStorage::loadEntities(LevelChunk *lc, Level *level, CompoundTag *ta } ListTag *tileEntityTags = (ListTag *) tag->getList(L"TileEntities"); - if (tileEntityTags != NULL) + if (tileEntityTags != nullptr) { for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); shared_ptr te = TileEntity::loadStatic(teTag); - if (te != NULL) + if (te != nullptr) { lc->addTileEntity(te); } @@ -476,7 +476,7 @@ LevelChunk *OldChunkStorage::load(Level *level, DataInputStream *dis) PIXBeginNamedEvent(0,"Loading TileTicks"); ListTag *tileTicks = (ListTag *) tag->getList(L"TileTicks"); - if (tileTicks != NULL) + if (tileTicks != nullptr) { for (int i = 0; i < tileTicks->size(); i++) { @@ -556,7 +556,7 @@ LevelChunk *OldChunkStorage::load(Level *level, CompoundTag *tag) // 4J removed - we shouldn't need this any more #if 0 - if (levelChunk->heightmap.data == NULL || !levelChunk->skyLight->isValid()) + if (levelChunk->heightmap.data == nullptr || !levelChunk->skyLight->isValid()) { static int chunksUpdated = 0; delete [] levelChunk->heightmap.data; @@ -594,7 +594,7 @@ LevelChunk *OldChunkStorage::load(Level *level, CompoundTag *tag) { ListTag *tileTicks = (ListTag *) tag->getList(L"TileTicks"); - if (tileTicks != NULL) + if (tileTicks != nullptr) { for (int i = 0; i < tileTicks->size(); i++) { diff --git a/Minecraft.World/OreFeature.cpp b/Minecraft.World/OreFeature.cpp index c057511bf..cea881aad 100644 --- a/Minecraft.World/OreFeature.cpp +++ b/Minecraft.World/OreFeature.cpp @@ -35,8 +35,8 @@ bool OreFeature::place(Level *level, Random *random, int x, int y, int z) bool collisionsExpected = false; - LevelGenerationOptions *levelGenOptions = NULL; - if( app.getLevelGenerationOptions() != NULL ) + LevelGenerationOptions *levelGenOptions = nullptr; + if( app.getLevelGenerationOptions() != nullptr ) { levelGenOptions = app.getLevelGenerationOptions(); @@ -83,7 +83,7 @@ bool OreFeature::place(Level *level, Random *random, int x, int y, int z) int zt1 = Mth::floor(zz + halfR); // 4J Stu Added to stop ore features generating areas previously place by game rule generation - if(collisionsExpected && levelGenOptions != NULL) + if(collisionsExpected && levelGenOptions != nullptr) { bool intersects = levelGenOptions->checkIntersects(xt0, yt0, zt0, xt1, yt1, zt1); if(intersects) diff --git a/Minecraft.World/OwnerHurtByTargetGoal.cpp b/Minecraft.World/OwnerHurtByTargetGoal.cpp index 8250dc184..787eb2aec 100644 --- a/Minecraft.World/OwnerHurtByTargetGoal.cpp +++ b/Minecraft.World/OwnerHurtByTargetGoal.cpp @@ -14,7 +14,7 @@ bool OwnerHurtByTargetGoal::canUse() { if (!tameAnimal->isTame()) return false; shared_ptr owner = dynamic_pointer_cast( tameAnimal->getOwner() ); - if (owner == NULL) return false; + if (owner == nullptr) return false; ownerLastHurtBy = weak_ptr(owner->getLastHurtByMob()); int ts = owner->getLastHurtByMobTimestamp(); @@ -27,7 +27,7 @@ void OwnerHurtByTargetGoal::start() mob->setTarget(ownerLastHurtBy.lock()); shared_ptr owner = dynamic_pointer_cast( tameAnimal->getOwner() ); - if (owner != NULL) + if (owner != nullptr) { timestamp = owner->getLastHurtByMobTimestamp(); } diff --git a/Minecraft.World/OwnerHurtTargetGoal.cpp b/Minecraft.World/OwnerHurtTargetGoal.cpp index b7e745051..a63e17846 100644 --- a/Minecraft.World/OwnerHurtTargetGoal.cpp +++ b/Minecraft.World/OwnerHurtTargetGoal.cpp @@ -14,7 +14,7 @@ bool OwnerHurtTargetGoal::canUse() { if (!tameAnimal->isTame()) return false; shared_ptr owner = dynamic_pointer_cast( tameAnimal->getOwner() ); - if (owner == NULL) return false; + if (owner == nullptr) return false; ownerLastHurt = weak_ptr(owner->getLastHurtMob()); int ts = owner->getLastHurtMobTimestamp(); shared_ptr locked = ownerLastHurt.lock(); @@ -26,7 +26,7 @@ void OwnerHurtTargetGoal::start() mob->setTarget(ownerLastHurt.lock()); shared_ptr owner = dynamic_pointer_cast( tameAnimal->getOwner() ); - if (owner != NULL) + if (owner != nullptr) { timestamp = owner->getLastHurtMobTimestamp(); diff --git a/Minecraft.World/Packet.cpp b/Minecraft.World/Packet.cpp index 44081a586..417df48f3 100644 --- a/Minecraft.World/Packet.cpp +++ b/Minecraft.World/Packet.cpp @@ -336,7 +336,7 @@ shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // th } packet = getPacket(id); - if (packet == NULL) assert(false);//throw new IOException(wstring(L"Bad packet id ") + std::to_wstring(id)); + if (packet == nullptr) assert(false);//throw new IOException(wstring(L"Bad packet id ") + std::to_wstring(id)); //app.DebugPrintf("%s reading packet %d\n", isServer ? "Server" : "Client", packet->getId()); packet->read(dis); @@ -345,7 +345,7 @@ shared_ptr Packet::readPacket(DataInputStream *dis, bool isServer) // th // { // // reached end of stream // OutputDebugString("Reached end of stream"); - // return NULL; + // return nullptr; // } // 4J - Don't bother tracking stats in a content package @@ -525,7 +525,7 @@ shared_ptr Packet::readItem(DataInputStream *dis) void Packet::writeItem(shared_ptr item, DataOutputStream *dos) { - if (item == NULL) + if (item == nullptr) { dos->writeShort(-1); } @@ -545,7 +545,7 @@ void Packet::writeItem(shared_ptr item, DataOutputStream *dos) CompoundTag *Packet::readNbt(DataInputStream *dis) { int size = dis->readShort(); - if (size < 0) return NULL; + if (size < 0) return nullptr; byteArray buff(size); dis->readFully(buff); CompoundTag *result = (CompoundTag *) NbtIo::decompress(buff); @@ -555,7 +555,7 @@ CompoundTag *Packet::readNbt(DataInputStream *dis) void Packet::writeNbt(CompoundTag *tag, DataOutputStream *dos) { - if (tag == NULL) + if (tag == nullptr) { dos->writeShort(-1); } diff --git a/Minecraft.World/Painting.cpp b/Minecraft.World/Painting.cpp index 4d79f6f44..e1232809b 100644 --- a/Minecraft.World/Painting.cpp +++ b/Minecraft.World/Painting.cpp @@ -54,7 +54,7 @@ const int Painting::Motive::MAX_MOTIVE_NAME_LENGTH = 13; //JAVA: "SkullAndRoses // 4J - added for common ctor code void Painting::_init( Level *level ) { - motive = NULL; + motive = nullptr; }; Painting::Painting(Level *level) : HangingEntity( level ) @@ -138,7 +138,7 @@ void Painting::readAdditionalSaveData(CompoundTag *tag) this->motive = (Motive *)Motive::values[i]; } } - if (this->motive == NULL) motive = (Motive *)Motive::values[ Kebab ]; + if (this->motive == nullptr) motive = (Motive *)Motive::values[ Kebab ]; HangingEntity::readAdditionalSaveData(tag); } @@ -155,7 +155,7 @@ int Painting::getHeight() void Painting::dropItem(shared_ptr causedBy) { - if ( (causedBy != NULL) && causedBy->instanceof(eTYPE_PLAYER) ) + if ( (causedBy != nullptr) && causedBy->instanceof(eTYPE_PLAYER) ) { shared_ptr player = dynamic_pointer_cast(causedBy); if (player->abilities.instabuild) diff --git a/Minecraft.World/Path.cpp b/Minecraft.World/Path.cpp index 0006ce095..afea4a176 100644 --- a/Minecraft.World/Path.cpp +++ b/Minecraft.World/Path.cpp @@ -46,7 +46,7 @@ Node *Path::last() { return nodes[length - 1]; } - return NULL; + return nullptr; } Node *Path::get(int i) @@ -94,7 +94,7 @@ Vec3 *Path::currentPos() bool Path::sameAs(Path *path) { - if (path == NULL) return false; + if (path == nullptr) return false; if (path->nodes.length != nodes.length) return false; for (int i = 0; i < nodes.length; ++i) if (nodes[i]->x != path->nodes[i]->x || nodes[i]->y != path->nodes[i]->y || nodes[i]->z != path->nodes[i]->z) return false; @@ -104,13 +104,13 @@ bool Path::sameAs(Path *path) bool Path::endsIn(Vec3 *pos) { Node *lastNode = last(); - if (lastNode == NULL) return false; + if (lastNode == nullptr) return false; return lastNode->x == static_cast(pos->x) && lastNode->y == static_cast(pos->y) && lastNode->z == static_cast(pos->z); } bool Path::endsInXZ(Vec3 *pos) { Node *lastNode = last(); - if (lastNode == NULL) return false; + if (lastNode == nullptr) return false; return lastNode->x == static_cast(pos->x) && lastNode->z == static_cast(pos->z); } \ No newline at end of file diff --git a/Minecraft.World/PathFinder.cpp b/Minecraft.World/PathFinder.cpp index dc8a9882c..eb3bd45e7 100644 --- a/Minecraft.World/PathFinder.cpp +++ b/Minecraft.World/PathFinder.cpp @@ -124,7 +124,7 @@ Path *PathFinder::findPath(Entity *e, Node *from, Node *to, Node *size, float ma } } - if (closest == from) return NULL; + if (closest == from) return nullptr; return reconstruct_path(from, closest); } @@ -140,44 +140,44 @@ int PathFinder::getNeighbors(Entity *entity, Node *pos, Node *size, Node *target Node *e = getNode(entity, pos->x + 1, pos->y, pos->z, size, jumpSize); Node *s = getNode(entity, pos->x, pos->y, pos->z - 1, size, jumpSize); - if (n != NULL && !n->closed && n->distanceTo(target) < maxDist) neighbors->data[p++] = n; - if (w != NULL && !w->closed && w->distanceTo(target) < maxDist) neighbors->data[p++] = w; - if (e != NULL && !e->closed && e->distanceTo(target) < maxDist) neighbors->data[p++] = e; - if (s != NULL && !s->closed && s->distanceTo(target) < maxDist) neighbors->data[p++] = s; + if (n != nullptr && !n->closed && n->distanceTo(target) < maxDist) neighbors->data[p++] = n; + if (w != nullptr && !w->closed && w->distanceTo(target) < maxDist) neighbors->data[p++] = w; + if (e != nullptr && !e->closed && e->distanceTo(target) < maxDist) neighbors->data[p++] = e; + if (s != nullptr && !s->closed && s->distanceTo(target) < maxDist) neighbors->data[p++] = s; return p; } Node *PathFinder::getNode(Entity *entity, int x, int y, int z, Node *size, int jumpSize) { - Node *best = NULL; + Node *best = nullptr; int pathType = isFree(entity, x, y, z, size); if (pathType == TYPE_WALKABLE) return getNode(x, y, z); if (pathType == TYPE_OPEN) best = getNode(x, y, z); - if (best == NULL && jumpSize > 0 && pathType != TYPE_FENCE && pathType != TYPE_TRAP && isFree(entity, x, y + jumpSize, z, size) == TYPE_OPEN) + if (best == nullptr && jumpSize > 0 && pathType != TYPE_FENCE && pathType != TYPE_TRAP && isFree(entity, x, y + jumpSize, z, size) == TYPE_OPEN) { best = getNode(x, y + jumpSize, z); y += jumpSize; } - if (best != NULL) + if (best != nullptr) { int drop = 0; int cost = 0; while (y > 0) { cost = isFree(entity, x, y - 1, z, size); - if (avoidWater && cost == TYPE_WATER) return NULL; + if (avoidWater && cost == TYPE_WATER) return nullptr; if (cost != TYPE_OPEN) break; // fell too far? - if (++drop >= 4) return NULL; // 4J - rolling this back to pre-java 1.6.4 version as we're suspicious of the performance implications of this -// if (drop++ >= entity->getMaxFallDistance()) return NULL; + if (++drop >= 4) return nullptr; // 4J - rolling this back to pre-java 1.6.4 version as we're suspicious of the performance implications of this +// if (drop++ >= entity->getMaxFallDistance()) return nullptr; y--; if (y > 0) best = getNode(x, y, z); } // fell into lava? - if (cost == TYPE_LAVA) return NULL; + if (cost == TYPE_LAVA) return nullptr; } return best; @@ -269,7 +269,7 @@ Path *PathFinder::reconstruct_path(Node *from, Node *to) { int count = 1; Node *n = to; - while (n->cameFrom != NULL) + while (n->cameFrom != nullptr) { count++; n = n->cameFrom; @@ -278,7 +278,7 @@ Path *PathFinder::reconstruct_path(Node *from, Node *to) NodeArray nodes = NodeArray(count); n = to; nodes.data[--count] = n; - while (n->cameFrom != NULL) + while (n->cameFrom != nullptr) { n = n->cameFrom; nodes.data[--count] = n; diff --git a/Minecraft.World/PathNavigation.cpp b/Minecraft.World/PathNavigation.cpp index 4a9f6d0c0..51d08d1eb 100644 --- a/Minecraft.World/PathNavigation.cpp +++ b/Minecraft.World/PathNavigation.cpp @@ -16,7 +16,7 @@ PathNavigation::PathNavigation(Mob *mob, Level *level) this->level = level; dist = mob->getAttribute(SharedMonsterAttributes::FOLLOW_RANGE); - path = NULL; + path = nullptr; speedModifier = 0.0; avoidSun = false; _tick = 0; @@ -30,7 +30,7 @@ PathNavigation::PathNavigation(Mob *mob, Level *level) PathNavigation::~PathNavigation() { - if(path != NULL) delete path; + if(path != nullptr) delete path; delete lastStuckCheckPos; } @@ -86,7 +86,7 @@ float PathNavigation::getMaxDist() Path *PathNavigation::createPath(double x, double y, double z) { - if (!canUpdatePath()) return NULL; + if (!canUpdatePath()) return nullptr; return level->findPath(mob->shared_from_this(), Mth::floor(x), static_cast(y), Mth::floor(z), getMaxDist(), _canPassDoors, _canOpenDoors, avoidWater, canFloat); } @@ -101,7 +101,7 @@ bool PathNavigation::moveTo(double x, double y, double z, double speedModifier) Path *PathNavigation::createPath(shared_ptr target) { - if (!canUpdatePath()) return NULL; + if (!canUpdatePath()) return nullptr; return level->findPath(mob->shared_from_this(), target, getMaxDist(), _canPassDoors, _canOpenDoors, avoidWater, canFloat); } @@ -111,21 +111,21 @@ bool PathNavigation::moveTo(shared_ptr target, double speedModifier) Path *newPath = createPath(target); MemSect(0); // No need to delete newPath here as this will be copied into the member variable path and the class can assume responsibility for it - if (newPath != NULL) return moveTo(newPath, speedModifier); + if (newPath != nullptr) return moveTo(newPath, speedModifier); else return false; } bool PathNavigation::moveTo(Path *newPath, double speedModifier) { - if(newPath == NULL) + if(newPath == nullptr) { - if(path != NULL) delete path; - path = NULL; + if(path != nullptr) delete path; + path = nullptr; return false; } if(!newPath->sameAs(path)) { - if(path != NULL) delete path; + if(path != nullptr) delete path; path = newPath; } else @@ -158,7 +158,7 @@ void PathNavigation::tick() if (isDone()) return; Vec3 *target = path->currentPos(mob->shared_from_this()); - if (target == NULL) return; + if (target == nullptr) return; mob->getMoveControl()->setWantedPosition(target->x, target->y, target->z, speedModifier); } @@ -169,7 +169,7 @@ void PathNavigation::updatePath() // find first elevations in path int firstElevation = path->getSize(); - for (int i = path->getIndex(); path != NULL && i < path->getSize(); ++i) + for (int i = path->getIndex(); path != nullptr && i < path->getSize(); ++i) { if (static_cast(path->get(i)->y) != static_cast(mobPos->y)) { @@ -216,13 +216,13 @@ void PathNavigation::updatePath() bool PathNavigation::isDone() { - return path == NULL || path->isDone(); + return path == nullptr || path->isDone(); } void PathNavigation::stop() { - if(path != NULL) delete path; - path = NULL; + if(path != nullptr) delete path; + path = nullptr; } Vec3 *PathNavigation::getTempMobPos() diff --git a/Minecraft.World/PathfinderMob.cpp b/Minecraft.World/PathfinderMob.cpp index 9942445c9..840a60208 100644 --- a/Minecraft.World/PathfinderMob.cpp +++ b/Minecraft.World/PathfinderMob.cpp @@ -15,7 +15,7 @@ AttributeModifier *PathfinderMob::SPEED_MODIFIER_FLEEING = (new AttributeModifie PathfinderMob::PathfinderMob(Level *level) : Mob( level ) { - path = NULL; + path = nullptr; attackTarget = nullptr; holdGround = false; fleeTime = 0; @@ -51,10 +51,10 @@ void PathfinderMob::serverAiStep() holdGround = shouldHoldGround(); float maxDist = 16; - if (attackTarget == NULL) + if (attackTarget == nullptr) { attackTarget = findAttackTarget(); - if (attackTarget != NULL) + if (attackTarget != nullptr) { setPath(level->findPath(shared_from_this(), attackTarget, maxDist, true, false, false, true)); // 4J - changed to setPath from path = } @@ -84,18 +84,18 @@ void PathfinderMob::serverAiStep() // they aren't enclosed. We don't want the extra network overhead of just having Everything wandering round all the time, so have put a management system in place // that selects a subset of entities which have had their flag set through the considerForExtraWandering method so that these can keep doing random strolling. - if (!holdGround && (attackTarget != NULL && (path == NULL || random->nextInt(20) == 0))) + if (!holdGround && (attackTarget != nullptr && (path == nullptr || random->nextInt(20) == 0))) { setPath(level->findPath(shared_from_this(), attackTarget, maxDist, true, false, false, true));// 4J - changed to setPath from path = } - else if (!holdGround && ((path == NULL && (random->nextInt(180) == 0) || fleeTime > 0) || (random->nextInt(120) == 0 || fleeTime > 0))) + else if (!holdGround && ((path == nullptr && (random->nextInt(180) == 0) || fleeTime > 0) || (random->nextInt(120) == 0 || fleeTime > 0))) { if(noActionTime < SharedConstants::TICKS_PER_SECOND * 5) { findRandomStrollLocation(); } } - else if (!holdGround && (path == NULL ) ) + else if (!holdGround && (path == nullptr ) ) { if( ( noActionTime >= SharedConstants::TICKS_PER_SECOND * 5 ) && isExtraWanderingEnabled() ) { @@ -115,28 +115,28 @@ void PathfinderMob::serverAiStep() bool inWater = isInWater(); bool inLava = isInLava(); xRot = 0; - if (path == NULL || random->nextInt(100) == 0) + if (path == nullptr || random->nextInt(100) == 0) { this->Mob::serverAiStep(); - setPath(NULL);// 4J - changed to setPath from path = + setPath(nullptr);// 4J - changed to setPath from path = return; } Vec3 *target = path->currentPos(shared_from_this()); double r = bbWidth * 2; - while (target != NULL && target->distanceToSqr(x, target->y, z) < r * r) + while (target != nullptr && target->distanceToSqr(x, target->y, z) < r * r) { path->next(); if (path->isDone()) { - target = NULL; - setPath(NULL); // 4J - changed to setPath from path = + target = nullptr; + setPath(nullptr); // 4J - changed to setPath from path = } else target = path->currentPos(shared_from_this()); } jumping = false; - if (target != NULL) + if (target != nullptr) { double xd = target->x - x; double zd = target->z - z; @@ -156,7 +156,7 @@ void PathfinderMob::serverAiStep() if (holdGround) { - if (attackTarget != NULL) + if (attackTarget != nullptr) { double xd2 = attackTarget->x - x; double zd2 = attackTarget->z - z; @@ -175,7 +175,7 @@ void PathfinderMob::serverAiStep() } } - if (attackTarget != NULL) + if (attackTarget != nullptr) { lookAt(attackTarget, 30, 30); } @@ -250,7 +250,7 @@ bool PathfinderMob::canSpawn() bool PathfinderMob::isPathFinding() { - return path != NULL; + return path != nullptr; } void PathfinderMob::setPath(Path *path) @@ -311,7 +311,7 @@ void PathfinderMob::tickLeash() { Mob::tickLeash(); - if (isLeashed() && getLeashHolder() != NULL && getLeashHolder()->level == this->level) + if (isLeashed() && getLeashHolder() != nullptr && getLeashHolder()->level == this->level) { // soft restriction shared_ptr leashHolder = getLeashHolder(); @@ -320,7 +320,7 @@ void PathfinderMob::tickLeash() float _distanceTo = distanceTo(leashHolder); shared_ptr tamabaleAnimal = shared_from_this()->instanceof(eTYPE_TAMABLE_ANIMAL) ? dynamic_pointer_cast(shared_from_this()) : nullptr; - if ( (tamabaleAnimal != NULL) && tamabaleAnimal->isSitting() ) + if ( (tamabaleAnimal != nullptr) && tamabaleAnimal->isSitting() ) { if (_distanceTo > 10) { diff --git a/Minecraft.World/PerlinNoise.cpp b/Minecraft.World/PerlinNoise.cpp index b4fd8004d..bb0ce8613 100644 --- a/Minecraft.World/PerlinNoise.cpp +++ b/Minecraft.World/PerlinNoise.cpp @@ -64,7 +64,7 @@ double PerlinNoise::getValue(double x, double y, double z) doubleArray PerlinNoise::getRegion(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize, double xScale, double yScale, double zScale) { - if (buffer.data == NULL) buffer = doubleArray(xSize * ySize * zSize); + if (buffer.data == nullptr) buffer = doubleArray(xSize * ySize * zSize); else for (unsigned int i = 0; i < buffer.length; i++) buffer[i] = 0; diff --git a/Minecraft.World/PerlinSimplexNoise.cpp b/Minecraft.World/PerlinSimplexNoise.cpp index a8f6101c7..97d114485 100644 --- a/Minecraft.World/PerlinSimplexNoise.cpp +++ b/Minecraft.World/PerlinSimplexNoise.cpp @@ -72,7 +72,7 @@ doubleArray PerlinSimplexNoise::getRegion(doubleArray buffer, double x, double y xScale/=1.5; yScale/=1.5; - if (buffer.data == NULL || static_cast(buffer.length) < xSize * ySize) + if (buffer.data == nullptr || static_cast(buffer.length) < xSize * ySize) { if( buffer.data ) delete [] buffer.data; buffer = doubleArray(xSize * ySize); @@ -98,7 +98,7 @@ doubleArray PerlinSimplexNoise::getRegion(doubleArray buffer, double x, double y xScale/=1.5; yScale/=1.5; - if (buffer.data == NULL) buffer = doubleArray(xSize * ySize * zSize); + if (buffer.data == nullptr) buffer = doubleArray(xSize * ySize * zSize); else for (unsigned int i = 0; i < buffer.length; i++) buffer[i] = 0; diff --git a/Minecraft.World/PickaxeItem.cpp b/Minecraft.World/PickaxeItem.cpp index 05177e7bc..1bcee6e03 100644 --- a/Minecraft.World/PickaxeItem.cpp +++ b/Minecraft.World/PickaxeItem.cpp @@ -54,7 +54,7 @@ bool PickaxeItem::canDestroySpecial(Tile *tile) // 4J - brought forward from 1.2.3 float PickaxeItem::getDestroySpeed(shared_ptr itemInstance, Tile *tile) { - if (tile != NULL && (tile->material == Material::metal || tile->material == Material::heavyMetal || tile->material == Material::stone)) + if (tile != nullptr && (tile->material == Material::metal || tile->material == Material::heavyMetal || tile->material == Material::stone)) { return speed; } diff --git a/Minecraft.World/Pig.cpp b/Minecraft.World/Pig.cpp index 54d82ad85..6ac1243af 100644 --- a/Minecraft.World/Pig.cpp +++ b/Minecraft.World/Pig.cpp @@ -64,7 +64,7 @@ bool Pig::canBeControlledByRider() { shared_ptr item = dynamic_pointer_cast(rider.lock())->getCarriedItem(); - return item != NULL && item->id == Item::carrotOnAStick_Id; + return item != nullptr && item->id == Item::carrotOnAStick_Id; } void Pig::defineSynchedData() @@ -109,7 +109,7 @@ bool Pig::mobInteract(shared_ptr player) { if(!Animal::mobInteract(player)) { - if (hasSaddle() && !level->isClientSide && (rider.lock() == NULL || rider.lock() == player)) + if (hasSaddle() && !level->isClientSide && (rider.lock() == nullptr || rider.lock() == player)) { // 4J HEG - Fixed issue with player not being able to dismount pig (issue #4479) player->ride( rider.lock() == player ? nullptr : shared_from_this() ); @@ -173,7 +173,7 @@ void Pig::thunderHit(const LightningBolt *lightningBolt) void Pig::causeFallDamage(float distance) { Animal::causeFallDamage(distance); - if ( (distance > 5) && rider.lock() != NULL && rider.lock()->instanceof(eTYPE_PLAYER) ) + if ( (distance > 5) && rider.lock() != nullptr && rider.lock()->instanceof(eTYPE_PLAYER) ) { (dynamic_pointer_cast(rider.lock()))->awardStat(GenericStats::flyPig(),GenericStats::param_flyPig()); } @@ -194,7 +194,7 @@ shared_ptr Pig::getBreedOffspring(shared_ptr target) bool Pig::isFood(shared_ptr itemInstance) { - return itemInstance != NULL && itemInstance->id == Item::carrots_Id; + return itemInstance != nullptr && itemInstance->id == Item::carrots_Id; } ControlledByPlayerGoal *Pig::getControlGoal() diff --git a/Minecraft.World/PigZombie.cpp b/Minecraft.World/PigZombie.cpp index 6c5457c8a..16f00213c 100644 --- a/Minecraft.World/PigZombie.cpp +++ b/Minecraft.World/PigZombie.cpp @@ -53,7 +53,7 @@ void PigZombie::tick() AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); speed->removeModifier(SPEED_MODIFIER_ATTACKING); - if (attackTarget != NULL) + if (attackTarget != nullptr) { speed->addModifier(new AttributeModifier(*SPEED_MODIFIER_ATTACKING)); } @@ -105,7 +105,7 @@ shared_ptr PigZombie::findAttackTarget() bool PigZombie::hurt(DamageSource *source, float dmg) { shared_ptr sourceEntity = source->getEntity(); - if ( sourceEntity != NULL && sourceEntity->instanceof(eTYPE_PLAYER) ) + if ( sourceEntity != nullptr && sourceEntity->instanceof(eTYPE_PLAYER) ) { vector > *nearby = level->getEntities( shared_from_this(), bb->grow(32, 32, 32)); for (auto& e : *nearby) diff --git a/Minecraft.World/PineFeature.cpp b/Minecraft.World/PineFeature.cpp index 685f1e48c..bbe424aa0 100644 --- a/Minecraft.World/PineFeature.cpp +++ b/Minecraft.World/PineFeature.cpp @@ -19,7 +19,7 @@ bool PineFeature::place(Level *level, Random *random, int x, int y, int z) } // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - topRadius, y - 1, z - topRadius, x + topRadius, y + treeHeight, z + topRadius); diff --git a/Minecraft.World/PistonBaseTile.cpp b/Minecraft.World/PistonBaseTile.cpp index 7cd4d1200..e8e2a7138 100644 --- a/Minecraft.World/PistonBaseTile.cpp +++ b/Minecraft.World/PistonBaseTile.cpp @@ -28,7 +28,7 @@ DWORD PistonBaseTile::tlsIdx = TlsAlloc(); // 4J - ignoreUpdate is a static in java, implementing as TLS here to make thread safe bool PistonBaseTile::ignoreUpdate() { - return (TlsGetValue(tlsIdx) != NULL); + return (TlsGetValue(tlsIdx) != nullptr); } void PistonBaseTile::ignoreUpdate(bool set) @@ -45,9 +45,9 @@ PistonBaseTile::PistonBaseTile(int id, bool isSticky) : Tile(id, Material::pisto setSoundType(SOUND_STONE); setDestroyTime(0.5f); - iconInside = NULL; - iconBack = NULL; - iconPlatform = NULL; + iconInside = nullptr; + iconBack = nullptr; + iconPlatform = nullptr; } Icon *PistonBaseTile::getPlatformTexture() @@ -97,7 +97,7 @@ Icon *PistonBaseTile::getTexture(const wstring &name) if (name.compare(PLATFORM_STICKY_TEX) == 0) return Tile::pistonStickyBase->iconPlatform; if (name.compare(INSIDE_TEX) == 0) return Tile::pistonBase->iconInside; - return NULL; + return nullptr; } //@Override @@ -144,7 +144,7 @@ void PistonBaseTile::neighborChanged(Level *level, int x, int y, int z, int type void PistonBaseTile::onPlace(Level *level, int x, int y, int z) { - if (!level->isClientSide && level->getTileEntity(x, y, z) == NULL && !ignoreUpdate()) + if (!level->isClientSide && level->getTileEntity(x, y, z) == nullptr && !ignoreUpdate()) { checkIfExtend(level, x, y, z); } @@ -255,7 +255,7 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, { PIXBeginNamedEvent(0,"Contract phase A\n"); shared_ptr prevTileEntity = level->getTileEntity(x + Facing::STEP_X[facing], y + Facing::STEP_Y[facing], z + Facing::STEP_Z[facing]); - if (prevTileEntity != NULL && dynamic_pointer_cast(prevTileEntity) != NULL) + if (prevTileEntity != nullptr && dynamic_pointer_cast(prevTileEntity) != nullptr) { dynamic_pointer_cast(prevTileEntity)->finalTick(); } @@ -285,7 +285,7 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, // the block two steps away is a moving piston block piece, so replace it with the real data, // since it's probably this piston which is changing too fast shared_ptr tileEntity = level->getTileEntity(twoX, twoY, twoZ); - if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL ) + if (tileEntity != nullptr && dynamic_pointer_cast(tileEntity) != nullptr ) { shared_ptr ppe = dynamic_pointer_cast(tileEntity); diff --git a/Minecraft.World/PistonExtensionTile.cpp b/Minecraft.World/PistonExtensionTile.cpp index 25c5adb95..bf5e6e602 100644 --- a/Minecraft.World/PistonExtensionTile.cpp +++ b/Minecraft.World/PistonExtensionTile.cpp @@ -7,7 +7,7 @@ PistonExtensionTile::PistonExtensionTile(int id) : Tile(id, Material::piston,isSolidRender() ) { // 4J added initialiser - overrideTopTexture = NULL; + overrideTopTexture = nullptr; setSoundType(SOUND_STONE); setDestroyTime(0.5f); @@ -20,7 +20,7 @@ void PistonExtensionTile::setOverrideTopTexture(Icon *overrideTopTexture) void PistonExtensionTile::clearOverrideTopTexture() { - this->overrideTopTexture = NULL; + this->overrideTopTexture = nullptr; } void PistonExtensionTile::playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player) @@ -65,7 +65,7 @@ Icon *PistonExtensionTile::getTexture(int face, int data) if (face == facing) { - if (overrideTopTexture != NULL) + if (overrideTopTexture != nullptr) { return overrideTopTexture; } diff --git a/Minecraft.World/PistonMovingPiece.cpp b/Minecraft.World/PistonMovingPiece.cpp index ed0bfeba3..a1fe1c957 100644 --- a/Minecraft.World/PistonMovingPiece.cpp +++ b/Minecraft.World/PistonMovingPiece.cpp @@ -23,7 +23,7 @@ void PistonMovingPiece::onPlace(Level *level, int x, int y, int z) void PistonMovingPiece::onRemove(Level *level, int x, int y, int z, int id, int data) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL) + if (tileEntity != nullptr && dynamic_pointer_cast(tileEntity) != nullptr) { dynamic_pointer_cast(tileEntity)->finalTick(); } @@ -62,7 +62,7 @@ bool PistonMovingPiece::use(Level *level, int x, int y, int z, shared_ptrisClientSide && level->getTileEntity(x, y, z) == NULL) + if (!level->isClientSide && level->getTileEntity(x, y, z) == nullptr) { // this block is no longer valid level->removeTile(x, y, z); @@ -81,7 +81,7 @@ void PistonMovingPiece::spawnResources(Level *level, int x, int y, int z, int da if (level->isClientSide) return; shared_ptr entity = getEntity(level, x, y, z); - if (entity == NULL) + if (entity == nullptr) { return; } @@ -93,7 +93,7 @@ void PistonMovingPiece::neighborChanged(Level *level, int x, int y, int z, int t { if (!level->isClientSide) { - level->getTileEntity(x, y, z) == NULL; + level->getTileEntity(x, y, z) == nullptr; } } @@ -105,9 +105,9 @@ shared_ptr PistonMovingPiece::newMovingPieceEntity(int block, int da AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z) { shared_ptr entity = getEntity(level, x, y, z); - if (entity == NULL) + if (entity == nullptr) { - return NULL; + return nullptr; } // move the aabb depending on the animation @@ -122,11 +122,11 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z) void PistonMovingPiece::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param { shared_ptr entity = dynamic_pointer_cast(forceEntity); - if( entity == NULL ) entity = getEntity(level, x, y, z); - if (entity != NULL) + if( entity == nullptr ) entity = getEntity(level, x, y, z); + if (entity != nullptr) { Tile *tile = Tile::tiles[entity->getId()]; - if (tile == NULL || tile == this) + if (tile == nullptr || tile == this) { return; } @@ -152,13 +152,13 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z, int tile, fl { if (tile == 0 || tile == id) { - return NULL; + return nullptr; } AABB *aabb = Tile::tiles[tile]->getAABB(level, x, y, z); - if (aabb == NULL) + if (aabb == nullptr) { - return NULL; + return nullptr; } // move the aabb depending on the animation @@ -192,7 +192,7 @@ AABB *PistonMovingPiece::getAABB(Level *level, int x, int y, int z, int tile, fl shared_ptr PistonMovingPiece::getEntity(LevelSource *level, int x, int y, int z) { shared_ptr tileEntity = level->getTileEntity(x, y, z); - if (tileEntity != NULL && dynamic_pointer_cast(tileEntity) != NULL) + if (tileEntity != nullptr && dynamic_pointer_cast(tileEntity) != nullptr) { return dynamic_pointer_cast(tileEntity); } diff --git a/Minecraft.World/PistonPieceEntity.cpp b/Minecraft.World/PistonPieceEntity.cpp index a915c2ff4..dc946a2bd 100644 --- a/Minecraft.World/PistonPieceEntity.cpp +++ b/Minecraft.World/PistonPieceEntity.cpp @@ -117,7 +117,7 @@ void PistonPieceEntity::moveCollidedEntities(float progress, float amount) } AABB *aabb = Tile::pistonMovingPiece->getAABB(level, x, y, z, id, progress, facing); - if (aabb != NULL) + if (aabb != nullptr) { vector > *entities = level->getEntities(nullptr, aabb); if (!entities->empty()) @@ -140,7 +140,7 @@ void PistonPieceEntity::moveCollidedEntities(float progress, float amount) void PistonPieceEntity::finalTick() { - if (progressO < 1 && level != NULL) + if (progressO < 1 && level != nullptr) { progressO = progress = 1; level->removeTileEntity(x, y, z); diff --git a/Minecraft.World/PlayGoal.cpp b/Minecraft.World/PlayGoal.cpp index 72ee69d46..6ce3af232 100644 --- a/Minecraft.World/PlayGoal.cpp +++ b/Minecraft.World/PlayGoal.cpp @@ -40,22 +40,22 @@ bool PlayGoal::canUse() } delete children; - if (followFriend.lock() == NULL) + if (followFriend.lock() == nullptr) { Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 16, 3); - if (pos == NULL) return false; + if (pos == nullptr) return false; } return true; } bool PlayGoal::canContinueToUse() { - return playTime > 0 && followFriend.lock() != NULL; + return playTime > 0 && followFriend.lock() != nullptr; } void PlayGoal::start() { - if (followFriend.lock() != NULL) mob->setChasing(true); + if (followFriend.lock() != nullptr) mob->setChasing(true); playTime = 1000; } @@ -68,7 +68,7 @@ void PlayGoal::stop() void PlayGoal::tick() { --playTime; - if (followFriend.lock() != NULL) + if (followFriend.lock() != nullptr) { if (mob->distanceToSqr(followFriend.lock()) > 2 * 2) mob->getNavigation()->moveTo(followFriend.lock(), speedModifier); } @@ -77,7 +77,7 @@ void PlayGoal::tick() if (mob->getNavigation()->isDone()) { Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 16, 3); - if (pos == NULL) return; + if (pos == nullptr) return; mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, speedModifier); } } diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index b7c659bb3..4d5d55fbc 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -64,17 +64,17 @@ void Player::_init() customTextureUrl2 = L""; m_uiPlayerCurrentSkin=0; - bedPosition = NULL; + bedPosition = nullptr; sleepCounter = 0; deathFadeCounter=0; bedOffsetX = bedOffsetY = bedOffsetZ = 0.0f; - stats = NULL; + stats = nullptr; - respawnPosition = NULL; + respawnPosition = nullptr; respawnForced = false; - minecartAchievementPos = NULL; + minecartAchievementPos = nullptr; fishing = nullptr; @@ -97,7 +97,7 @@ void Player::_init() m_uiGamePrivileges = 0; - m_ppAdditionalModelParts=NULL; + m_ppAdditionalModelParts=nullptr; m_bCheckedForModelParts=false; m_bCheckedDLCForModelParts=false; @@ -192,7 +192,7 @@ int Player::getUseItemDuration() bool Player::isUsingItem() { - return useItem != NULL; + return useItem != nullptr; } int Player::getTicksUsingItem() @@ -206,7 +206,7 @@ int Player::getTicksUsingItem() void Player::releaseUsingItem() { - if (useItem != NULL) + if (useItem != nullptr) { useItem->releaseUsing(level, dynamic_pointer_cast( shared_from_this() ), useItemDuration); @@ -237,13 +237,13 @@ bool Player::isBlocking() // 4J Stu - Added for things that should only be ticked once per simulation frame void Player::updateFrameTick() { - if (useItem != NULL) + if (useItem != nullptr) { shared_ptr item = inventory->getSelected(); // 4J Stu - Fix for #45508 - TU5: Gameplay: Eating one piece of food will result in a second piece being eaten as well - // Original code was item != useItem. Changed this now to use the equals function, and add the NULL check as well for the other possible not equals (useItem is not NULL if we are here) + // Original code was item != useItem. Changed this now to use the equals function, and add the nullptr check as well for the other possible not equals (useItem is not nullptr if we are here) // This is because the useItem and item could be different objects due to an inventory update from the server, but still be the same item (with the same id,count and auxvalue) - if (item == NULL || !item->equals(useItem) ) + if (item == nullptr || !item->equals(useItem) ) { stopUsingItem(); } @@ -316,7 +316,7 @@ void Player::tick() if (!level->isClientSide) { - if (containerMenu != NULL && !containerMenu->stillValid( dynamic_pointer_cast( shared_from_this() ) )) + if (containerMenu != nullptr && !containerMenu->stillValid( dynamic_pointer_cast( shared_from_this() ) )) { closeContainer(); containerMenu = inventoryMenu; @@ -348,12 +348,12 @@ void Player::tick() zCloak += zca * 0.25; yCloak += yca * 0.25; - if (riding == NULL) + if (riding == nullptr) { - if( minecartAchievementPos != NULL ) + if( minecartAchievementPos != nullptr ) { delete minecartAchievementPos; - minecartAchievementPos = NULL; + minecartAchievementPos = nullptr; } } @@ -573,13 +573,13 @@ void Player::spawnEatParticles(shared_ptr useItem, int count) void Player::completeUsingItem() { - if (useItem != NULL) + if (useItem != nullptr) { spawnEatParticles(useItem, 16); int oldCount = useItem->count; shared_ptr itemInstance = useItem->useTimeDepleted(level, dynamic_pointer_cast(shared_from_this())); - if (itemInstance != useItem || (itemInstance != NULL && itemInstance->count != oldCount)) + if (itemInstance != useItem || (itemInstance != nullptr && itemInstance->count != oldCount)) { inventory->items[inventory->selected] = itemInstance; if (itemInstance->count == 0) @@ -615,11 +615,11 @@ void Player::closeContainer() void Player::ride(shared_ptr e) { - if (riding != NULL && e == NULL) + if (riding != nullptr && e == nullptr) { if (!level->isClientSide) findStandUpPosition(riding); - if (riding != NULL) + if (riding != nullptr) { riding->rider = weak_ptr(); } @@ -675,7 +675,7 @@ void Player::setCustomSkin(DWORD skinId) // set the new player additional boxes /*vector *pvModelParts=app.GetAdditionalModelParts(m_dwSkinId); - if(pvModelParts==NULL) + if(pvModelParts==nullptr) { // we don't have the data from the dlc skin yet app.DebugPrintf("Couldn't get model parts for skin %X\n",m_dwSkinId); @@ -683,7 +683,7 @@ void Player::setCustomSkin(DWORD skinId) // do we have it from the DLC pack? DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(this->customTextureUrl); - if(pDLCSkinFile!=NULL) + if(pDLCSkinFile!=nullptr) { DWORD dwBoxC=pDLCSkinFile->getAdditionalBoxesCount(); if(dwBoxC!=0) @@ -694,13 +694,13 @@ void Player::setCustomSkin(DWORD skinId) } else { - this->SetAdditionalModelParts(NULL); + this->SetAdditionalModelParts(nullptr); } app.SetAnimOverrideBitmask(pDLCSkinFile->getSkinID(),pDLCSkinFile->getAnimOverrideBitmask()); } else { - this->SetAdditionalModelParts(NULL); + this->SetAdditionalModelParts(nullptr); } } else @@ -713,7 +713,7 @@ void Player::setCustomSkin(DWORD skinId) // reset the check for model parts m_bCheckedForModelParts=false; m_bCheckedDLCForModelParts=false; - this->SetAdditionalModelParts(NULL); + this->SetAdditionalModelParts(nullptr); } @@ -964,7 +964,7 @@ void Player::rideTick() checkRidingStatistiscs(x - preX, y - preY, z - preZ); // riding can be set to null inside 'Entity::rideTick()'. - if ( riding != NULL && (riding->GetType() & eTYPE_PIG) == eTYPE_PIG ) + if ( riding != nullptr && (riding->GetType() & eTYPE_PIG) == eTYPE_PIG ) { // 4J Stu - I don't know why we would want to do this, but it means that the players head is locked in position and can't move around //xRot = preXRot; @@ -1039,8 +1039,8 @@ void Player::aiStep() if (getHealth() > 0) { - AABB *pickupArea = NULL; - if (riding != NULL && !riding->removed) + AABB *pickupArea = nullptr; + if (riding != nullptr && !riding->removed) { // if the player is riding, also touch entities under the // pig/horse @@ -1052,7 +1052,7 @@ void Player::aiStep() } vector > *entities = level->getEntities(shared_from_this(), pickupArea); - if (entities != NULL) + if (entities != nullptr) { for (auto& e : *entities) { @@ -1104,7 +1104,7 @@ void Player::die(DamageSource *source) inventory->dropAll(); } - if (source != NULL) + if (source != nullptr) { xd = -Mth::cos((hurtDir + yRot) * PI / 180) * 0.1f; zd = -Mth::sin((hurtDir + yRot) * PI / 180) * 0.1f; @@ -1157,7 +1157,7 @@ bool Player::isCreativeModeAllowed() shared_ptr Player::drop(bool all) { - return drop(inventory->removeItem(inventory->selected, all && inventory->getSelected() != NULL ? inventory->getSelected()->count : 1), false); + return drop(inventory->removeItem(inventory->selected, all && inventory->getSelected() != nullptr ? inventory->getSelected()->count : 1), false); } shared_ptr Player::drop(shared_ptr item) @@ -1167,7 +1167,7 @@ shared_ptr Player::drop(shared_ptr item) shared_ptr Player::drop(shared_ptr item, bool randomly) { - if (item == NULL) return nullptr; + if (item == nullptr) return nullptr; if (item->count == 0) return nullptr; shared_ptr thrownItem = shared_ptr( new ItemEntity(level, x, y - 0.3f + getHeadHeight(), z, item) ); @@ -1221,7 +1221,7 @@ float Player::getDestroySpeed(Tile *tile, bool hasProperTool) int efficiency = EnchantmentHelper::getDiggingBonus(dynamic_pointer_cast(shared_from_this())); shared_ptr item = inventory->getSelected(); - if (efficiency > 0 && item != NULL) + if (efficiency > 0 && item != nullptr) { float boost = efficiency * efficiency + 1; @@ -1312,7 +1312,7 @@ void Player::addAdditonalSaveData(CompoundTag *entityTag) entityTag->putInt(L"XpTotal", totalExperience); entityTag->putInt(L"Score", getScore()); - if (respawnPosition != NULL) + if (respawnPosition != nullptr) { entityTag->putInt(L"SpawnX", respawnPosition->x); entityTag->putInt(L"SpawnY", respawnPosition->y); @@ -1407,10 +1407,10 @@ bool Player::hurt(DamageSource *source, float dmg) if (dmg == 0) return false; shared_ptr attacker = source->getEntity(); - if ( attacker != NULL && attacker->instanceof(eTYPE_ARROW) ) + if ( attacker != nullptr && attacker->instanceof(eTYPE_ARROW) ) { shared_ptr arrow = dynamic_pointer_cast(attacker); - if ( arrow->owner != NULL) + if ( arrow->owner != nullptr) { attacker = arrow->owner; } @@ -1424,7 +1424,7 @@ bool Player::canHarmPlayer(shared_ptr target) Team *team = getTeam(); Team *otherTeam = target->getTeam(); - if (team == NULL) + if (team == nullptr) { return true; } @@ -1455,7 +1455,7 @@ float Player::getArmorCoverPercentage() int count = 0; for (int i = 0; i < inventory->armor.length; i++) { - if (inventory->armor[i] != NULL) { + if (inventory->armor[i] != nullptr) { count++; } } @@ -1526,13 +1526,13 @@ bool Player::interact(shared_ptr entity) shared_ptr thisPlayer = dynamic_pointer_cast(shared_from_this()); shared_ptr item = getSelectedItem(); - shared_ptr itemClone = (item != NULL) ? item->copy() : nullptr; + shared_ptr itemClone = (item != nullptr) ? item->copy() : nullptr; if ( entity->interact(thisPlayer) ) { // [EB]: Added rude check to see if we're still talking about the // same item; this code caused bucket->milkbucket to be deleted because // the milkbuckets' stack got decremented to 0. - if (item != NULL && item == getSelectedItem()) + if (item != nullptr && item == getSelectedItem()) { if (item->count <= 0 && !abilities.instabuild) { @@ -1546,7 +1546,7 @@ bool Player::interact(shared_ptr entity) return true; } - if ( (item != NULL) && entity->instanceof(eTYPE_LIVINGENTITY) ) + if ( (item != nullptr) && entity->instanceof(eTYPE_LIVINGENTITY) ) { // 4J - PC Comments // Hack to prevent item stacks from decrementing if the player has @@ -1613,7 +1613,7 @@ void Player::attack(shared_ptr entity) if (dmg > 0 || magicBoost > 0) { - bool bCrit = fallDistance > 0 && !onGround && !onLadder() && !isInWater() && !hasEffect(MobEffect::blindness) && (riding == NULL) && entity->instanceof(eTYPE_LIVINGENTITY); + bool bCrit = fallDistance > 0 && !onGround && !onLadder() && !isInWater() && !hasEffect(MobEffect::blindness) && (riding == nullptr) && entity->instanceof(eTYPE_LIVINGENTITY); if (bCrit && dmg > 0) { dmg *= 1.5f; @@ -1671,12 +1671,12 @@ void Player::attack(shared_ptr entity) if ( entity->instanceof(eTYPE_MULTIENTITY_MOB_PART) ) { shared_ptr multiMob = dynamic_pointer_cast((dynamic_pointer_cast(entity))->parentMob.lock()); - if ( (multiMob != NULL) && multiMob->instanceof(eTYPE_LIVINGENTITY) ) + if ( (multiMob != nullptr) && multiMob->instanceof(eTYPE_LIVINGENTITY) ) { hurtTarget = dynamic_pointer_cast( multiMob ); } } - if ( (item != NULL) && hurtTarget->instanceof(eTYPE_LIVINGENTITY) ) + if ( (item != nullptr) && hurtTarget->instanceof(eTYPE_LIVINGENTITY) ) { item->hurtEnemy(dynamic_pointer_cast(hurtTarget), dynamic_pointer_cast( shared_from_this() ) ); if (item->count <= 0) @@ -1737,14 +1737,14 @@ void Player::animateRespawn(shared_ptr player, Level *level) Slot *Player::getInventorySlot(int slotId) { - return NULL; + return nullptr; } void Player::remove() { LivingEntity::remove(); inventoryMenu->removed( dynamic_pointer_cast( shared_from_this() ) ); - if (containerMenu != NULL) + if (containerMenu != nullptr) { containerMenu->removed( dynamic_pointer_cast( shared_from_this() ) ); } @@ -1909,12 +1909,12 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool save Pos *pos = bedPosition; Pos *standUp = bedPosition; - if (pos != NULL && level->getTile(pos->x, pos->y, pos->z) == Tile::bed_Id) + if (pos != nullptr && level->getTile(pos->x, pos->y, pos->z) == Tile::bed_Id) { BedTile::setOccupied(level, pos->x, pos->y, pos->z, false); standUp = BedTile::findStandUpPosition(level, pos->x, pos->y, pos->z, 0); - if (standUp == NULL) + if (standUp == nullptr) { standUp = new Pos(pos->x, pos->y + 1, pos->z); } @@ -1968,7 +1968,7 @@ Pos *Player::checkBedValidRespawnPosition(Level *level, Pos *pos, bool forced) { return pos; } - return NULL; + return nullptr; } // make sure the bed still has a stand-up position Pos *standUp = BedTile::findStandUpPosition(level, pos->x, pos->y, pos->z, 0); @@ -1977,7 +1977,7 @@ Pos *Player::checkBedValidRespawnPosition(Level *level, Pos *pos, bool forced) float Player::getSleepRotation() { - if (bedPosition != NULL) + if (bedPosition != nullptr) { int data = level->getData(bedPosition->x, bedPosition->y, bedPosition->z); int direction = BedTile::getDirection(data); @@ -2059,21 +2059,21 @@ bool Player::isRespawnForced() void Player::setRespawnPosition(Pos *respawnPosition, bool forced) { - if (respawnPosition != NULL) + if (respawnPosition != nullptr) { this->respawnPosition = new Pos(*respawnPosition); respawnForced = forced; } else { - this->respawnPosition = NULL; + this->respawnPosition = nullptr; respawnForced = false; } } void Player::awardStat(Stat *stat, byteArray paramBlob) { - if (paramBlob.data != NULL) + if (paramBlob.data != nullptr) { delete [] paramBlob.data; } @@ -2102,7 +2102,7 @@ void Player::travel(float xa, float ya) { double preX = x, preY = y, preZ = z; - if (abilities.flying && riding == NULL) + if (abilities.flying && riding == nullptr) { double ydo = yd; float ofs = flyingSpeed; @@ -2127,7 +2127,7 @@ float Player::getSpeed() void Player::checkMovementStatistiscs(double dx, double dy, double dz) { - if (riding != NULL) + if (riding != nullptr) { return; } @@ -2195,7 +2195,7 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz) void Player::checkRidingStatistiscs(double dx, double dy, double dz) { - if (riding != NULL) + if (riding != nullptr) { int distance = static_cast(Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f)); if (distance > 0) @@ -2211,7 +2211,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) } int dist = 0; - if (minecartAchievementPos == NULL) + if (minecartAchievementPos == nullptr) { minecartAchievementPos = new Pos(Mth::floor(x), Mth::floor(y), Mth::floor(z)); } @@ -2309,7 +2309,7 @@ void Player::killed(shared_ptr mob) awardStat(GenericStats::killsSkeleton(), GenericStats::param_noArgs()); break; case eTYPE_SPIDER: - if( mob->rider.lock() != NULL && mob->rider.lock()->GetType() == eTYPE_SKELETON ) + if( mob->rider.lock() != nullptr && mob->rider.lock()->GetType() == eTYPE_SKELETON ) awardStat(GenericStats::killsSpiderJockey(), GenericStats::param_noArgs()); else awardStat(GenericStats::killsSpider(), GenericStats::param_noArgs()); @@ -2348,7 +2348,7 @@ void Player::makeStuckInWeb() Icon *Player::getItemInHandIcon(shared_ptr item, int layer) { Icon *icon = LivingEntity::getItemInHandIcon(item, layer); - if (item->id == Item::fishingRod->id && fishing != NULL) + if (item->id == Item::fishingRod->id && fishing != nullptr) { icon = Item::fishingRod->getEmptyIcon(); } @@ -2356,7 +2356,7 @@ Icon *Player::getItemInHandIcon(shared_ptr item, int layer) { return item->getItem()->getLayerIcon(item->getAuxValue(), layer); } - else if (useItem != NULL && item->id == Item::bow_Id) + else if (useItem != nullptr && item->id == Item::bow_Id) { int ticksHeld = (item->getUseDuration() - useItemDuration); if (ticksHeld >= BowItem::MAX_DRAW_DURATION - 2) @@ -2502,7 +2502,7 @@ bool Player::mayDestroyBlockAt(int x, int y, int z) { return true; } - else if (getSelectedItem() != NULL) + else if (getSelectedItem() != nullptr) { shared_ptr carried = getSelectedItem(); @@ -2521,7 +2521,7 @@ bool Player::mayUseItemAt(int x, int y, int z, int face, shared_ptrmayBePlacedInAdventureMode(); } @@ -2806,7 +2806,7 @@ void Player::setPlayerGamePrivilege(unsigned int &uiGamePrivileges, EPlayerGameP bool Player::isAllowedToUse(Tile *tile) { bool allowed = true; - if(tile != NULL && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) + if(tile != nullptr && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { allowed = false; @@ -2877,7 +2877,7 @@ bool Player::isAllowedToUse(Tile *tile) bool Player::isAllowedToUse(shared_ptr item) { bool allowed = true; - if(item != NULL && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) + if(item != nullptr && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { if(getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) { @@ -3085,7 +3085,7 @@ bool Player::canCreateParticles() vector *Player::GetAdditionalModelParts() { - if(m_ppAdditionalModelParts==NULL && !m_bCheckedForModelParts) + if(m_ppAdditionalModelParts==nullptr && !m_bCheckedForModelParts) { bool hasCustomTexture = !customTextureUrl.empty(); bool customTextureIsDefaultSkin = customTextureUrl.substr(0,3).compare(L"def") == 0; @@ -3094,11 +3094,11 @@ vector *Player::GetAdditionalModelParts() m_ppAdditionalModelParts=app.GetAdditionalModelParts(m_dwSkinId); // If it's a default texture (which has no parts), we have the parts, or we already have the texture (in which case we should have parts if there are any) then we are done - if(!hasCustomTexture || customTextureIsDefaultSkin || m_ppAdditionalModelParts != NULL || app.IsFileInMemoryTextures(customTextureUrl)) + if(!hasCustomTexture || customTextureIsDefaultSkin || m_ppAdditionalModelParts != nullptr || app.IsFileInMemoryTextures(customTextureUrl)) { m_bCheckedForModelParts=true; } - if(m_ppAdditionalModelParts == NULL && !m_bCheckedDLCForModelParts) + if(m_ppAdditionalModelParts == nullptr && !m_bCheckedDLCForModelParts) { m_bCheckedDLCForModelParts = true; @@ -3108,7 +3108,7 @@ vector *Player::GetAdditionalModelParts() // do we have it from the DLC pack? DLCSkinFile *pDLCSkinFile = app.m_dlcManager.getSkinFile(this->customTextureUrl); - if(pDLCSkinFile!=NULL) + if(pDLCSkinFile!=nullptr) { DWORD dwBoxC=pDLCSkinFile->getAdditionalBoxesCount(); if(dwBoxC!=0) diff --git a/Minecraft.World/PlayerEnderChestContainer.cpp b/Minecraft.World/PlayerEnderChestContainer.cpp index e84e59207..33ebcbd40 100644 --- a/Minecraft.World/PlayerEnderChestContainer.cpp +++ b/Minecraft.World/PlayerEnderChestContainer.cpp @@ -38,7 +38,7 @@ ListTag *PlayerEnderChestContainer::createTag() for (int i = 0; i < getContainerSize(); i++) { shared_ptr item = getItem(i); - if (item != NULL) + if (item != nullptr) { CompoundTag *tag = new CompoundTag(); tag->putByte(L"Slot", static_cast(i)); @@ -51,7 +51,7 @@ ListTag *PlayerEnderChestContainer::createTag() bool PlayerEnderChestContainer::stillValid(shared_ptr player) { - if (activeChest != NULL && !activeChest->stillValid(player)) + if (activeChest != nullptr && !activeChest->stillValid(player)) { return false; } @@ -60,7 +60,7 @@ bool PlayerEnderChestContainer::stillValid(shared_ptr player) void PlayerEnderChestContainer::startOpen() { - if (activeChest != NULL) + if (activeChest != nullptr) { activeChest->startOpen(); } diff --git a/Minecraft.World/PlayerInfoPacket.cpp b/Minecraft.World/PlayerInfoPacket.cpp index 9cbe5f7cc..d0ad8d2af 100644 --- a/Minecraft.World/PlayerInfoPacket.cpp +++ b/Minecraft.World/PlayerInfoPacket.cpp @@ -28,7 +28,7 @@ PlayerInfoPacket::PlayerInfoPacket(BYTE networkSmallId, short playerColourIndex, PlayerInfoPacket::PlayerInfoPacket(shared_ptr player) { m_networkSmallId = 0; - if(player->connection != NULL && player->connection->getNetworkPlayer() != NULL) m_networkSmallId = player->connection->getNetworkPlayer()->GetSmallId(); + if(player->connection != nullptr && player->connection->getNetworkPlayer() != nullptr) m_networkSmallId = player->connection->getNetworkPlayer()->GetSmallId(); m_playerColourIndex = player->getPlayerIndex(); m_playerPrivileges = player->getAllPlayerGamePrivileges(); m_entityId = player->entityId; diff --git a/Minecraft.World/PlayerTeam.cpp b/Minecraft.World/PlayerTeam.cpp index 3e159af45..608cb36b0 100644 --- a/Minecraft.World/PlayerTeam.cpp +++ b/Minecraft.World/PlayerTeam.cpp @@ -77,7 +77,7 @@ wstring PlayerTeam::formatNameForTeam(PlayerTeam *team) wstring PlayerTeam::formatNameForTeam(Team *team, const wstring &name) { - if (team == NULL) return name; + if (team == nullptr) return name; return team->getFormattedName(name); } diff --git a/Minecraft.World/PortalForcer.cpp b/Minecraft.World/PortalForcer.cpp index b38508076..13a4778ac 100644 --- a/Minecraft.World/PortalForcer.cpp +++ b/Minecraft.World/PortalForcer.cpp @@ -513,7 +513,7 @@ void PortalForcer::tick(__int64 time) __int64 key = *it; PortalPosition *pos = cachedPortals[key]; - if (pos == NULL || pos->lastUsed < cutoff) + if (pos == nullptr || pos->lastUsed < cutoff) { delete pos; it = cachedPortalKeys.erase(it); diff --git a/Minecraft.World/PortalTile.cpp b/Minecraft.World/PortalTile.cpp index 5e891e536..5e664e656 100644 --- a/Minecraft.World/PortalTile.cpp +++ b/Minecraft.World/PortalTile.cpp @@ -28,7 +28,7 @@ void PortalTile::tick(Level *level, int x, int y, int z, Random *random) // spawn a pig man here int iResult = 0; shared_ptr entity = SpawnEggItem::spawnMobAt(level, 57, x + .5, y0 + 1.1, z + .5, &iResult); - if (entity != NULL) + if (entity != nullptr) { entity->changingDimensionDelay = entity->getDimensionChangingDelay(); } @@ -38,7 +38,7 @@ void PortalTile::tick(Level *level, int x, int y, int z, Random *random) AABB *PortalTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } void PortalTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param @@ -201,7 +201,7 @@ void PortalTile::entityInside(Level *level, int x, int y, int z, shared_ptrGetType() == eTYPE_EXPERIENCEORB ) return; // 4J added - if (entity->riding == NULL && entity->rider.lock() == NULL) entity->handleInsidePortal(); + if (entity->riding == nullptr && entity->rider.lock() == nullptr) entity->handleInsidePortal(); } void PortalTile::animateTick(Level *level, int xt, int yt, int zt, Random *random) diff --git a/Minecraft.World/Pos.cpp b/Minecraft.World/Pos.cpp index b7695a35a..d2f25defd 100644 --- a/Minecraft.World/Pos.cpp +++ b/Minecraft.World/Pos.cpp @@ -28,8 +28,8 @@ Pos::Pos(Pos *position) bool Pos::equals(void *other) { // TODO 4J Stu I cannot do a dynamic_cast from a void pointer - // If I cast it to a Pos then do a dynamic_cast will it still return NULL if it wasn't originally a Pos? - if (!( dynamic_cast( static_cast(other) ) != NULL )) + // If I cast it to a Pos then do a dynamic_cast will it still return nullptr if it wasn't originally a Pos? + if (!( dynamic_cast( static_cast(other) ) != nullptr )) { return false; } diff --git a/Minecraft.World/PotionBrewing.cpp b/Minecraft.World/PotionBrewing.cpp index 3ec38ef94..469c40715 100644 --- a/Minecraft.World/PotionBrewing.cpp +++ b/Minecraft.World/PotionBrewing.cpp @@ -186,7 +186,7 @@ int PotionBrewing::getColorValue(vector *effects) int baseColor = colourTable->getColor( eMinecraftColour_Potion_BaseColour ); - if (effects == NULL || effects->empty()) + if (effects == nullptr || effects->empty()) { return baseColor; } @@ -238,7 +238,7 @@ int PotionBrewing::getColorValue(int brew, bool includeDisabledEffects) } vector *effects = getEffects(brew, false); int color = getColorValue(effects); - if(effects != NULL) + if(effects != nullptr) { for(auto& effect : *effects) { @@ -552,13 +552,13 @@ int PotionBrewing::parseEffectFormulaValue(const wstring &definition, int start, vector *PotionBrewing::getEffects(int brew, bool includeDisabledEffects) { - vector *list = NULL; + vector *list = nullptr; //for (MobEffect effect : MobEffect.effects) for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i) { MobEffect *effect = MobEffect::effects[i]; - if (effect == NULL || (effect->isDisabled() && !includeDisabledEffects)) + if (effect == nullptr || (effect->isDisabled() && !includeDisabledEffects)) { continue; } @@ -602,7 +602,7 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis } } - if (list == NULL) + if (list == nullptr) { list = new vector(); } diff --git a/Minecraft.World/PotionItem.cpp b/Minecraft.World/PotionItem.cpp index fd8937bf8..3438cb854 100644 --- a/Minecraft.World/PotionItem.cpp +++ b/Minecraft.World/PotionItem.cpp @@ -26,26 +26,26 @@ PotionItem::PotionItem(int id) : Item(id) setStackedByData(true); setMaxDamage(0); - iconThrowable = NULL; - iconDrinkable = NULL; - iconOverlay = NULL; + iconThrowable = nullptr; + iconDrinkable = nullptr; + iconOverlay = nullptr; } vector *PotionItem::getMobEffects(shared_ptr potion) { if (!potion->hasTag() || !potion->getTag()->contains(L"CustomPotionEffects")) { - vector *effects = NULL; + vector *effects = nullptr; auto it = cachedMobEffects.find(potion->getAuxValue()); if(it != cachedMobEffects.end()) effects = it->second; - if (effects == NULL) + if (effects == nullptr) { effects = PotionBrewing::getEffects(potion->getAuxValue(), false); cachedMobEffects[potion->getAuxValue()] = effects; } // Result should be a new (unmanaged) vector, so create a new one - return effects == NULL ? NULL : new vector(*effects); + return effects == nullptr ? nullptr : new vector(*effects); } else { @@ -64,13 +64,13 @@ vector *PotionItem::getMobEffects(shared_ptr vector *PotionItem::getMobEffects(int auxValue) { - vector *effects = NULL; + vector *effects = nullptr; auto it = cachedMobEffects.find(auxValue); if(it != cachedMobEffects.end()) effects = it->second; - if (effects == NULL) + if (effects == nullptr) { effects = PotionBrewing::getEffects(auxValue, false); - if(effects != NULL) cachedMobEffects.insert( std::pair *>(auxValue, effects) ); + if(effects != nullptr) cachedMobEffects.insert( std::pair *>(auxValue, effects) ); } return effects; } @@ -82,7 +82,7 @@ shared_ptr PotionItem::useTimeDepleted(shared_ptr in if (!level->isClientSide) { vector *effects = getMobEffects(instance); - if (effects != NULL) + if (effects != nullptr) { for(auto& effect : *effects) { @@ -183,7 +183,7 @@ bool PotionItem::hasMultipleSpriteLayers() bool PotionItem::hasInstantenousEffects(int itemAuxValue) { vector *mobEffects = getMobEffects(itemAuxValue); - if (mobEffects == NULL || mobEffects->empty()) + if (mobEffects == nullptr || mobEffects->empty()) { return false; } @@ -216,7 +216,7 @@ wstring PotionItem::getHoverName(shared_ptr itemInstance) } vector *effects = ((PotionItem *) Item::potion)->getMobEffects(itemInstance); - if (effects != NULL && !effects->empty()) + if (effects != nullptr && !effects->empty()) { //String postfixString = effects.get(0).getDescriptionId(); //postfixString += ".postfix"; @@ -244,7 +244,7 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p } vector *effects = ((PotionItem *) Item::potion)->getMobEffects(itemInstance); attrAttrModMap modifiers; - if (effects != NULL && !effects->empty()) + if (effects != nullptr && !effects->empty()) { //for (MobEffectInstance effect : effects) for(auto& effect : *effects) @@ -254,7 +254,7 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p MobEffect *mobEffect = MobEffect::effects[effect->getId()]; unordered_map *effectModifiers = mobEffect->getAttributeModifiers(); - if (effectModifiers != NULL && effectModifiers->size() > 0) + if (effectModifiers != nullptr && effectModifiers->size() > 0) { for(auto& it : *effectModifiers) { @@ -335,7 +335,7 @@ void PotionItem::appendHoverText(shared_ptr itemInstance, shared_p bool PotionItem::isFoil(shared_ptr itemInstance) { vector *mobEffects = getMobEffects(itemInstance); - return mobEffects != NULL && !mobEffects->empty(); + return mobEffects != nullptr && !mobEffects->empty(); } unsigned int PotionItem::getUseDescriptionId(shared_ptr instance) @@ -368,7 +368,7 @@ Icon *PotionItem::getTexture(const wstring &name) if (name.compare(DEFAULT_ICON) == 0) return Item::potion->iconDrinkable; if (name.compare(THROWABLE_ICON) == 0) return Item::potion->iconThrowable; if (name.compare(CONTENTS_ICON) == 0) return Item::potion->iconOverlay; - return NULL; + return nullptr; } @@ -381,7 +381,7 @@ vector > *PotionItem::getUniquePotionValues() { vector *effects = PotionBrewing::getEffects(brew, false); - if (effects != NULL) + if (effects != nullptr) { if(!effects->empty()) { diff --git a/Minecraft.World/PreLoginPacket.cpp b/Minecraft.World/PreLoginPacket.cpp index 5be50ea79..aa6832cad 100644 --- a/Minecraft.World/PreLoginPacket.cpp +++ b/Minecraft.World/PreLoginPacket.cpp @@ -9,7 +9,7 @@ PreLoginPacket::PreLoginPacket() { loginKey = L""; - m_playerXuids = NULL; + m_playerXuids = nullptr; m_dwPlayerCount = 0; m_friendsOnlyBits = 0; m_ugcPlayersVersion = 0; @@ -23,7 +23,7 @@ PreLoginPacket::PreLoginPacket() PreLoginPacket::PreLoginPacket(wstring userName) { this->loginKey = userName; - m_playerXuids = NULL; + m_playerXuids = nullptr; m_dwPlayerCount = 0; m_friendsOnlyBits = 0; m_ugcPlayersVersion = 0; @@ -50,7 +50,7 @@ PreLoginPacket::PreLoginPacket(wstring userName, PlayerUID *playerXuids, DWORD p PreLoginPacket::~PreLoginPacket() { - if( m_playerXuids != NULL ) delete [] m_playerXuids; + if( m_playerXuids != nullptr ) delete [] m_playerXuids; } void PreLoginPacket::read(DataInputStream *dis) //throws IOException diff --git a/Minecraft.World/PressurePlateTile.cpp b/Minecraft.World/PressurePlateTile.cpp index beed308ac..650fbf9f8 100644 --- a/Minecraft.World/PressurePlateTile.cpp +++ b/Minecraft.World/PressurePlateTile.cpp @@ -23,14 +23,14 @@ int PressurePlateTile::getSignalForData(int data) int PressurePlateTile::getSignalStrength(Level *level, int x, int y, int z) { - vector< shared_ptr > *entities = NULL; + vector< shared_ptr > *entities = nullptr; if (sensitivity == everything) entities = level->getEntities(nullptr, getSensitiveAABB(x, y, z)); else if (sensitivity == mobs) entities = level->getEntitiesOfClass(typeid(LivingEntity), getSensitiveAABB(x, y, z)); else if (sensitivity == players) entities = level->getEntitiesOfClass(typeid(Player), getSensitiveAABB(x, y, z)); else __debugbreak(); // 4J-JEV: We're going to delete something at a random location. - if (entities != NULL && !entities->empty()) + if (entities != nullptr && !entities->empty()) { for (auto& e : *entities) { diff --git a/Minecraft.World/ProtectionEnchantment.cpp b/Minecraft.World/ProtectionEnchantment.cpp index 8304529b0..13a6836cc 100644 --- a/Minecraft.World/ProtectionEnchantment.cpp +++ b/Minecraft.World/ProtectionEnchantment.cpp @@ -54,7 +54,7 @@ int ProtectionEnchantment::getDescriptionId() bool ProtectionEnchantment::isCompatibleWith(Enchantment *other) const { ProtectionEnchantment *pe = dynamic_cast( other ); - if (pe != NULL) + if (pe != nullptr) { if (pe->type == type) { diff --git a/Minecraft.World/PumpkinTile.cpp b/Minecraft.World/PumpkinTile.cpp index 2bc369721..f7bfe218c 100644 --- a/Minecraft.World/PumpkinTile.cpp +++ b/Minecraft.World/PumpkinTile.cpp @@ -13,8 +13,8 @@ const wstring PumpkinTile::TEXTURE_LANTERN = L"pumpkin_jack"; PumpkinTile::PumpkinTile(int id, bool lit) : DirectionalTile(id, Material::vegetable, isSolidRender() ) { - iconTop = NULL; - iconFace = NULL; + iconTop = nullptr; + iconFace = nullptr; setTicking(true); this->lit = lit; } diff --git a/Minecraft.World/RandomLevelSource.cpp b/Minecraft.World/RandomLevelSource.cpp index 3e6994f77..1946e44e6 100644 --- a/Minecraft.World/RandomLevelSource.cpp +++ b/Minecraft.World/RandomLevelSource.cpp @@ -58,8 +58,8 @@ RandomLevelSource::RandomLevelSource(Level *level, __int64 seed, bool generateSt } else { - floatingIslandScale = NULL; - floatingIslandNoise = NULL; + floatingIslandScale = nullptr; + floatingIslandNoise = nullptr; } forestNoise = new PerlinNoise(random, 8); @@ -93,7 +93,7 @@ RandomLevelSource::~RandomLevelSource() delete forestNoise; - if( pows.data != NULL ) delete [] pows.data; + if( pows.data != nullptr ) delete [] pows.data; } @@ -385,7 +385,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi byte material = b->material; LevelGenerationOptions *lgo = app.getLevelGenerationOptions(); - if(lgo != NULL) + if(lgo != nullptr) { lgo->getBiomeOverride(b->id,material,top); } @@ -420,7 +420,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi { top = b->topMaterial; material = b->material; - if(lgo != NULL) + if(lgo != nullptr) { lgo->getBiomeOverride(b->id,material,top); } @@ -525,11 +525,11 @@ void RandomLevelSource::lightChunk(LevelChunk *lc) doubleArray RandomLevelSource::getHeights(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize, BiomeArray& biomes) { - if (buffer.data == NULL) + if (buffer.data == nullptr) { buffer = doubleArray(xSize * ySize * zSize); } - if (pows.data == NULL) + if (pows.data == nullptr) { pows = floatArray(5 * 5); for (int xb = -2; xb <= 2; xb++) @@ -882,9 +882,9 @@ wstring RandomLevelSource::gatherStats() vector *RandomLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == nullptr) { - return NULL; + return nullptr; } if (mobCategory == MobCategory::monster && scatteredFeature->isSwamphut(x, y, z)) { @@ -895,20 +895,20 @@ vector *RandomLevelSource::getMobsAt(MobCategory *mobCa TilePos *RandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != NULL) + if (LargeFeature::STRONGHOLD == featureName && strongholdFeature != nullptr) { return strongholdFeature->getNearestGeneratedFeature(level, x, y, z); } - return NULL; + return nullptr; } void RandomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) { if (generateStructures) { - mineShaftFeature->apply(this, level, chunkX, chunkZ, NULL); - villageFeature->apply(this, level, chunkX, chunkZ, NULL); - strongholdFeature->apply(this, level, chunkX, chunkZ, NULL); - scatteredFeature->apply(this, level, chunkX, chunkZ, NULL); + mineShaftFeature->apply(this, level, chunkX, chunkZ, byteArray()); + villageFeature->apply(this, level, chunkX, chunkZ, byteArray()); + strongholdFeature->apply(this, level, chunkX, chunkZ, byteArray()); + scatteredFeature->apply(this, level, chunkX, chunkZ, byteArray()); } } \ No newline at end of file diff --git a/Minecraft.World/RandomPos.cpp b/Minecraft.World/RandomPos.cpp index c2cfd9080..1a86800e9 100644 --- a/Minecraft.World/RandomPos.cpp +++ b/Minecraft.World/RandomPos.cpp @@ -7,7 +7,7 @@ Vec3 *RandomPos::tempDir = Vec3::newPermanent(0, 0, 0); Vec3 *RandomPos::getPos(shared_ptr mob, int xzDist, int yDist, int quadrant/*=-1*/) // 4J - added quadrant { - return generateRandomPos(mob, xzDist, yDist, NULL, quadrant); + return generateRandomPos(mob, xzDist, yDist, nullptr, quadrant); } Vec3 *RandomPos::getPosTowards(shared_ptr mob, int xzDist, int yDist, Vec3 *towardsPos) @@ -62,7 +62,7 @@ Vec3 *RandomPos::generateRandomPos(shared_ptr mob, int xzDist, in } yt = random->nextInt(2 * yDist) - yDist; - if (dir != NULL && xt * dir->x + zt * dir->z < 0) continue; + if (dir != nullptr && xt * dir->x + zt * dir->z < 0) continue; xt += Mth::floor(mob->x); yt += Mth::floor(mob->y); @@ -84,5 +84,5 @@ Vec3 *RandomPos::generateRandomPos(shared_ptr mob, int xzDist, in return Vec3::newTemp(xBest, yBest, zBest); } - return NULL; + return nullptr; } \ No newline at end of file diff --git a/Minecraft.World/RandomScatteredLargeFeature.cpp b/Minecraft.World/RandomScatteredLargeFeature.cpp index bd0b70bb0..3b03dba62 100644 --- a/Minecraft.World/RandomScatteredLargeFeature.cpp +++ b/Minecraft.World/RandomScatteredLargeFeature.cpp @@ -67,7 +67,7 @@ bool RandomScatteredLargeFeature::isFeatureChunk(int x, int z, bool bIsSuperflat bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != NULL ) + if( levelGenOptions != nullptr ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Temples); } @@ -123,14 +123,14 @@ RandomScatteredLargeFeature::ScatteredFeatureStart::ScatteredFeatureStart(Level bool RandomScatteredLargeFeature::isSwamphut(int cellX, int cellY, int cellZ) { StructureStart *structureAt = getStructureAt(cellX, cellY, cellZ); - if (structureAt == NULL || !( dynamic_cast( structureAt ) ) || structureAt->pieces.empty()) + if (structureAt == nullptr || !( dynamic_cast( structureAt ) ) || structureAt->pieces.empty()) { return false; } - StructurePiece *first = NULL; + StructurePiece *first = nullptr; auto it = structureAt->pieces.begin(); if(it != structureAt->pieces.end() ) first = *it; - return dynamic_cast(first) != NULL; + return dynamic_cast(first) != nullptr; } vector *RandomScatteredLargeFeature::getSwamphutEnemies() diff --git a/Minecraft.World/RandomStrollGoal.cpp b/Minecraft.World/RandomStrollGoal.cpp index 15957ab38..4eb5815da 100644 --- a/Minecraft.World/RandomStrollGoal.cpp +++ b/Minecraft.World/RandomStrollGoal.cpp @@ -22,7 +22,7 @@ bool RandomStrollGoal::canUse() if (mob->getRandom()->nextInt(120) == 0) { Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 10, 7); - if (pos == NULL) return false; + if (pos == nullptr) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; @@ -38,7 +38,7 @@ bool RandomStrollGoal::canUse() if( mob->isExtraWanderingEnabled() ) { Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(mob->shared_from_this()), 10, 7,mob->getWanderingQuadrant()); - if (pos == NULL) return false; + if (pos == nullptr) return false; wantedX = pos->x; wantedY = pos->y; wantedZ = pos->z; diff --git a/Minecraft.World/RangedAttackGoal.cpp b/Minecraft.World/RangedAttackGoal.cpp index 2923e0111..72178d9d5 100644 --- a/Minecraft.World/RangedAttackGoal.cpp +++ b/Minecraft.World/RangedAttackGoal.cpp @@ -40,7 +40,7 @@ RangedAttackGoal::RangedAttackGoal(RangedAttackMob *rangedMob, Mob *mob, double bool RangedAttackGoal::canUse() { shared_ptr bestTarget = mob->getTarget(); - if (bestTarget == NULL) return false; + if (bestTarget == nullptr) return false; target = weak_ptr(bestTarget); return true; } @@ -60,7 +60,7 @@ void RangedAttackGoal::stop() void RangedAttackGoal::tick() { // 4J: It's possible the target has gone since canUse selected it, don't do tick if target is null - if (target.lock() == NULL) return; + if (target.lock() == nullptr) return; double targetDistSqr = mob->distanceToSqr(target.lock()->x, target.lock()->bb->y0, target.lock()->z); bool canSee = mob->getSensing()->canSee(target.lock()); diff --git a/Minecraft.World/ReadOnlyChunkCache.cpp b/Minecraft.World/ReadOnlyChunkCache.cpp index fdab13dc1..dfafdf2d5 100644 --- a/Minecraft.World/ReadOnlyChunkCache.cpp +++ b/Minecraft.World/ReadOnlyChunkCache.cpp @@ -25,7 +25,7 @@ ReadOnlyChunkCache::~ReadOnlyChunkCache() bool ReadOnlyChunkCache::hasChunk(int x, int z) { int slot = (x & LEN_MASK) | ((z & LEN_MASK) * LEN); - return chunks[slot] != NULL && (chunks[slot]->isAt(x, z)); + return chunks[slot] != nullptr && (chunks[slot]->isAt(x, z)); } LevelChunk *ReadOnlyChunkCache::create(int x, int z) @@ -41,7 +41,7 @@ LevelChunk *ReadOnlyChunkCache::getChunk(int x, int z) if (!hasChunk(x, z)) { LevelChunk *newChunk = load(x, z); - if (newChunk == NULL) + if (newChunk == nullptr) { newChunk = new EmptyLevelChunk(level, emptyPixels, x, z); } @@ -91,10 +91,10 @@ wstring ReadOnlyChunkCache::gatherStats() vector *ReadOnlyChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { - return NULL; + return nullptr; } TilePos *ReadOnlyChunkCache::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return NULL; + return nullptr; } diff --git a/Minecraft.World/Recipes.cpp b/Minecraft.World/Recipes.cpp index eca5951f2..94ee30ac7 100644 --- a/Minecraft.World/Recipes.cpp +++ b/Minecraft.World/Recipes.cpp @@ -8,15 +8,15 @@ #include "net.minecraft.world.level.tile.h" #include "net.minecraft.world.item.crafting.h" -Recipes *Recipes::instance = NULL; -ArmorRecipes *Recipes::pArmorRecipes=NULL; -ClothDyeRecipes *Recipes::pClothDyeRecipes=NULL; -FoodRecipies *Recipes::pFoodRecipies=NULL; -OreRecipies *Recipes::pOreRecipies=NULL; -StructureRecipies *Recipes::pStructureRecipies=NULL; -ToolRecipies *Recipes::pToolRecipies=NULL; -WeaponRecipies *Recipes::pWeaponRecipies=NULL; -FireworksRecipe *Recipes::pFireworksRecipes=NULL; +Recipes *Recipes::instance = nullptr; +ArmorRecipes *Recipes::pArmorRecipes=nullptr; +ClothDyeRecipes *Recipes::pClothDyeRecipes=nullptr; +FoodRecipies *Recipes::pFoodRecipies=nullptr; +OreRecipies *Recipes::pOreRecipies=nullptr; +StructureRecipies *Recipes::pStructureRecipies=nullptr; +ToolRecipies *Recipes::pToolRecipies=nullptr; +WeaponRecipies *Recipes::pWeaponRecipies=nullptr; +FireworksRecipe *Recipes::pFireworksRecipes=nullptr; void Recipes::staticCtor() { @@ -1042,7 +1042,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) Item *pItem; wchar_t wchFrom; int iCount; - ItemInstance **ids = NULL; + ItemInstance **ids = nullptr; myMap *mappings = new unordered_map(); @@ -1163,7 +1163,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...) } else { - ids[j] = NULL; + ids[j] = nullptr; } } } @@ -1248,7 +1248,7 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... ) recipies->push_back(new ShapelessRecipy(result, ingredients, group)); } -shared_ptr Recipes::getItemFor(shared_ptr craftSlots, Level *level, Recipy *recipesClass /*= NULL*/) +shared_ptr Recipes::getItemFor(shared_ptr craftSlots, Level *level, Recipy *recipesClass /*= nullptr*/) { int count = 0; shared_ptr first = nullptr; @@ -1256,7 +1256,7 @@ shared_ptr Recipes::getItemFor(shared_ptr craft for (int i = 0; i < craftSlots->getContainerSize(); i++) { shared_ptr item = craftSlots->getItem(i); - if (item != NULL) + if (item != nullptr) { if (count == 0) first = item; if (count == 1) second = item; @@ -1275,7 +1275,7 @@ shared_ptr Recipes::getItemFor(shared_ptr craft return shared_ptr( new ItemInstance(first->id, 1, resultDamage) ); } - if(recipesClass != NULL) + if(recipesClass != nullptr) { if (recipesClass->matches(craftSlots, level)) return recipesClass->assemble(craftSlots); } diff --git a/Minecraft.World/Recipes.h b/Minecraft.World/Recipes.h index aacdac305..d6e508a89 100644 --- a/Minecraft.World/Recipes.h +++ b/Minecraft.World/Recipes.h @@ -90,7 +90,7 @@ public: ShapedRecipy *addShapedRecipy(ItemInstance *, ... ); void addShapelessRecipy(ItemInstance *result,... ); - shared_ptr getItemFor(shared_ptr craftSlots, Level *level, Recipy *recipesClass = NULL); // 4J Added recipesClass param + shared_ptr getItemFor(shared_ptr craftSlots, Level *level, Recipy *recipesClass = nullptr); // 4J Added recipesClass param vector *getRecipies(); // 4J-PB - Added all below for new Xbox 'crafting' diff --git a/Minecraft.World/RecordingItem.cpp b/Minecraft.World/RecordingItem.cpp index 8e0de1156..3475263f5 100644 --- a/Minecraft.World/RecordingItem.cpp +++ b/Minecraft.World/RecordingItem.cpp @@ -73,6 +73,6 @@ RecordingItem *RecordingItem::getByName(const wstring &name) } else { - return NULL; + return nullptr; } } \ No newline at end of file diff --git a/Minecraft.World/RedStoneDustTile.cpp b/Minecraft.World/RedStoneDustTile.cpp index a4577bd32..e348406b9 100644 --- a/Minecraft.World/RedStoneDustTile.cpp +++ b/Minecraft.World/RedStoneDustTile.cpp @@ -25,10 +25,10 @@ RedStoneDustTile::RedStoneDustTile(int id) : Tile(id, Material::decoration,isSol updateDefaultShape(); - iconCross = NULL; - iconLine = NULL; - iconCrossOver = NULL; - iconLineOver = NULL; + iconCross = nullptr; + iconLine = nullptr; + iconCrossOver = nullptr; + iconLineOver = nullptr; } // 4J Added override @@ -39,7 +39,7 @@ void RedStoneDustTile::updateDefaultShape() AABB *RedStoneDustTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool RedStoneDustTile::isSolidRender(bool isServerLevel) @@ -409,5 +409,5 @@ Icon *RedStoneDustTile::getTexture(const wstring &name) if (name.compare(TEXTURE_LINE) == 0) return Tile::redStoneDust->iconLine; if (name.compare(TEXTURE_CROSS_OVERLAY) == 0) return Tile::redStoneDust->iconCrossOver; if (name.compare(TEXTURE_LINE_OVERLAY) == 0) return Tile::redStoneDust->iconLineOver; - return NULL; + return nullptr; } diff --git a/Minecraft.World/ReedTile.cpp b/Minecraft.World/ReedTile.cpp index c01eb7646..dc60bfba6 100644 --- a/Minecraft.World/ReedTile.cpp +++ b/Minecraft.World/ReedTile.cpp @@ -78,7 +78,7 @@ bool ReedTile::canSurvive(Level *level, int x, int y, int z) AABB *ReedTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } int ReedTile::getResource(int data, Random *random, int playerBonusLevel) diff --git a/Minecraft.World/ReedsFeature.cpp b/Minecraft.World/ReedsFeature.cpp index 2792b21bd..ec46f0538 100644 --- a/Minecraft.World/ReedsFeature.cpp +++ b/Minecraft.World/ReedsFeature.cpp @@ -12,7 +12,7 @@ bool ReedsFeature::place(Level *level, Random *random, int x, int y, int z) int z2 = z + random->nextInt(4) - random->nextInt(4); // 4J Stu Added to stop reed features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x2, y2, z2, x2, y2, z2); diff --git a/Minecraft.World/Region.cpp b/Minecraft.World/Region.cpp index e4edce166..1e8acaf36 100644 --- a/Minecraft.World/Region.cpp +++ b/Minecraft.World/Region.cpp @@ -45,7 +45,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int for (int zc = zc1; zc <= zc2; zc++) { LevelChunk *chunk = level->getChunk(xc, zc); - if(chunk != NULL) + if(chunk != nullptr) { LevelChunkArray *lca = (*chunks)[xc - xc1]; lca->data[zc - zc1] = chunk; @@ -58,7 +58,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int { LevelChunkArray *lca = (*chunks)[xc - xc1]; LevelChunk *chunk = lca->data[zc - zc1]; - if (chunk != NULL) + if (chunk != nullptr) { if (!chunk->isYSpaceEmpty(y1, y2)) { @@ -71,7 +71,7 @@ Region::Region(Level *level, int x1, int y1, int z1, int x2, int y2, int z2, int // AP - added a caching system for Chunk::rebuild to take advantage of xcCached = -1; zcCached = -1; - CachedTiles = NULL; + CachedTiles = nullptr; } bool Region::isAllEmpty() @@ -111,7 +111,7 @@ int Region::getTile(int x, int y, int z) } LevelChunk *lc = (*chunks)[xc]->data[zc]; - if (lc == NULL) return 0; + if (lc == nullptr) return 0; return lc->getTile(x & 15, y, z & 15); } @@ -122,7 +122,7 @@ void Region::setCachedTiles(unsigned char *tiles, int xc, int zc) xcCached = xc; zcCached = zc; int size = 16 * 16 * Level::maxBuildHeight; - if( CachedTiles == NULL ) + if( CachedTiles == nullptr ) { CachedTiles = static_cast(malloc(size)); } @@ -132,14 +132,14 @@ void Region::setCachedTiles(unsigned char *tiles, int xc, int zc) LevelChunk* Region::getLevelChunk(int x, int y, int z) { if (y < 0) return 0; - if (y >= Level::maxBuildHeight) return NULL; + if (y >= Level::maxBuildHeight) return nullptr; int xc = (x >> 4) - xc1; int zc = (z >> 4) - zc1; if (xc < 0 || xc >= static_cast(chunks->length) || zc < 0 || zc >= static_cast((*chunks)[xc]->length)) { - return NULL; + return nullptr; } LevelChunk *lc = (*chunks)[xc]->data[zc]; @@ -263,7 +263,7 @@ Biome *Region::getBiome(int x, int z) bool Region::isSolidRenderTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile == NULL) return false; + if (tile == nullptr) return false; // 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so // blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by @@ -278,7 +278,7 @@ bool Region::isSolidRenderTile(int x, int y, int z) for( int i = 0; i < 6; i++ ) { int t = getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) + if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == nullptr ) || !Tile::tiles[t]->isSolidRender() ) ) { return false; } @@ -294,7 +294,7 @@ bool Region::isSolidRenderTile(int x, int y, int z) bool Region::isSolidBlockingTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - if (tile == NULL) return false; + if (tile == nullptr) return false; return tile->material->blocksMotion() && tile->isCubeShaped(); } @@ -307,7 +307,7 @@ bool Region::isTopSolidBlocking(int x, int y, int z) bool Region::isEmptyTile(int x, int y, int z) { Tile *tile = Tile::tiles[getTile(x, y, z)]; - return (tile == NULL); + return (tile == nullptr); } diff --git a/Minecraft.World/RegionFile.cpp b/Minecraft.World/RegionFile.cpp index 10efc2fa2..ddbeb6554 100644 --- a/Minecraft.World/RegionFile.cpp +++ b/Minecraft.World/RegionFile.cpp @@ -39,7 +39,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) */ fileEntry = m_saveFile->createFile( fileName->getName() ); - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); + m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_END ); if ( fileEntry->getFileSize() < SECTOR_BYTES) { @@ -54,7 +54,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) m_bIsEmpty = false; } - //if ((GetFileSize(file,NULL) & 0xfff) != 0) + //if ((GetFileSize(file,nullptr) & 0xfff) != 0) if ((fileEntry->getFileSize() & 0xfff) != 0) { //byte zero = 0; @@ -91,7 +91,7 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) sectorFree->at(0) = false; // chunk offset table sectorFree->at(1) = false; // for the last modified info - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_BEGIN ); for (int i = 0; i < SECTOR_INTS; ++i) { unsigned int offset = 0; @@ -139,11 +139,11 @@ void RegionFile::writeAllOffsets() // used for the file ConsoleSaveFile conversi m_saveFile->LockSaveAccess(); DWORD numberOfBytesWritten = 0; - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_BEGIN ); m_saveFile->writeFile(fileEntry,offsets, SECTOR_BYTES ,&numberOfBytesWritten); numberOfBytesWritten = 0; - m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES, nullptr, FILE_BEGIN ); m_saveFile->writeFile(fileEntry, chunkTimestamps, SECTOR_BYTES, &numberOfBytesWritten); m_saveFile->ReleaseSaveAccess(); @@ -175,7 +175,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was if (outOfBounds(x, z)) { // debugln("READ", x, z, "out of bounds"); - return NULL; + return nullptr; } // 4J - removed try/catch @@ -184,7 +184,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was if (offset == 0) { // debugln("READ", x, z, "miss"); - return NULL; + return nullptr; } unsigned int sectorNumber = offset >> 8; @@ -193,13 +193,13 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was if (sectorNumber + numSectors > sectorFree->size()) { // debugln("READ", x, z, "invalid sector"); - return NULL; + return nullptr; } m_saveFile->LockSaveAccess(); //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN); unsigned int length; unsigned int decompLength; @@ -229,7 +229,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was // debugln("READ", x, z, "invalid length: " + length + " > 4096 * " + numSectors); m_saveFile->ReleaseSaveAccess(); - return NULL; + return nullptr; } MemSect(50); @@ -373,7 +373,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync */ // debug("SAVE", x, z, length, "grow"); //SetFilePointer(file,0,0,FILE_END); - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_END ); + m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_END ); sectorNumber = static_cast(sectorFree->size()); #ifndef _CONTENT_PACAKGE @@ -382,7 +382,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync DWORD numberOfBytesWritten = 0; for (int i = 0; i < sectorsNeeded; ++i) { - //WriteFile(file,emptySector.data,SECTOR_BYTES,&numberOfBytesWritten,NULL); + //WriteFile(file,emptySector.data,SECTOR_BYTES,&numberOfBytesWritten,nullptr); m_saveFile->writeFile(fileEntry,emptySector.data,SECTOR_BYTES,&numberOfBytesWritten); sectorFree->push_back(false); } @@ -407,7 +407,7 @@ void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int co { DWORD numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN ); // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data // We store length and decompression length as ints, then length bytes of xbox LZX compressed data @@ -426,7 +426,7 @@ void RegionFile::zero(int sectorNumber, int length) { DWORD numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); - m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN ); m_saveFile->zeroFile( fileEntry, length, &numberOfBytesWritten ); } @@ -449,7 +449,7 @@ bool RegionFile::hasChunk(int x, int z) // 4J added - write the initial two sectors that used to be written in the ctor when the file was empty void RegionFile::insertInitialSectors() { - m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_BEGIN ); DWORD numberOfBytesWritten = 0; byte zeroBytes[ SECTOR_BYTES ]; ZeroMemory(zeroBytes, SECTOR_BYTES); @@ -472,7 +472,7 @@ void RegionFile::setOffset(int x, int z, int offset) DWORD numberOfBytesWritten = 0; offsets[x + z * 32] = offset; - m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, (x + z * 32) * 4, nullptr, FILE_BEGIN ); m_saveFile->writeFile(fileEntry,&offset,4,&numberOfBytesWritten); } @@ -486,7 +486,7 @@ void RegionFile::setTimestamp(int x, int z, int value) DWORD numberOfBytesWritten = 0; chunkTimestamps[x + z * 32] = value; - m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, NULL, FILE_BEGIN ); + m_saveFile->setFilePointer( fileEntry, SECTOR_BYTES + (x + z * 32) * 4, nullptr, FILE_BEGIN ); m_saveFile->writeFile(fileEntry,&value,4,&numberOfBytesWritten); } diff --git a/Minecraft.World/RegionFileCache.cpp b/Minecraft.World/RegionFileCache.cpp index 2bb370a8a..ab0492b48 100644 --- a/Minecraft.World/RegionFileCache.cpp +++ b/Minecraft.World/RegionFileCache.cpp @@ -38,13 +38,13 @@ RegionFile *RegionFileCache::_getRegionFile(ConsoleSaveFile *saveFile, const wst } MemSect(0); - RegionFile *ref = NULL; + RegionFile *ref = nullptr; auto it = cache.find(file); if( it != cache.end() ) ref = it->second; // 4J Jev, put back in. - if (ref != NULL) + if (ref != nullptr) { return ref; } @@ -72,7 +72,7 @@ void RegionFileCache::_clear() // 4J - TODO was synchronized for(auto& it : cache) { RegionFile *regionFile = it.second; - if (regionFile != NULL) + if (regionFile != nullptr) { regionFile->close(); } diff --git a/Minecraft.World/RepairResultSlot.cpp b/Minecraft.World/RepairResultSlot.cpp index 51e95b424..87d2aab6e 100644 --- a/Minecraft.World/RepairResultSlot.cpp +++ b/Minecraft.World/RepairResultSlot.cpp @@ -30,7 +30,7 @@ void RepairResultSlot::onTake(shared_ptr player, shared_ptrrepairItemCountCost > 0) { shared_ptr addition = m_menu->repairSlots->getItem(AnvilMenu::ADDITIONAL_SLOT); - if (addition != NULL && addition->count > m_menu->repairItemCountCost) + if (addition != nullptr && addition->count > m_menu->repairItemCountCost) { addition->count -= m_menu->repairItemCountCost; m_menu->repairSlots->setItem(AnvilMenu::ADDITIONAL_SLOT, addition); diff --git a/Minecraft.World/RespawnPacket.cpp b/Minecraft.World/RespawnPacket.cpp index d9e37dca5..2e91b8f5a 100644 --- a/Minecraft.World/RespawnPacket.cpp +++ b/Minecraft.World/RespawnPacket.cpp @@ -11,9 +11,9 @@ RespawnPacket::RespawnPacket() this->difficulty = 1; this->mapSeed = 0; this->mapHeight = 0; - this->playerGameType = NULL; + this->playerGameType = nullptr; this->m_newSeaLevel = false; - m_pLevelType = NULL; + m_pLevelType = nullptr; m_newEntityId = 0; m_xzSize = LEVEL_MAX_WIDTH; m_hellScale = HELL_LEVEL_MAX_SCALE; @@ -47,7 +47,7 @@ void RespawnPacket::read(DataInputStream *dis) //throws IOException mapHeight = dis->readShort(); wstring typeName = readUtf(dis, 16); m_pLevelType = LevelType::getLevelType(typeName); - if (m_pLevelType == NULL) + if (m_pLevelType == nullptr) { m_pLevelType = LevelType::lvl_normal; } @@ -68,7 +68,7 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException dos->writeByte(dimension); dos->writeByte(playerGameType->getId()); dos->writeShort(mapHeight); - if (m_pLevelType == NULL) + if (m_pLevelType == nullptr) { writeUtf(L"", dos); } @@ -89,7 +89,7 @@ void RespawnPacket::write(DataOutputStream *dos) //throws IOException int RespawnPacket::getEstimatedSize() { int length=0; - if (m_pLevelType != NULL) + if (m_pLevelType != nullptr) { length = static_cast(m_pLevelType->getGeneratorName().length()); } diff --git a/Minecraft.World/RestrictOpenDoorGoal.cpp b/Minecraft.World/RestrictOpenDoorGoal.cpp index e8620a71d..3f7e2ed98 100644 --- a/Minecraft.World/RestrictOpenDoorGoal.cpp +++ b/Minecraft.World/RestrictOpenDoorGoal.cpp @@ -14,9 +14,9 @@ bool RestrictOpenDoorGoal::canUse() { if (mob->level->isDay()) return false; shared_ptr village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 16); - if (village == NULL) return false; + if (village == nullptr) return false; shared_ptr _doorInfo = village->getClosestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); - if (_doorInfo == NULL) return false; + if (_doorInfo == nullptr) return false; doorInfo = _doorInfo; return _doorInfo->distanceToInsideSqr(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)) < 1.5 * 1.5; } @@ -25,7 +25,7 @@ bool RestrictOpenDoorGoal::canContinueToUse() { if (mob->level->isDay()) return false; shared_ptr _doorInfo = doorInfo.lock(); - if ( _doorInfo == NULL ) return false; + if ( _doorInfo == nullptr ) return false; return !_doorInfo->removed && _doorInfo->isInsideSide(Mth::floor(mob->x), Mth::floor(mob->z)); } diff --git a/Minecraft.World/ResultContainer.cpp b/Minecraft.World/ResultContainer.cpp index 8c85d0c32..7c8dd1c18 100644 --- a/Minecraft.World/ResultContainer.cpp +++ b/Minecraft.World/ResultContainer.cpp @@ -33,7 +33,7 @@ bool ResultContainer::hasCustomName() shared_ptr ResultContainer::removeItem(unsigned int slot, int count) { - if (items[0] != NULL) + if (items[0] != nullptr) { shared_ptr item = items[0]; items[0] = nullptr; @@ -44,7 +44,7 @@ shared_ptr ResultContainer::removeItem(unsigned int slot, int coun shared_ptr ResultContainer::removeItemNoUpdate(int slot) { - if (items[0] != NULL) + if (items[0] != nullptr) { shared_ptr item = items[0]; items[0] = nullptr; diff --git a/Minecraft.World/ResultSlot.cpp b/Minecraft.World/ResultSlot.cpp index 08ffe714a..87318d66b 100644 --- a/Minecraft.World/ResultSlot.cpp +++ b/Minecraft.World/ResultSlot.cpp @@ -60,7 +60,7 @@ void ResultSlot::onTake(shared_ptr player, shared_ptr carr for (unsigned int i = 0; i < craftSlots->getContainerSize(); i++) { shared_ptr item = craftSlots->getItem(i); - if (item != NULL) + if (item != nullptr) { craftSlots->removeItem(i, 1); @@ -77,7 +77,7 @@ void ResultSlot::onTake(shared_ptr player, shared_ptr carr } // If this slot is now empty, place it there (current behavior) - if (craftSlots->getItem(i) == NULL) + if (craftSlots->getItem(i) == nullptr) { craftSlots->setItem(i, craftResult); } diff --git a/Minecraft.World/RunAroundLikeCrazyGoal.cpp b/Minecraft.World/RunAroundLikeCrazyGoal.cpp index 118b09f92..40138d739 100644 --- a/Minecraft.World/RunAroundLikeCrazyGoal.cpp +++ b/Minecraft.World/RunAroundLikeCrazyGoal.cpp @@ -17,9 +17,9 @@ RunAroundLikeCrazyGoal::RunAroundLikeCrazyGoal(EntityHorse *mob, double speedMod bool RunAroundLikeCrazyGoal::canUse() { - if (horse->isTamed() || horse->rider.lock() == NULL) return false; + if (horse->isTamed() || horse->rider.lock() == nullptr) return false; Vec3 *pos = RandomPos::getPos(dynamic_pointer_cast(horse->shared_from_this()), 5, 4); - if (pos == NULL) return false; + if (pos == nullptr) return false; posX = pos->x; posY = pos->y; posZ = pos->z; @@ -33,7 +33,7 @@ void RunAroundLikeCrazyGoal::start() bool RunAroundLikeCrazyGoal::canContinueToUse() { - return !horse->getNavigation()->isDone() && horse->rider.lock() != NULL; + return !horse->getNavigation()->isDone() && horse->rider.lock() != nullptr; } void RunAroundLikeCrazyGoal::tick() diff --git a/Minecraft.World/SaddleItem.cpp b/Minecraft.World/SaddleItem.cpp index f982b7517..638730609 100644 --- a/Minecraft.World/SaddleItem.cpp +++ b/Minecraft.World/SaddleItem.cpp @@ -11,7 +11,7 @@ SaddleItem::SaddleItem(int id) : Item(id) bool SaddleItem::interactEnemy(shared_ptr itemInstance, shared_ptr player, shared_ptr mob) { - if ( (mob != NULL) && mob->instanceof(eTYPE_PIG) ) + if ( (mob != nullptr) && mob->instanceof(eTYPE_PIG) ) { shared_ptr pig = dynamic_pointer_cast(mob); if (!pig->hasSaddle() && !pig->isBaby()) diff --git a/Minecraft.World/SandFeature.cpp b/Minecraft.World/SandFeature.cpp index 122264fff..9c0dc67c0 100644 --- a/Minecraft.World/SandFeature.cpp +++ b/Minecraft.World/SandFeature.cpp @@ -22,7 +22,7 @@ bool SandFeature::place(Level *level, Random *random, int x, int y, int z) int yr = 2; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - r, y - yr, z - r, x + r, y + yr, z + r); diff --git a/Minecraft.World/SandStoneTile.cpp b/Minecraft.World/SandStoneTile.cpp index daf42db86..bd7309b9d 100644 --- a/Minecraft.World/SandStoneTile.cpp +++ b/Minecraft.World/SandStoneTile.cpp @@ -14,9 +14,9 @@ int SandStoneTile::SANDSTONE_NAMES[SANDSTONE_BLOCK_NAMES] = { SandStoneTile::SandStoneTile(int id) : Tile(id, Material::stone) { - icons = NULL; - iconTop = NULL; - iconBottom = NULL; + icons = nullptr; + iconTop = nullptr; + iconBottom = nullptr; } Icon *SandStoneTile::getTexture(int face, int data) diff --git a/Minecraft.World/Sapling.cpp b/Minecraft.World/Sapling.cpp index 85fcea986..c169a6082 100644 --- a/Minecraft.World/Sapling.cpp +++ b/Minecraft.World/Sapling.cpp @@ -17,7 +17,7 @@ const wstring Sapling::TEXTURE_NAMES[] = {L"sapling", L"sapling_spruce", L"sapli Sapling::Sapling(int id) : Bush( id ) { this->updateDefaultShape(); - icons = NULL; + icons = nullptr; } // 4J Added override @@ -65,7 +65,7 @@ void Sapling::growTree(Level *level, int x, int y, int z, Random *random) { int data = level->getData(x, y, z) & TYPE_MASK; - Feature *f = NULL; + Feature *f = nullptr; int ox = 0, oz = 0; bool multiblock = false; @@ -93,12 +93,12 @@ void Sapling::growTree(Level *level, int x, int y, int z, Random *random) break; } } - if (f != NULL) + if (f != nullptr) { break; } } - if (f == NULL) + if (f == nullptr) { ox = oz = 0; f = new TreeFeature(true, 4 + random->nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false); @@ -138,7 +138,7 @@ void Sapling::growTree(Level *level, int x, int y, int z, Random *random) level->setTileAndData(x, y, z, id, data, Tile::UPDATE_NONE); } } - if( f != NULL ) + if( f != nullptr ) delete f; } diff --git a/Minecraft.World/SavedDataStorage.cpp b/Minecraft.World/SavedDataStorage.cpp index 422b66dca..d882b2053 100644 --- a/Minecraft.World/SavedDataStorage.cpp +++ b/Minecraft.World/SavedDataStorage.cpp @@ -26,7 +26,7 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin if (it != cache.end()) return (*it).second; shared_ptr data = nullptr; - if (levelStorage != NULL) + if (levelStorage != nullptr) { //File file = levelStorage->getDataFile(id); ConsoleSavePath file = levelStorage->getDataFile(id); @@ -61,7 +61,7 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin } } - if (data != NULL) + if (data != nullptr) { cache.insert( unordered_map >::value_type( id , data ) ); savedDatas.push_back(data); @@ -71,7 +71,7 @@ shared_ptr SavedDataStorage::get(const type_info& clazz, const wstrin void SavedDataStorage::set(const wstring& id, shared_ptr data) { - if (data == NULL) + if (data == nullptr) { // TODO 4J Stu - throw new RuntimeException("Can't set null data"); assert( false ); @@ -104,7 +104,7 @@ void SavedDataStorage::save() void SavedDataStorage::save(shared_ptr data) { - if (levelStorage == NULL) return; + if (levelStorage == nullptr) return; //File file = levelStorage->getDataFile(data->id); ConsoleSavePath file = levelStorage->getDataFile(data->id); if (!file.getName().empty()) @@ -127,7 +127,7 @@ void SavedDataStorage::loadAuxValues() { usedAuxIds.clear(); - if (levelStorage == NULL) return; + if (levelStorage == nullptr) return; //File file = levelStorage->getDataFile(L"idcounts"); ConsoleSavePath file = levelStorage->getDataFile(L"idcounts"); if (!file.getName().empty() && levelStorage->getSaveFile()->doesFileExist( file ) ) @@ -163,7 +163,7 @@ int SavedDataStorage::getFreeAuxValueFor(const wstring& id) } usedAuxIds[id] = val; - if (levelStorage == NULL) return val; + if (levelStorage == nullptr) return val; //File file = levelStorage->getDataFile(L"idcounts"); ConsoleSavePath file = levelStorage->getDataFile(L"idcounts"); if (!file.getName().empty()) @@ -188,7 +188,7 @@ int SavedDataStorage::getFreeAuxValueFor(const wstring& id) // 4J Added int SavedDataStorage::getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int centreZC, int scale) { - if( levelStorage == NULL ) + if( levelStorage == nullptr ) { switch(dimension) { diff --git a/Minecraft.World/ScatteredFeaturePieces.cpp b/Minecraft.World/ScatteredFeaturePieces.cpp index 317d6d9ef..a623f9727 100644 --- a/Minecraft.World/ScatteredFeaturePieces.cpp +++ b/Minecraft.World/ScatteredFeaturePieces.cpp @@ -35,7 +35,7 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(Random *ran orientation = random->nextInt(4); LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != NULL ) + if( levelGenOptions != nullptr ) { int tempOrientation = 0; if(levelGenOptions->isFeatureChunk(west>>4,north>>4,StructureFeature::eFeature_Temples, &tempOrientation) ) @@ -739,7 +739,7 @@ bool ScatteredFeaturePieces::SwamplandHut::postProcess(Level *level, Random *ran shared_ptr witch = shared_ptr( new Witch(level) ); witch->moveTo(wx + .5, wy, wz + .5, 0, 0); - witch->finalizeMobSpawn(NULL); + witch->finalizeMobSpawn(nullptr); level->addEntity(witch); } } diff --git a/Minecraft.World/Scoreboard.cpp b/Minecraft.World/Scoreboard.cpp index 5c6f2ebd7..bab0b213e 100644 --- a/Minecraft.World/Scoreboard.cpp +++ b/Minecraft.World/Scoreboard.cpp @@ -4,15 +4,15 @@ Objective *Scoreboard::getObjective(const wstring &name) { - return NULL; + return nullptr; //return objectivesByName.find(name)->second; } Objective *Scoreboard::addObjective(const wstring &name, ObjectiveCriteria *criteria) { - return NULL; + return nullptr; // Objective *objective = getObjective(name); -// if (objective != NULL) +// if (objective != nullptr) // { //#indef _CONTENT_PACKAGE // __debugbreak(); @@ -24,7 +24,7 @@ Objective *Scoreboard::addObjective(const wstring &name, ObjectiveCriteria *crit // // vector *criteriaList = objectivesByCriteria.find(criteria)->second; // -// if (criteriaList == NULL) +// if (criteriaList == nullptr) // { // criteriaList = new vector(); // objectivesByCriteria[criteria] = criteriaList; @@ -39,18 +39,18 @@ Objective *Scoreboard::addObjective(const wstring &name, ObjectiveCriteria *crit vector *Scoreboard::findObjectiveFor(ObjectiveCriteria *criteria) { - return NULL; + return nullptr; //vector *objectives = objectivesByCriteria.find(criteria)->second; - //return objectives == NULL ? new vector() : new vector(objectives); + //return objectives == nullptr ? new vector() : new vector(objectives); } Score *Scoreboard::getPlayerScore(const wstring &name, Objective *objective) { - return NULL; + return nullptr; //unordered_map *scores = playerScores.find(name)->it; - //if (scores == NULL) + //if (scores == nullptr) //{ // scores = new unordered_map(); // playerScores.put(name, scores); @@ -58,7 +58,7 @@ Score *Scoreboard::getPlayerScore(const wstring &name, Objective *objective) //Score *score = scores->get(objective); - //if (score == NULL) + //if (score == nullptr) //{ // score = new Score(this, objective, name); // scores->put(objective, score); @@ -69,7 +69,7 @@ Score *Scoreboard::getPlayerScore(const wstring &name, Objective *objective) vector *Scoreboard::getPlayerScores(Objective *objective) { - return NULL; + return nullptr; //vector *result = new vector(); //for (Map scores : playerScores.values()) @@ -85,13 +85,13 @@ vector *Scoreboard::getPlayerScores(Objective *objective) vector *Scoreboard::getObjectives() { - return NULL; + return nullptr; //return objectivesByName.values(); } vector *Scoreboard::getTrackedPlayers() { - return NULL; + return nullptr; //return playerScores.keySet(); } @@ -99,7 +99,7 @@ void Scoreboard::resetPlayerScore(const wstring &player) { //unordered_map *removed = playerScores.remove(player); - //if (removed != NULL) + //if (removed != nullptr) //{ // onPlayerRemoved(player); //} @@ -107,7 +107,7 @@ void Scoreboard::resetPlayerScore(const wstring &player) vector *Scoreboard::getScores() { - return NULL; + return nullptr; //Collection> values = playerScores.values(); //List result = new ArrayList(); @@ -121,7 +121,7 @@ vector *Scoreboard::getScores() vector *Scoreboard::getScores(Objective *objective) { - return NULL; + return nullptr; //Collection> values = playerScores.values(); //List result = new ArrayList(); @@ -135,7 +135,7 @@ vector *Scoreboard::getScores(Objective *objective) unordered_map *Scoreboard::getPlayerScores(const wstring &player) { - return NULL; + return nullptr; //Map result = playerScores.get(player); //if (result == null) result = new HashMap(); //return result; @@ -166,19 +166,19 @@ void Scoreboard::setDisplayObjective(int slot, Objective *objective) Objective *Scoreboard::getDisplayObjective(int slot) { - return NULL; + return nullptr; //return displayObjectives[slot]; } PlayerTeam *Scoreboard::getPlayerTeam(const wstring &name) { - return NULL; + return nullptr; //return teamsByName.get(name); } PlayerTeam *Scoreboard::addPlayerTeam(const wstring &name) { - return NULL; + return nullptr; //PlayerTeam team = getPlayerTeam(name); //if (team != null) throw new IllegalArgumentException("An objective with the name '" + name + "' already exists!"); @@ -237,13 +237,13 @@ void Scoreboard::removePlayerFromTeam(const wstring &player, PlayerTeam *team) vector *Scoreboard::getTeamNames() { - return NULL; + return nullptr; //return teamsByName.keySet(); } vector *Scoreboard::getPlayerTeams() { - return NULL; + return nullptr; //return teamsByName.values(); } @@ -255,7 +255,7 @@ shared_ptr Scoreboard::getPlayer(const wstring &name) PlayerTeam *Scoreboard::getPlayersTeam(const wstring &name) { - return NULL; + return nullptr; //return teamsByPlayer.get(name); } diff --git a/Minecraft.World/ServersideAttributeMap.cpp b/Minecraft.World/ServersideAttributeMap.cpp index 901854cca..5da807123 100644 --- a/Minecraft.World/ServersideAttributeMap.cpp +++ b/Minecraft.World/ServersideAttributeMap.cpp @@ -17,7 +17,7 @@ AttributeInstance *ServersideAttributeMap::getInstance(eATTRIBUTE_ID id) // 4J: Removed legacy name // If we didn't find it, search by legacy name - /*if (result == NULL) + /*if (result == nullptr) { auto it = attributesByLegacy.find(name); if(it != attributesByLegacy.end()) @@ -43,7 +43,7 @@ AttributeInstance *ServersideAttributeMap::registerAttribute(Attribute *attribut // 4J: Removed legacy name // If this is a ranged attribute also add to legacy name map /*RangedAttribute *rangedAttribute = dynamic_cast(attribute); - if (rangedAttribute != NULL && rangedAttribute->getImportLegacyName() != L"") + if (rangedAttribute != nullptr && rangedAttribute->getImportLegacyName() != L"") { attributesByLegacy.insert(std::pair(rangedAttribute->getImportLegacyName(), instance)); }*/ diff --git a/Minecraft.World/SetDisplayObjectivePacket.cpp b/Minecraft.World/SetDisplayObjectivePacket.cpp index f1cffa4b2..9908d15ec 100644 --- a/Minecraft.World/SetDisplayObjectivePacket.cpp +++ b/Minecraft.World/SetDisplayObjectivePacket.cpp @@ -13,7 +13,7 @@ SetDisplayObjectivePacket::SetDisplayObjectivePacket(int slot, Objective *object { this->slot = slot; - if (objective == NULL) + if (objective == nullptr) { objectiveName = L""; } diff --git a/Minecraft.World/SetEntityDataPacket.cpp b/Minecraft.World/SetEntityDataPacket.cpp index 9947c1630..a49ba9d90 100644 --- a/Minecraft.World/SetEntityDataPacket.cpp +++ b/Minecraft.World/SetEntityDataPacket.cpp @@ -10,7 +10,7 @@ SetEntityDataPacket::SetEntityDataPacket() { id = -1; - packedItems = NULL; + packedItems = nullptr; } SetEntityDataPacket::~SetEntityDataPacket() diff --git a/Minecraft.World/SetEntityLinkPacket.cpp b/Minecraft.World/SetEntityLinkPacket.cpp index cae35e485..3ad0f45b9 100644 --- a/Minecraft.World/SetEntityLinkPacket.cpp +++ b/Minecraft.World/SetEntityLinkPacket.cpp @@ -18,7 +18,7 @@ SetEntityLinkPacket::SetEntityLinkPacket(int linkType, shared_ptr source { type = linkType; this->sourceId = sourceEntity->entityId; - this->destId = destEntity != NULL ? destEntity->entityId : -1; + this->destId = destEntity != nullptr ? destEntity->entityId : -1; } int SetEntityLinkPacket::getEstimatedSize() diff --git a/Minecraft.World/SetEquippedItemPacket.cpp b/Minecraft.World/SetEquippedItemPacket.cpp index 1da93b840..ac9d22b26 100644 --- a/Minecraft.World/SetEquippedItemPacket.cpp +++ b/Minecraft.World/SetEquippedItemPacket.cpp @@ -20,7 +20,7 @@ SetEquippedItemPacket::SetEquippedItemPacket(int entity, int slot, shared_ptrslot = slot; // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game - this->item = item == NULL ? nullptr : item->copy(); + this->item = item == nullptr ? nullptr : item->copy(); } void SetEquippedItemPacket::read(DataInputStream *dis) //throws IOException diff --git a/Minecraft.World/SetPlayerTeamPacket.cpp b/Minecraft.World/SetPlayerTeamPacket.cpp index fe36bfff5..a574067dd 100644 --- a/Minecraft.World/SetPlayerTeamPacket.cpp +++ b/Minecraft.World/SetPlayerTeamPacket.cpp @@ -42,7 +42,7 @@ SetPlayerTeamPacket::SetPlayerTeamPacket(PlayerTeam *team, vector *play __debugbreak(); #endif } - if (playerNames == NULL || playerNames->empty()) + if (playerNames == nullptr || playerNames->empty()) { app.DebugPrintf("Players cannot be null/empty"); #ifndef _CONTENT_PACKAGE diff --git a/Minecraft.World/ShapedRecipy.cpp b/Minecraft.World/ShapedRecipy.cpp index be1adb0b7..ac3c82ad6 100644 --- a/Minecraft.World/ShapedRecipy.cpp +++ b/Minecraft.World/ShapedRecipy.cpp @@ -52,18 +52,18 @@ bool ShapedRecipy::matches(shared_ptr craftSlots, int xOffs, for (int y = 0; y < 3; y++) { int xs = x - xOffs; int ys = y - yOffs; - ItemInstance *expected = NULL; + ItemInstance *expected = nullptr; if (xs >= 0 && ys >= 0 && xs < width && ys < height) { if (xFlip) expected = recipeItems[(width - xs - 1) + ys * width]; else expected = recipeItems[xs + ys * width]; } shared_ptr item = craftSlots->getItem(x, y); - if (item == NULL && expected == NULL) + if (item == nullptr && expected == nullptr) { continue; } - if ((item == NULL && expected != NULL) || (item != NULL && expected == NULL)) + if ((item == nullptr && expected != nullptr) || (item != nullptr && expected == nullptr)) { return false; } @@ -84,13 +84,13 @@ shared_ptr ShapedRecipy::assemble(shared_ptr cr { shared_ptr result = getResultItem()->copy(); - if (_keepTag && craftSlots != NULL) + if (_keepTag && craftSlots != nullptr) { for (int i = 0; i < craftSlots->getContainerSize(); i++) { shared_ptr item = craftSlots->getItem(i); - if (item != NULL && item->hasTag()) + if (item != nullptr && item->hasTag()) { result->setTag(static_cast(item->tag->copy())); } @@ -117,7 +117,7 @@ bool ShapedRecipy::requires(int iRecipe) if (x < width && y < height) { ItemInstance *expected = recipeItems[x+y*width]; - if (expected!=NULL) + if (expected!=nullptr) { //printf("\tIngredient %d is %d\n",iCount++,expected->id); } @@ -159,7 +159,7 @@ void ShapedRecipy::requires(INGREDIENTS_REQUIRED *pIngReq) { ItemInstance *expected = recipeItems[x+y*width]; - if (expected!=NULL) + if (expected!=nullptr) { int iAuxVal = expected->getAuxValue(); TempIngReq.uiGridA[x+y*3]=expected->id | iAuxVal<<24; diff --git a/Minecraft.World/SharedMonsterAttributes.cpp b/Minecraft.World/SharedMonsterAttributes.cpp index 12d467f2f..53c050083 100644 --- a/Minecraft.World/SharedMonsterAttributes.cpp +++ b/Minecraft.World/SharedMonsterAttributes.cpp @@ -70,7 +70,7 @@ void SharedMonsterAttributes::loadAttributes(BaseAttributeMap *attributes, ListT CompoundTag *tag = list->get(i); AttributeInstance *instance = attributes->getInstance(static_cast(tag->getInt(L"ID"))); - if (instance != NULL) + if (instance != nullptr) { loadAttribute(instance, tag); } @@ -93,7 +93,7 @@ void SharedMonsterAttributes::loadAttribute(AttributeInstance *instance, Compoun { AttributeModifier *modifier = loadAttributeModifier(list->get(i)); AttributeModifier *old = instance->getModifier(modifier->getId()); - if (old != NULL) instance->removeModifier(old); + if (old != nullptr) instance->removeModifier(old); instance->addModifier(modifier); } } diff --git a/Minecraft.World/Sheep.cpp b/Minecraft.World/Sheep.cpp index e865d899a..7343e29c0 100644 --- a/Minecraft.World/Sheep.cpp +++ b/Minecraft.World/Sheep.cpp @@ -169,7 +169,7 @@ bool Sheep::mobInteract(shared_ptr player) if (!player->isAllowedToInteract( shared_from_this() )) return false; //Animal::interact(player); - if (item != NULL && item->id == Item::shears->id && !isSheared() && !isBaby()) + if (item != nullptr && item->id == Item::shears->id && !isSheared() && !isBaby()) { if (!level->isClientSide) { @@ -324,7 +324,7 @@ int Sheep::getOffspringColor(shared_ptr animal, shared_ptr partn shared_ptr instance = Recipes::getInstance()->getItemFor(container, animal->level); int color = 0; - if (instance != NULL && instance->getItem()->id == Item::dye_powder_Id) + if (instance != nullptr && instance->getItem()->id == Item::dye_powder_Id) { color = instance->getAuxValue(); } diff --git a/Minecraft.World/ShovelItem.cpp b/Minecraft.World/ShovelItem.cpp index 8064cbe31..4b75cd852 100644 --- a/Minecraft.World/ShovelItem.cpp +++ b/Minecraft.World/ShovelItem.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.level.tile.h" #include "ShovelItem.h" -TileArray *ShovelItem::diggables = NULL; +TileArray *ShovelItem::diggables = nullptr; void ShovelItem::staticCtor() { diff --git a/Minecraft.World/SignItem.cpp b/Minecraft.World/SignItem.cpp index c9cb627e6..a418fd347 100644 --- a/Minecraft.World/SignItem.cpp +++ b/Minecraft.World/SignItem.cpp @@ -49,7 +49,7 @@ bool SignItem::useOn(shared_ptr instance, shared_ptr playe instance->count--; shared_ptr ste = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); - if (ste != NULL) player->openTextEdit(ste); + if (ste != nullptr) player->openTextEdit(ste); // 4J-JEV: Hook for durango 'BlockPlaced' event. player->awardStat( diff --git a/Minecraft.World/SignTile.cpp b/Minecraft.World/SignTile.cpp index 52d62a60c..1f8c6e948 100644 --- a/Minecraft.World/SignTile.cpp +++ b/Minecraft.World/SignTile.cpp @@ -26,7 +26,7 @@ void SignTile::updateDefaultShape() AABB *SignTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } AABB *SignTile::getTileAABB(Level *level, int x, int y, int z) diff --git a/Minecraft.World/Silverfish.cpp b/Minecraft.World/Silverfish.cpp index 5cd4c77ee..98f559c92 100644 --- a/Minecraft.World/Silverfish.cpp +++ b/Minecraft.World/Silverfish.cpp @@ -72,7 +72,7 @@ int Silverfish::getDeathSound() bool Silverfish::hurt(DamageSource *source, float dmg) { if (isInvulnerable()) return false; - if (lookForFriends <= 0 && (dynamic_cast(source) != NULL || source == DamageSource::magic)) + if (lookForFriends <= 0 && (dynamic_cast(source) != nullptr || source == DamageSource::magic)) { // look for friends lookForFriends = 20; @@ -173,7 +173,7 @@ void Silverfish::serverAiStep() } } - if (attackTarget == NULL && !isPathFinding()) + if (attackTarget == nullptr && !isPathFinding()) { // if the silverfish isn't doing anything special, it will merge // with any rock tile it is nearby @@ -193,7 +193,7 @@ void Silverfish::serverAiStep() } } - else if (attackTarget != NULL && !isPathFinding()) + else if (attackTarget != nullptr && !isPathFinding()) { attackTarget = nullptr; } @@ -216,7 +216,7 @@ bool Silverfish::canSpawn() if (Monster::canSpawn()) { shared_ptr nearestPlayer = level->getNearestPlayer(shared_from_this(), 5.0); - return nearestPlayer == NULL; + return nearestPlayer == nullptr; } return false; } diff --git a/Minecraft.World/SimpleContainer.cpp b/Minecraft.World/SimpleContainer.cpp index a5f551e2a..87d11a70d 100644 --- a/Minecraft.World/SimpleContainer.cpp +++ b/Minecraft.World/SimpleContainer.cpp @@ -13,12 +13,12 @@ SimpleContainer::SimpleContainer(int name, wstring stringName, bool customName, this->size = size; items = new ItemInstanceArray( size ); - listeners = NULL; + listeners = nullptr; } void SimpleContainer::addListener(net_minecraft_world::ContainerListener *listener) { - if (listeners == NULL) listeners = new vector(); + if (listeners == nullptr) listeners = new vector(); listeners->push_back(listener); } @@ -43,7 +43,7 @@ shared_ptr SimpleContainer::getItem(unsigned int slot) shared_ptr SimpleContainer::removeItem(unsigned int slot, int count) { - if ((*items)[slot] != NULL) { + if ((*items)[slot] != nullptr) { if ((*items)[slot]->count <= count) { shared_ptr item = (*items)[slot]; @@ -64,7 +64,7 @@ shared_ptr SimpleContainer::removeItem(unsigned int slot, int coun shared_ptr SimpleContainer::removeItemNoUpdate(int slot) { - if ((*items)[slot] != NULL) + if ((*items)[slot] != nullptr) { shared_ptr item = (*items)[slot]; (*items)[slot] = nullptr; @@ -76,7 +76,7 @@ shared_ptr SimpleContainer::removeItemNoUpdate(int slot) void SimpleContainer::setItem(unsigned int slot, shared_ptr item) { (*items)[slot] = item; - if (item != NULL && item->count > getMaxStackSize()) item->count = getMaxStackSize(); + if (item != nullptr && item->count > getMaxStackSize()) item->count = getMaxStackSize(); setChanged(); } @@ -113,7 +113,7 @@ int SimpleContainer::getMaxStackSize() const void SimpleContainer::setChanged() { - if (listeners != NULL) for (unsigned int i = 0; i < listeners->size(); i++) + if (listeners != nullptr) for (unsigned int i = 0; i < listeners->size(); i++) { listeners->at(i)->containerChanged();//shared_from_this()); } diff --git a/Minecraft.World/SitGoal.cpp b/Minecraft.World/SitGoal.cpp index b79b2df7e..7b04a5f6c 100644 --- a/Minecraft.World/SitGoal.cpp +++ b/Minecraft.World/SitGoal.cpp @@ -21,9 +21,9 @@ bool SitGoal::canUse() if (!mob->onGround) return false; shared_ptr owner = dynamic_pointer_cast( mob->getOwner() ); - if (owner == NULL) return true; // owner not on level + if (owner == nullptr) return true; // owner not on level - if (mob->distanceToSqr(owner) < FollowOwnerGoal::TeleportDistance * FollowOwnerGoal::TeleportDistance && owner->getLastHurtByMob() != NULL) return false; + if (mob->distanceToSqr(owner) < FollowOwnerGoal::TeleportDistance * FollowOwnerGoal::TeleportDistance && owner->getLastHurtByMob() != nullptr) return false; return _wantToSit; } diff --git a/Minecraft.World/Skeleton.cpp b/Minecraft.World/Skeleton.cpp index e7db69430..d5f59dfe0 100644 --- a/Minecraft.World/Skeleton.cpp +++ b/Minecraft.World/Skeleton.cpp @@ -43,7 +43,7 @@ Skeleton::Skeleton(Level *level) : Monster( level ) targetSelector.addGoal(1, new HurtByTargetGoal(this, false)); targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, typeid(Player), 0, true)); - if (level != NULL && !level->isClientSide) reassessWeaponGoal(); + if (level != nullptr && !level->isClientSide) reassessWeaponGoal(); } Skeleton::~Skeleton() @@ -119,7 +119,7 @@ void Skeleton::aiStep() bool burn = true; shared_ptr helmet = getCarried(SLOT_HELM); - if (helmet != NULL) + if (helmet != nullptr) { if (helmet->isDamageableItem()) { @@ -155,7 +155,7 @@ void Skeleton::rideTick() { Monster::rideTick(); - if ( riding != NULL && riding->instanceof(eTYPE_PATHFINDER_MOB) ) + if ( riding != nullptr && riding->instanceof(eTYPE_PATHFINDER_MOB) ) { yBodyRot = dynamic_pointer_cast(riding)->yBodyRot; } @@ -166,7 +166,7 @@ void Skeleton::die(DamageSource *source) { Monster::die(source); - if ( source->getDirectEntity() != NULL && source->getDirectEntity()->instanceof(eTYPE_ARROW) && source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_PLAYER) ) + if ( source->getDirectEntity() != nullptr && source->getDirectEntity()->instanceof(eTYPE_ARROW) && source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER) ) { shared_ptr player = dynamic_pointer_cast( source->getEntity() ); @@ -232,7 +232,7 @@ MobGroupData *Skeleton::finalizeMobSpawn(MobGroupData *groupData, int extraData { groupData = Monster::finalizeMobSpawn(groupData); - if ( dynamic_cast(level->dimension) != NULL && getRandom()->nextInt(5) > 0) + if ( dynamic_cast(level->dimension) != nullptr && getRandom()->nextInt(5) > 0) { goalSelector.addGoal(4, meleeGoal, false); @@ -250,7 +250,7 @@ MobGroupData *Skeleton::finalizeMobSpawn(MobGroupData *groupData, int extraData setCanPickUpLoot(random->nextFloat() < MAX_PICKUP_LOOT_CHANCE * level->getDifficulty(x, y, z)); - if (getCarried(SLOT_HELM) == NULL) + if (getCarried(SLOT_HELM) == nullptr) { if (Calendar::GetMonth() + 1 == 10 && Calendar::GetDayOfMonth() == 31 && random->nextFloat() < 0.25f) { @@ -269,7 +269,7 @@ void Skeleton::reassessWeaponGoal() shared_ptr carried = getCarriedItem(); - if (carried != NULL && carried->id == Item::bow_Id) + if (carried != nullptr && carried->id == Item::bow_Id) { goalSelector.addGoal(4, bowGoal, false); } diff --git a/Minecraft.World/SkullItem.cpp b/Minecraft.World/SkullItem.cpp index f0356a965..383f226f4 100644 --- a/Minecraft.World/SkullItem.cpp +++ b/Minecraft.World/SkullItem.cpp @@ -48,7 +48,7 @@ bool SkullItem::useOn(shared_ptr instance, shared_ptr play shared_ptr skullTE = level->getTileEntity(x, y, z); shared_ptr skull = dynamic_pointer_cast(skullTE); - if (skull != NULL) + if (skull != nullptr) { wstring extra = L""; if (instance->hasTag() && instance->getTag()->contains(L"SkullOwner")) diff --git a/Minecraft.World/SkullTile.cpp b/Minecraft.World/SkullTile.cpp index 92ce78070..28699645d 100644 --- a/Minecraft.World/SkullTile.cpp +++ b/Minecraft.World/SkullTile.cpp @@ -79,7 +79,7 @@ int SkullTile::cloneTileData(Level *level, int x, int y, int z) { shared_ptr tileEntity = level->getTileEntity(x, y, z); shared_ptr skull = dynamic_pointer_cast(tileEntity); - if (skull != NULL) + if (skull != nullptr) { return skull->getSkullType(); } @@ -274,7 +274,7 @@ bool SkullTile::isSkullAt(Level *level, int x, int y, int z, int skullType) } shared_ptr te = level->getTileEntity(x, y, z); shared_ptr skull = dynamic_pointer_cast(te); - if (skull == NULL) + if (skull == nullptr) { return false; } diff --git a/Minecraft.World/SkyIslandDimension.cpp b/Minecraft.World/SkyIslandDimension.cpp index 0746c92ca..01df4306b 100644 --- a/Minecraft.World/SkyIslandDimension.cpp +++ b/Minecraft.World/SkyIslandDimension.cpp @@ -23,7 +23,7 @@ float SkyIslandDimension::getTimeOfDay(__int64 time, float a) const float *SkyIslandDimension::getSunriseColor(float td, float a) { - return NULL; + return nullptr; } Vec3 *SkyIslandDimension::getFogColor(float td, float a) const diff --git a/Minecraft.World/Slime.cpp b/Minecraft.World/Slime.cpp index 5f93dbfb2..aefb8ae29 100644 --- a/Minecraft.World/Slime.cpp +++ b/Minecraft.World/Slime.cpp @@ -135,14 +135,14 @@ void Slime::serverAiStep() { checkDespawn(); shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 16); - if (player != NULL) + if (player != nullptr) { lookAt(player, 10, 20); } if (onGround && jumpDelay-- <= 0) { jumpDelay = getJumpDelay(); - if (player != NULL) + if (player != nullptr) { jumpDelay /= 3; } diff --git a/Minecraft.World/Slot.cpp b/Minecraft.World/Slot.cpp index a5a53a481..91920b2de 100644 --- a/Minecraft.World/Slot.cpp +++ b/Minecraft.World/Slot.cpp @@ -15,7 +15,7 @@ Slot::Slot(shared_ptr container, int slot, int x, int y) : container( void Slot::onQuickCraft(shared_ptr picked, shared_ptr original) { - if (picked == NULL || original == NULL) + if (picked == nullptr || original == nullptr) { return; } @@ -44,14 +44,14 @@ void Slot::swap(Slot *other) shared_ptr item1 = container->getItem(slot); shared_ptr item2 = other->container->getItem(other->slot); - if (item1 != NULL && item1->count > other->getMaxStackSize()) + if (item1 != nullptr && item1->count > other->getMaxStackSize()) { - if (item2 != NULL) return; + if (item2 != nullptr) return; item2 = item1->remove(item1->count - other->getMaxStackSize()); } - if (item2 != NULL && item2->count > getMaxStackSize()) + if (item2 != nullptr && item2->count > getMaxStackSize()) { - if (item1 != NULL) return; + if (item1 != nullptr) return; item1 = item2->remove(item2->count - getMaxStackSize()); } other->container->setItem(other->slot, item1); @@ -77,7 +77,7 @@ shared_ptr Slot::getItem() bool Slot::hasItem() { - return getItem() != NULL; + return getItem() != nullptr; } void Slot::set(shared_ptr item) @@ -98,7 +98,7 @@ int Slot::getMaxStackSize() const Icon *Slot::getNoItemIcon() { - return NULL; + return nullptr; } shared_ptr Slot::remove(int c) @@ -125,7 +125,7 @@ bool Slot::mayCombine(shared_ptr second) { shared_ptr first = getItem(); - if(first == NULL || second == NULL) return false; + if(first == nullptr || second == nullptr) return false; ArmorItem *thisItem = dynamic_cast(first->getItem()); if(thisItem) @@ -135,7 +135,7 @@ bool Slot::mayCombine(shared_ptr second) return thisIsDyableArmor && itemIsDye; } // 4J Stu - This condition taken from Recipes::getItemFor to repair items, but added the damaged check to skip when the result is pointless - else if (first != NULL && second != NULL && first->id == second->id && first->count == 1 && second->count == 1 && Item::items[first->id]->canBeDepleted() && (first->isDamaged() || second->isDamaged()) ) + else if (first != nullptr && second != nullptr && first->id == second->id && first->count == 1 && second->count == 1 && Item::items[first->id]->canBeDepleted() && (first->isDamaged() || second->isDamaged()) ) { // 4J Stu - Don't allow combinining enchanted items, the enchantment will be lost. They can use the anvil for this return !first->isEnchanted() && !second->isEnchanted(); @@ -148,7 +148,7 @@ shared_ptr Slot::combine(shared_ptr item) shared_ptr result = nullptr; shared_ptr first = getItem(); - shared_ptr craftSlots = shared_ptr( new CraftingContainer(NULL, 2, 2) ); + shared_ptr craftSlots = shared_ptr( new CraftingContainer(nullptr, 2, 2) ); craftSlots->setItem(0, item); craftSlots->setItem(1, first); @@ -159,7 +159,7 @@ shared_ptr Slot::combine(shared_ptr item) } else { - result = Recipes::getInstance()->getItemFor(craftSlots, NULL); + result = Recipes::getInstance()->getItemFor(craftSlots, nullptr); } craftSlots->setItem(0, nullptr); diff --git a/Minecraft.World/SmallFireball.cpp b/Minecraft.World/SmallFireball.cpp index 30f7a0b2b..2475f5dcf 100644 --- a/Minecraft.World/SmallFireball.cpp +++ b/Minecraft.World/SmallFireball.cpp @@ -25,7 +25,7 @@ void SmallFireball::onHit(HitResult *res) { if (!level->isClientSide) { - if (res->entity != NULL) + if (res->entity != nullptr) { DamageSource *damageSource = DamageSource::fireball(dynamic_pointer_cast(shared_from_this()),owner); if (!res->entity->isFireImmune() && res->entity->hurt(damageSource, 5)) diff --git a/Minecraft.World/SmoothStoneBrickTile.cpp b/Minecraft.World/SmoothStoneBrickTile.cpp index 22fb6df5c..a42af97be 100644 --- a/Minecraft.World/SmoothStoneBrickTile.cpp +++ b/Minecraft.World/SmoothStoneBrickTile.cpp @@ -12,7 +12,7 @@ const unsigned int SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES[SMOOTH_STONE_B SmoothStoneBrickTile::SmoothStoneBrickTile(int id) : Tile(id, Material::stone) { - icons = NULL; + icons = nullptr; } Icon *SmoothStoneBrickTile::getTexture(int face, int data) diff --git a/Minecraft.World/Snowball.cpp b/Minecraft.World/Snowball.cpp index 6588ac966..bb873b205 100644 --- a/Minecraft.World/Snowball.cpp +++ b/Minecraft.World/Snowball.cpp @@ -31,7 +31,7 @@ Snowball::Snowball(Level *level, double x, double y, double z) : Throwable(level void Snowball::onHit(HitResult *res) { - if (res->entity != NULL) + if (res->entity != nullptr) { int damage = 0; if ( res->entity->instanceof(eTYPE_BLAZE) ) diff --git a/Minecraft.World/Socket.cpp b/Minecraft.World/Socket.cpp index 1a7d27caa..290b39dca 100644 --- a/Minecraft.World/Socket.cpp +++ b/Minecraft.World/Socket.cpp @@ -14,7 +14,7 @@ CRITICAL_SECTION Socket::s_hostQueueLock[2]; std::queue Socket::s_hostQueue[2]; Socket::SocketOutputStreamLocal *Socket::s_hostOutStream[2]; Socket::SocketInputStreamLocal *Socket::s_hostInStream[2]; -ServerConnection *Socket::s_serverConnection = NULL; +ServerConnection *Socket::s_serverConnection = nullptr; void Socket::Initialise(ServerConnection *serverConnection) { @@ -67,7 +67,7 @@ Socket::Socket(bool response) { m_endClosed[i] = false; } - m_socketClosedEvent = NULL; + m_socketClosedEvent = nullptr; createdOk = true; networkPlayerSmallId = g_NetworkManager.GetHostPlayer()->GetSmallId(); } @@ -80,8 +80,8 @@ Socket::Socket(INetworkPlayer *player, bool response /* = false*/, bool hostLoca for( int i = 0; i < 2; i++ ) { InitializeCriticalSection(&m_queueLockNetwork[i]); - m_inputStream[i] = NULL; - m_outputStream[i] = NULL; + m_inputStream[i] = nullptr; + m_outputStream[i] = nullptr; m_endClosed[i] = false; } @@ -105,7 +105,7 @@ Socket::Socket(INetworkPlayer *player, bool response /* = false*/, bool hostLoca SocketAddress *Socket::getRemoteSocketAddress() { - return NULL; + return nullptr; } INetworkPlayer *Socket::getPlayer() @@ -115,7 +115,7 @@ INetworkPlayer *Socket::getPlayer() void Socket::setPlayer(INetworkPlayer *player) { - if(player!=NULL) + if(player!=nullptr) { networkPlayerSmallId = player->GetSmallId(); } @@ -147,7 +147,7 @@ void Socket::pushDataToQueue(const BYTE * pbData, DWORD dwDataSize, bool fromHos void Socket::addIncomingSocket(Socket *socket) { - if( s_serverConnection != NULL ) + if( s_serverConnection != nullptr ) { s_serverConnection->NewIncomingSocket(socket); } @@ -240,7 +240,7 @@ bool Socket::close(bool isServerConnection) allClosed = true; m_endClosed[m_end] = true; } - if( allClosed && m_socketClosedEvent != NULL ) + if( allClosed && m_socketClosedEvent != nullptr ) { m_socketClosedEvent->Set(); } @@ -488,15 +488,15 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int buffer.dwDataSize = length; INetworkPlayer *hostPlayer = g_NetworkManager.GetHostPlayer(); - if(hostPlayer == NULL) + if(hostPlayer == nullptr) { - app.DebugPrintf("Trying to write to network, but the hostPlayer is NULL\n"); + app.DebugPrintf("Trying to write to network, but the hostPlayer is nullptr\n"); return; } INetworkPlayer *socketPlayer = m_socket->getPlayer(); - if(socketPlayer == NULL) + if(socketPlayer == nullptr) { - app.DebugPrintf("Trying to write to network, but the socketPlayer is NULL\n"); + app.DebugPrintf("Trying to write to network, but the socketPlayer is nullptr\n"); return; } @@ -517,7 +517,7 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int hostPlayer->SendData(socketPlayer, buffer.pbyData, buffer.dwDataSize, lowPriority, requireAck); - // DWORD queueSize = hostPlayer->GetSendQueueSize( NULL, QNET_GETSENDQUEUESIZE_BYTES ); + // DWORD queueSize = hostPlayer->GetSendQueueSize( nullptr, QNET_GETSENDQUEUESIZE_BYTES ); // if( queueSize > 24000 ) // { // //printf("Queue size is: %d, forcing doWork()\n",queueSize); diff --git a/Minecraft.World/SparseDataStorage.cpp b/Minecraft.World/SparseDataStorage.cpp index 15cd33acd..a499e8331 100644 --- a/Minecraft.World/SparseDataStorage.cpp +++ b/Minecraft.World/SparseDataStorage.cpp @@ -451,7 +451,7 @@ void SparseDataStorage::tick() int freeIndex = ( deleteQueueIndex + 1 ) % 3; // printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); - unsigned char *toFree = NULL; + unsigned char *toFree = nullptr; do { toFree = deleteQueue[freeIndex].Pop(); diff --git a/Minecraft.World/SparseLightStorage.cpp b/Minecraft.World/SparseLightStorage.cpp index f0dc9f7ce..5d3288c53 100644 --- a/Minecraft.World/SparseLightStorage.cpp +++ b/Minecraft.World/SparseLightStorage.cpp @@ -457,7 +457,7 @@ void SparseLightStorage::tick() int freeIndex = ( deleteQueueIndex + 1 ) % 3; // printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); - unsigned char *toFree = NULL; + unsigned char *toFree = nullptr; do { toFree = deleteQueue[freeIndex].Pop(); diff --git a/Minecraft.World/SpawnEggItem.cpp b/Minecraft.World/SpawnEggItem.cpp index 9c0591262..5124f668c 100644 --- a/Minecraft.World/SpawnEggItem.cpp +++ b/Minecraft.World/SpawnEggItem.cpp @@ -16,7 +16,7 @@ SpawnEggItem::SpawnEggItem(int id) : Item(id) { setMaxStackSize(16); // 4J-PB brought forward. It is 64 on PC, but we'll never be able to place that many setStackedByData(true); - overlay = NULL; + overlay = nullptr; } wstring SpawnEggItem::getHoverName(shared_ptr itemInstance) @@ -69,7 +69,7 @@ Icon *SpawnEggItem::getLayerIcon(int auxValue, int spriteLayer) shared_ptr SpawnEggItem::canSpawn(int iAuxVal, Level *level, int *piResult) { shared_ptr newEntity = EntityIO::newById(iAuxVal, level); - if (newEntity != NULL) + if (newEntity != nullptr) { bool canSpawn = false; @@ -200,7 +200,7 @@ bool SpawnEggItem::useOn(shared_ptr itemInstance, shared_ptrremoveTile(x,y,z); level->setTileAndData(x,y,z,Tile::mobSpawner_Id, 0, Tile::UPDATE_ALL); shared_ptr mste = dynamic_pointer_cast( level->getTileEntity(x,y,z) ); - if(mste != NULL) + if(mste != nullptr) { mste->setEntityId( EntityIO::getEncodeId(itemInstance->getAuxValue()) ); return true; @@ -213,7 +213,7 @@ bool SpawnEggItem::useOn(shared_ptr itemInstance, shared_ptrgetRenderShape() == Tile::SHAPE_FENCE)) + if (face == Facing::UP && (Tile::tiles[tile] != nullptr && Tile::tiles[tile]->getRenderShape() == Tile::SHAPE_FENCE)) { // special case yOff = .5; @@ -224,10 +224,10 @@ bool SpawnEggItem::useOn(shared_ptr itemInstance, shared_ptrinstanceof(eTYPE_MOB) && itemInstance->hasCustomHoverName() ) @@ -252,7 +252,7 @@ shared_ptr SpawnEggItem::use(shared_ptr itemInstance if (level->isClientSide) return itemInstance; HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == NULL) + if (hr == nullptr) { delete hr; return itemInstance; @@ -275,7 +275,7 @@ shared_ptr SpawnEggItem::use(shared_ptr itemInstance { int iResult=0; shared_ptr result = spawnMobAt(level, itemInstance->getAuxValue(), xt, yt, zt, &iResult); - if (result != NULL) + if (result != nullptr) { // 4J-JEV: SetCustomName is a method for Mob not LivingEntity; so change instanceof to check for Mobs. if ( result->instanceof(eTYPE_MOB) && itemInstance->hasCustomHoverName() ) @@ -317,7 +317,7 @@ shared_ptr SpawnEggItem::spawnMobAt(Level *level, int auxVal, double x, newEntity = canSpawn(mobId, level, piResult); // 4J-JEV: DynCasting to Mob not LivingEntity; so change instanceof to check for Mobs. - if ( newEntity != NULL && newEntity->instanceof(eTYPE_MOB) ) + if ( newEntity != nullptr && newEntity->instanceof(eTYPE_MOB) ) { shared_ptr mob = dynamic_pointer_cast(newEntity); newEntity->moveTo(x, y, z, Mth::wrapDegrees(level->random->nextFloat() * 360), 0); @@ -325,7 +325,7 @@ shared_ptr SpawnEggItem::spawnMobAt(Level *level, int auxVal, double x, mob->yHeadRot = mob->yRot; mob->yBodyRot = mob->yRot; - mob->finalizeMobSpawn(NULL, extraData); + mob->finalizeMobSpawn(nullptr, extraData); level->addEntity(newEntity); mob->playAmbientSound(); } diff --git a/Minecraft.World/Spider.cpp b/Minecraft.World/Spider.cpp index ffce490d8..24d737699 100644 --- a/Minecraft.World/Spider.cpp +++ b/Minecraft.World/Spider.cpp @@ -197,12 +197,12 @@ MobGroupData *Spider::finalizeMobSpawn(MobGroupData *groupData, int extraData /* { shared_ptr skeleton = shared_ptr( new Skeleton(level) ); skeleton->moveTo(x, y, z, yRot, 0); - skeleton->finalizeMobSpawn(NULL); + skeleton->finalizeMobSpawn(nullptr); level->addEntity(skeleton); skeleton->ride(shared_from_this()); } - if (groupData == NULL) + if (groupData == nullptr) { groupData = new SpiderEffectsGroupData(); @@ -211,10 +211,10 @@ MobGroupData *Spider::finalizeMobSpawn(MobGroupData *groupData, int extraData /* static_cast(groupData)->setRandomEffect(level->random); } } - if ( dynamic_cast( groupData ) != NULL) + if ( dynamic_cast( groupData ) != nullptr) { int effect = static_cast(groupData)->effectId; - if (effect > 0 && MobEffect::effects[effect] != NULL) + if (effect > 0 && MobEffect::effects[effect] != nullptr) { addEffect(new MobEffectInstance(effect, Integer::MAX_VALUE)); } diff --git a/Minecraft.World/SpringFeature.cpp b/Minecraft.World/SpringFeature.cpp index c6fa5e9f4..fdd1cbef1 100644 --- a/Minecraft.World/SpringFeature.cpp +++ b/Minecraft.World/SpringFeature.cpp @@ -11,7 +11,7 @@ SpringFeature::SpringFeature(int tile) bool SpringFeature::place(Level *level, Random *random, int x, int y, int z) { // 4J Stu Added to stop spring features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x, y, z, x, y, z); diff --git a/Minecraft.World/SpruceFeature.cpp b/Minecraft.World/SpruceFeature.cpp index 39d628cf4..d42e46f38 100644 --- a/Minecraft.World/SpruceFeature.cpp +++ b/Minecraft.World/SpruceFeature.cpp @@ -23,7 +23,7 @@ bool SpruceFeature::place(Level *level, Random *random, int x, int y, int z) } // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - leafRadius, y - 1, z - leafRadius, x + leafRadius, y + treeHeight, z + leafRadius); diff --git a/Minecraft.World/StairTile.cpp b/Minecraft.World/StairTile.cpp index de2cc865c..094ebf6f0 100644 --- a/Minecraft.World/StairTile.cpp +++ b/Minecraft.World/StairTile.cpp @@ -66,7 +66,7 @@ void StairTile::setBaseShape(LevelSource *level, int x, int y, int z) bool StairTile::isStairs(int id) { StairTile *st = dynamic_cast(Tile::tiles[id]); - return id > 0 && st != NULL; //Tile::tiles[id] instanceof StairTile; + return id > 0 && st != nullptr; //Tile::tiles[id] instanceof StairTile; } bool StairTile::isLockAttached(LevelSource *level, int x, int y, int z, int data) @@ -476,7 +476,7 @@ HitResult *StairTile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 * HitResult *results[8]; for(unsigned int i = 0; i < 8; ++i) { - results[i] = NULL; + results[i] = nullptr; } int data = level->getData(xt, yt, zt); int dir = data & 0x3; @@ -498,16 +498,16 @@ HitResult *StairTile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 * for(unsigned int j = 0; j < DEAD_SPACE_COLUMN_COUNT; ++j) { - results[deadSpaces[j]] = NULL; + results[deadSpaces[j]] = nullptr; } - HitResult *closest = NULL; + HitResult *closest = nullptr; double closestDist = 0; for (unsigned int i = 0; i < 8; ++i) { HitResult *result = results[i]; - if (result != NULL) + if (result != nullptr) { double dist = result->pos->distanceToSqr(b); diff --git a/Minecraft.World/Stats.cpp b/Minecraft.World/Stats.cpp index 3d4020b17..43ff486cf 100644 --- a/Minecraft.World/Stats.cpp +++ b/Minecraft.World/Stats.cpp @@ -27,30 +27,30 @@ vector *Stats::itemsCraftedStats = new vector; vector *Stats::blocksPlacedStats = new vector; #endif -Stat *Stats::walkOneM = NULL; -Stat *Stats::swimOneM = NULL; -Stat *Stats::fallOneM = NULL; -Stat *Stats::climbOneM = NULL; -Stat *Stats::minecartOneM = NULL; -Stat *Stats::boatOneM = NULL; -Stat *Stats::pigOneM = NULL; -Stat *Stats::portalsCreated = NULL; -Stat *Stats::cowsMilked = NULL; -Stat *Stats::netherLavaCollected = NULL; -Stat *Stats::killsZombie = NULL; -Stat *Stats::killsSkeleton = NULL; -Stat *Stats::killsCreeper = NULL; -Stat *Stats::killsSpider = NULL; -Stat *Stats::killsSpiderJockey = NULL; -Stat *Stats::killsZombiePigman = NULL; -Stat *Stats::killsSlime = NULL; -Stat *Stats::killsGhast = NULL; -Stat *Stats::killsNetherZombiePigman = NULL; +Stat *Stats::walkOneM = nullptr; +Stat *Stats::swimOneM = nullptr; +Stat *Stats::fallOneM = nullptr; +Stat *Stats::climbOneM = nullptr; +Stat *Stats::minecartOneM = nullptr; +Stat *Stats::boatOneM = nullptr; +Stat *Stats::pigOneM = nullptr; +Stat *Stats::portalsCreated = nullptr; +Stat *Stats::cowsMilked = nullptr; +Stat *Stats::netherLavaCollected = nullptr; +Stat *Stats::killsZombie = nullptr; +Stat *Stats::killsSkeleton = nullptr; +Stat *Stats::killsCreeper = nullptr; +Stat *Stats::killsSpider = nullptr; +Stat *Stats::killsSpiderJockey = nullptr; +Stat *Stats::killsZombiePigman = nullptr; +Stat *Stats::killsSlime = nullptr; +Stat *Stats::killsGhast = nullptr; +Stat *Stats::killsNetherZombiePigman = nullptr; // 4J : WESTY : Added for new achievements. -Stat *Stats::befriendsWolf = NULL; -Stat *Stats::totalBlocksMined = NULL; -Stat *Stats::timePlayed = NULL; +Stat *Stats::befriendsWolf = nullptr; +Stat *Stats::totalBlocksMined = nullptr; +Stat *Stats::timePlayed = nullptr; StatArray Stats::blocksMined; StatArray Stats::itemsCollected; @@ -62,8 +62,8 @@ StatArray Stats::rainbowCollection; StatArray Stats::biomesVisisted; #endif -Stat *Stats::killsEnderdragon = NULL; // The number of times this player has dealt the killing blow to the Enderdragon -Stat *Stats::completeTheEnd = NULL; // The number of times this player has been present when the Enderdragon has died +Stat *Stats::killsEnderdragon = nullptr; // The number of times this player has dealt the killing blow to the Enderdragon +Stat *Stats::completeTheEnd = nullptr; // The number of times this player has been present when the Enderdragon has died void Stats::staticCtor() { @@ -517,7 +517,7 @@ void Stats::buildAdditionalStats() blocksPlaced[itemStat->getItemId()] = itemStat; itemStat->postConstruct(); - GeneralStat *generalStat = NULL; + GeneralStat *generalStat = nullptr; rainbowCollection = StatArray(16); for (unsigned int i = 0; i < 16; i++) diff --git a/Minecraft.World/StemTile.cpp b/Minecraft.World/StemTile.cpp index 69ced0d27..445c88e4a 100644 --- a/Minecraft.World/StemTile.cpp +++ b/Minecraft.World/StemTile.cpp @@ -17,7 +17,7 @@ StemTile::StemTile(int id, Tile *fruit) : Bush(id) float ss = 0.125f; this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss); - iconAngled = NULL; + iconAngled = nullptr; } bool StemTile::mayPlaceOn(int tile) @@ -184,7 +184,7 @@ void StemTile::spawnResources(Level *level, int x, int y, int z, int data, float return; } - Item *seed = NULL; + Item *seed = nullptr; if (fruit == Tile::pumpkin) seed = Item::seeds_pumpkin; if (fruit == Tile::melon) seed = Item::seeds_melon; for (int i = 0; i < 3; i++) diff --git a/Minecraft.World/StrongholdFeature.cpp b/Minecraft.World/StrongholdFeature.cpp index 2ce875950..83f05cf3f 100644 --- a/Minecraft.World/StrongholdFeature.cpp +++ b/Minecraft.World/StrongholdFeature.cpp @@ -39,7 +39,7 @@ void StrongholdFeature::_init() // 4J added initialisers for (int i = 0; i < strongholdPos_length; i++) { - strongholdPos[i] = NULL; + strongholdPos[i] = nullptr; } isSpotSelected = false; } @@ -140,7 +140,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) int selectedZ = static_cast(Math::round(sin(angle) * dist)); TilePos *position = level->getBiomeSource()->findBiome((selectedX << 4) + 8, (selectedZ << 4) + 8, 7 << 4, allowedBiomes, &random); - if (position != NULL) + if (position != nullptr) { selectedX = position->x >> 4; selectedZ = position->z >> 4; @@ -191,7 +191,7 @@ bool StrongholdFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) { bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != NULL ) + if( levelGenOptions != nullptr ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Stronghold); } @@ -211,7 +211,7 @@ vector *StrongholdFeature::getGuesstimatedFeaturePositions() for( int i = 0; i < strongholdPos_length; i++ ) { ChunkPos *chunkPos = strongholdPos[i]; - if (chunkPos != NULL) + if (chunkPos != nullptr) { positions->push_back(chunkPos->getMiddleBlockPosition(64)); } @@ -225,7 +225,7 @@ StructureStart *StrongholdFeature::createStructureStart(int x, int z) StrongholdStart *start = new StrongholdStart(level, random, x, z); // 4J - front() was get(0) - while (start->getPieces()->empty() || static_cast(start->getPieces()->front())->portalRoomPiece == NULL) + while (start->getPieces()->empty() || static_cast(start->getPieces()->front())->portalRoomPiece == nullptr) { delete start; // regenerate stronghold without changing seed diff --git a/Minecraft.World/StrongholdPieces.cpp b/Minecraft.World/StrongholdPieces.cpp index e1f912bc0..d98d94881 100644 --- a/Minecraft.World/StrongholdPieces.cpp +++ b/Minecraft.World/StrongholdPieces.cpp @@ -90,7 +90,7 @@ bool StrongholdPieces::updatePieceWeight() StrongholdPieces::StrongholdPiece *StrongholdPieces::findAndCreatePieceFactory(EPieceClass pieceClass, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { - StrongholdPiece *strongholdPiece = NULL; + StrongholdPiece *strongholdPiece = nullptr; if (pieceClass == EPieceClass_Straight) { @@ -145,7 +145,7 @@ StrongholdPieces::StrongholdPiece *StrongholdPieces::generatePieceFromSmallDoor( { if (!updatePieceWeight()) { - return NULL; + return nullptr; } if (imposedPiece != EPieceClass_NULL) @@ -153,7 +153,7 @@ StrongholdPieces::StrongholdPiece *StrongholdPieces::generatePieceFromSmallDoor( StrongholdPiece *strongholdPiece = findAndCreatePieceFactory(imposedPiece, pieces, random, footX, footY, footZ, direction, depth); imposedPiece = EPieceClass_NULL; - if (strongholdPiece != NULL) + if (strongholdPiece != nullptr) { return strongholdPiece; } @@ -176,7 +176,7 @@ StrongholdPieces::StrongholdPiece *StrongholdPieces::generatePieceFromSmallDoor( } StrongholdPiece *strongholdPiece = findAndCreatePieceFactory(piece->pieceClass, pieces, random, footX, footY, footZ, direction, depth); - if (strongholdPiece != NULL) + if (strongholdPiece != nullptr) { piece->placeCount++; startPiece->previousPiece = piece; @@ -192,21 +192,21 @@ StrongholdPieces::StrongholdPiece *StrongholdPieces::generatePieceFromSmallDoor( } { BoundingBox *box = FillerCorridor::findPieceBox(pieces, random, footX, footY, footZ, direction); - if (box != NULL && box->y0 > 1) + if (box != nullptr && box->y0 > 1) { return new FillerCorridor(depth, random, box, direction); } - if(box != NULL) delete box; + if(box != nullptr) delete box; } - return NULL; + return nullptr; } StructurePiece *StrongholdPieces::generateAndAddPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { if (depth > MAX_DEPTH) { - return NULL; + return nullptr; } if (abs(footX - startPiece->getBoundingBox()->x0) > 3 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 3 * 16) { @@ -221,7 +221,7 @@ StructurePiece *StrongholdPieces::generateAndAddPiece(StartPiece *startPiece, li printf("Portal room forcing attempt\n"); #endif StrongholdPiece *strongholdPiece = PortalRoom::createPiece(pieces, random, footX, footY, footZ, direction, depth); - if (strongholdPiece != NULL) + if (strongholdPiece != nullptr) { piece->placeCount++; startPiece->previousPiece = piece; @@ -237,11 +237,11 @@ StructurePiece *StrongholdPieces::generateAndAddPiece(StartPiece *startPiece, li } } } - return NULL; + return nullptr; } StructurePiece *newPiece = generatePieceFromSmallDoor(startPiece, pieces, random, footX, footY, footZ, direction, depth + 1); - if (newPiece != NULL) + if (newPiece != nullptr) { pieces->push_back(newPiece); startPiece->pendingChildren.push_back(newPiece); @@ -349,7 +349,7 @@ StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildForward case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x1 + 1, boundingBox->y0 + yOff, boundingBox->z0 + xOff, orientation, getGenDepth()); } - return NULL; + return nullptr; } StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildLeft(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff) @@ -365,7 +365,7 @@ StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildLeft(St case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); } - return NULL; + return nullptr; } StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildRight(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff) @@ -381,20 +381,20 @@ StructurePiece *StrongholdPieces::StrongholdPiece::generateSmallDoorChildRight(S case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); } - return NULL; + return nullptr; } bool StrongholdPieces::StrongholdPiece::isOkBox(BoundingBox *box, StartPiece *startRoom) { - //return box != NULL && box->y0 > LOWEST_Y_POSITION; + //return box != nullptr && box->y0 > LOWEST_Y_POSITION; bool bIsOk = false; - if(box != NULL) + if(box != nullptr) { if( box->y0 > LOWEST_Y_POSITION ) bIsOk = true; - if( startRoom != NULL && startRoom->m_level->getOriginalSaveVersion() >= SAVE_FILE_VERSION_MOVED_STRONGHOLD ) + if( startRoom != nullptr && startRoom->m_level->getOriginalSaveVersion() >= SAVE_FILE_VERSION_MOVED_STRONGHOLD ) { int xzSize = startRoom->m_level->getLevelData()->getXZSize(); int blockMin = -( (xzSize << 4) / 2) + 1; @@ -442,12 +442,12 @@ BoundingBox *StrongholdPieces::FillerCorridor::findPieceBox(listgetBoundingBox()->y0 == box->y0) @@ -468,7 +468,7 @@ BoundingBox *StrongholdPieces::FillerCorridor::findPieceBox(list(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new StairsDown(genDepth, random, box, direction); @@ -618,15 +618,15 @@ StrongholdPieces::StartPiece::StartPiece(int genDepth, Random *random, int west, { // 4J added initialisers isLibraryAdded = false; - previousPiece = NULL; - portalRoomPiece = NULL; + previousPiece = nullptr; + portalRoomPiece = nullptr; m_level = level; } TilePos *StrongholdPieces::StartPiece::getLocatorPosition() { - if( portalRoomPiece != NULL ) + if( portalRoomPiece != nullptr ) { return portalRoomPiece->getLocatorPosition(); } @@ -672,13 +672,13 @@ StrongholdPieces::Straight *StrongholdPieces::Straight::createPiece(list(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new Straight(genDepth, random, box, direction); @@ -772,13 +772,13 @@ StrongholdPieces::ChestCorridor *StrongholdPieces::ChestCorridor::createPiece(li { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, -1, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new ChestCorridor(genDepth, random, box, direction); @@ -844,13 +844,13 @@ StrongholdPieces::StraightStairsDown *StrongholdPieces::StraightStairsDown::crea { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -1, 4 - height, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new StraightStairsDown(genDepth, random, box, direction); @@ -916,13 +916,13 @@ StrongholdPieces::LeftTurn *StrongholdPieces::LeftTurn::createPiece(list(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new LeftTurn(genDepth, random, box, direction); @@ -1032,13 +1032,13 @@ StrongholdPieces::RoomCrossing *StrongholdPieces::RoomCrossing::createPiece(list { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -4, -1, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new RoomCrossing(genDepth, random, box, direction); @@ -1184,13 +1184,13 @@ StrongholdPieces::PrisonHall *StrongholdPieces::PrisonHall::createPiece(list(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new PrisonHall(genDepth, random, box, direction); @@ -1263,19 +1263,19 @@ StrongholdPieces::Library *StrongholdPieces::Library::createPiece(list(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; // make a short library box = BoundingBox::orientBox(footX, footY, footZ, -4, -1, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } } @@ -1476,13 +1476,13 @@ StrongholdPieces::FiveCrossing *StrongholdPieces::FiveCrossing::createPiece(list { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, -4, -3, 0, width, height, depth, direction); - StartPiece *startPiece = NULL; - if(pieces != NULL) startPiece = static_cast(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new FiveCrossing(genDepth, random, box, direction); @@ -1561,7 +1561,7 @@ void StrongholdPieces::PortalRoom::readAdditonalSaveData(CompoundTag *tag) void StrongholdPieces::PortalRoom::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { - if (startPiece != NULL) + if (startPiece != nullptr) { static_cast(startPiece)->portalRoomPiece = this; } @@ -1572,13 +1572,13 @@ StrongholdPieces::PortalRoom *StrongholdPieces::PortalRoom::createPiece(list(pieces->front()); + StartPiece *startPiece = nullptr; + if(pieces != nullptr) startPiece = static_cast(pieces->front()); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new PortalRoom(genDepth, random, box, direction); @@ -1688,7 +1688,7 @@ bool StrongholdPieces::PortalRoom::postProcess(Level *level, Random *random, Bou hasPlacedMobSpawner = true; level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast(level->getTileEntity(x, y, z)); - if (entity != NULL) entity->getSpawner()->setEntityId(L"Silverfish"); + if (entity != nullptr) entity->getSpawner()->setEntityId(L"Silverfish"); } } diff --git a/Minecraft.World/StructureFeature.cpp b/Minecraft.World/StructureFeature.cpp index dfb214a54..acc574729 100644 --- a/Minecraft.World/StructureFeature.cpp +++ b/Minecraft.World/StructureFeature.cpp @@ -109,7 +109,7 @@ bool StructureFeature::isIntersection(int cellX, int cellZ) bool StructureFeature::isInsideFeature(int cellX, int cellY, int cellZ) { restoreSavedData(level); - return getStructureAt(cellX, cellY, cellZ) != NULL; + return getStructureAt(cellX, cellY, cellZ) != nullptr; } StructureStart *StructureFeature::getStructureAt(int cellX, int cellY, int cellZ) @@ -142,7 +142,7 @@ StructureStart *StructureFeature::getStructureAt(int cellX, int cellY, int cellZ } } } - return NULL; + return nullptr; } bool StructureFeature::isInsideBoundingFeature(int cellX, int cellY, int cellZ) @@ -178,7 +178,7 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i addFeature(level, cellX >> 4, cellZ >> 4, 0, 0, byteArray()); double minDistance = DBL_MAX; - TilePos *selected = NULL; + TilePos *selected = nullptr; for(auto& it : cachedStructures) { @@ -203,14 +203,14 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i } } } - if (selected != NULL) + if (selected != nullptr) { return selected; } else { vector *guesstimatedFeaturePositions = getGuesstimatedFeaturePositions(); - if (guesstimatedFeaturePositions != NULL) + if (guesstimatedFeaturePositions != nullptr) { TilePos *pSelectedPos = new TilePos(0,0,0); @@ -233,22 +233,22 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i return pSelectedPos; } } - return NULL; + return nullptr; } vector *StructureFeature::getGuesstimatedFeaturePositions() { - return NULL; + return nullptr; } void StructureFeature::restoreSavedData(Level *level) { #ifdef ENABLE_STRUCTURE_SAVING - if (savedData == NULL) + if (savedData == nullptr) { savedData = dynamic_pointer_cast( level->getSavedData(typeid(StructureFeatureSavedData), getFeatureName()) ); - if (savedData == NULL) + if (savedData == nullptr) { savedData = shared_ptr( new StructureFeatureSavedData(getFeatureName()) ); level->setSavedData(getFeatureName(), savedData); diff --git a/Minecraft.World/StructureFeatureIO.cpp b/Minecraft.World/StructureFeatureIO.cpp index 3e73b028e..784d14c9f 100644 --- a/Minecraft.World/StructureFeatureIO.cpp +++ b/Minecraft.World/StructureFeatureIO.cpp @@ -63,7 +63,7 @@ wstring StructureFeatureIO::getEncodeId(StructurePiece *piece) StructureStart *StructureFeatureIO::loadStaticStart(CompoundTag *tag, Level *level) { - StructureStart *start = NULL; + StructureStart *start = nullptr; auto it = startIdClassMap.find(tag->getString(L"id")); if(it != startIdClassMap.end()) @@ -71,7 +71,7 @@ StructureStart *StructureFeatureIO::loadStaticStart(CompoundTag *tag, Level *lev start = (it->second)(); } - if (start != NULL) + if (start != nullptr) { start->load(level, tag); } @@ -84,7 +84,7 @@ StructureStart *StructureFeatureIO::loadStaticStart(CompoundTag *tag, Level *lev StructurePiece *StructureFeatureIO::loadStaticPiece(CompoundTag *tag, Level *level) { - StructurePiece *piece = NULL; + StructurePiece *piece = nullptr; auto it = pieceIdClassMap.find(tag->getString(L"id")); if(it != pieceIdClassMap.end()) @@ -92,7 +92,7 @@ StructurePiece *StructureFeatureIO::loadStaticPiece(CompoundTag *tag, Level *lev piece = (it->second)(); } - if (piece != NULL) + if (piece != nullptr) { piece->load(level, tag); } diff --git a/Minecraft.World/StructurePiece.cpp b/Minecraft.World/StructurePiece.cpp index be0822bf5..bb3887c0f 100644 --- a/Minecraft.World/StructurePiece.cpp +++ b/Minecraft.World/StructurePiece.cpp @@ -44,7 +44,7 @@ StructurePiece::StructurePiece() { - boundingBox = NULL; + boundingBox = nullptr; orientation = 0; genDepth = 0; // for reflection @@ -52,14 +52,14 @@ StructurePiece::StructurePiece() StructurePiece::StructurePiece( int genDepth ) { - boundingBox = NULL; + boundingBox = nullptr; this->genDepth = genDepth; orientation = Direction::UNDEFINED; } StructurePiece::~StructurePiece() { - if(boundingBox != NULL) delete boundingBox; + if(boundingBox != nullptr) delete boundingBox; } CompoundTag *StructurePiece::createTag() @@ -120,7 +120,7 @@ StructurePiece* StructurePiece::findCollisionPiece( list< StructurePiece* > *pie return piece; } } - return NULL; + return nullptr; } // 4J-PB - Added from 1.2.3 @@ -437,7 +437,7 @@ int StructurePiece::getOrientationData( int tile, int data ) } } } - else if (tile == Tile::tripWireSource_Id || (Tile::tiles[tile] != NULL && dynamic_cast(Tile::tiles[tile]))) + else if (tile == Tile::tripWireSource_Id || (Tile::tiles[tile] != nullptr && dynamic_cast(Tile::tiles[tile]))) { if (orientation == Direction::SOUTH) { @@ -816,7 +816,7 @@ bool StructurePiece::createChest( Level* level, BoundingBox* chunkBB, Random* ra { level->setTileAndData( worldX, worldY, worldZ, Tile::chest->id, 0, Tile::UPDATE_CLIENTS ); shared_ptr chest = dynamic_pointer_cast(level->getTileEntity( worldX, worldY, worldZ )); - if ( chest != NULL ) WeighedTreasure::addChestItems( random, treasure, chest, numRolls ); + if ( chest != nullptr ) WeighedTreasure::addChestItems( random, treasure, chest, numRolls ); return true; } } @@ -835,7 +835,7 @@ bool StructurePiece::createDispenser(Level *level, BoundingBox *chunkBB, Random { level->setTileAndData(worldX, worldY, worldZ, Tile::dispenser_Id, getOrientationData(Tile::dispenser_Id, facing), Tile::UPDATE_CLIENTS); shared_ptr dispenser = dynamic_pointer_cast(level->getTileEntity(worldX, worldY, worldZ)); - if (dispenser != NULL) WeighedTreasure::addDispenserItems(random, items, dispenser, numRolls); + if (dispenser != nullptr) WeighedTreasure::addDispenserItems(random, items, dispenser, numRolls); return true; } } diff --git a/Minecraft.World/StructureStart.cpp b/Minecraft.World/StructureStart.cpp index 3f22b4a7d..0065160e4 100644 --- a/Minecraft.World/StructureStart.cpp +++ b/Minecraft.World/StructureStart.cpp @@ -9,14 +9,14 @@ StructureStart::StructureStart() { chunkX = chunkZ = 0; - boundingBox = NULL; // 4J added initialiser + boundingBox = nullptr; // 4J added initialiser } StructureStart::StructureStart(int x, int z) { this->chunkX = x; this->chunkZ = z; - boundingBox = NULL; + boundingBox = nullptr; } StructureStart::~StructureStart() diff --git a/Minecraft.World/SwampTreeFeature.cpp b/Minecraft.World/SwampTreeFeature.cpp index 19d3f66a7..5b94767ac 100644 --- a/Minecraft.World/SwampTreeFeature.cpp +++ b/Minecraft.World/SwampTreeFeature.cpp @@ -14,7 +14,7 @@ bool SwampTreeFeature::place(Level *level, Random *random, int x, int y, int z) if (y < 1 || y + treeHeight + 1 > Level::genDepth) return false; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); bool intersects = levelGenOptions->checkIntersects(x - 3, y - 1, z - 3, x + 3, y + treeHeight, z + 3); diff --git a/Minecraft.World/SwellGoal.cpp b/Minecraft.World/SwellGoal.cpp index 040d09c27..0fd3c34a8 100644 --- a/Minecraft.World/SwellGoal.cpp +++ b/Minecraft.World/SwellGoal.cpp @@ -16,7 +16,7 @@ SwellGoal::SwellGoal(Creeper *creeper) bool SwellGoal::canUse() { shared_ptr target = creeper->getTarget(); - return creeper->getSwellDir() > 0 || (target != NULL && (creeper->distanceToSqr(target) < 3 * 3)); + return creeper->getSwellDir() > 0 || (target != nullptr && (creeper->distanceToSqr(target) < 3 * 3)); } void SwellGoal::start() @@ -32,7 +32,7 @@ void SwellGoal::stop() void SwellGoal::tick() { - if (target.lock() == NULL) + if (target.lock() == nullptr) { creeper->setSwellDir(-1); return; diff --git a/Minecraft.World/SynchedEntityData.cpp b/Minecraft.World/SynchedEntityData.cpp index 577063db6..2c126f562 100644 --- a/Minecraft.World/SynchedEntityData.cpp +++ b/Minecraft.World/SynchedEntityData.cpp @@ -128,7 +128,7 @@ shared_ptr SynchedEntityData::getItemInstance(int id) Pos *SynchedEntityData::getPos(int id) { assert(false); // 4J - not currently implemented - return NULL; + return nullptr; } void SynchedEntityData::set(int id, int value) @@ -238,18 +238,18 @@ void SynchedEntityData::pack(vector > *items, DataOutputStr vector > *SynchedEntityData::packDirty() { - vector > *result = NULL; + vector > *result = nullptr; if (m_isDirty) { for( int i = 0; i <= MAX_ID_VALUE; i++ ) { shared_ptr dataItem = itemsById[i]; - if ((dataItem != NULL) && dataItem->isDirty()) + if ((dataItem != nullptr) && dataItem->isDirty()) { dataItem->setDirty(false); - if (result == NULL) + if (result == nullptr) { result = new vector >(); } @@ -267,7 +267,7 @@ void SynchedEntityData::packAll(DataOutputStream *output) // throws IOException for( int i = 0; i <= MAX_ID_VALUE; i++ ) { shared_ptr dataItem = itemsById[i]; - if(dataItem != NULL) + if(dataItem != nullptr) { writeDataItem(output, dataItem); } @@ -279,14 +279,14 @@ void SynchedEntityData::packAll(DataOutputStream *output) // throws IOException vector > *SynchedEntityData::getAll() { - vector > *result = NULL; + vector > *result = nullptr; for( int i = 0; i <= MAX_ID_VALUE; i++ ) { shared_ptr dataItem = itemsById[i]; - if(dataItem != NULL) + if(dataItem != nullptr) { - if (result == NULL) + if (result == nullptr) { result = new vector >(); } @@ -338,14 +338,14 @@ void SynchedEntityData::writeDataItem(DataOutputStream *output, shared_ptr > *SynchedEntityData::unpack(DataInputStream *input) //throws IOException { - vector > *result = NULL; + vector > *result = nullptr; int currentHeader = input->readByte(); while (currentHeader != EOF_MARKER) { - if (result == NULL) + if (result == nullptr) { result = new vector >(); } @@ -393,7 +393,7 @@ vector > *SynchedEntityData::unpack(Data default: app.DebugPrintf(" ------ garbage data, or early end of stream due to an incomplete packet\n"); delete result; - return NULL; + return nullptr; break; } result->push_back(item); @@ -415,7 +415,7 @@ void SynchedEntityData::assignValues(vector > *items) for (auto& item : *items) { shared_ptr itemFromId = itemsById[item->getId()]; - if( itemFromId != NULL ) + if( itemFromId != nullptr ) { switch(item->getType()) { @@ -465,7 +465,7 @@ int SynchedEntityData::getSizeInBytes() for( int i = 0; i <= MAX_ID_VALUE; i++ ) { shared_ptr dataItem = itemsById[i]; - if(dataItem != NULL) + if(dataItem != nullptr) { size += 1; diff --git a/Minecraft.World/Tag.cpp b/Minecraft.World/Tag.cpp index adc753608..58332f0c0 100644 --- a/Minecraft.World/Tag.cpp +++ b/Minecraft.World/Tag.cpp @@ -27,7 +27,7 @@ Tag::Tag(const wstring &name) // 4J - Was Object obj bool Tag::equals(Tag *obj) { - if (obj == NULL )// || !(obj instanceof Tag)) + if (obj == nullptr )// || !(obj instanceof Tag)) { return false; } @@ -150,7 +150,7 @@ Tag *Tag::newTag(byte type, const wstring &name) case TAG_Compound: return new CompoundTag(name); } - return NULL; + return nullptr; } wchar_t *Tag::getTagName(byte type) diff --git a/Minecraft.World/TakeFlowerGoal.cpp b/Minecraft.World/TakeFlowerGoal.cpp index 0774374be..71e7c7c6d 100644 --- a/Minecraft.World/TakeFlowerGoal.cpp +++ b/Minecraft.World/TakeFlowerGoal.cpp @@ -53,7 +53,7 @@ bool TakeFlowerGoal::canUse() bool TakeFlowerGoal::canContinueToUse() { - return golem.lock() != NULL && golem.lock()->getOfferFlowerTick() > 0; + return golem.lock() != nullptr && golem.lock()->getOfferFlowerTick() > 0; } void TakeFlowerGoal::start() diff --git a/Minecraft.World/TallGrass.cpp b/Minecraft.World/TallGrass.cpp index 1a89d3edf..bf8899103 100644 --- a/Minecraft.World/TallGrass.cpp +++ b/Minecraft.World/TallGrass.cpp @@ -81,7 +81,7 @@ int TallGrass::getResourceCountForLootBonus(int bonusLevel, Random *random) void TallGrass::playerDestroy(Level *level, shared_ptr player, int x, int y, int z, int data) { - if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) + if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears->id) { player->awardStat( GenericStats::blocksMined(id), diff --git a/Minecraft.World/TamableAnimal.cpp b/Minecraft.World/TamableAnimal.cpp index a938cc293..1fb41df32 100644 --- a/Minecraft.World/TamableAnimal.cpp +++ b/Minecraft.World/TamableAnimal.cpp @@ -13,7 +13,7 @@ TamableAnimal::TamableAnimal(Level *level) : Animal(level) TamableAnimal::~TamableAnimal() { - if(sitGoal != NULL) delete sitGoal; + if(sitGoal != nullptr) delete sitGoal; } void TamableAnimal::defineSynchedData() @@ -169,7 +169,7 @@ Team *TamableAnimal::getTeam() if (isTame()) { shared_ptr owner = dynamic_pointer_cast(getOwner()); - if (owner != NULL) + if (owner != nullptr) { return owner->getTeam(); } @@ -186,7 +186,7 @@ bool TamableAnimal::isAlliedTo(shared_ptr other) { return true; } - if (owner != NULL) + if (owner != nullptr) { return owner->isAlliedTo(other); } diff --git a/Minecraft.World/TargetGoal.cpp b/Minecraft.World/TargetGoal.cpp index 982acb5e2..0c2b9363f 100644 --- a/Minecraft.World/TargetGoal.cpp +++ b/Minecraft.World/TargetGoal.cpp @@ -34,7 +34,7 @@ TargetGoal::TargetGoal(PathfinderMob *mob, bool mustSee, bool mustReach) bool TargetGoal::canContinueToUse() { shared_ptr target = mob->getTarget(); - if (target == NULL) return false; + if (target == nullptr) return false; if (!target->isAlive()) return false; double within = getFollowDistance(); @@ -56,7 +56,7 @@ bool TargetGoal::canContinueToUse() double TargetGoal::getFollowDistance() { AttributeInstance *followRange = mob->getAttribute(SharedMonsterAttributes::FOLLOW_RANGE); - return followRange == NULL ? 16 : followRange->getValue(); + return followRange == nullptr ? 16 : followRange->getValue(); } void TargetGoal::start() @@ -73,16 +73,16 @@ void TargetGoal::stop() bool TargetGoal::canAttack(shared_ptr target, bool allowInvulnerable) { - if (target == NULL) return false; + if (target == nullptr) return false; if (target == mob->shared_from_this()) return false; if (!target->isAlive()) return false; if (!mob->canAttackType(target->GetType())) return false; OwnableEntity *ownableMob = dynamic_cast(mob); - if (ownableMob != NULL && !ownableMob->getOwnerUUID().empty()) + if (ownableMob != nullptr && !ownableMob->getOwnerUUID().empty()) { shared_ptr ownableTarget = dynamic_pointer_cast(target); - if (ownableTarget != NULL && ownableMob->getOwnerUUID().compare(ownableTarget->getOwnerUUID()) == 0) + if (ownableTarget != nullptr && ownableMob->getOwnerUUID().compare(ownableTarget->getOwnerUUID()) == 0) { // We're attacking something owned by the same person... return false; @@ -117,9 +117,9 @@ bool TargetGoal::canReach(shared_ptr target) { reachCacheTime = 10 + mob->getRandom()->nextInt(5); Path *path = mob->getNavigation()->createPath(target); - if (path == NULL) return false; + if (path == nullptr) return false; Node *last = path->last(); - if (last == NULL) + if (last == nullptr) { delete path; return false; diff --git a/Minecraft.World/Team.cpp b/Minecraft.World/Team.cpp index f3f6e04e6..7c3bde0c5 100644 --- a/Minecraft.World/Team.cpp +++ b/Minecraft.World/Team.cpp @@ -4,7 +4,7 @@ bool Team::isAlliedTo(Team *other) { - if (other == NULL) + if (other == nullptr) { return false; } diff --git a/Minecraft.World/TemptGoal.cpp b/Minecraft.World/TemptGoal.cpp index aebab8fa2..40b3201ca 100644 --- a/Minecraft.World/TemptGoal.cpp +++ b/Minecraft.World/TemptGoal.cpp @@ -29,10 +29,10 @@ bool TemptGoal::canUse() return false; } player = weak_ptr(mob->level->getNearestPlayer(mob->shared_from_this(), 10)); - if (player.lock() == NULL) return false; + if (player.lock() == nullptr) return false; mob->setDespawnProtected(); // If we've got a nearby player, then consider this mob as something we'd miss if it despawned shared_ptr item = player.lock()->getSelectedItem(); - if (item == NULL) return false; + if (item == nullptr) return false; if (item->id != itemId) return false; return true; } @@ -41,7 +41,7 @@ bool TemptGoal::canContinueToUse() { if (canScare) { - if(player.lock() == NULL) return false; + if(player.lock() == nullptr) return false; if (mob->distanceToSqr(player.lock()) < 6 * 6) { if (player.lock()->distanceToSqr(px, py, pz) > 0.1 * 0.1) return false; diff --git a/Minecraft.World/TextureAndGeometryPacket.cpp b/Minecraft.World/TextureAndGeometryPacket.cpp index 5386bd12b..bf5eccdbb 100644 --- a/Minecraft.World/TextureAndGeometryPacket.cpp +++ b/Minecraft.World/TextureAndGeometryPacket.cpp @@ -10,21 +10,21 @@ TextureAndGeometryPacket::TextureAndGeometryPacket() { this->textureName = L""; this->dwTextureBytes = 0; - this->pbData = NULL; + this->pbData = nullptr; this->dwBoxC = 0; - this->BoxDataA = NULL; + this->BoxDataA = nullptr; uiAnimOverrideBitmask=0; } TextureAndGeometryPacket::~TextureAndGeometryPacket() { // can't free these - they're used elsewhere -// if(this->BoxDataA!=NULL) +// if(this->BoxDataA!=nullptr) // { // delete [] this->BoxDataA; // } // -// if(this->pbData!=NULL) +// if(this->pbData!=nullptr) // { // delete [] this->pbData; // } @@ -43,7 +43,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P this->pbData = pbData; this->dwTextureBytes = dwBytes; this->dwBoxC = 0; - this->BoxDataA=NULL; + this->BoxDataA=nullptr; this->uiAnimOverrideBitmask=0; } @@ -75,7 +75,7 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P } else { - this->BoxDataA=NULL; + this->BoxDataA=nullptr; } } @@ -93,10 +93,10 @@ TextureAndGeometryPacket::TextureAndGeometryPacket(const wstring &textureName, P this->pbData = pbData; this->dwTextureBytes = dwBytes; this->uiAnimOverrideBitmask = uiAnimOverrideBitmask; - if(pvSkinBoxes==NULL) + if(pvSkinBoxes==nullptr) { this->dwBoxC=0; - this->BoxDataA=NULL; + this->BoxDataA=nullptr; } else { diff --git a/Minecraft.World/TexturePacket.cpp b/Minecraft.World/TexturePacket.cpp index 061c6fc1e..eadcb3edb 100644 --- a/Minecraft.World/TexturePacket.cpp +++ b/Minecraft.World/TexturePacket.cpp @@ -10,13 +10,13 @@ TexturePacket::TexturePacket() { this->textureName = L""; this->dwBytes = 0; - this->pbData = NULL; + this->pbData = nullptr; } TexturePacket::~TexturePacket() { // can't free this - it's used elsewhere -// if(this->pbData!=NULL) +// if(this->pbData!=nullptr) // { // delete [] this->pbData; // } diff --git a/Minecraft.World/TheEndDimension.cpp b/Minecraft.World/TheEndDimension.cpp index ccc8641b4..ef11b1fb6 100644 --- a/Minecraft.World/TheEndDimension.cpp +++ b/Minecraft.World/TheEndDimension.cpp @@ -26,7 +26,7 @@ float TheEndDimension::getTimeOfDay(__int64 time, float a) const float *TheEndDimension::getSunriseColor(float td, float a) { - return NULL; + return nullptr; } Vec3 *TheEndDimension::getFogColor(float td, float a) const diff --git a/Minecraft.World/TheEndLevelRandomLevelSource.cpp b/Minecraft.World/TheEndLevelRandomLevelSource.cpp index 5b965ef79..858e79727 100644 --- a/Minecraft.World/TheEndLevelRandomLevelSource.cpp +++ b/Minecraft.World/TheEndLevelRandomLevelSource.cpp @@ -195,7 +195,7 @@ LevelChunk *TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs) doubleArray TheEndLevelRandomLevelSource::getHeights(doubleArray buffer, int x, int y, int z, int xSize, int ySize, int zSize) { - if (buffer.data == NULL) + if (buffer.data == nullptr) { buffer = doubleArray(xSize * ySize * zSize); } @@ -407,16 +407,16 @@ wstring TheEndLevelRandomLevelSource::gatherStats() vector *TheEndLevelRandomLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z) { Biome *biome = level->getBiome(x, z); - if (biome == NULL) + if (biome == nullptr) { - return NULL; + return nullptr; } return biome->getMobs(mobCategory); } TilePos *TheEndLevelRandomLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z) { - return NULL; + return nullptr; } void TheEndLevelRandomLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ) diff --git a/Minecraft.World/TheEndPortal.cpp b/Minecraft.World/TheEndPortal.cpp index f2cb5dadf..0298ca48b 100644 --- a/Minecraft.World/TheEndPortal.cpp +++ b/Minecraft.World/TheEndPortal.cpp @@ -13,7 +13,7 @@ DWORD TheEndPortal::tlsIdx = TlsAlloc(); // 4J - allowAnywhere is a static in java, implementing as TLS here to make thread safe bool TheEndPortal::allowAnywhere() { - return (TlsGetValue(tlsIdx) != NULL); + return (TlsGetValue(tlsIdx) != nullptr); } void TheEndPortal::allowAnywhere(bool set) @@ -66,7 +66,7 @@ void TheEndPortal::entityInside(Level *level, int x, int y, int z, shared_ptrGetType() == eTYPE_EXPERIENCEORB ) return; // 4J added - if (entity->riding == NULL && entity->rider.lock() == NULL) + if (entity->riding == nullptr && entity->rider.lock() == nullptr) { if (!level->isClientSide) { diff --git a/Minecraft.World/TheEndPortalFrameTile.cpp b/Minecraft.World/TheEndPortalFrameTile.cpp index f7b10a05a..80e78f49d 100644 --- a/Minecraft.World/TheEndPortalFrameTile.cpp +++ b/Minecraft.World/TheEndPortalFrameTile.cpp @@ -9,8 +9,8 @@ const wstring TheEndPortalFrameTile::TEXTURE_EYE = L"endframe_eye"; TheEndPortalFrameTile::TheEndPortalFrameTile(int id) : Tile(id, Material::glass, isSolidRender() ) { - iconTop = NULL; - iconEye = NULL; + iconTop = nullptr; + iconEye = nullptr; } Icon *TheEndPortalFrameTile::getTexture(int face, int data) diff --git a/Minecraft.World/ThinFenceTile.cpp b/Minecraft.World/ThinFenceTile.cpp index 3f471ce41..cbfdd2fe0 100644 --- a/Minecraft.World/ThinFenceTile.cpp +++ b/Minecraft.World/ThinFenceTile.cpp @@ -5,7 +5,7 @@ ThinFenceTile::ThinFenceTile(int id, const wstring &tex, const wstring &edgeTex, Material *material, bool dropsResources) : Tile(id, material,isSolidRender()) { - iconSide = NULL; + iconSide = nullptr; edgeTexture = edgeTex; this->dropsResources = dropsResources; this->texture = tex; diff --git a/Minecraft.World/ThornsEnchantment.cpp b/Minecraft.World/ThornsEnchantment.cpp index 536686427..a301907e2 100644 --- a/Minecraft.World/ThornsEnchantment.cpp +++ b/Minecraft.World/ThornsEnchantment.cpp @@ -62,14 +62,14 @@ void ThornsEnchantment::doThornsAfterAttack(shared_ptr source, shared_pt source->hurt(DamageSource::thorns(target), getDamage(level, random)); source->playSound(eSoundType_DAMAGE_THORNS, .5f, 1.0f); - if (item != NULL) + if (item != nullptr) { item->hurtAndBreak(3, target); } } else { - if (item != NULL) + if (item != nullptr) { item->hurtAndBreak(1, target); } diff --git a/Minecraft.World/Throwable.cpp b/Minecraft.World/Throwable.cpp index 4aecacfda..08e40aa6d 100644 --- a/Minecraft.World/Throwable.cpp +++ b/Minecraft.World/Throwable.cpp @@ -166,7 +166,7 @@ void Throwable::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != NULL) + if (res != nullptr) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -185,7 +185,7 @@ void Throwable::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != NULL) + if (p != nullptr) { double dd = from->distanceTo(p->pos); delete p; @@ -197,14 +197,14 @@ void Throwable::tick() } } - if (hitEntity != NULL) + if (hitEntity != nullptr) { - if(res != NULL) delete res; + if(res != nullptr) delete res; res = new HitResult(hitEntity); } } - if (res != NULL) + if (res != nullptr) { if ( (res->type == HitResult::TILE) && (level->getTile(res->x, res->y, res->z) == Tile::portalTile_Id) ) { @@ -274,7 +274,7 @@ void Throwable::addAdditonalSaveData(CompoundTag *tag) tag->putByte(L"shake", static_cast(shakeTime)); tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); - if (ownerName.empty() && (owner != NULL) && owner->instanceof(eTYPE_PLAYER) ) + if (ownerName.empty() && (owner != nullptr) && owner->instanceof(eTYPE_PLAYER) ) { ownerName = owner->getAName(); } @@ -301,7 +301,7 @@ float Throwable::getShadowHeightOffs() shared_ptr Throwable::getOwner() { - if (owner == NULL && !ownerName.empty() ) + if (owner == nullptr && !ownerName.empty() ) { owner = level->getPlayerByName(ownerName); } diff --git a/Minecraft.World/ThrownEgg.cpp b/Minecraft.World/ThrownEgg.cpp index 1378e094b..7bf85d71b 100644 --- a/Minecraft.World/ThrownEgg.cpp +++ b/Minecraft.World/ThrownEgg.cpp @@ -33,7 +33,7 @@ ThrownEgg::ThrownEgg(Level *level, double x, double y, double z) : Throwable(lev void ThrownEgg::onHit(HitResult *res) { - if (res->entity != NULL) + if (res->entity != nullptr) { DamageSource *damageSource = DamageSource::thrown(shared_from_this(), owner); res->entity->hurt(damageSource, 0); diff --git a/Minecraft.World/ThrownEnderpearl.cpp b/Minecraft.World/ThrownEnderpearl.cpp index 1035bffdc..c325f1c91 100644 --- a/Minecraft.World/ThrownEnderpearl.cpp +++ b/Minecraft.World/ThrownEnderpearl.cpp @@ -32,7 +32,7 @@ ThrownEnderpearl::ThrownEnderpearl(Level *level, double x, double y, double z) : void ThrownEnderpearl::onHit(HitResult *res) { - if (res->entity != NULL) + if (res->entity != nullptr) { DamageSource *damageSource = DamageSource::thrown(shared_from_this(), getOwner() ); res->entity->hurt(damageSource, 0); @@ -49,7 +49,7 @@ void ThrownEnderpearl::onHit(HitResult *res) // If the owner has been removed, then ignore // 4J-JEV: Cheap type check first. - if ( (getOwner() != NULL) && getOwner()->instanceof(eTYPE_SERVERPLAYER) ) + if ( (getOwner() != nullptr) && getOwner()->instanceof(eTYPE_SERVERPLAYER) ) { shared_ptr serverPlayer = dynamic_pointer_cast(getOwner() ); if (!serverPlayer->removed) diff --git a/Minecraft.World/ThrownPotion.cpp b/Minecraft.World/ThrownPotion.cpp index fbab11d8f..6e0618582 100644 --- a/Minecraft.World/ThrownPotion.cpp +++ b/Minecraft.World/ThrownPotion.cpp @@ -72,13 +72,13 @@ float ThrownPotion::getThrowUpAngleOffset() void ThrownPotion::setPotionValue(int potionValue) { - if (potionItem == NULL) potionItem = shared_ptr( new ItemInstance(Item::potion, 1, 0) ); + if (potionItem == nullptr) potionItem = shared_ptr( new ItemInstance(Item::potion, 1, 0) ); potionItem->setAuxValue(potionValue); } int ThrownPotion::getPotionValue() { - if (potionItem == NULL) potionItem = shared_ptr( new ItemInstance(Item::potion, 1, 0) ); + if (potionItem == nullptr) potionItem = shared_ptr( new ItemInstance(Item::potion, 1, 0) ); return potionItem->getAuxValue(); } @@ -88,12 +88,12 @@ void ThrownPotion::onHit(HitResult *res) { vector *mobEffects = Item::potion->getMobEffects(potionItem); - if (mobEffects != NULL && !mobEffects->empty()) + if (mobEffects != nullptr && !mobEffects->empty()) { AABB *aoe = bb->grow(SPLASH_RANGE, SPLASH_RANGE / 2, SPLASH_RANGE); vector > *entitiesOfClass = level->getEntitiesOfClass(typeid(LivingEntity), aoe); - if (entitiesOfClass != NULL && !entitiesOfClass->empty()) + if (entitiesOfClass != nullptr && !entitiesOfClass->empty()) { for(auto & it : *entitiesOfClass) { @@ -148,12 +148,12 @@ void ThrownPotion::readAdditionalSaveData(CompoundTag *tag) setPotionValue(tag->getInt(L"potionValue")); } - if (potionItem == NULL) remove(); + if (potionItem == nullptr) remove(); } void ThrownPotion::addAdditonalSaveData(CompoundTag *tag) { Throwable::addAdditonalSaveData(tag); - if (potionItem != NULL) tag->putCompound(L"Potion", potionItem->save(new CompoundTag())); + if (potionItem != nullptr) tag->putCompound(L"Potion", potionItem->save(new CompoundTag())); } \ No newline at end of file diff --git a/Minecraft.World/TickNextTickData.cpp b/Minecraft.World/TickNextTickData.cpp index 277be1f8c..95639b044 100644 --- a/Minecraft.World/TickNextTickData.cpp +++ b/Minecraft.World/TickNextTickData.cpp @@ -21,7 +21,7 @@ bool TickNextTickData::equals(const TickNextTickData *o) const { // TODO 4J Is this safe to cast it before we do a dynamic_cast? Will the dynamic_cast still fail? // We cannot dynamic_cast a void* - if ( o != NULL) + if ( o != nullptr) { TickNextTickData *t = (TickNextTickData *) o; return x == t->x && y == t->y && z == t->z && Tile::isMatching(tileId, t->tileId); diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index ef1b7e358..7ab09928f 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -21,18 +21,18 @@ wstring Tile::TILE_DESCRIPTION_PREFIX = L"Tile."; const float Tile::INDESTRUCTIBLE_DESTROY_TIME = -1.0f; -Tile::SoundType *Tile::SOUND_NORMAL = NULL; -Tile::SoundType *Tile::SOUND_WOOD = NULL; -Tile::SoundType *Tile::SOUND_GRAVEL = NULL; -Tile::SoundType *Tile::SOUND_GRASS = NULL; -Tile::SoundType *Tile::SOUND_STONE = NULL; -Tile::SoundType *Tile::SOUND_METAL = NULL; -Tile::SoundType *Tile::SOUND_GLASS = NULL; -Tile::SoundType *Tile::SOUND_CLOTH = NULL; -Tile::SoundType *Tile::SOUND_SAND = NULL; -Tile::SoundType *Tile::SOUND_SNOW = NULL; -Tile::SoundType *Tile::SOUND_LADDER = NULL; -Tile::SoundType *Tile::SOUND_ANVIL = NULL; +Tile::SoundType *Tile::SOUND_NORMAL = nullptr; +Tile::SoundType *Tile::SOUND_WOOD = nullptr; +Tile::SoundType *Tile::SOUND_GRAVEL = nullptr; +Tile::SoundType *Tile::SOUND_GRASS = nullptr; +Tile::SoundType *Tile::SOUND_STONE = nullptr; +Tile::SoundType *Tile::SOUND_METAL = nullptr; +Tile::SoundType *Tile::SOUND_GLASS = nullptr; +Tile::SoundType *Tile::SOUND_CLOTH = nullptr; +Tile::SoundType *Tile::SOUND_SAND = nullptr; +Tile::SoundType *Tile::SOUND_SNOW = nullptr; +Tile::SoundType *Tile::SOUND_LADDER = nullptr; +Tile::SoundType *Tile::SOUND_ANVIL = nullptr; bool Tile::solid[TILE_NUM_COUNT]; int Tile::lightBlock[TILE_NUM_COUNT]; @@ -42,183 +42,183 @@ unsigned char Tile::_sendTileData[TILE_NUM_COUNT]; // 4J changed - was bool, no bool Tile::mipmapEnable[TILE_NUM_COUNT]; bool Tile::propagate[TILE_NUM_COUNT]; -Tile **Tile::tiles = NULL; +Tile **Tile::tiles = nullptr; -Tile *Tile::stone = NULL; -GrassTile *Tile::grass = NULL; -Tile *Tile::dirt = NULL; -Tile *Tile::cobblestone = NULL; -Tile *Tile::wood = NULL; -Tile *Tile::sapling = NULL; -Tile *Tile::unbreakable = NULL; -LiquidTile *Tile::water = NULL; -Tile *Tile::calmWater = NULL; -LiquidTile *Tile::lava = NULL; -Tile *Tile::calmLava = NULL; -Tile *Tile::sand = NULL; -Tile *Tile::gravel = NULL; -Tile *Tile::goldOre = NULL; -Tile *Tile::ironOre = NULL; -Tile *Tile::coalOre = NULL; -Tile *Tile::treeTrunk = NULL; -LeafTile *Tile::leaves = NULL; -Tile *Tile::sponge = NULL; -Tile *Tile::glass = NULL; -Tile *Tile::lapisOre = NULL; -Tile *Tile::lapisBlock = NULL; -Tile *Tile::dispenser = NULL; -Tile *Tile::sandStone = NULL; -Tile *Tile::noteblock = NULL; -Tile *Tile::bed = NULL; -Tile *Tile::goldenRail = NULL; -Tile *Tile::detectorRail = NULL; -PistonBaseTile *Tile::pistonStickyBase = NULL; -Tile *Tile::web = NULL; -TallGrass *Tile::tallgrass = NULL; -DeadBushTile *Tile::deadBush = NULL; -PistonBaseTile *Tile::pistonBase = NULL; -PistonExtensionTile *Tile::pistonExtension = NULL; -Tile *Tile::wool = NULL; -PistonMovingPiece *Tile::pistonMovingPiece = NULL; -Bush *Tile::flower = NULL; -Bush *Tile::rose = NULL; -Bush *Tile::mushroom_brown = NULL; -Bush *Tile::mushroom_red = NULL; -Tile *Tile::goldBlock = NULL; -Tile *Tile::ironBlock = NULL; -HalfSlabTile *Tile::stoneSlab = NULL; -HalfSlabTile *Tile::stoneSlabHalf = NULL; -Tile *Tile::redBrick = NULL; -Tile *Tile::tnt = NULL; -Tile *Tile::bookshelf = NULL; -Tile *Tile::mossyCobblestone = NULL; -Tile *Tile::obsidian = NULL; -Tile *Tile::torch = NULL; -FireTile *Tile::fire = NULL; -Tile *Tile::mobSpawner = NULL; -Tile *Tile::stairs_wood = NULL; -ChestTile *Tile::chest = NULL; -RedStoneDustTile *Tile::redStoneDust = NULL; -Tile *Tile::diamondOre = NULL; -Tile *Tile::diamondBlock = NULL; -Tile *Tile::workBench = NULL; -Tile *Tile::wheat = NULL; -Tile *Tile::farmland = NULL; -Tile *Tile::furnace = NULL; -Tile *Tile::furnace_lit = NULL; -Tile *Tile::sign = NULL; -Tile *Tile::door_wood = NULL; -Tile *Tile::ladder = NULL; -Tile *Tile::rail = NULL; -Tile *Tile::stairs_stone = NULL; -Tile *Tile::wallSign = NULL; -Tile *Tile::lever = NULL; -Tile *Tile::pressurePlate_stone = NULL; -Tile *Tile::door_iron = NULL; -Tile *Tile::pressurePlate_wood = NULL; -Tile *Tile::redStoneOre = NULL; -Tile *Tile::redStoneOre_lit = NULL; -Tile *Tile::redstoneTorch_off = NULL; -Tile *Tile::redstoneTorch_on = NULL; -Tile *Tile::button = NULL; -Tile *Tile::topSnow = NULL; -Tile *Tile::ice = NULL; -Tile *Tile::snow = NULL; -Tile *Tile::cactus = NULL; -Tile *Tile::clay = NULL; -Tile *Tile::reeds = NULL; -Tile *Tile::jukebox = NULL; -Tile *Tile::fence = NULL; -Tile *Tile::pumpkin = NULL; -Tile *Tile::netherRack = NULL; -Tile *Tile::soulsand = NULL; -Tile *Tile::glowstone = NULL; -PortalTile *Tile::portalTile = NULL; -Tile *Tile::litPumpkin = NULL; -Tile *Tile::cake = NULL; -RepeaterTile *Tile::diode_off = NULL; -RepeaterTile *Tile::diode_on = NULL; -Tile *Tile::stained_glass = NULL; -Tile *Tile::trapdoor = NULL; +Tile *Tile::stone = nullptr; +GrassTile *Tile::grass = nullptr; +Tile *Tile::dirt = nullptr; +Tile *Tile::cobblestone = nullptr; +Tile *Tile::wood = nullptr; +Tile *Tile::sapling = nullptr; +Tile *Tile::unbreakable = nullptr; +LiquidTile *Tile::water = nullptr; +Tile *Tile::calmWater = nullptr; +LiquidTile *Tile::lava = nullptr; +Tile *Tile::calmLava = nullptr; +Tile *Tile::sand = nullptr; +Tile *Tile::gravel = nullptr; +Tile *Tile::goldOre = nullptr; +Tile *Tile::ironOre = nullptr; +Tile *Tile::coalOre = nullptr; +Tile *Tile::treeTrunk = nullptr; +LeafTile *Tile::leaves = nullptr; +Tile *Tile::sponge = nullptr; +Tile *Tile::glass = nullptr; +Tile *Tile::lapisOre = nullptr; +Tile *Tile::lapisBlock = nullptr; +Tile *Tile::dispenser = nullptr; +Tile *Tile::sandStone = nullptr; +Tile *Tile::noteblock = nullptr; +Tile *Tile::bed = nullptr; +Tile *Tile::goldenRail = nullptr; +Tile *Tile::detectorRail = nullptr; +PistonBaseTile *Tile::pistonStickyBase = nullptr; +Tile *Tile::web = nullptr; +TallGrass *Tile::tallgrass = nullptr; +DeadBushTile *Tile::deadBush = nullptr; +PistonBaseTile *Tile::pistonBase = nullptr; +PistonExtensionTile *Tile::pistonExtension = nullptr; +Tile *Tile::wool = nullptr; +PistonMovingPiece *Tile::pistonMovingPiece = nullptr; +Bush *Tile::flower = nullptr; +Bush *Tile::rose = nullptr; +Bush *Tile::mushroom_brown = nullptr; +Bush *Tile::mushroom_red = nullptr; +Tile *Tile::goldBlock = nullptr; +Tile *Tile::ironBlock = nullptr; +HalfSlabTile *Tile::stoneSlab = nullptr; +HalfSlabTile *Tile::stoneSlabHalf = nullptr; +Tile *Tile::redBrick = nullptr; +Tile *Tile::tnt = nullptr; +Tile *Tile::bookshelf = nullptr; +Tile *Tile::mossyCobblestone = nullptr; +Tile *Tile::obsidian = nullptr; +Tile *Tile::torch = nullptr; +FireTile *Tile::fire = nullptr; +Tile *Tile::mobSpawner = nullptr; +Tile *Tile::stairs_wood = nullptr; +ChestTile *Tile::chest = nullptr; +RedStoneDustTile *Tile::redStoneDust = nullptr; +Tile *Tile::diamondOre = nullptr; +Tile *Tile::diamondBlock = nullptr; +Tile *Tile::workBench = nullptr; +Tile *Tile::wheat = nullptr; +Tile *Tile::farmland = nullptr; +Tile *Tile::furnace = nullptr; +Tile *Tile::furnace_lit = nullptr; +Tile *Tile::sign = nullptr; +Tile *Tile::door_wood = nullptr; +Tile *Tile::ladder = nullptr; +Tile *Tile::rail = nullptr; +Tile *Tile::stairs_stone = nullptr; +Tile *Tile::wallSign = nullptr; +Tile *Tile::lever = nullptr; +Tile *Tile::pressurePlate_stone = nullptr; +Tile *Tile::door_iron = nullptr; +Tile *Tile::pressurePlate_wood = nullptr; +Tile *Tile::redStoneOre = nullptr; +Tile *Tile::redStoneOre_lit = nullptr; +Tile *Tile::redstoneTorch_off = nullptr; +Tile *Tile::redstoneTorch_on = nullptr; +Tile *Tile::button = nullptr; +Tile *Tile::topSnow = nullptr; +Tile *Tile::ice = nullptr; +Tile *Tile::snow = nullptr; +Tile *Tile::cactus = nullptr; +Tile *Tile::clay = nullptr; +Tile *Tile::reeds = nullptr; +Tile *Tile::jukebox = nullptr; +Tile *Tile::fence = nullptr; +Tile *Tile::pumpkin = nullptr; +Tile *Tile::netherRack = nullptr; +Tile *Tile::soulsand = nullptr; +Tile *Tile::glowstone = nullptr; +PortalTile *Tile::portalTile = nullptr; +Tile *Tile::litPumpkin = nullptr; +Tile *Tile::cake = nullptr; +RepeaterTile *Tile::diode_off = nullptr; +RepeaterTile *Tile::diode_on = nullptr; +Tile *Tile::stained_glass = nullptr; +Tile *Tile::trapdoor = nullptr; -Tile *Tile::monsterStoneEgg = NULL; -Tile *Tile::stoneBrick = NULL; -Tile *Tile::hugeMushroom_brown = NULL; -Tile *Tile::hugeMushroom_red = NULL; -Tile *Tile::ironFence = NULL; -Tile *Tile::thinGlass = NULL; -Tile *Tile::melon = NULL; -Tile *Tile::pumpkinStem = NULL; -Tile *Tile::melonStem = NULL; -Tile *Tile::vine = NULL; -Tile *Tile::fenceGate = NULL; -Tile *Tile::stairs_bricks = NULL; -Tile *Tile::stairs_stoneBrickSmooth = NULL; +Tile *Tile::monsterStoneEgg = nullptr; +Tile *Tile::stoneBrick = nullptr; +Tile *Tile::hugeMushroom_brown = nullptr; +Tile *Tile::hugeMushroom_red = nullptr; +Tile *Tile::ironFence = nullptr; +Tile *Tile::thinGlass = nullptr; +Tile *Tile::melon = nullptr; +Tile *Tile::pumpkinStem = nullptr; +Tile *Tile::melonStem = nullptr; +Tile *Tile::vine = nullptr; +Tile *Tile::fenceGate = nullptr; +Tile *Tile::stairs_bricks = nullptr; +Tile *Tile::stairs_stoneBrickSmooth = nullptr; -MycelTile *Tile::mycel = NULL; -Tile *Tile::waterLily = NULL; -Tile *Tile::netherBrick = NULL; -Tile *Tile::netherFence = NULL; -Tile *Tile::stairs_netherBricks = NULL; -Tile *Tile::netherStalk = NULL; -Tile *Tile::enchantTable = NULL; -Tile *Tile::brewingStand = NULL; -CauldronTile *Tile::cauldron = NULL; -Tile *Tile::endPortalTile = NULL; -Tile *Tile::endPortalFrameTile = NULL; -Tile *Tile::endStone = NULL; -Tile *Tile::dragonEgg = NULL; -Tile *Tile::redstoneLight = NULL; -Tile *Tile::redstoneLight_lit = NULL; +MycelTile *Tile::mycel = nullptr; +Tile *Tile::waterLily = nullptr; +Tile *Tile::netherBrick = nullptr; +Tile *Tile::netherFence = nullptr; +Tile *Tile::stairs_netherBricks = nullptr; +Tile *Tile::netherStalk = nullptr; +Tile *Tile::enchantTable = nullptr; +Tile *Tile::brewingStand = nullptr; +CauldronTile *Tile::cauldron = nullptr; +Tile *Tile::endPortalTile = nullptr; +Tile *Tile::endPortalFrameTile = nullptr; +Tile *Tile::endStone = nullptr; +Tile *Tile::dragonEgg = nullptr; +Tile *Tile::redstoneLight = nullptr; +Tile *Tile::redstoneLight_lit = nullptr; // TU9 -Tile *Tile::stairs_sandstone = NULL; -Tile *Tile::woodStairsDark = NULL; -Tile *Tile::woodStairsBirch = NULL; -Tile *Tile::woodStairsJungle = NULL; -Tile *Tile::commandBlock = NULL; -BeaconTile *Tile::beacon = NULL; -Tile *Tile::button_wood = NULL; -HalfSlabTile *Tile::woodSlab = NULL; -HalfSlabTile *Tile::woodSlabHalf = NULL; +Tile *Tile::stairs_sandstone = nullptr; +Tile *Tile::woodStairsDark = nullptr; +Tile *Tile::woodStairsBirch = nullptr; +Tile *Tile::woodStairsJungle = nullptr; +Tile *Tile::commandBlock = nullptr; +BeaconTile *Tile::beacon = nullptr; +Tile *Tile::button_wood = nullptr; +HalfSlabTile *Tile::woodSlab = nullptr; +HalfSlabTile *Tile::woodSlabHalf = nullptr; -Tile *Tile::emeraldOre = NULL; -Tile *Tile::enderChest = NULL; -TripWireSourceTile *Tile::tripWireSource = NULL; -Tile *Tile::tripWire = NULL; -Tile *Tile::emeraldBlock = NULL; +Tile *Tile::emeraldOre = nullptr; +Tile *Tile::enderChest = nullptr; +TripWireSourceTile *Tile::tripWireSource = nullptr; +Tile *Tile::tripWire = nullptr; +Tile *Tile::emeraldBlock = nullptr; -Tile *Tile::cocoa = NULL; -Tile *Tile::skull = NULL; +Tile *Tile::cocoa = nullptr; +Tile *Tile::skull = nullptr; -Tile *Tile::cobbleWall = NULL; -Tile *Tile::flowerPot = NULL; -Tile *Tile::carrots = NULL; -Tile *Tile::potatoes = NULL; -Tile *Tile::anvil = NULL; -Tile *Tile::chest_trap = NULL; -Tile *Tile::weightedPlate_light = NULL; -Tile *Tile::weightedPlate_heavy = NULL; -ComparatorTile *Tile::comparator_off = NULL; -ComparatorTile *Tile::comparator_on = NULL; +Tile *Tile::cobbleWall = nullptr; +Tile *Tile::flowerPot = nullptr; +Tile *Tile::carrots = nullptr; +Tile *Tile::potatoes = nullptr; +Tile *Tile::anvil = nullptr; +Tile *Tile::chest_trap = nullptr; +Tile *Tile::weightedPlate_light = nullptr; +Tile *Tile::weightedPlate_heavy = nullptr; +ComparatorTile *Tile::comparator_off = nullptr; +ComparatorTile *Tile::comparator_on = nullptr; -DaylightDetectorTile *Tile::daylightDetector = NULL; -Tile *Tile::redstoneBlock = NULL; +DaylightDetectorTile *Tile::daylightDetector = nullptr; +Tile *Tile::redstoneBlock = nullptr; -Tile *Tile::netherQuartz = NULL; -HopperTile *Tile::hopper = NULL; -Tile *Tile::quartzBlock = NULL; -Tile *Tile::stairs_quartz = NULL; -Tile *Tile::activatorRail = NULL; -Tile *Tile::dropper = NULL; -Tile *Tile::clayHardened_colored = NULL; -Tile *Tile::stained_glass_pane = NULL; +Tile *Tile::netherQuartz = nullptr; +HopperTile *Tile::hopper = nullptr; +Tile *Tile::quartzBlock = nullptr; +Tile *Tile::stairs_quartz = nullptr; +Tile *Tile::activatorRail = nullptr; +Tile *Tile::dropper = nullptr; +Tile *Tile::clayHardened_colored = nullptr; +Tile *Tile::stained_glass_pane = nullptr; -Tile *Tile::hayBlock = NULL; -Tile *Tile::woolCarpet = NULL; -Tile *Tile::clayHardened = NULL; -Tile *Tile::coalBlock = NULL; +Tile *Tile::hayBlock = nullptr; +Tile *Tile::woolCarpet = nullptr; +Tile *Tile::clayHardened = nullptr; +Tile *Tile::coalBlock = nullptr; DWORD Tile::tlsIdxShape = TlsAlloc(); @@ -475,9 +475,9 @@ void Tile::staticCtor() for (int i = 0; i < 256; i++) { - if ( Tile::tiles[i] != NULL ) + if ( Tile::tiles[i] != nullptr ) { - if( Item::items[i] == NULL) + if( Item::items[i] == nullptr) { Item::items[i] = new TileItem(i - 256); Tile::tiles[i]->init(); @@ -485,7 +485,7 @@ void Tile::staticCtor() bool propagate = false; if (i > 0 && Tile::tiles[i]->getRenderShape() == Tile::SHAPE_STAIRS) propagate = true; - if (i > 0 && dynamic_cast(Tile::tiles[i]) != NULL) + if (i > 0 && dynamic_cast(Tile::tiles[i]) != nullptr) { propagate = true; } @@ -549,7 +549,7 @@ Tile::Tile(int id, Material *material, bool isSolidRender) _init(id,material, isSolidRender); m_iMaterial=Item::eMaterial_undefined; m_iBaseItemType=Item::eBaseItemType_undefined; - icon = NULL; + icon = nullptr; } Tile *Tile::sendTileData(unsigned char importantMask/*=15*/) @@ -610,7 +610,7 @@ Tile *Tile::setExplodeable(float explosionResistance) bool Tile::isSolidBlockingTile(int t) { Tile *tile = Tile::tiles[t]; - if (tile == NULL) return false; + if (tile == nullptr) return false; return tile->material->isSolidBlocking() && tile->isCubeShaped() && !tile->isSignalSource(); } @@ -779,13 +779,13 @@ Icon *Tile::getTexture(LevelSource *level, int x, int y, int z, int face) for( int i = 0; (i < 6) && opaque; i++ ) { int t = level->getTile(x + axo[i], y + ayo[i] , z + azo[i]); - if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) ) + if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == nullptr ) || !Tile::tiles[t]->isSolidRender() ) ) { opaque = false; } } - Icon *icon = NULL; + Icon *icon = nullptr; if(opaque) { Tile::leaves->setFancy(false); @@ -822,7 +822,7 @@ AABB *Tile::getTileAABB(Level *level, int x, int y, int z) void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) { AABB *aabb = getAABB(level, x, y, z); - if (aabb != NULL && box->intersects(aabb)) boxes->push_back(aabb); + if (aabb != nullptr && box->intersects(aabb)) boxes->push_back(aabb); } AABB *Tile::getAABB(Level *level, int x, int y, int z) @@ -975,16 +975,16 @@ HitResult *Tile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) Vec3 *zh0 = a->clipZ(b, tls->zz0); Vec3 *zh1 = a->clipZ(b, tls->zz1); - Vec3 *closest = NULL; + Vec3 *closest = nullptr; - if (containsX(xh0) && (closest == NULL || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0; - if (containsX(xh1) && (closest == NULL || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1; - if (containsY(yh0) && (closest == NULL || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0; - if (containsY(yh1) && (closest == NULL || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1; - if (containsZ(zh0) && (closest == NULL || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0; - if (containsZ(zh1) && (closest == NULL || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1; + if (containsX(xh0) && (closest == nullptr || a->distanceToSqr(xh0) < a->distanceToSqr(closest))) closest = xh0; + if (containsX(xh1) && (closest == nullptr || a->distanceToSqr(xh1) < a->distanceToSqr(closest))) closest = xh1; + if (containsY(yh0) && (closest == nullptr || a->distanceToSqr(yh0) < a->distanceToSqr(closest))) closest = yh0; + if (containsY(yh1) && (closest == nullptr || a->distanceToSqr(yh1) < a->distanceToSqr(closest))) closest = yh1; + if (containsZ(zh0) && (closest == nullptr || a->distanceToSqr(zh0) < a->distanceToSqr(closest))) closest = zh0; + if (containsZ(zh1) && (closest == nullptr || a->distanceToSqr(zh1) < a->distanceToSqr(closest))) closest = zh1; - if (closest == NULL) return NULL; + if (closest == nullptr) return nullptr; int face = -1; @@ -1000,7 +1000,7 @@ HitResult *Tile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) bool Tile::containsX(Vec3 *v) { - if( v == NULL) return false; + if( v == nullptr) return false; ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile @@ -1010,7 +1010,7 @@ bool Tile::containsX(Vec3 *v) bool Tile::containsY(Vec3 *v) { - if( v == NULL) return false; + if( v == nullptr) return false; ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile @@ -1020,7 +1020,7 @@ bool Tile::containsY(Vec3 *v) bool Tile::containsZ(Vec3 *v) { - if( v == NULL) return false; + if( v == nullptr) return false; ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); // 4J Stu - Added this so that the TLS shape is correct for this tile @@ -1194,7 +1194,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, // 4J Stu - Special case - only record a crop destroy if is fully grown if( id==Tile::wheat_Id ) { - if( Tile::wheat->getResource(data, NULL, 0) > 0 ) + if( Tile::wheat->getResource(data, nullptr, 0) > 0 ) player->awardStat( GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) @@ -1202,7 +1202,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, } else if (id == Tile::potatoes_Id) { - if (Tile::potatoes->getResource(data, NULL, 0) > 0) + if (Tile::potatoes->getResource(data, nullptr, 0) > 0) player->awardStat( GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) @@ -1210,7 +1210,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, } else if (id == Tile::carrots_Id) { - if (Tile::potatoes->getResource(data, NULL, 0) > 0) + if (Tile::potatoes->getResource(data, nullptr, 0) > 0) player->awardStat( GenericStats::blocksMined(id), GenericStats::param_blocksMined(id,data,1) @@ -1233,7 +1233,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, if (isSilkTouchable() && EnchantmentHelper::hasSilkTouch(player)) { shared_ptr item = getSilkTouchItemInstance(data); - if (item != NULL) + if (item != nullptr) { popResource(level, x, y, z, item); } @@ -1388,7 +1388,7 @@ bool Tile::isMatching(int tileIdA, int tileIdB) { return true; } - if (tileIdA == 0 || tileIdB == 0 || tiles[tileIdA] == NULL || tiles[tileIdB] == NULL) + if (tileIdA == 0 || tileIdB == 0 || tiles[tileIdA] == nullptr || tiles[tileIdB] == nullptr) { return false; } diff --git a/Minecraft.World/TileEntity.cpp b/Minecraft.World/TileEntity.cpp index 1eb9cab2d..1fff44bb3 100644 --- a/Minecraft.World/TileEntity.cpp +++ b/Minecraft.World/TileEntity.cpp @@ -46,11 +46,11 @@ void TileEntity::setId(tileEntityCreateFn createFn, eINSTANCEOF clas, wstring id TileEntity::TileEntity() { - level = NULL; + level = nullptr; x = y = z = 0; remove = false; data = -1; - tile = NULL; + tile = nullptr; renderRemoveStage = e_RenderRemoveStageKeep; } @@ -66,7 +66,7 @@ void TileEntity::setLevel(Level *level) bool TileEntity::hasLevel() { - return level != NULL; + return level != nullptr; } void TileEntity::load(CompoundTag *tag) @@ -101,7 +101,7 @@ shared_ptr TileEntity::loadStatic(CompoundTag *tag) auto it = idCreateMap.find(tag->getString(L"id")); if (it != idCreateMap.end()) entity = shared_ptr(it->second()); - if (entity != NULL) + if (entity != nullptr) { entity->load(tag); } @@ -129,11 +129,11 @@ void TileEntity::setData(int data, int updateFlags) void TileEntity::setChanged() { - if (level != NULL) + if (level != nullptr) { data = level->getData(x, y, z); level->tileEntityChanged(x, y, z, shared_from_this()); - if (getTile() != NULL) level->updateNeighbourForOutputSignal(x, y, z, getTile()->id); + if (getTile() != nullptr) level->updateNeighbourForOutputSignal(x, y, z, getTile()->id); } } @@ -152,7 +152,7 @@ double TileEntity::getViewDistance() Tile *TileEntity::getTile() { - if( tile == NULL ) tile = Tile::tiles[level->getTile(x, y, z)]; + if( tile == nullptr ) tile = Tile::tiles[level->getTile(x, y, z)]; return tile; } @@ -183,7 +183,7 @@ bool TileEntity::triggerEvent(int b0, int b1) void TileEntity::clearCache() { - tile = NULL; + tile = nullptr; data = -1; } diff --git a/Minecraft.World/TileEntityDataPacket.cpp b/Minecraft.World/TileEntityDataPacket.cpp index 10d64bb0a..a30f7873a 100644 --- a/Minecraft.World/TileEntityDataPacket.cpp +++ b/Minecraft.World/TileEntityDataPacket.cpp @@ -10,7 +10,7 @@ void TileEntityDataPacket::_init() { x = y = z = 0; type = TYPE_MOB_SPAWNER; - tag = NULL; + tag = nullptr; } diff --git a/Minecraft.World/TileItem.cpp b/Minecraft.World/TileItem.cpp index ce313dd6c..8d22594db 100644 --- a/Minecraft.World/TileItem.cpp +++ b/Minecraft.World/TileItem.cpp @@ -20,7 +20,7 @@ using namespace std; TileItem::TileItem(int id) : Item(id) { this->tileId = id + 256; - itemIcon = NULL; + itemIcon = nullptr; } int TileItem::getTileId() @@ -39,7 +39,7 @@ int TileItem::getIconType() Icon *TileItem::getIcon(int auxValue) { - if (itemIcon != NULL) + if (itemIcon != nullptr) { return itemIcon; } @@ -128,7 +128,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe // // if(iPlaceSound==-1) // { - // strcpy(szPlaceSoundName,"NULL"); + // strcpy(szPlaceSoundName,"nullptr"); // } // else // { @@ -136,7 +136,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe // } // if(iStepSound==-1) // { - // strcpy(szStepSoundName,"NULL"); + // strcpy(szStepSoundName,"nullptr"); // } // else // { diff --git a/Minecraft.World/TntTile.cpp b/Minecraft.World/TntTile.cpp index 430755fc9..1b16a3752 100644 --- a/Minecraft.World/TntTile.cpp +++ b/Minecraft.World/TntTile.cpp @@ -12,8 +12,8 @@ TntTile::TntTile(int id) : Tile(id, Material::explosive) { - iconTop = NULL; - iconBottom = NULL; + iconTop = nullptr; + iconBottom = nullptr; } Icon *TntTile::getTexture(int face, int data) @@ -87,7 +87,7 @@ void TntTile::destroy(Level *level, int x, int y, int z, int data, shared_ptr
  • player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param { if (soundOnly) return false; - if (player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::flintAndSteel_Id) + if (player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::flintAndSteel_Id) { destroy(level, x, y, z, EXPLODE_BIT, player); level->removeTile(x, y, z); diff --git a/Minecraft.World/TorchTile.cpp b/Minecraft.World/TorchTile.cpp index cc3775743..129a3b13b 100644 --- a/Minecraft.World/TorchTile.cpp +++ b/Minecraft.World/TorchTile.cpp @@ -11,7 +11,7 @@ TorchTile::TorchTile(int id) : Tile(id, Material::decoration,isSolidRender()) AABB *TorchTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } AABB *TorchTile::getTileAABB(Level *level, int x, int y, int z) diff --git a/Minecraft.World/TradeWithPlayerGoal.cpp b/Minecraft.World/TradeWithPlayerGoal.cpp index e8b791d13..155525bc4 100644 --- a/Minecraft.World/TradeWithPlayerGoal.cpp +++ b/Minecraft.World/TradeWithPlayerGoal.cpp @@ -19,7 +19,7 @@ bool TradeWithPlayerGoal::canUse() if (mob->hurtMarked) return false; shared_ptr trader = mob->getTradingPlayer(); - if (trader == NULL) + if (trader == nullptr) { // no interaction return false; diff --git a/Minecraft.World/TrapDoorTile.cpp b/Minecraft.World/TrapDoorTile.cpp index 9b668e3fb..6ea64172e 100644 --- a/Minecraft.World/TrapDoorTile.cpp +++ b/Minecraft.World/TrapDoorTile.cpp @@ -212,5 +212,5 @@ bool TrapDoorTile::attachesTo(int id) } Tile *tile = Tile::tiles[id]; - return tile != NULL && (tile->material->isSolidBlocking() && tile->isCubeShaped()) || tile == Tile::glowstone || (dynamic_cast(tile) != NULL) || (dynamic_cast(tile) != NULL); + return tile != nullptr && (tile->material->isSolidBlocking() && tile->isCubeShaped()) || tile == Tile::glowstone || (dynamic_cast(tile) != nullptr) || (dynamic_cast(tile) != nullptr); } \ No newline at end of file diff --git a/Minecraft.World/TrapMenu.cpp b/Minecraft.World/TrapMenu.cpp index 657578398..a89069c7c 100644 --- a/Minecraft.World/TrapMenu.cpp +++ b/Minecraft.World/TrapMenu.cpp @@ -40,7 +40,7 @@ shared_ptr TrapMenu::quickMoveStack(shared_ptr player, int { shared_ptr clicked = nullptr; Slot *slot = slots.at(slotIndex); - if (slot != NULL && slot->hasItem()) + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); diff --git a/Minecraft.World/TreeFeature.cpp b/Minecraft.World/TreeFeature.cpp index f27258af4..2bfec1479 100644 --- a/Minecraft.World/TreeFeature.cpp +++ b/Minecraft.World/TreeFeature.cpp @@ -19,7 +19,7 @@ bool TreeFeature::place(Level *level, Random *random, int x, int y, int z) if (y < 1 || y + treeHeight + 1 > Level::maxBuildHeight) return false; // 4J Stu Added to stop tree features generating areas previously place by game rule generation - if(app.getLevelGenerationOptions() != NULL) + if(app.getLevelGenerationOptions() != nullptr) { PIXBeginNamedEvent(0,"TreeFeature checking intersects"); LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); diff --git a/Minecraft.World/TripWireSourceTile.cpp b/Minecraft.World/TripWireSourceTile.cpp index c92713341..fcd7564d3 100644 --- a/Minecraft.World/TripWireSourceTile.cpp +++ b/Minecraft.World/TripWireSourceTile.cpp @@ -12,7 +12,7 @@ TripWireSourceTile::TripWireSourceTile(int id) : Tile(id, Material::decoration, AABB *TripWireSourceTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool TripWireSourceTile::blocksLight() diff --git a/Minecraft.World/TripWireTile.cpp b/Minecraft.World/TripWireTile.cpp index fb3fe150c..ee302af26 100644 --- a/Minecraft.World/TripWireTile.cpp +++ b/Minecraft.World/TripWireTile.cpp @@ -20,7 +20,7 @@ int TripWireTile::getTickDelay(Level *level) AABB *TripWireTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool TripWireTile::blocksLight() @@ -106,7 +106,7 @@ void TripWireTile::playerWillDestroy(Level *level, int x, int y, int z, int data { if (level->isClientSide) return; - if (player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears_Id) + if (player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears_Id) { level->setData(x, y, z, data | MASK_DISARMED, Tile::UPDATE_NONE); } diff --git a/Minecraft.World/Vec3.cpp b/Minecraft.World/Vec3.cpp index 69a332ccf..b513c1499 100644 --- a/Minecraft.World/Vec3.cpp +++ b/Minecraft.World/Vec3.cpp @@ -3,7 +3,7 @@ #include "AABB.h" DWORD Vec3::tlsIdx = 0; -Vec3::ThreadStorage *Vec3::tlsDefault = NULL; +Vec3::ThreadStorage *Vec3::tlsDefault = nullptr; Vec3::ThreadStorage::ThreadStorage() { @@ -19,7 +19,7 @@ Vec3::ThreadStorage::~ThreadStorage() void Vec3::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == NULL ) + if(tlsDefault == nullptr ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -157,10 +157,10 @@ Vec3 *Vec3::clipX(Vec3 *b, double xt) double yd = b->y - y; double zd = b->z - z; - if (xd * xd < 0.0000001f) return NULL; + if (xd * xd < 0.0000001f) return nullptr; double d = (xt - x) / xd; - if (d < 0 || d > 1) return NULL; + if (d < 0 || d > 1) return nullptr; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } @@ -170,10 +170,10 @@ Vec3 *Vec3::clipY(Vec3 *b, double yt) double yd = b->y - y; double zd = b->z - z; - if (yd * yd < 0.0000001f) return NULL; + if (yd * yd < 0.0000001f) return nullptr; double d = (yt - y) / yd; - if (d < 0 || d > 1) return NULL; + if (d < 0 || d > 1) return nullptr; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } @@ -183,10 +183,10 @@ Vec3 *Vec3::clipZ(Vec3 *b, double zt) double yd = b->y - y; double zd = b->z - z; - if (zd * zd < 0.0000001f) return NULL; + if (zd * zd < 0.0000001f) return nullptr; double d = (zt - z) / zd; - if (d < 0 || d > 1) return NULL; + if (d < 0 || d > 1) return nullptr; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } diff --git a/Minecraft.World/Village.cpp b/Minecraft.World/Village.cpp index a72319fe9..705815b95 100644 --- a/Minecraft.World/Village.cpp +++ b/Minecraft.World/Village.cpp @@ -25,7 +25,7 @@ Village::Village() golemCount = 0; noBreedTimer = 0; - level = NULL; + level = nullptr; } Village::Village(Level *level) @@ -69,7 +69,7 @@ void Village::tick(int tick) if (golemCount < idealGolemCount && doorInfos.size() > 20 && level->random->nextInt(7000) == 0) { Vec3 *spawnPos = findRandomSpawnPos(center->x, center->y, center->z, 2, 4, 2); - if (spawnPos != NULL) + if (spawnPos != nullptr) { shared_ptr vg = shared_ptr( new VillagerGolem(level) ); vg->setPos(spawnPos->x, spawnPos->y, spawnPos->z); @@ -103,7 +103,7 @@ Vec3 *Village::findRandomSpawnPos(int x, int y, int z, int sx, int sy, int sz) if (!isInside(xx, yy, zz)) continue; if (canSpawnAt(xx, yy, zz, sx, sy, sz)) return Vec3::newTemp(xx, yy, zz); } - return NULL; + return nullptr; } bool Village::canSpawnAt(int x, int y, int z, int sx, int sy, int sz) @@ -215,7 +215,7 @@ shared_ptrVillage::getBestDoorInfo(int x, int y, int z) bool Village::hasDoorInfo(int x, int y, int z) { - return getDoorInfo(x, y, z) != NULL; + return getDoorInfo(x, y, z) != nullptr; } shared_ptr Village::getDoorInfo(int x, int y, int z) @@ -260,7 +260,7 @@ void Village::addAggressor(shared_ptr mob) shared_ptr Village::getClosestAggressor(shared_ptr from) { double closestSqr = Double::MAX_VALUE; - Aggressor *closest = NULL; + Aggressor *closest = nullptr; for(auto& a : aggressors) { double distSqr = a->mob->distanceToSqr(from); @@ -268,7 +268,7 @@ shared_ptr Village::getClosestAggressor(shared_ptr f closest = a; closestSqr = distSqr; } - return closest != NULL ? closest->mob : nullptr; + return closest != nullptr ? closest->mob : nullptr; } shared_ptr Village::getClosestBadStandingPlayer(shared_ptr from) @@ -282,7 +282,7 @@ shared_ptr Village::getClosestBadStandingPlayer(shared_ptr if (isVeryBadStanding(player)) { shared_ptr mob = level->getPlayerByName(player); - if (mob != NULL) + if (mob != nullptr) { double distSqr = mob->distanceToSqr(from); if (distSqr > closestSqr) continue; diff --git a/Minecraft.World/VillageFeature.cpp b/Minecraft.World/VillageFeature.cpp index e1ad19270..bde8a66c2 100644 --- a/Minecraft.World/VillageFeature.cpp +++ b/Minecraft.World/VillageFeature.cpp @@ -82,7 +82,7 @@ bool VillageFeature::isFeatureChunk(int x, int z,bool bIsSuperflat) bool forcePlacement = false; LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); - if( levelGenOptions != NULL ) + if( levelGenOptions != nullptr ) { forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Village); } diff --git a/Minecraft.World/VillagePieces.cpp b/Minecraft.World/VillagePieces.cpp index cee09e800..fbdf05a7e 100644 --- a/Minecraft.World/VillagePieces.cpp +++ b/Minecraft.World/VillagePieces.cpp @@ -101,7 +101,7 @@ int VillagePieces::updatePieceWeight(list *currentPieces) VillagePieces::VillagePiece *VillagePieces::findAndCreatePieceFactory(StartPiece *startPiece, VillagePieces::PieceWeight *piece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { VillagePieces::EPieceClass pieceClass = piece->pieceClass; - VillagePiece *villagePiece = NULL; + VillagePiece *villagePiece = nullptr; if (pieceClass == VillagePieces::EPieceClass_SimpleHouse) { @@ -148,7 +148,7 @@ VillagePieces::VillagePiece *VillagePieces::generatePieceFromSmallDoor(StartPiec int totalWeight = updatePieceWeight(startPiece->pieceSet); if (totalWeight <= 0) { - return NULL; + return nullptr; } int numAttempts = 0; @@ -168,7 +168,7 @@ VillagePieces::VillagePiece *VillagePieces::generatePieceFromSmallDoor(StartPiec } VillagePiece *villagePiece = findAndCreatePieceFactory(startPiece, piece, pieces, random, footX, footY, footZ, direction, depth); - if (villagePiece != NULL) + if (villagePiece != nullptr) { piece->placeCount++; startPiece->previousPiece = piece; @@ -186,29 +186,29 @@ VillagePieces::VillagePiece *VillagePieces::generatePieceFromSmallDoor(StartPiec // attempt to place a light post instead { BoundingBox *box = LightPost::findPieceBox(startPiece, pieces, random, footX, footY, footZ, direction); - if (box != NULL) + if (box != nullptr) { return new LightPost(startPiece, depth, random, box, direction); } delete box; } - return NULL; + return nullptr; } StructurePiece *VillagePieces::generateAndAddPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { if (depth > MAX_DEPTH) { - return NULL; + return nullptr; } if (abs(footX - startPiece->getBoundingBox()->x0) > 7 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 7 * 16) { - return NULL; + return nullptr; } StructurePiece *newPiece = generatePieceFromSmallDoor(startPiece, pieces, random, footX, footY, footZ, direction, depth + 1); - if (newPiece != NULL) + if (newPiece != nullptr) { int x = (newPiece->boundingBox->x0 + newPiece->boundingBox->x1) / 2; int z = (newPiece->boundingBox->z0 + newPiece->boundingBox->z1) / 2; @@ -223,22 +223,22 @@ StructurePiece *VillagePieces::generateAndAddPiece(StartPiece *startPiece, list< } delete newPiece; } - return NULL; + return nullptr; } StructurePiece *VillagePieces::generateAndAddRoadPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int depth) { if (depth > BASE_ROAD_DEPTH + startPiece->villageSize) { - return NULL; + return nullptr; } if (abs(footX - startPiece->getBoundingBox()->x0) > 7 * 16 || abs(footZ - startPiece->getBoundingBox()->z0) > 7 * 16) { - return NULL; + return nullptr; } BoundingBox *box = StraightRoad::findPieceBox(startPiece, pieces, random, footX, footY, footZ, direction); - if (box != NULL && box->y0 > LOWEST_Y_POSITION) + if (box != nullptr && box->y0 > LOWEST_Y_POSITION) { StructurePiece *newPiece = new StraightRoad(startPiece, depth, random, box, direction); int x = (newPiece->boundingBox->x0 + newPiece->boundingBox->x1) / 2; @@ -255,12 +255,12 @@ StructurePiece *VillagePieces::generateAndAddRoadPiece(StartPiece *startPiece, l // 4J Stu - The dtor for newPiece will destroy box delete newPiece; } - else if(box != NULL) + else if(box != nullptr) { delete box; } - return NULL; + return nullptr; } VillagePieces::VillagePiece::VillagePiece() @@ -268,7 +268,7 @@ VillagePieces::VillagePiece::VillagePiece() heightPosition = -1; spawnedVillagerCount = 0; isDesertVillage = false; - startPiece = NULL; + startPiece = nullptr; // for reflection } @@ -278,7 +278,7 @@ VillagePieces::VillagePiece::VillagePiece(StartPiece *startPiece, int genDepth) isDesertVillage = false; spawnedVillagerCount = 0; this->startPiece = startPiece; - if (startPiece != NULL) + if (startPiece != nullptr) { this->isDesertVillage = startPiece->isDesertVillage; } @@ -311,7 +311,7 @@ StructurePiece *VillagePieces::VillagePiece::generateHouseNorthernLeft(StartPiec case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z0 - 1, Direction::NORTH, getGenDepth()); } - return NULL; + return nullptr; } StructurePiece *VillagePieces::VillagePiece::generateHouseNorthernRight(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff) @@ -327,7 +327,7 @@ StructurePiece *VillagePieces::VillagePiece::generateHouseNorthernRight(StartPie case Direction::EAST: return generateAndAddPiece(startPiece, pieces, random, boundingBox->x0 + zOff, boundingBox->y0 + yOff, boundingBox->z1 + 1, Direction::SOUTH, getGenDepth()); } - return NULL; + return nullptr; } int VillagePieces::VillagePiece::getAverageGroundHeight(Level *level, BoundingBox *chunkBB) @@ -357,7 +357,7 @@ bool VillagePieces::VillagePiece::isOkBox(BoundingBox *box, StartPiece *startRoo { bool bIsOk = false; - if(box != NULL) + if(box != nullptr) { if( box->y0 > LOWEST_Y_POSITION ) bIsOk = true; @@ -569,10 +569,10 @@ VillagePieces::StartPiece::StartPiece() // for reflection } -VillagePieces::StartPiece::StartPiece(BiomeSource *biomeSource, int genDepth, Random *random, int west, int north, list *pieceSet, int villageSize, Level *level) : Well(NULL, 0, random, west, north) +VillagePieces::StartPiece::StartPiece(BiomeSource *biomeSource, int genDepth, Random *random, int west, int north, list *pieceSet, int villageSize, Level *level) : Well(nullptr, 0, random, west, north) { isLibraryAdded = false; // 4J - added initialiser - previousPiece = NULL; // 4J - added initialiser + previousPiece = nullptr; // 4J - added initialiser this->biomeSource = biomeSource; this->pieceSet = pieceSet; this->villageSize = villageSize; @@ -629,7 +629,7 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, list(startPiece), pieces, random, 0, depth); - if (piece != NULL) + if (piece != nullptr) { depth += Math::_max(piece->boundingBox->getXSpan(), piece->boundingBox->getZSpan()); hasHouses = true; @@ -642,7 +642,7 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, list(startPiece), pieces, random, 0, depth); - if (piece != NULL) + if (piece != nullptr) { depth += Math::_max(piece->boundingBox->getXSpan(), piece->boundingBox->getZSpan()); hasHouses = true; @@ -696,7 +696,7 @@ BoundingBox *VillagePieces::StraightRoad::findPieceBox(StartPiece *startPiece, l { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, 3, length, direction); - if (isOkBox(box, startPiece) && StructurePiece::findCollisionPiece(pieces, box) == NULL) + if (isOkBox(box, startPiece) && StructurePiece::findCollisionPiece(pieces, box) == nullptr) { return box; } @@ -704,7 +704,7 @@ BoundingBox *VillagePieces::StraightRoad::findPieceBox(StartPiece *startPiece, l length -= 7; } - return NULL; + return nullptr; } bool VillagePieces::StraightRoad::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -753,10 +753,10 @@ VillagePieces::SimpleHouse *VillagePieces::SimpleHouse::createPiece(StartPiece * { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new SimpleHouse(startPiece, genDepth, random, box, direction); @@ -880,10 +880,10 @@ VillagePieces::SmallTemple *VillagePieces::SmallTemple::createPiece(StartPiece * { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new SmallTemple(startPiece, genDepth, random, box, direction); @@ -1022,10 +1022,10 @@ VillagePieces::BookHouse *VillagePieces::BookHouse::createPiece(StartPiece *star { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new BookHouse(startPiece, genDepth, random, box, direction); @@ -1178,10 +1178,10 @@ VillagePieces::SmallHut *VillagePieces::SmallHut::createPiece(StartPiece *startP { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new SmallHut(startPiece, genDepth, random, box, direction); @@ -1284,10 +1284,10 @@ VillagePieces::PigHouse *VillagePieces::PigHouse::createPiece(StartPiece *startP BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new PigHouse(startPiece, genDepth, random, box, direction); @@ -1429,10 +1429,10 @@ VillagePieces::TwoRoomHouse *VillagePieces::TwoRoomHouse::createPiece(StartPiece { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new TwoRoomHouse(startPiece, genDepth, random, box, direction); @@ -1619,10 +1619,10 @@ VillagePieces::Smithy *VillagePieces::Smithy::createPiece(StartPiece *startPiece { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new Smithy(startPiece, genDepth, random, box, direction); @@ -1790,10 +1790,10 @@ VillagePieces::Farmland *VillagePieces::Farmland::createPiece(StartPiece *startP { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new Farmland(startPiece, genDepth, random, box, direction); @@ -1902,10 +1902,10 @@ VillagePieces::DoubleFarmland *VillagePieces::DoubleFarmland::createPiece(StartP { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return new DoubleFarmland(startPiece, genDepth, random, box, direction); @@ -1983,10 +1983,10 @@ BoundingBox *VillagePieces::LightPost::findPieceBox(StartPiece *startPiece, list { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); - if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != NULL) + if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { delete box; - return NULL; + return nullptr; } return box; diff --git a/Minecraft.World/VillageSiege.cpp b/Minecraft.World/VillageSiege.cpp index 0ce8a4e12..525b0b36d 100644 --- a/Minecraft.World/VillageSiege.cpp +++ b/Minecraft.World/VillageSiege.cpp @@ -83,7 +83,7 @@ bool VillageSiege::tryToSetupSiege() shared_ptr _village = level->villages->getClosestVillage(static_cast(player->x), static_cast(player->y), static_cast(player->z), 1); village = _village; - if (_village == NULL) continue; + if (_village == nullptr) continue; if (_village->getDoorCount() < 10) continue; if (_village->getStableAge() < 20) continue; if (_village->getPopulationSize() < 20) continue; @@ -115,7 +115,7 @@ bool VillageSiege::tryToSetupSiege() if (overlaps) return false; Vec3 *spawnPos = findRandomSpawnPos(spawnX, spawnY, spawnZ); - if (spawnPos == NULL) continue; + if (spawnPos == nullptr) continue; nextSpawnTime = 0; siegeCount = 20; @@ -127,17 +127,17 @@ bool VillageSiege::tryToSetupSiege() bool VillageSiege::trySpawn() { Vec3 *spawnPos = findRandomSpawnPos(spawnX, spawnY, spawnZ); - if (spawnPos == NULL) return false; + if (spawnPos == nullptr) return false; shared_ptr mob; { mob = shared_ptr( new Zombie(level) ); - mob->finalizeMobSpawn(NULL); + mob->finalizeMobSpawn(nullptr); mob->setVillager(false); } mob->moveTo(spawnPos->x, spawnPos->y, spawnPos->z, level->random->nextFloat() * 360, 0); level->addEntity(mob); shared_ptr _village = village.lock(); - if( _village == NULL ) return false; + if( _village == nullptr ) return false; Pos *center = _village->getCenter(); mob->restrictTo(center->x, center->y, center->z, _village->getRadius()); @@ -147,7 +147,7 @@ bool VillageSiege::trySpawn() Vec3 *VillageSiege::findRandomSpawnPos(int x, int y, int z) { shared_ptr _village = village.lock(); - if( _village == NULL ) return NULL; + if( _village == nullptr ) return nullptr; for (int i = 0; i < 10; ++i) { @@ -157,5 +157,5 @@ Vec3 *VillageSiege::findRandomSpawnPos(int x, int y, int z) if (!_village->isInside(xx, yy, zz)) continue; if (MobSpawner::isSpawnPositionOk(MobCategory::monster, level, xx, yy, zz)) return Vec3::newTemp(xx, yy, zz); } - return NULL; + return nullptr; } \ No newline at end of file diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index 94ec5a529..26f5e5740 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -38,7 +38,7 @@ void Villager::_init(int profession) village = weak_ptr(); tradingPlayer = weak_ptr(); - offers = NULL; + offers = nullptr; updateMerchantTimer = 0; addRecipeOnUpdate = false; riches = 0; @@ -102,7 +102,7 @@ void Villager::serverAiMobStep() shared_ptr _village = level->villages->getClosestVillage(Mth::floor(x), Mth::floor(y), Mth::floor(z), Villages::MaxDoorDist); village = _village; - if (_village == NULL) clearRestriction(); + if (_village == nullptr) clearRestriction(); else { Pos *center = _village->getCenter(); @@ -137,7 +137,7 @@ void Villager::serverAiMobStep() addOffers(1); addRecipeOnUpdate = false; - if (village.lock() != NULL && !lastPlayerTradeName.empty()) + if (village.lock() != nullptr && !lastPlayerTradeName.empty()) { level->broadcastEntityEvent(shared_from_this(), EntityEvent::VILLAGER_HAPPY); village.lock()->modifyStanding(lastPlayerTradeName, 1); @@ -154,7 +154,7 @@ bool Villager::mobInteract(shared_ptr player) { // [EB]: Truly dislike this code but I don't see another easy way shared_ptr item = player->inventory->getSelected(); - bool holdingSpawnEgg = item != NULL && item->id == Item::spawnEgg_Id; + bool holdingSpawnEgg = item != nullptr && item->id == Item::spawnEgg_Id; if (!holdingSpawnEgg && isAlive() && !isTrading() && !isBaby()) { @@ -182,7 +182,7 @@ void Villager::addAdditonalSaveData(CompoundTag *tag) AgableMob::addAdditonalSaveData(tag); tag->putInt(L"Profession", getProfession()); tag->putInt(L"Riches", riches); - if (offers != NULL) + if (offers != nullptr) { tag->putCompound(L"Offers", offers->createTag()); } @@ -259,7 +259,7 @@ void Villager::setLastHurtByMob(shared_ptr mob) { AgableMob::setLastHurtByMob(mob); shared_ptr _village = village.lock(); - if (_village != NULL && mob != NULL) + if (_village != nullptr && mob != nullptr) { _village->addAggressor(mob); @@ -282,10 +282,10 @@ void Villager::setLastHurtByMob(shared_ptr mob) void Villager::die(DamageSource *source) { shared_ptr _village = village.lock(); - if (_village != NULL) + if (_village != nullptr) { shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != NULL) + if (sourceEntity != nullptr) { if ( sourceEntity->instanceof(eTYPE_PLAYER) ) { @@ -296,12 +296,12 @@ void Villager::die(DamageSource *source) _village->resetNoBreedTimer(); } } - else if (sourceEntity == NULL) + else if (sourceEntity == nullptr) { // if the villager was killed by the world (such as lava or falling), blame // the nearest player by not reproducing for a while shared_ptr nearestPlayer = level->getNearestPlayer(shared_from_this(), 16.0f); - if (nearestPlayer != NULL) + if (nearestPlayer != nullptr) { _village->resetNoBreedTimer(); } @@ -335,7 +335,7 @@ shared_ptr Villager::getTradingPlayer() bool Villager::isTrading() { - return tradingPlayer.lock() != NULL; + return tradingPlayer.lock() != nullptr; } void Villager::notifyTrade(MerchantRecipe *activeRecipe) @@ -349,7 +349,7 @@ void Villager::notifyTrade(MerchantRecipe *activeRecipe) { updateMerchantTimer = SharedConstants::TICKS_PER_SECOND * 2; addRecipeOnUpdate = true; - if (tradingPlayer.lock() != NULL) + if (tradingPlayer.lock() != nullptr) { lastPlayerTradeName = tradingPlayer.lock()->getName(); } @@ -370,7 +370,7 @@ void Villager::notifyTradeUpdated(shared_ptr item) if (!level->isClientSide && (ambientSoundTime > (-getAmbientSoundInterval() + SharedConstants::TICKS_PER_SECOND))) { ambientSoundTime = -getAmbientSoundInterval(); - if (item != NULL) + if (item != nullptr) { playSound(eSoundType_MOB_VILLAGER_YES, getSoundVolume(), getVoicePitch()); } @@ -383,7 +383,7 @@ void Villager::notifyTradeUpdated(shared_ptr item) MerchantRecipeList *Villager::getOffers(shared_ptr forPlayer) { - if (offers == NULL) + if (offers == nullptr) { addOffers(1); } @@ -515,7 +515,7 @@ void Villager::addOffers(int addCount) // shuffle the list to make it more interesting std::random_shuffle(newOffers->begin(), newOffers->end()); - if (offers == NULL) + if (offers == nullptr) { offers = new MerchantRecipeList(); } @@ -736,7 +736,7 @@ shared_ptr Villager::getBreedOffspring(shared_ptr target) if(level->canCreateMore(GetType(), Level::eSpawnType_Breed) ) { shared_ptr villager = shared_ptr(new Villager(level)); - villager->finalizeMobSpawn(NULL); + villager->finalizeMobSpawn(nullptr); return villager; } else diff --git a/Minecraft.World/VillagerGolem.cpp b/Minecraft.World/VillagerGolem.cpp index 691bade8e..09508bfc4 100644 --- a/Minecraft.World/VillagerGolem.cpp +++ b/Minecraft.World/VillagerGolem.cpp @@ -68,7 +68,7 @@ void VillagerGolem::serverAiMobStep() villageUpdateInterval = 70 + random->nextInt(50); shared_ptr _village = level->villages->getClosestVillage(Mth::floor(x), Mth::floor(y), Mth::floor(z), Villages::MaxDoorDist); village = _village; - if (_village == NULL) clearRestriction(); + if (_village == nullptr) clearRestriction(); else { Pos *center = _village->getCenter(); @@ -244,7 +244,7 @@ void VillagerGolem::setPlayerCreated(bool value) void VillagerGolem::die(DamageSource *source) { - if (!isPlayerCreated() && lastHurtByPlayer != NULL && village.lock() != NULL) + if (!isPlayerCreated() && lastHurtByPlayer != nullptr && village.lock() != nullptr) { village.lock()->modifyStanding(lastHurtByPlayer->getName(), -5); } @@ -257,7 +257,7 @@ bool VillagerGolem::hurt(DamageSource *source, float dmg) if (isPlayerCreated()) { shared_ptr entity = source->getDirectEntity(); - if (entity != NULL && entity->instanceof(eTYPE_PLAYER)) + if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { shared_ptr player = dynamic_pointer_cast(entity); if (!player->isAllowedToAttackPlayers()) return false; diff --git a/Minecraft.World/Villages.cpp b/Minecraft.World/Villages.cpp index b5fb1b471..d73d568d5 100644 --- a/Minecraft.World/Villages.cpp +++ b/Minecraft.World/Villages.cpp @@ -11,7 +11,7 @@ const wstring Villages::VILLAGE_FILE_ID = L"villages"; Villages::Villages(const wstring &id) : SavedData(id) { _tick = 0; - level = NULL; + level = nullptr; } Villages::Villages(Level *level) : SavedData(VILLAGE_FILE_ID) @@ -147,7 +147,7 @@ void Villages::addDoorInfos(Pos *pos) if (isDoor(xx, yy, zz)) { shared_ptr currentDoor = getDoorInfo(xx, yy, zz); - if (currentDoor == NULL) createDoorInfo(xx, yy, zz); + if (currentDoor == nullptr) createDoorInfo(xx, yy, zz); else currentDoor->timeStamp = _tick; } } diff --git a/Minecraft.World/VineTile.cpp b/Minecraft.World/VineTile.cpp index 25600cbd7..2403c69aa 100644 --- a/Minecraft.World/VineTile.cpp +++ b/Minecraft.World/VineTile.cpp @@ -102,7 +102,7 @@ void VineTile::updateShape(LevelSource *level, int x, int y, int z, int forceDat AABB *VineTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } bool VineTile::mayPlace(Level *level, int x, int y, int z, int face) @@ -259,7 +259,7 @@ testLoop: if(noSideSpread) break; int edgeTile = level->getTile(x + Direction::STEP_X[testDirection], y, z + Direction::STEP_Z[testDirection]); - if (edgeTile == 0 || Tile::tiles[edgeTile] == NULL) + if (edgeTile == 0 || Tile::tiles[edgeTile] == nullptr) { // if the edge tile is air, we could possibly cling // to something @@ -371,7 +371,7 @@ int VineTile::getResourceCount(Random *random) void VineTile::playerDestroy(Level *level, shared_ptrplayer, int x, int y, int z, int data) { - if (!level->isClientSide && player->getSelectedItem() != NULL && player->getSelectedItem()->id == Item::shears->id) + if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears->id) { player->awardStat( GenericStats::blocksMined(id), diff --git a/Minecraft.World/WallTile.cpp b/Minecraft.World/WallTile.cpp index a95360cec..b7d3f038c 100644 --- a/Minecraft.World/WallTile.cpp +++ b/Minecraft.World/WallTile.cpp @@ -159,7 +159,7 @@ bool WallTile::connectsTo(LevelSource *level, int x, int y, int z) return true; } Tile *tileInstance = Tile::tiles[tile]; - if (tileInstance != NULL) + if (tileInstance != nullptr) { if (tileInstance->material->isSolidBlocking() && tileInstance->isCubeShaped()) { diff --git a/Minecraft.World/WaterLevelChunk.cpp b/Minecraft.World/WaterLevelChunk.cpp index 7727898bb..07d1024c5 100644 --- a/Minecraft.World/WaterLevelChunk.cpp +++ b/Minecraft.World/WaterLevelChunk.cpp @@ -160,5 +160,5 @@ void WaterLevelChunk::setLevelChunkBrightness(LightLayer::variety layer, int x, Biome *WaterLevelChunk::getBiome(int x, int z, BiomeSource *biomeSource) { - return NULL; + return nullptr; } diff --git a/Minecraft.World/WaterLilyTile.cpp b/Minecraft.World/WaterLilyTile.cpp index ec789afc7..71c37874a 100644 --- a/Minecraft.World/WaterLilyTile.cpp +++ b/Minecraft.World/WaterLilyTile.cpp @@ -25,7 +25,7 @@ int WaterlilyTile::getRenderShape() void WaterlilyTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr source) { - if (source == NULL || !source->instanceof(eTYPE_BOAT)) + if (source == nullptr || !source->instanceof(eTYPE_BOAT)) { Bush::addAABBs(level, x, y, z, box, boxes, source); } diff --git a/Minecraft.World/WaterLilyTileItem.cpp b/Minecraft.World/WaterLilyTileItem.cpp index fe523c052..978a611fc 100644 --- a/Minecraft.World/WaterLilyTileItem.cpp +++ b/Minecraft.World/WaterLilyTileItem.cpp @@ -13,7 +13,7 @@ WaterLilyTileItem::WaterLilyTileItem(int id) : ColoredTileItem(id, false) bool WaterLilyTileItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == NULL) return false; + if (hr == nullptr) return false; if (hr->type == HitResult::TILE) { @@ -47,7 +47,7 @@ bool WaterLilyTileItem::TestUse(shared_ptr itemInstance, Level *le shared_ptr WaterLilyTileItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) { HitResult *hr = getPlayerPOVHitResult(level, player, true); - if (hr == NULL) return itemInstance; + if (hr == nullptr) return itemInstance; if (hr->type == HitResult::TILE) { diff --git a/Minecraft.World/WebTile.cpp b/Minecraft.World/WebTile.cpp index a724c36dd..43609e56f 100644 --- a/Minecraft.World/WebTile.cpp +++ b/Minecraft.World/WebTile.cpp @@ -22,7 +22,7 @@ bool WebTile::isSolidRender(bool isServerLevel) AABB *WebTile::getAABB(Level *level, int x, int y, int z) { - return NULL; + return nullptr; } diff --git a/Minecraft.World/WeighedRandom.cpp b/Minecraft.World/WeighedRandom.cpp index 0c27bf32a..777ab92f5 100644 --- a/Minecraft.World/WeighedRandom.cpp +++ b/Minecraft.World/WeighedRandom.cpp @@ -28,7 +28,7 @@ WeighedRandomItem *WeighedRandom::getRandomItem(Random *random, vector *items) @@ -62,7 +62,7 @@ WeighedRandomItem *WeighedRandom::getRandomItem(Random *random, WeighedRandomIte return items[i]; } } - return NULL; + return nullptr; } diff --git a/Minecraft.World/Witch.cpp b/Minecraft.World/Witch.cpp index 592fc5cd8..6f8f4941f 100644 --- a/Minecraft.World/Witch.cpp +++ b/Minecraft.World/Witch.cpp @@ -96,10 +96,10 @@ void Witch::aiStep() shared_ptr item = getCarriedItem(); setEquippedSlot(SLOT_WEAPON, nullptr); - if (item != NULL && item->id == Item::potion_Id) + if (item != nullptr && item->id == Item::potion_Id) { vector *effects = Item::potion->getMobEffects(item); - if (effects != NULL) + if (effects != nullptr) { for(auto& effect : *effects) { @@ -124,11 +124,11 @@ void Witch::aiStep() { potion = PotionBrewing::POTION_ID_HEAL; } - else if (random->nextFloat() < 0.25f && getTarget() != NULL && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11) + else if (random->nextFloat() < 0.25f && getTarget() != nullptr && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11) { potion = PotionBrewing::POTION_ID_SWIFTNESS; } - else if (random->nextFloat() < 0.25f && getTarget() != NULL && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11) + else if (random->nextFloat() < 0.25f && getTarget() != nullptr && !hasEffect(MobEffect::movementSpeed) && getTarget()->distanceToSqr(shared_from_this()) > 11 * 11) { potion = PotionBrewing::POTION_ID_SWIFTNESS; } diff --git a/Minecraft.World/WitherBoss.cpp b/Minecraft.World/WitherBoss.cpp index 8a568b894..ceb64df2f 100644 --- a/Minecraft.World/WitherBoss.cpp +++ b/Minecraft.World/WitherBoss.cpp @@ -124,7 +124,7 @@ void WitherBoss::aiStep() if (!level->isClientSide && getAlternativeTarget(0) > 0) { shared_ptr e = level->getEntity(getAlternativeTarget(0)); - if (e != NULL) + if (e != nullptr) { if ((y < e->y) || (!isPowered() && y < (e->y + 5))) { @@ -167,7 +167,7 @@ void WitherBoss::aiStep() { e = level->getEntity(entityId); } - if (e != NULL) + if (e != nullptr) { double hx = getHeadX(i + 1); double hy = getHeadY(i + 1); @@ -258,7 +258,7 @@ void WitherBoss::newServerAiStep() shared_ptr current = level->getEntity(headTarget); // 4J: Added check for instance of living entity, had a problem with IDs being recycled to other entities - if (current == NULL || !current->instanceof(eTYPE_LIVINGENTITY) || !current->isAlive() || distanceToSqr(current) > 30 * 30 || !canSee(current)) + if (current == nullptr || !current->instanceof(eTYPE_LIVINGENTITY) || !current->isAlive() || distanceToSqr(current) > 30 * 30 || !canSee(current)) { setAlternativeTarget(i, 0); } @@ -303,7 +303,7 @@ void WitherBoss::newServerAiStep() } } } - if (getTarget() != NULL) + if (getTarget() != nullptr) { assert(getTarget()->instanceof(eTYPE_LIVINGENTITY)); setAlternativeTarget(0, getTarget()->entityId); @@ -462,14 +462,14 @@ bool WitherBoss::hurt(DamageSource *source, float dmg) if (isPowered()) { shared_ptr directEntity = source->getDirectEntity(); - if (directEntity != NULL && directEntity->GetType() == eTYPE_ARROW) + if (directEntity != nullptr && directEntity->GetType() == eTYPE_ARROW) { return false; } } shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != NULL) + if (sourceEntity != nullptr) { if ( sourceEntity->instanceof(eTYPE_PLAYER) ) { diff --git a/Minecraft.World/WitherSkull.cpp b/Minecraft.World/WitherSkull.cpp index 92f810df7..ccde41d42 100644 --- a/Minecraft.World/WitherSkull.cpp +++ b/Minecraft.World/WitherSkull.cpp @@ -55,9 +55,9 @@ void WitherSkull::onHit(HitResult *res) { if (!level->isClientSide) { - if (res->entity != NULL) + if (res->entity != nullptr) { - if (owner != NULL) + if (owner != nullptr) { DamageSource *damageSource = DamageSource::mobAttack(owner); if (res->entity->hurt(damageSource, 8)) diff --git a/Minecraft.World/Wolf.cpp b/Minecraft.World/Wolf.cpp index 2443c6632..55088ffd0 100644 --- a/Minecraft.World/Wolf.cpp +++ b/Minecraft.World/Wolf.cpp @@ -81,7 +81,7 @@ bool Wolf::useNewAi() void Wolf::setTarget(shared_ptr target) { TamableAnimal::setTarget(target); - if ( target == NULL ) + if ( target == nullptr ) { setAngry(false); } @@ -286,7 +286,7 @@ bool Wolf::hurt(DamageSource *source, float dmg) if (isTame()) { shared_ptr entity = source->getDirectEntity(); - if (entity != NULL && entity->instanceof(eTYPE_PLAYER)) + if (entity != nullptr && entity->instanceof(eTYPE_PLAYER)) { shared_ptr attacker = dynamic_pointer_cast(entity); attacker->canHarmPlayer(getOwnerUUID()); @@ -296,7 +296,7 @@ bool Wolf::hurt(DamageSource *source, float dmg) if (isInvulnerable()) return false; shared_ptr sourceEntity = source->getEntity(); sitGoal->wantToSit(false); - if (sourceEntity != NULL && !(sourceEntity->instanceof(eTYPE_PLAYER) || sourceEntity->instanceof(eTYPE_ARROW))) + if (sourceEntity != nullptr && !(sourceEntity->instanceof(eTYPE_PLAYER) || sourceEntity->instanceof(eTYPE_ARROW))) { // Take half damage from non-players and arrows dmg = (dmg + 1) / 2; @@ -327,7 +327,7 @@ void Wolf::setTame(bool value) void Wolf::tame(const wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting) { setTame(true); - setPath(NULL); + setPath(nullptr); setTarget(nullptr); sitGoal->wantToSit(bSetSitting); setHealth(TAME_HEALTH); @@ -344,9 +344,9 @@ bool Wolf::mobInteract(shared_ptr player) if (isTame()) { - if (item != NULL) + if (item != nullptr) { - if(dynamic_cast(Item::items[item->id]) != NULL) + if(dynamic_cast(Item::items[item->id]) != nullptr) { FoodItem *food = dynamic_cast( Item::items[item->id] ); @@ -387,7 +387,7 @@ bool Wolf::mobInteract(shared_ptr player) { sitGoal->wantToSit(!isSitting()); jumping = false; - setPath(NULL); + setPath(nullptr); setAttackTarget(nullptr); setTarget(nullptr); } @@ -395,7 +395,7 @@ bool Wolf::mobInteract(shared_ptr player) } else { - if (item != NULL && item->id == Item::bone->id && !isAngry()) + if (item != nullptr && item->id == Item::bone->id && !isAngry()) { // 4J-PB - don't lose the bone in creative mode if (player->abilities.instabuild==false) @@ -430,7 +430,7 @@ bool Wolf::mobInteract(shared_ptr player) } // 4J-PB - stop wild wolves going in to Love Mode (even though they do on Java, but don't breed) - if((item != NULL) && isFood(item)) + if((item != nullptr) && isFood(item)) { return false; } @@ -467,8 +467,8 @@ float Wolf::getTailAngle() bool Wolf::isFood(shared_ptr item) { - if (item == NULL) return false; - if (dynamic_cast(Item::items[item->id]) == NULL) return false; + if (item == nullptr) return false; + if (dynamic_cast(Item::items[item->id]) == nullptr) return false; return static_cast(Item::items[item->id])->isMeat(); } @@ -552,7 +552,7 @@ bool Wolf::canMate(shared_ptr animal) if (!animal->instanceof(eTYPE_WOLF)) return false; shared_ptr partner = dynamic_pointer_cast(animal); - if (partner == NULL) return false; + if (partner == nullptr) return false; if (!partner->isTame()) return false; if (partner->isSitting()) return false; diff --git a/Minecraft.World/WoodTile.cpp b/Minecraft.World/WoodTile.cpp index c735c581a..239ef61c4 100644 --- a/Minecraft.World/WoodTile.cpp +++ b/Minecraft.World/WoodTile.cpp @@ -21,7 +21,7 @@ const wstring WoodTile::TEXTURE_NAMES[] = {L"oak", L"spruce", L"birch", L"jungle WoodTile::WoodTile(int id) : Tile(id, Material::wood) { - icons = NULL; + icons = nullptr; } unsigned int WoodTile::getDescriptionId(int iData) diff --git a/Minecraft.World/WorkbenchTile.cpp b/Minecraft.World/WorkbenchTile.cpp index 82193b692..cc505fc6a 100644 --- a/Minecraft.World/WorkbenchTile.cpp +++ b/Minecraft.World/WorkbenchTile.cpp @@ -7,8 +7,8 @@ WorkbenchTile::WorkbenchTile(int id) : Tile(id, Material::wood) { - iconTop = NULL; - iconFront = NULL; + iconTop = nullptr; + iconFront = nullptr; } Icon *WorkbenchTile::getTexture(int face, int data) diff --git a/Minecraft.World/Zombie.cpp b/Minecraft.World/Zombie.cpp index d13f18fe1..aba3fb2ab 100644 --- a/Minecraft.World/Zombie.cpp +++ b/Minecraft.World/Zombie.cpp @@ -94,7 +94,7 @@ void Zombie::setBaby(bool baby) { getEntityData()->set(DATA_BABY_ID, static_cast(baby ? 1 : 0)); - if (level != NULL && !level->isClientSide) + if (level != nullptr && !level->isClientSide) { AttributeInstance *speed = getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED); speed->removeModifier(SPEED_MODIFIER_BABY); @@ -125,7 +125,7 @@ void Zombie::aiStep() bool burn = true; shared_ptr helmet = getCarried(SLOT_HELM); - if (helmet != NULL) + if (helmet != nullptr) { if (helmet->isDamageableItem()) { @@ -154,10 +154,10 @@ bool Zombie::hurt(DamageSource *source, float dmg) if (Monster::hurt(source, dmg)) { shared_ptr target = getTarget(); - if ( (target == NULL) && getAttackTarget() != NULL && getAttackTarget()->instanceof(eTYPE_LIVINGENTITY) ) target = dynamic_pointer_cast( getAttackTarget() ); - if ( (target == NULL) && source->getEntity() != NULL && source->getEntity()->instanceof(eTYPE_LIVINGENTITY) ) target = dynamic_pointer_cast( source->getEntity() ); + if ( (target == nullptr) && getAttackTarget() != nullptr && getAttackTarget()->instanceof(eTYPE_LIVINGENTITY) ) target = dynamic_pointer_cast( getAttackTarget() ); + if ( (target == nullptr) && source->getEntity() != nullptr && source->getEntity()->instanceof(eTYPE_LIVINGENTITY) ) target = dynamic_pointer_cast( source->getEntity() ); - if ( (target != NULL) && level->difficulty >= Difficulty::HARD && random->nextFloat() < getAttribute(SPAWN_REINFORCEMENTS_CHANCE)->getValue()) + if ( (target != nullptr) && level->difficulty >= Difficulty::HARD && random->nextFloat() < getAttribute(SPAWN_REINFORCEMENTS_CHANCE)->getValue()) { int x = Mth::floor(this->x); int y = Mth::floor(this->y); @@ -178,7 +178,7 @@ bool Zombie::hurt(DamageSource *source, float dmg) { level->addEntity(reinforcement); reinforcement->setTarget(target); - reinforcement->finalizeMobSpawn(NULL); + reinforcement->finalizeMobSpawn(nullptr); getAttribute(SPAWN_REINFORCEMENTS_CHANCE)->addModifier(new AttributeModifier(-0.05f, AttributeModifier::OPERATION_ADDITION)); reinforcement->getAttribute(SPAWN_REINFORCEMENTS_CHANCE)->addModifier(new AttributeModifier(-0.05f, AttributeModifier::OPERATION_ADDITION)); @@ -217,7 +217,7 @@ bool Zombie::doHurtTarget(shared_ptr target) if (result) { - if (getCarriedItem() == NULL && isOnFire() && random->nextFloat() < level->difficulty * 0.3f) + if (getCarriedItem() == nullptr && isOnFire() && random->nextFloat() < level->difficulty * 0.3f) { target->setOnFire(2 * level->difficulty); } @@ -319,7 +319,7 @@ void Zombie::killed(shared_ptr mob) shared_ptr zombie = shared_ptr(new Zombie(level)); zombie->copyPosition(mob); level->removeEntity(mob); - zombie->finalizeMobSpawn(NULL); + zombie->finalizeMobSpawn(nullptr); zombie->setVillager(true); if (mob->isBaby()) zombie->setBaby(true); level->addEntity(zombie); @@ -335,12 +335,12 @@ MobGroupData *Zombie::finalizeMobSpawn(MobGroupData *groupData, int extraData /* setCanPickUpLoot(random->nextFloat() < MAX_PICKUP_LOOT_CHANCE * difficulty); - if (groupData == NULL) + if (groupData == nullptr) { groupData = new ZombieGroupData(level->random->nextFloat() < 0.05f, level->random->nextFloat() < 0.05f); } - if ( dynamic_cast( groupData ) != NULL) + if ( dynamic_cast( groupData ) != nullptr) { ZombieGroupData *zombieData = static_cast(groupData); @@ -358,7 +358,7 @@ MobGroupData *Zombie::finalizeMobSpawn(MobGroupData *groupData, int extraData /* populateDefaultEquipmentSlots(); populateDefaultEquipmentEnchantments(); - if (getCarried(SLOT_HELM) == NULL) + if (getCarried(SLOT_HELM) == nullptr) { // [EB]: We have this code in quite some places, shouldn't we set // something like this globally? @@ -389,7 +389,7 @@ bool Zombie::mobInteract(shared_ptr player) { shared_ptr item = player->getSelectedItem(); - if (item != NULL && item->getItem() == Item::apple_gold && item->getAuxValue() == 0 && isVillager() && hasEffect(MobEffect::weakness)) + if (item != nullptr && item->getItem() == Item::apple_gold && item->getAuxValue() == 0 && isVillager() && hasEffect(MobEffect::weakness)) { if (!player->abilities.instabuild) item->count--; if (item->count <= 0) @@ -448,7 +448,7 @@ void Zombie::finishConversion() { shared_ptr villager = shared_ptr(new Villager(level)); villager->copyPosition(shared_from_this()); - villager->finalizeMobSpawn(NULL); + villager->finalizeMobSpawn(nullptr); villager->setRewardPlayersInVillage(); if (isBaby()) villager->setAge(-20 * 60 * 20); level->removeEntity(shared_from_this()); diff --git a/Minecraft.World/ZoneFile.cpp b/Minecraft.World/ZoneFile.cpp index fc1f36bfe..17eddb82b 100644 --- a/Minecraft.World/ZoneFile.cpp +++ b/Minecraft.World/ZoneFile.cpp @@ -23,7 +23,7 @@ ZoneFile::ZoneFile(__int64 key, File file, File entityFile) : slots(slotsLength) // this.entityFile = new NbtSlotFile(entityFile); // } - channel = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + channel = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); // 4J - try/catch removed // try { readHeader(); diff --git a/Minecraft.World/ZoneIo.cpp b/Minecraft.World/ZoneIo.cpp index 5860b10c9..a064317a9 100644 --- a/Minecraft.World/ZoneIo.cpp +++ b/Minecraft.World/ZoneIo.cpp @@ -22,8 +22,8 @@ void ZoneIo::write(byteArray bb, int size) void ZoneIo::write(ByteBuffer *bb, int size) { DWORD numberOfBytesWritten; - SetFilePointer(channel,static_cast(pos),NULL,NULL); - WriteFile(channel,bb->getBuffer(), bb->getSize(),&numberOfBytesWritten,NULL); + SetFilePointer(channel,static_cast(pos),nullptr,nullptr); + WriteFile(channel,bb->getBuffer(), bb->getSize(),&numberOfBytesWritten,nullptr); pos += size; } @@ -31,13 +31,13 @@ ByteBuffer *ZoneIo::read(int size) { DWORD numberOfBytesRead; byteArray bb = byteArray(size); - SetFilePointer(channel,static_cast(pos),NULL,NULL); + SetFilePointer(channel,static_cast(pos),nullptr,nullptr); ByteBuffer *buff = ByteBuffer::wrap(bb); // 4J - to investigate - why is this buffer flipped before anything goes in it? buff->order(ZonedChunkStorage::BYTEORDER); buff->position(size); buff->flip(); - ReadFile(channel, buff->getBuffer(), buff->getSize(), &numberOfBytesRead, NULL); + ReadFile(channel, buff->getBuffer(), buff->getSize(), &numberOfBytesRead, nullptr); pos += size; return buff; } diff --git a/Minecraft.World/ZonedChunkStorage.cpp b/Minecraft.World/ZonedChunkStorage.cpp index 5c6bf192c..7766687b0 100644 --- a/Minecraft.World/ZonedChunkStorage.cpp +++ b/Minecraft.World/ZonedChunkStorage.cpp @@ -62,8 +62,8 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) if ( !file.exists() ) { - if (!create) return NULL; - HANDLE ch = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (!create) return nullptr; + HANDLE ch = CreateFile(wstringtofilename(file.getPath()), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); CloseHandle(ch); } @@ -76,7 +76,7 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) zoneFile->lastUse = tickCount; if (!zoneFile->containsSlot(slot)) { - if (!create) return NULL; + if (!create) return nullptr; } return zoneFile; @@ -85,14 +85,14 @@ ZoneFile *ZonedChunkStorage::getZoneFile(int x, int z, bool create) ZoneIo *ZonedChunkStorage::getBuffer(int x, int z, bool create) { ZoneFile *zoneFile = getZoneFile(x, z, create); - if (zoneFile == NULL) return NULL; + if (zoneFile == nullptr) return nullptr; return zoneFile->getZoneIo(getSlot(x, z)); } LevelChunk *ZonedChunkStorage::load(Level *level, int x, int z) { ZoneIo *zoneIo = getBuffer(x, z, false); - if (zoneIo == NULL) return NULL; + if (zoneIo == nullptr) return nullptr; LevelChunk *lc = new LevelChunk(level, x, z); lc->unsaved = false; diff --git a/Minecraft.World/compression.cpp b/Minecraft.World/compression.cpp index 6a43e112c..2a8f8e0b8 100644 --- a/Minecraft.World/compression.cpp +++ b/Minecraft.World/compression.cpp @@ -12,7 +12,7 @@ DWORD Compression::tlsIdx = 0; -Compression::ThreadStorage *Compression::tlsDefault = NULL; +Compression::ThreadStorage *Compression::tlsDefault = nullptr; Compression::ThreadStorage::ThreadStorage() { @@ -27,7 +27,7 @@ Compression::ThreadStorage::~ThreadStorage() void Compression::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == NULL ) + if(tlsDefault == nullptr ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -189,12 +189,12 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz // only use 5% of this buffer // 4J Stu - Changed this again to dynamically allocate a buffer if it's going to be too big - unsigned char *pucIn = NULL; + unsigned char *pucIn = nullptr; //const unsigned int staticRleSize = 1024*200; //static unsigned char rleBuf[staticRleSize]; unsigned int rleSize = staticRleSize; - unsigned char *dynamicRleBuf = NULL; + unsigned char *dynamicRleBuf = nullptr; if(*pDestSize > rleSize) { @@ -246,7 +246,7 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz // printf("Decompressed from %d to %d to %d\n",SrcSize,rleSize,*pDestSize); - if(dynamicRleBuf != NULL) delete [] dynamicRleBuf; + if(dynamicRleBuf != nullptr) delete [] dynamicRleBuf; LeaveCriticalSection(&rleDecompressLock); return S_OK; @@ -406,9 +406,9 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS break; case eCompressionType_ZLIBRLE: #if (defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64) - if (pDestination != NULL) + if (pDestination != nullptr) return ::uncompress(static_cast(pDestination), (unsigned long *) pDestSize, static_cast(pSource), SrcSize); // Decompress - else break; // Cannot decompress when destination is NULL + else break; // Cannot decompress when destination is nullptr #else assert(0); break; @@ -417,7 +417,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS #if (defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WIN64) // Note that we're missing the normal zlib header and footer so we'll use inflate to // decompress the payload and skip all the CRC checking, etc - if (pDestination != NULL) + if (pDestination != nullptr) { // Read big-endian srcize from array PBYTE pbDestSize = (PBYTE) pDestSize; @@ -466,7 +466,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS delete uncompr.data; return S_OK; } - else break; // Cannot decompress when destination is NULL + else break; // Cannot decompress when destination is nullptr #else assert(0); #endif diff --git a/Minecraft.World/x64headers/extraX64.h b/Minecraft.World/x64headers/extraX64.h index fa6ee0f99..42cc3b439 100644 --- a/Minecraft.World/x64headers/extraX64.h +++ b/Minecraft.World/x64headers/extraX64.h @@ -120,7 +120,7 @@ public: else { LeaveCriticalSection(&m_cs); - return NULL; + return nullptr; } } private: diff --git a/tall cloc b/tall cloc new file mode 100644 index 000000000..74570f663 --- /dev/null +++ b/tall cloc @@ -0,0 +1,324 @@ + + SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS + + Commands marked with * may be preceded by a number, _N. + Notes in parentheses indicate the behavior if _N is given. + A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. + + h H Display this help. + q :q Q :Q ZZ Exit. + --------------------------------------------------------------------------- + + MMOOVVIINNGG + + e ^E j ^N CR * Forward one line (or _N lines). + y ^Y k ^K ^P * Backward one line (or _N lines). + ESC-j * Forward one file line (or _N file lines). + ESC-k * Backward one file line (or _N file lines). + f ^F ^V SPACE * Forward one window (or _N lines). + b ^B ESC-v * Backward one window (or _N lines). + z * Forward one window (and set window to _N). + w * Backward one window (and set window to _N). + ESC-SPACE * Forward one window, but don't stop at end-of-file. + ESC-b * Backward one window, but don't stop at beginning-of-file. + d ^D * Forward one half-window (and set half-window to _N). + u ^U * Backward one half-window (and set half-window to _N). + ESC-) RightArrow * Right one half screen width (or _N positions). + ESC-( LeftArrow * Left one half screen width (or _N positions). + ESC-} ^RightArrow Right to last column displayed. + ESC-{ ^LeftArrow Left to first column. + F Forward forever; like "tail -f". + ESC-F Like F but stop when search pattern is found. + r ^R ^L Repaint screen. + R Repaint screen, discarding buffered input. + --------------------------------------------------- + Default "window" is the screen height. + Default "half-window" is half of the screen height. + --------------------------------------------------------------------------- + + SSEEAARRCCHHIINNGG + + /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. + ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. + n * Repeat previous search (for _N-th occurrence). + N * Repeat previous search in reverse direction. + ESC-n * Repeat previous search, spanning files. + ESC-N * Repeat previous search, reverse dir. & spanning files. + ^O^N ^On * Search forward for (_N-th) OSC8 hyperlink. + ^O^P ^Op * Search backward for (_N-th) OSC8 hyperlink. + ^O^L ^Ol Jump to the currently selected OSC8 hyperlink. + ESC-u Undo (toggle) search highlighting. + ESC-U Clear search highlighting. + &_p_a_t_t_e_r_n * Display only matching lines. + --------------------------------------------------- + Search is case-sensitive unless changed with -i or -I. + A search pattern may begin with one or more of: + ^N or ! Search for NON-matching lines. + ^E or * Search multiple files (pass thru END OF FILE). + ^F or @ Start search at FIRST file (for /) or last file (for ?). + ^K Highlight matches, but don't move (KEEP position). + ^R Don't use REGULAR EXPRESSIONS. + ^S _n Search for match in _n-th parenthesized subpattern. + ^W WRAP search if no match found. + ^L Enter next character literally into pattern. + --------------------------------------------------------------------------- + + JJUUMMPPIINNGG + + g < ESC-< * Go to first line in file (or line _N). + G > ESC-> * Go to last line in file (or line _N). + p % * Go to beginning of file (or _N percent into file). + t * Go to the (_N-th) next tag. + T * Go to the (_N-th) previous tag. + { ( [ * Find close bracket } ) ]. + } ) ] * Find open bracket { ( [. + ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. + ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>. + --------------------------------------------------- + Each "find close bracket" command goes forward to the close bracket + matching the (_N-th) open bracket in the top line. + Each "find open bracket" command goes backward to the open bracket + matching the (_N-th) close bracket in the bottom line. + + m_<_l_e_t_t_e_r_> Mark the current top line with . + M_<_l_e_t_t_e_r_> Mark the current bottom line with . + '_<_l_e_t_t_e_r_> Go to a previously marked position. + '' Go to the previous position. + ^X^X Same as '. + ESC-m_<_l_e_t_t_e_r_> Clear a mark. + --------------------------------------------------- + A mark is any upper-case or lower-case letter. + Certain marks are predefined: + ^ means beginning of the file + $ means end of the file + --------------------------------------------------------------------------- + + CCHHAANNGGIINNGG FFIILLEESS + + :e [_f_i_l_e] Examine a new file. + ^X^V Same as :e. + :n * Examine the (_N-th) next file from the command line. + :p * Examine the (_N-th) previous file from the command line. + :x * Examine the first (or _N-th) file from the command line. + ^O^O Open the currently selected OSC8 hyperlink. + :d Delete the current file from the command line list. + = ^G :f Print current file name. + --------------------------------------------------------------------------- + + MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS + + -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. + --_<_n_a_m_e_> Toggle a command line option, by name. + __<_f_l_a_g_> Display the setting of a command line option. + ___<_n_a_m_e_> Display the setting of an option, by name. + +_c_m_d Execute the less cmd each time a new file is examined. + + !_c_o_m_m_a_n_d Execute the shell command with $SHELL. + #_c_o_m_m_a_n_d Execute the shell command, expanded like a prompt. + |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. + s _f_i_l_e Save input to a file. + v Edit the current file with $VISUAL or $EDITOR. + V Print version number of "less". + --------------------------------------------------------------------------- + + OOPPTTIIOONNSS + + Most options may be changed either on the command line, + or from within less by using the - or -- command. + Options may be given in one of two forms: either a single + character preceded by a -, or a name preceded by --. + + -? ........ --help + Display help (from command line). + -a ........ --search-skip-screen + Search skips current screen. + -A ........ --SEARCH-SKIP-SCREEN + Search starts just after target line. + -b [_N] .... --buffers=[_N] + Number of buffers. + -B ........ --auto-buffers + Don't automatically allocate buffers for pipes. + -c ........ --clear-screen + Repaint by clearing rather than scrolling. + -d ........ --dumb + Dumb terminal. + -D xx_c_o_l_o_r . --color=xx_c_o_l_o_r + Set screen colors. + -e -E .... --quit-at-eof --QUIT-AT-EOF + Quit at end of file. + -f ........ --force + Force open non-regular files. + -F ........ --quit-if-one-screen + Quit if entire file fits on first screen. + -g ........ --hilite-search + Highlight only last match for searches. + -G ........ --HILITE-SEARCH + Don't highlight any matches for searches. + -h [_N] .... --max-back-scroll=[_N] + Backward scroll limit. + -i ........ --ignore-case + Ignore case in searches that do not contain uppercase. + -I ........ --IGNORE-CASE + Ignore case in all searches. + -j [_N] .... --jump-target=[_N] + Screen position of target lines. + -J ........ --status-column + Display a status column at left edge of screen. + -k _f_i_l_e ... --lesskey-file=_f_i_l_e + Use a compiled lesskey file. + -K ........ --quit-on-intr + Exit less in response to ctrl-C. + -L ........ --no-lessopen + Ignore the LESSOPEN environment variable. + -m -M .... --long-prompt --LONG-PROMPT + Set prompt style. + -n ......... --line-numbers + Suppress line numbers in prompts and messages. + -N ......... --LINE-NUMBERS + Display line number at start of each line. + -o [_f_i_l_e] .. --log-file=[_f_i_l_e] + Copy to log file (standard input only). + -O [_f_i_l_e] .. --LOG-FILE=[_f_i_l_e] + Copy to log file (unconditionally overwrite). + -p _p_a_t_t_e_r_n . --pattern=[_p_a_t_t_e_r_n] + Start at pattern (from command line). + -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] + Define new prompt. + -q -Q .... --quiet --QUIET --silent --SILENT + Quiet the terminal bell. + -r -R .... --raw-control-chars --RAW-CONTROL-CHARS + Output "raw" control characters. + -s ........ --squeeze-blank-lines + Squeeze multiple blank lines. + -S ........ --chop-long-lines + Chop (truncate) long lines rather than wrapping. + -t _t_a_g .... --tag=[_t_a_g] + Find a tag. + -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] + Use an alternate tags file. + -u -U .... --underline-special --UNDERLINE-SPECIAL + Change handling of backspaces, tabs and carriage returns. + -V ........ --version + Display the version number of "less". + -w ........ --hilite-unread + Highlight first new line after forward-screen. + -W ........ --HILITE-UNREAD + Highlight first new line after any forward movement. + -x [_N[,...]] --tabs=[_N[,...]] + Set tab stops. + -X ........ --no-init + Don't use termcap init/deinit strings. + -y [_N] .... --max-forw-scroll=[_N] + Forward scroll limit. + -z [_N] .... --window=[_N] + Set size of window. + -" [_c[_c]] . --quotes=[_c[_c]] + Set shell quote characters. + -~ ........ --tilde + Don't display tildes after end of file. + -# [_N] .... --shift=[_N] + Set horizontal scroll amount (0 = one half screen width). + + --exit-follow-on-close + Exit F command on a pipe when writer closes pipe. + --file-size + Automatically determine the size of the input file. + --follow-name + The F command changes files if the input file is renamed. + --form-feed + Stop scrolling when a form feed character is reached. + --header=[_L[,_C[,_N]]] + Use _L lines (starting at line _N) and _C columns as headers. + --incsearch + Search file as each pattern character is typed in. + --intr=[_C] + Use _C instead of ^X to interrupt a read. + --lesskey-context=_t_e_x_t + Use lesskey source file contents. + --lesskey-src=_f_i_l_e + Use a lesskey source file. + --line-num-width=[_N] + Set the width of the -N line number field to _N characters. + --match-shift=[_N] + Show at least _N characters to the left of a search match. + --modelines=[_N] + Read _N lines from the input file and look for vim modelines. + --mouse + Enable mouse input. + --no-edit-warn + Don't warn when using v command on a file opened via LESSOPEN. + --no-keypad + Don't send termcap keypad init/deinit strings. + --no-histdups + Remove duplicates from command history. + --no-number-headers + Don't give line numbers to header lines. + --no-paste + Ignore pasted input. + --no-search-header-lines + Searches do not include header lines. + --no-search-header-columns + Searches do not include header columns. + --no-search-headers + Searches do not include header lines or columns. + --no-vbell + Disable the terminal's visual bell. + --redraw-on-quit + Redraw final screen when quitting. + --rscroll=[_C] + Set the character used to mark truncated lines. + --save-marks + Retain marks across invocations of less. + --search-options=[EFKNRW-] + Set default options for every search. + --show-preproc-errors + Display a message if preprocessor exits with an error status. + --proc-backspace + Process backspaces for bold/underline. + --PROC-BACKSPACE + Treat backspaces as control characters. + --proc-return + Delete carriage returns before newline. + --PROC-RETURN + Treat carriage returns as control characters. + --proc-tab + Expand tabs to spaces. + --PROC-TAB + Treat tabs as control characters. + --status-col-width=[_N] + Set the width of the -J status column to _N characters. + --status-line + Highlight or color the entire line containing a mark. + --use-backslash + Subsequent options use backslash as escape char. + --use-color + Enables colored text. + --wheel-lines=[_N] + Each click of the mouse wheel moves _N lines. + --wordwrap + Wrap lines at spaces. + + + --------------------------------------------------------------------------- + + LLIINNEE EEDDIITTIINNGG + + These keys can be used to edit text being entered + on the "command line" at the bottom of the screen. + + RightArrow ..................... ESC-l ... Move cursor right one character. + LeftArrow ...................... ESC-h ... Move cursor left one character. + ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word. + ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word. + HOME ........................... ESC-0 ... Move cursor to start of line. + END ............................ ESC-$ ... Move cursor to end of line. + BACKSPACE ................................ Delete char to left of cursor. + DELETE ......................... ESC-x ... Delete char under cursor. + ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor. + ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor. + ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line. + UpArrow ........................ ESC-k ... Retrieve previous command line. + DownArrow ...................... ESC-j ... Retrieve next command line. + TAB ...................................... Complete filename & cycle. + SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle. + ctrl-L ................................... Complete filename, list all.